app.conversion.pandapower_converter
App conversion module: pandapower_converter
Provides a converter that maps a minimal Omnes Model to a pandapower network (pandapowerNet). The converter models a balanced (single-phase equivalent) network and extracts time series profiles for use with pandapower simulations.
Notes - Balanced single-phase equivalent is used. Extend for three-phase/unbalanced use. - Batteries and flexible devices are modeled as sgen/load elements whose p_mw are provided externally for each timestep. - Time series values are expected in kW and are converted to MW where needed.
PandapowerConverter
Bases: Converter
Convert an Omnes Model into a pandapower network and associated time series.
The converter constructs pandapower network elements (buses, lines, sgens, loads, ext_grids, switches) and collects time series data into the network's 'profiles' attribute. Time series are converted to numpy arrays for use in simulations.
Attributes
DEFAULT_TIME_SET_SIZE : int Default fallback size for time sets when needed. net : pandapowerNet The pandapower network being constructed. bus_map : dict Mapping from Omnes bus id to pandapower bus index.
convert_back(model)
Map simulation results from a pandapower network back onto model entities.
Updates model entities (for example, last_vm_pu or last_loading_percent) with values read from the network results tables.
Parameters
net The pandapower network containing simulation results. model The Omnes model to update.
convert_model(model, time_set=None, new_freq=None, **kwargs)
Convert a Model into a pandapower network and collect profiles.
Parameters
model The Omnes Model to convert. time_set Optional time set specification (int or range). If None the model's defaults are used. new_freq Optional target frequency for resampling time series (e.g., '15min').
Returns
pandapowerNet The constructed pandapower network with 'profiles' and 'time_set' attributes populated.
convert_quantity(quantity, name, time_set=None, freq=None)
Convert a Quantity to a numpy array suitable for pandapower profiles.
- Returns None if the quantity is empty.
- For Parameter instances, returns the parameter's scalar or array value.
- For Timeseries-like quantities, returns values resampled to the requested time_set and frequency.
Parameters
quantity The Quantity to convert. name Human-readable identifier used for logging/debugging. time_set Optional time set specification for resampling. freq Optional frequency for resampling.
Returns
numpy.ndarray or None Array of values across the time set, or None if empty.