Skip to content

MESQUAL Network Lines Data

NetworkLineFlowsData

Wrapper for bidirectional flow data of network transmission lines.

This class encapsulates energy or power flow data for lines in both directions, accounting for transmission losses. It provides a standardized interface for handling complex flow patterns in electrical network analysis.

Flow Direction Conventions
  • sent_up: Flow entering line at node_from (towards node_to)
  • received_up: Flow leaving line at node_from after losses (coming from node_to)
  • sent_down: Flow entering line at node_to (towards node_from)
  • received_down: Flow leaving line at node_to after losses (coming from node_from)

The distinction between 'sent' and 'received' allows for modeling transmission losses, where received_flow = sent_flow * (1 - loss_rate).

Parameters:

Name Type Description Default
sent_up DataFrame

DataFrame with flow data entering at node_from

required
received_up DataFrame

DataFrame with flow data received at node_from after losses

required
sent_down DataFrame

DataFrame with flow data entering at node_to

required
received_down DataFrame

DataFrame with flow data received at node_to after losses

required
granularity None | float | Series

Time granularity of the data (None, float in minutes, or Series)

None

Raises:

Type Description
ValueError

If indices or columns of the four DataFrames don't match

Example:

>>> import pandas as pd
>>> index = pd.date_range('2024-01-01', periods=24, freq='1H')
>>> columns = ['Line_A_B', 'Line_B_C']
>>> flows_up = pd.DataFrame(100, index=index, columns=columns)
>>> flows_down = pd.DataFrame(50, index=index, columns=columns)
>>> line_data = NetworkLineFlowsData.from_up_and_down_flow_without_losses(
...     flows_up, flows_down)
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
class NetworkLineFlowsData:
    """Wrapper for bidirectional flow data of network transmission lines.

    This class encapsulates energy or power flow data for lines in both directions,
    accounting for transmission losses. It provides a standardized interface for
    handling complex flow patterns in electrical network analysis.

    Flow Direction Conventions:
        - sent_up: Flow entering line at node_from (towards node_to)
        - received_up: Flow leaving line at node_from after losses (coming from node_to)
        - sent_down: Flow entering line at node_to (towards node_from)  
        - received_down: Flow leaving line at node_to after losses (coming from node_from)

    The distinction between 'sent' and 'received' allows for modeling transmission
    losses, where received_flow = sent_flow * (1 - loss_rate).

    Args:
        sent_up: DataFrame with flow data entering at node_from
        received_up: DataFrame with flow data received at node_from after losses
        sent_down: DataFrame with flow data entering at node_to
        received_down: DataFrame with flow data received at node_to after losses
        granularity: Time granularity of the data (None, float in minutes, or Series)

    Raises:
        ValueError: If indices or columns of the four DataFrames don't match

    Example:

        >>> import pandas as pd
        >>> index = pd.date_range('2024-01-01', periods=24, freq='1H')
        >>> columns = ['Line_A_B', 'Line_B_C']
        >>> flows_up = pd.DataFrame(100, index=index, columns=columns)
        >>> flows_down = pd.DataFrame(50, index=index, columns=columns)
        >>> line_data = NetworkLineFlowsData.from_up_and_down_flow_without_losses(
        ...     flows_up, flows_down)
    """
    def __init__(
            self,
            sent_up: pd.DataFrame,
            received_up: pd.DataFrame,
            sent_down: pd.DataFrame,
            received_down: pd.DataFrame,
            granularity: None | float | pd.Series = None
    ):
        """Initialize NetworkLineFlowsData with flow data in both directions.

        Args:
            sent_up: Flow data sent in up direction (node_from -> node_to)
            received_up: Flow data received in up direction after losses
            sent_down: Flow data sent in down direction (node_to -> node_from)
            received_down: Flow data received in down direction after losses
            granularity: Time granularity information for the data
        """
        self.sent_up = sent_up
        self.received_up = received_up
        self.sent_down = sent_down
        self.received_down = received_down
        self.granularity = granularity
        self.__post_init__()

    def __post_init__(self):
        """Validate that all DataFrames have matching indices and columns.

        Raises:
            ValueError: If any DataFrame has mismatched indices or columns.
        """
        dataframes = [self.received_up, self.sent_down, self.received_down]
        for i, df in enumerate(dataframes):
            df_name = ['received_up', 'sent_down', 'received_down'][i]
            if not self.sent_up.index.equals(df.index):
                raise ValueError(f'Index mismatch: sent_up vs {df_name}')
            if not self.sent_up.columns.equals(df.columns):
                raise ValueError(f'Columns mismatch: sent_up vs {df_name}')

    def from_mw_to_mwh(self) -> 'NetworkLineFlowsData':
        """Convert flow data from MW (power) to MWh (energy).

        This conversion requires granularity information to properly scale the values.

        Returns:
            New NetworkLineFlowsData instance with energy values

        Raises:
            NotImplementedError: Method not yet implemented
        """
        # TODO: Implement MW to MWh conversion using granularity
        raise NotImplementedError("MW to MWh conversion not yet implemented")

    def from_mwh_to_mw(self) -> 'NetworkLineFlowsData':
        """Convert flow data from MWh (energy) to MW (power).

        This conversion requires granularity information to properly scale the values.

        Returns:
            New NetworkLineFlowsData instance with power values

        Raises:
            NotImplementedError: Method not yet implemented
        """
        # TODO: Implement MWh to MW conversion using granularity  
        raise NotImplementedError("MWh to MW conversion not yet implemented")

    @classmethod
    def from_net_flow_without_losses(cls, net_flow: pd.DataFrame) -> "NetworkLineFlowsData":
        """Create NetworkLineFlowsData from net flow data assuming no transmission losses.

        Converts net flow data (where positive values indicate flow in up direction
        and negative values indicate flow in down direction) into the bidirectional
        flow representation used by this class.

        Args:
            net_flow: DataFrame with net flow values. Positive = up direction,
                negative = down direction

        Returns:
            NetworkLineFlowsData instance with flows split into up/down directions

        Example:

            >>> import pandas as pd
            >>> net_flows = pd.DataFrame({
            ...     'Line_A_B': [100, -50, 75],
            ...     'Line_B_C': [200, 150, -100]
            ... })
            >>> line_data = NetworkLineFlowsData.from_net_flow_without_losses(net_flows)
        """
        positive_flow = net_flow.clip(lower=0)
        negative_flow = -net_flow.clip(upper=0)

        return cls(
            sent_up=positive_flow,
            received_up=positive_flow,
            sent_down=negative_flow,
            received_down=negative_flow
        )

    @classmethod
    def from_up_and_down_flow_without_losses(
            cls,
            flow_up: pd.DataFrame,
            flow_down: pd.DataFrame
    ) -> "NetworkLineFlowsData":
        """Create NetworkLineFlowsData from separate up and down flow data without losses.

        This constructor assumes that there are no transmission losses, so sent and
        received flows are identical in each direction.

        Args:
            flow_up: DataFrame with flow data in up direction (node_from -> node_to)
            flow_down: DataFrame with flow data in down direction (node_to -> node_from)

        Returns:
            NetworkLineFlowsData instance where sent and received flows are equal

        Example:

            >>> import pandas as pd
            >>> up_flows = pd.DataFrame({'Line_A_B': [100, 80, 120]})
            >>> down_flows = pd.DataFrame({'Line_A_B': [50, 60, 40]})
            >>> line_data = NetworkLineFlowsData.from_up_and_down_flow_without_losses(
            ...     up_flows, down_flows)
        """
        return cls(
            sent_up=flow_up,
            received_up=flow_up,
            sent_down=flow_down,
            received_down=flow_down
        )

__init__

__init__(sent_up: DataFrame, received_up: DataFrame, sent_down: DataFrame, received_down: DataFrame, granularity: None | float | Series = None)

Initialize NetworkLineFlowsData with flow data in both directions.

Parameters:

Name Type Description Default
sent_up DataFrame

Flow data sent in up direction (node_from -> node_to)

required
received_up DataFrame

Flow data received in up direction after losses

required
sent_down DataFrame

Flow data sent in down direction (node_to -> node_from)

required
received_down DataFrame

Flow data received in down direction after losses

required
granularity None | float | Series

Time granularity information for the data

None
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
def __init__(
        self,
        sent_up: pd.DataFrame,
        received_up: pd.DataFrame,
        sent_down: pd.DataFrame,
        received_down: pd.DataFrame,
        granularity: None | float | pd.Series = None
):
    """Initialize NetworkLineFlowsData with flow data in both directions.

    Args:
        sent_up: Flow data sent in up direction (node_from -> node_to)
        received_up: Flow data received in up direction after losses
        sent_down: Flow data sent in down direction (node_to -> node_from)
        received_down: Flow data received in down direction after losses
        granularity: Time granularity information for the data
    """
    self.sent_up = sent_up
    self.received_up = received_up
    self.sent_down = sent_down
    self.received_down = received_down
    self.granularity = granularity
    self.__post_init__()

__post_init__

__post_init__()

Validate that all DataFrames have matching indices and columns.

Raises:

Type Description
ValueError

If any DataFrame has mismatched indices or columns.

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
66
67
68
69
70
71
72
73
74
75
76
77
78
def __post_init__(self):
    """Validate that all DataFrames have matching indices and columns.

    Raises:
        ValueError: If any DataFrame has mismatched indices or columns.
    """
    dataframes = [self.received_up, self.sent_down, self.received_down]
    for i, df in enumerate(dataframes):
        df_name = ['received_up', 'sent_down', 'received_down'][i]
        if not self.sent_up.index.equals(df.index):
            raise ValueError(f'Index mismatch: sent_up vs {df_name}')
        if not self.sent_up.columns.equals(df.columns):
            raise ValueError(f'Columns mismatch: sent_up vs {df_name}')

from_mw_to_mwh

from_mw_to_mwh() -> NetworkLineFlowsData

Convert flow data from MW (power) to MWh (energy).

This conversion requires granularity information to properly scale the values.

Returns:

Type Description
NetworkLineFlowsData

New NetworkLineFlowsData instance with energy values

Raises:

Type Description
NotImplementedError

Method not yet implemented

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
80
81
82
83
84
85
86
87
88
89
90
91
92
def from_mw_to_mwh(self) -> 'NetworkLineFlowsData':
    """Convert flow data from MW (power) to MWh (energy).

    This conversion requires granularity information to properly scale the values.

    Returns:
        New NetworkLineFlowsData instance with energy values

    Raises:
        NotImplementedError: Method not yet implemented
    """
    # TODO: Implement MW to MWh conversion using granularity
    raise NotImplementedError("MW to MWh conversion not yet implemented")

from_mwh_to_mw

from_mwh_to_mw() -> NetworkLineFlowsData

Convert flow data from MWh (energy) to MW (power).

This conversion requires granularity information to properly scale the values.

Returns:

Type Description
NetworkLineFlowsData

New NetworkLineFlowsData instance with power values

Raises:

Type Description
NotImplementedError

Method not yet implemented

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
def from_mwh_to_mw(self) -> 'NetworkLineFlowsData':
    """Convert flow data from MWh (energy) to MW (power).

    This conversion requires granularity information to properly scale the values.

    Returns:
        New NetworkLineFlowsData instance with power values

    Raises:
        NotImplementedError: Method not yet implemented
    """
    # TODO: Implement MWh to MW conversion using granularity  
    raise NotImplementedError("MWh to MW conversion not yet implemented")

from_net_flow_without_losses classmethod

from_net_flow_without_losses(net_flow: DataFrame) -> NetworkLineFlowsData

Create NetworkLineFlowsData from net flow data assuming no transmission losses.

Converts net flow data (where positive values indicate flow in up direction and negative values indicate flow in down direction) into the bidirectional flow representation used by this class.

Parameters:

Name Type Description Default
net_flow DataFrame

DataFrame with net flow values. Positive = up direction, negative = down direction

required

Returns:

Type Description
NetworkLineFlowsData

NetworkLineFlowsData instance with flows split into up/down directions

Example:

>>> import pandas as pd
>>> net_flows = pd.DataFrame({
...     'Line_A_B': [100, -50, 75],
...     'Line_B_C': [200, 150, -100]
... })
>>> line_data = NetworkLineFlowsData.from_net_flow_without_losses(net_flows)
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@classmethod
def from_net_flow_without_losses(cls, net_flow: pd.DataFrame) -> "NetworkLineFlowsData":
    """Create NetworkLineFlowsData from net flow data assuming no transmission losses.

    Converts net flow data (where positive values indicate flow in up direction
    and negative values indicate flow in down direction) into the bidirectional
    flow representation used by this class.

    Args:
        net_flow: DataFrame with net flow values. Positive = up direction,
            negative = down direction

    Returns:
        NetworkLineFlowsData instance with flows split into up/down directions

    Example:

        >>> import pandas as pd
        >>> net_flows = pd.DataFrame({
        ...     'Line_A_B': [100, -50, 75],
        ...     'Line_B_C': [200, 150, -100]
        ... })
        >>> line_data = NetworkLineFlowsData.from_net_flow_without_losses(net_flows)
    """
    positive_flow = net_flow.clip(lower=0)
    negative_flow = -net_flow.clip(upper=0)

    return cls(
        sent_up=positive_flow,
        received_up=positive_flow,
        sent_down=negative_flow,
        received_down=negative_flow
    )

from_up_and_down_flow_without_losses classmethod

from_up_and_down_flow_without_losses(flow_up: DataFrame, flow_down: DataFrame) -> NetworkLineFlowsData

Create NetworkLineFlowsData from separate up and down flow data without losses.

This constructor assumes that there are no transmission losses, so sent and received flows are identical in each direction.

Parameters:

Name Type Description Default
flow_up DataFrame

DataFrame with flow data in up direction (node_from -> node_to)

required
flow_down DataFrame

DataFrame with flow data in down direction (node_to -> node_from)

required

Returns:

Type Description
NetworkLineFlowsData

NetworkLineFlowsData instance where sent and received flows are equal

Example:

>>> import pandas as pd
>>> up_flows = pd.DataFrame({'Line_A_B': [100, 80, 120]})
>>> down_flows = pd.DataFrame({'Line_A_B': [50, 60, 40]})
>>> line_data = NetworkLineFlowsData.from_up_and_down_flow_without_losses(
...     up_flows, down_flows)
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@classmethod
def from_up_and_down_flow_without_losses(
        cls,
        flow_up: pd.DataFrame,
        flow_down: pd.DataFrame
) -> "NetworkLineFlowsData":
    """Create NetworkLineFlowsData from separate up and down flow data without losses.

    This constructor assumes that there are no transmission losses, so sent and
    received flows are identical in each direction.

    Args:
        flow_up: DataFrame with flow data in up direction (node_from -> node_to)
        flow_down: DataFrame with flow data in down direction (node_to -> node_from)

    Returns:
        NetworkLineFlowsData instance where sent and received flows are equal

    Example:

        >>> import pandas as pd
        >>> up_flows = pd.DataFrame({'Line_A_B': [100, 80, 120]})
        >>> down_flows = pd.DataFrame({'Line_A_B': [50, 60, 40]})
        >>> line_data = NetworkLineFlowsData.from_up_and_down_flow_without_losses(
        ...     up_flows, down_flows)
    """
    return cls(
        sent_up=flow_up,
        received_up=flow_up,
        sent_down=flow_down,
        received_down=flow_down
    )

NetworkLineCapacitiesData dataclass

Wrapper for bidirectional capacity data of network transmission lines.

This dataclass encapsulates transmission capacity limits for network lines in both directions. Capacities can be asymmetric to reflect real-world transmission constraints or operational limits.

Capacity Direction Conventions
  • capacities_up: Maximum transmission capacity from node_from to node_to
  • capacities_down: Maximum transmission capacity from node_to to node_from

Parameters:

Name Type Description Default
capacities_up DataFrame

DataFrame with capacity limits in up direction

required
capacities_down DataFrame

DataFrame with capacity limits in down direction

required
granularity None | float | Series

Time granularity of capacity data (None, float in minutes, or Series)

None

Raises:

Type Description
ValueError

If indices or columns of the two DataFrames don't match

Example:

>>> import pandas as pd
>>> index = pd.date_range('2024-01-01', periods=24, freq='1H')
>>> columns = ['Line_A_B', 'Line_B_C']
>>> caps = pd.DataFrame(1000, index=index, columns=columns)
>>> capacity_data = NetworkLineCapacitiesData.from_symmetric_capacities(caps)
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
@dataclass
class NetworkLineCapacitiesData:
    """Wrapper for bidirectional capacity data of network transmission lines.

    This dataclass encapsulates transmission capacity limits for network lines in both
    directions. Capacities can be asymmetric to reflect real-world transmission
    constraints or operational limits.

    Capacity Direction Conventions:
        - capacities_up: Maximum transmission capacity from node_from to node_to
        - capacities_down: Maximum transmission capacity from node_to to node_from

    Args:
        capacities_up: DataFrame with capacity limits in up direction
        capacities_down: DataFrame with capacity limits in down direction  
        granularity: Time granularity of capacity data (None, float in minutes, or Series)

    Raises:
        ValueError: If indices or columns of the two DataFrames don't match

    Example:

        >>> import pandas as pd
        >>> index = pd.date_range('2024-01-01', periods=24, freq='1H')
        >>> columns = ['Line_A_B', 'Line_B_C']
        >>> caps = pd.DataFrame(1000, index=index, columns=columns)
        >>> capacity_data = NetworkLineCapacitiesData.from_symmetric_capacities(caps)
    """
    capacities_up: pd.DataFrame
    capacities_down: pd.DataFrame
    granularity: None | float | pd.Series = None

    def __post_init__(self):
        """Validate that both capacity DataFrames have matching indices and columns.

        Raises:
            ValueError: If DataFrames have mismatched indices or columns.
        """
        if not self.capacities_up.index.equals(self.capacities_down.index):
            raise ValueError('Index mismatch: capacities_up vs capacities_down')
        if not self.capacities_up.columns.equals(self.capacities_down.columns):
            raise ValueError('Columns mismatch: capacities_up vs capacities_down')

    def from_mw_to_mwh(self) -> 'NetworkLineCapacitiesData':
        """Convert capacity data from MW (power) to MWh (energy).

        This conversion requires granularity information to properly scale the values.

        Returns:
            New NetworkLineCapacitiesData instance with energy capacity values

        Raises:
            NotImplementedError: Method not yet implemented
        """
        # TODO: Implement MW to MWh conversion using granularity
        raise NotImplementedError("MW to MWh conversion not yet implemented")

    def from_mwh_to_mw(self) -> 'NetworkLineCapacitiesData':
        """Convert capacity data from MWh (energy) to MW (power).

        This conversion requires granularity information to properly scale the values.

        Returns:
            New NetworkLineCapacitiesData instance with power capacity values

        Raises:
            NotImplementedError: Method not yet implemented
        """
        # TODO: Implement MWh to MW conversion using granularity
        raise NotImplementedError("MWh to MW conversion not yet implemented")

    @classmethod
    def from_symmetric_capacities(cls, capacities: pd.DataFrame) -> "NetworkLineCapacitiesData":
        """Create NetworkLineCapacitiesData with identical capacities in both directions.

        This is a convenience constructor for cases where transmission lines have
        the same capacity limit in both directions.

        Args:
            capacities: DataFrame with capacity values to use for both directions

        Returns:
            NetworkLineCapacitiesData instance with symmetric capacities

        Example:

            >>> import pandas as pd
            >>> caps = pd.DataFrame({
            ...     'Line_A_B': [1000, 1200, 800],
            ...     'Line_B_C': [1500, 1500, 1000]
            ... })
            >>> capacity_data = NetworkLineCapacitiesData.from_symmetric_capacities(caps)
        """
        return cls(capacities_up=capacities, capacities_down=capacities)

__post_init__

__post_init__()

Validate that both capacity DataFrames have matching indices and columns.

Raises:

Type Description
ValueError

If DataFrames have mismatched indices or columns.

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
208
209
210
211
212
213
214
215
216
217
def __post_init__(self):
    """Validate that both capacity DataFrames have matching indices and columns.

    Raises:
        ValueError: If DataFrames have mismatched indices or columns.
    """
    if not self.capacities_up.index.equals(self.capacities_down.index):
        raise ValueError('Index mismatch: capacities_up vs capacities_down')
    if not self.capacities_up.columns.equals(self.capacities_down.columns):
        raise ValueError('Columns mismatch: capacities_up vs capacities_down')

from_mw_to_mwh

from_mw_to_mwh() -> NetworkLineCapacitiesData

Convert capacity data from MW (power) to MWh (energy).

This conversion requires granularity information to properly scale the values.

Returns:

Type Description
NetworkLineCapacitiesData

New NetworkLineCapacitiesData instance with energy capacity values

Raises:

Type Description
NotImplementedError

Method not yet implemented

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
219
220
221
222
223
224
225
226
227
228
229
230
231
def from_mw_to_mwh(self) -> 'NetworkLineCapacitiesData':
    """Convert capacity data from MW (power) to MWh (energy).

    This conversion requires granularity information to properly scale the values.

    Returns:
        New NetworkLineCapacitiesData instance with energy capacity values

    Raises:
        NotImplementedError: Method not yet implemented
    """
    # TODO: Implement MW to MWh conversion using granularity
    raise NotImplementedError("MW to MWh conversion not yet implemented")

from_mwh_to_mw

from_mwh_to_mw() -> NetworkLineCapacitiesData

Convert capacity data from MWh (energy) to MW (power).

This conversion requires granularity information to properly scale the values.

Returns:

Type Description
NetworkLineCapacitiesData

New NetworkLineCapacitiesData instance with power capacity values

Raises:

Type Description
NotImplementedError

Method not yet implemented

Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
233
234
235
236
237
238
239
240
241
242
243
244
245
def from_mwh_to_mw(self) -> 'NetworkLineCapacitiesData':
    """Convert capacity data from MWh (energy) to MW (power).

    This conversion requires granularity information to properly scale the values.

    Returns:
        New NetworkLineCapacitiesData instance with power capacity values

    Raises:
        NotImplementedError: Method not yet implemented
    """
    # TODO: Implement MWh to MW conversion using granularity
    raise NotImplementedError("MWh to MW conversion not yet implemented")

from_symmetric_capacities classmethod

from_symmetric_capacities(capacities: DataFrame) -> NetworkLineCapacitiesData

Create NetworkLineCapacitiesData with identical capacities in both directions.

This is a convenience constructor for cases where transmission lines have the same capacity limit in both directions.

Parameters:

Name Type Description Default
capacities DataFrame

DataFrame with capacity values to use for both directions

required

Returns:

Type Description
NetworkLineCapacitiesData

NetworkLineCapacitiesData instance with symmetric capacities

Example:

>>> import pandas as pd
>>> caps = pd.DataFrame({
...     'Line_A_B': [1000, 1200, 800],
...     'Line_B_C': [1500, 1500, 1000]
... })
>>> capacity_data = NetworkLineCapacitiesData.from_symmetric_capacities(caps)
Source code in submodules/mesqual/mesqual/energy_data_handling/network_lines_data.py
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
@classmethod
def from_symmetric_capacities(cls, capacities: pd.DataFrame) -> "NetworkLineCapacitiesData":
    """Create NetworkLineCapacitiesData with identical capacities in both directions.

    This is a convenience constructor for cases where transmission lines have
    the same capacity limit in both directions.

    Args:
        capacities: DataFrame with capacity values to use for both directions

    Returns:
        NetworkLineCapacitiesData instance with symmetric capacities

    Example:

        >>> import pandas as pd
        >>> caps = pd.DataFrame({
        ...     'Line_A_B': [1000, 1200, 800],
        ...     'Line_B_C': [1500, 1500, 1000]
        ... })
        >>> capacity_data = NetworkLineCapacitiesData.from_symmetric_capacities(caps)
    """
    return cls(capacities_up=capacities, capacities_down=capacities)