VeraGridEngine.Devices package

Subpackages

Submodules

VeraGridEngine.Devices.admittance_matrix module

class VeraGridEngine.Devices.admittance_matrix.AdmittanceMatrix(size: int = 0)[source]

Bases: object

This is the admittance matrix to store the three-phases admittance of a branch

copy() AdmittanceMatrix[source]

Make a copy of the admittance matrix :return:

parse(data: Dict[str, str | float | int]) None[source]

Parse the tap data :param data: dictionary representation of the tap

property phA
Returns:

property phB
property phC
property phN
Returns:

property size: int
to_dict() Dict[str, str | float][source]

Get a dictionary representation of the tap :return:

property values: ndarray[tuple[Any, ...], dtype[complex128]]
VeraGridEngine.Devices.admittance_matrix.list_to_matrix(data: List[List[float]] | None, size: int) ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]][source]

Attempts converting a list of lists to matrix :param data: list of lists of floats representing a matrix :param size: size of the matrix (square) :return: Numpy array representing a matrix

VeraGridEngine.Devices.assets module

class VeraGridEngine.Devices.assets.Assets[source]

Bases: object

Class to store the assets

add_area(obj: Area)[source]

Add area :param obj: Area object

add_battery(bus: None | Bus = None, api_obj: None | Battery = None) Battery[source]

Add battery :param bus: :param api_obj: :return:

add_branch(obj: Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | Branch) None[source]

Add any branch object (it’s type will be inferred here) :param obj: any class inheriting from ParentBranch

add_branch_group(obj: BranchGroup)[source]

Add a BranchGroup object :param obj: BranchGroup instance

add_bus(obj: None | Bus = None) Bus[source]

Add a Bus object to the grid.

Arguments:

obj (Bus): Bus object

add_bus_bar(obj: BusBar)[source]

Add Substation :param obj: BusBar object

add_community(obj: Community)[source]

Add a Community object :param obj: Community instance

add_contingency(obj: Contingency)[source]

Add a contingency :param obj: Contingency

add_contingency_group(obj: ContingencyGroup)[source]

Add contingency group :param obj: ContingencyGroup

add_controllable_shunt(bus: None | Bus = None, api_obj: None | ControllableShunt = None) ControllableShunt[source]

Add a ControllableShunt object :param bus: Main bus (optional) :param api_obj: ControllableShunt instance :return: ControllableShunt

add_country(obj: Country)[source]

Add country :param obj: object

add_current_injection(bus: None | Bus = None, api_obj: None | CurrentInjection = None) CurrentInjection[source]

Add a CurrentInjection object :param bus: Bus :param api_obj: CurrentInjection instance

add_dc_line(obj: DcLine)[source]

Add a line object :param obj: Line instance

add_diagram(diagram: MapDiagram | SchematicDiagram)[source]

Add diagram :param diagram: MapDiagram, SchematicDiagram device :return:

add_dynamic_plot(obj: DynamicPlot)[source]

Add dynamic plot :param obj: DynamicPlot

add_dynamic_plot_entry(obj: DynamicPlotEntry)[source]

Add dynamic plot entry :param obj: DynamicPlotEntry

add_element(obj: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement) None[source]

Add a device in its corresponding list :param obj: device object to add :return: Nothing

add_emission_gas(obj: EmissionGas)[source]

Add EmissionGas :param obj: EmissionGas object

add_emt_event(obj: EmtEvent)[source]

Add emt_event :param obj: EmtEvent

add_emt_events_group(obj: EmtEventsGroup)[source]

Add emt events group :param obj: EmtEventsGroup

add_emt_model(obj: EmtModelTemplate)[source]

Add emt model to the collection :param obj: DynamicModel instance

add_emt_model_catalogue()[source]

Create default catalogue of EMT values :return:

add_external_grid(bus: None | Bus = None, api_obj: None | ExternalGrid = None) ExternalGrid[source]

Add an external grid :param bus: Bus object :param api_obj: api_obj, if None, create a new one :return: ExternalGrid

add_facility(obj: Facility)[source]

Add facility :param obj: Facility object

add_fluid_node(obj: FluidNode)[source]

Add fluid node :param obj: FluidNode

add_fluid_p2x(node: None | FluidNode = None, api_obj: FluidP2x | None = None) FluidP2x[source]

Add power to x :param node: Fluid node to add to :param api_obj:FluidP2x

add_fluid_path(obj: FluidPath)[source]

Add fluid path :param obj:FluidPath

add_fluid_pump(node: None | FluidNode = None, api_obj: FluidPump | None = None) FluidPump[source]

Add fluid pump :param node: Fluid node to add to :param api_obj:FluidPump

add_fluid_turbine(node: None | FluidNode = None, api_obj: FluidTurbine | None = None) FluidTurbine[source]

Add fluid turbine :param node: Fluid node to add to :param api_obj: FluidTurbine

add_fmu_template(obj: FmuTemplate) None[source]

Add one reusable FMU template to the catalogue.

Parameters:

obj – FMU template instance.

Returns:

None.

add_fuel(obj: Fuel)[source]

Add Fuel :param obj: Fuel object

add_generator(bus: None | Bus = None, api_obj: None | Generator = None) Generator[source]

Add a generator :param bus: Main bus (optional) :param api_obj: Generator object (optional) :return: Generator object (created if api_obj is None)

add_hvdc(obj: HvdcLine)[source]

Add a hvdc line object :param obj: HvdcLine instance

add_if_measurement(obj: IfMeasurement)[source]

Add a IfMeasurement object :param obj: IfMeasurement instance

add_investment(obj: Investment)[source]

Add investment :param obj: Investment

add_investments_group(obj: InvestmentsGroup)[source]

Add investments group :param obj: InvestmentsGroup

add_it_measurement(obj: ItMeasurement)[source]

Add a ItMeasurement object :param obj: ItMeasurement instance

add_line(obj: Line, logger: Logger | DataLogger = <VeraGridEngine.basic_structures.Logger object>) Line[source]

Add a line object :param obj: Line instance :param logger: Logger to record events

add_load(bus: None | Bus = None, api_obj: None | Load = None) Load[source]

Add a load device :param bus: Main bus (optional) :param api_obj: Device to add (optional) :return: Load device passed or created

add_modelling_authority(obj: ModellingAuthority)[source]

Add a ModellingAuthority object :param obj: ModellingAuthority instance

add_municipality(obj: Municipality)[source]

Add a Municipality object :param obj: Municipality instance

add_overhead_line(obj: OverheadLineType)[source]

Add overhead line (tower) template to the collection :param obj: Tower instance

add_owner(obj: Owner)[source]

Add owner :param obj: Owner

add_pf_measurement(obj: PfMeasurement)[source]

Add a PfMeasurement object :param obj: PfMeasurement instance

add_pg_measurement(obj: PgMeasurement)[source]

Add a PgMeasurement object :param obj: PgMeasurement instance

add_pi_measurement(obj: PiMeasurement)[source]

Add a PiMeasurement object :param obj: PiMeasurement instance

add_pt_measurement(obj: PtMeasurement)[source]

Add a PfMeasurement object :param obj: PfMeasurement instance

add_qf_measurement(obj: QfMeasurement)[source]

Add a QfMeasurement object :param obj: QfMeasurement instance

add_qg_measurement(obj: QgMeasurement)[source]

Add a QiMeasurement object :param obj: QiMeasurement instance

add_qi_measurement(obj: QiMeasurement)[source]

Add a QiMeasurement object :param obj: QiMeasurement instance

add_qt_measurement(obj: QtMeasurement)[source]

Add a QtMeasurement object :param obj: QtMeasurement instance

add_region(obj: Region)[source]

Add a Region object :param obj: Region instance

add_remedial_action(obj: RemedialAction)[source]

Add a remedial actions :param obj: RemedialAction

add_remedial_action_group(obj: RemedialActionGroup)[source]

Add _remedial_action group :param obj: ContingencyGroup

add_rms_event(obj: RmsEvent)[source]

Add rms_event :param obj: RmsEvent

add_rms_events_group(obj: RmsEventsGroup)[source]

Add rms events group :param obj: RmsEventsGroup

add_rms_model(obj: RmsModelTemplate)[source]

Add rms model to the collection :param obj: DynamicModel instance

add_rms_model_catalogue()[source]

Here the list of all rms templates must be returned in a list :return:

add_sequence_line(obj: SequenceLineType)[source]

Add sequence line to the collection :param obj: SequenceLineType instance

add_series_reactance(obj: SeriesReactance)[source]

Add a SeriesReactance object :param obj: SeriesReactance instance

add_short_circuit_event(obj: ShortCircuitEvent)[source]

Add short_circuit_definitions :param obj: ShortCircuitDefinition

add_shunt(bus: None | Bus = None, api_obj: None | Shunt = None) Shunt[source]

Add a Shunt object to a Bus.

Arguments:

bus (Bus): Bus object

api_obj (Shunt): Shunt object

add_static_generator(bus: None | Bus = None, api_obj: None | StaticGenerator = None) StaticGenerator[source]

Add a static generator :param bus: Bus object :param api_obj: StaticGenerator object :return: StaticGenerator object (created if api_obj is None)

add_substation(obj: Substation)[source]

Add Substation :param obj: Substation object

add_switch(obj: Switch)[source]

Add a Switch object :param obj: Switch instance

add_technology(obj: Technology)[source]

Add technology :param obj: Technology

add_transformer2w(obj: Transformer2W) Transformer2W[source]

Add a transformer object :param obj: Transformer2W instance

add_transformer3w(obj: Transformer3W, add_middle_bus: bool = True)[source]

Add a transformer object :param obj: Transformer3W instance :param add_middle_bus: Add the TR3 middle bus?

add_transformer_nw(obj: TransformerNW, add_middle_bus: bool = True)[source]

Add an N-winding transformer object :param obj: TransformerNW instance :param add_middle_bus: Add the internal star bus?

add_transformer_type(obj: TransformerType)[source]

Add transformer template :param obj: TransformerType instance

add_underground_line(obj: UndergroundLineType)[source]

Add underground line :param obj: UndergroundLineType instance

add_upfc(obj: UPFC)[source]

Add a UPFC object :param obj: UPFC instance

add_va_measurement(obj: VaMeasurement)[source]

Add a VaMeasurement object :param obj: VmMeasurement instance

add_vm_measurement(obj: VmMeasurement)[source]

Add a VmMeasurement object :param obj: VmMeasurement instance

add_voltage_level(obj: VoltageLevel)[source]

Add a VoltageLevel object :param obj: VoltageLevel instance

add_vsc(obj: VSC)[source]

Add a hvdc line object :param obj: HvdcLine instance

add_winding(obj: Winding)[source]

Add a winding object :param obj: Winding instance

add_wire(obj: Wire)[source]

Add Wire to the collection :param obj: Wire instance

add_zone(obj: Zone)[source]

Add zone :param obj: Zone object

apply_all_relevant_investments() Logger[source]

Apply the investments that shall be in operation at the model date :return: Logger

apply_investment(investment: Investment, logger: Logger)[source]

Apply investment :param investment: :param logger: :return:

apply_investments_group(inv_group: InvestmentsGroup, inv_groups_dict: Dict[InvestmentsGroup, List[Investment]] | None = None) Logger[source]

Apply the investments that shall be in operation at the model date :param inv_group: :param inv_groups_dict: :return: Logger

property areas: List[Area]

Get the list of Areas :return:

property batteries: List[Battery]

Get list of batteries :return:

property branch_groups: List[BranchGroup]
Returns:

property bus_bars: List[BusBar]

Get the list of BusBars :return:

property buses: List[Bus]

Get list of buses :return:

clear() None[source]

Clear the multi-circuit (delete the bus and branch objects)

property communities: List[Community]
Returns:

property contingencies: List[Contingency]

Get list of contingencies :return:

property contingency_groups: List[ContingencyGroup]

Get list of contingency groups :return:

property controllable_shunts: List[ControllableShunt]

Get list of controllable shunts :return:

property countries: List[Country]
Returns:

create_profiles(steps, step_length, step_unit, time_base: datetime = datetime.datetime(2026, 6, 9, 7, 26, 30, 969157))[source]

Set the default profiles in all the objects enabled to have profiles. :param steps: Number of time steps :param step_length: Time length (1, 2, 15, …) :param step_unit: Unit of the time step (β€œh”, β€œm” or β€œs”) :param time_base: Date to start from

property current_injections: List[CurrentInjection]

Get list of current injection devices :return:

property dc_lines: List[DcLine]

get list of dc lines :return:

delete_area(obj: Area)[source]

Delete area :param obj: Area

delete_battery(obj: Battery)[source]

Delete a battery :param obj: :return:

delete_branch(obj: Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance)[source]

Delete a Branch object from the grid.

Arguments:

obj (Branch): Branch object

delete_branch_group(obj: BranchGroup) None[source]

Add a BranchGroup object :param obj: BranchGroup instance

delete_branches_with_sets(buses_to_remove: Set[Bus], delete_associated: bool = False)[source]

Delete branch objects that may contain contingencies, remedial actions, or investments Used when you delete buses connected to branches :param buses_to_remove: Set of buses to remove :param delete_associated: Delete the associated branches :return: None

delete_bus(obj: Bus, delete_associated=False)[source]

Delete a Bus object from the grid. :param obj: Bus object :param delete_associated: Delete the associated branches and injections

delete_bus_bar(obj: BusBar)[source]

Delete Substation :param obj: Substation object

delete_buses(lst: Sequence[Bus], delete_associated=False)[source]

Delete a Bus object from the grid. :param lst: Array of objects to remove :param delete_associated: Delete the associated branches and injections

delete_community(obj: Community) None[source]

Add a Community object :param obj: Community instance

delete_contingency(obj, del_group: bool = False)[source]

Delete zone :param obj: index :param del_group: Delete group if empty?

delete_contingency_group(obj: ContingencyGroup)[source]

Delete contingency group :param obj: ContingencyGroup

delete_controllable_shunt(obj: ControllableShunt) None[source]

Add a LinearShunt object :param obj: LinearShunt instance

delete_country(obj)[source]

Delete country :param obj: index

delete_current_injection(obj: CurrentInjection) None[source]

Add a CurrentInjection object :param obj: CurrentInjection instance

delete_dc_line(obj: DcLine)[source]

Delete line :param obj: Line instance

delete_dynamic_plot(obj: DynamicPlot)[source]

Delete dynamic plot :param obj: index

delete_dynamic_plot_entry(obj: DynamicPlotEntry)[source]

Delete dynamic plot entry :param obj: index

delete_element(obj: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement) None[source]

Get set of elements and their parent nodes :param obj: device object to delete_with_dialogue :return: Nothing

delete_emission_gas(obj: EmissionGas)[source]

Delete Substation :param obj: index

delete_emt_event(obj: EmtEvent, del_group: bool = False)[source]

Delete zone :param obj: index :param del_group: delete_with_dialogue the group?

delete_emt_events_group(obj: EmtEventsGroup)[source]

Delete zone :param obj: index

delete_emt_model(obj: EmtModelTemplate)[source]

Delete EMT model from the collection :param obj: DynamicModel object

delete_external_grid(obj: ExternalGrid)[source]

Delete a external grid :param obj: :return:

delete_facility(obj: Facility)[source]

Delete area :param obj: Area

delete_fluid_node(obj: FluidNode)[source]

Delete fluid node :param obj: FluidNode

delete_fluid_p2x(obj: FluidP2x)[source]

Delete fuid pump :param obj: FluidP2x

delete_fluid_path(obj: FluidPath)[source]

Delete fuid path :param obj: FluidPath

delete_fluid_pump(obj: FluidPump)[source]

Delete fuid pump :param obj: FluidPump

delete_fluid_turbine(obj: FluidTurbine)[source]

Delete fuid turbine :param obj: FluidTurbine

delete_fmu_template(obj: FmuTemplate) None[source]

Delete one reusable FMU template from the catalogue.

Parameters:

obj – FMU template instance.

Returns:

None.

delete_fuel(obj)[source]

Delete Fuel :param obj: index

delete_generator(obj: Generator)[source]

Delete a generator :param obj: :return:

delete_groupings_with_object(obj: Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, delete_groups: bool = True)[source]

Delete the dependencies that may come with a branch :param obj: branch object or any object :param delete_groups: delete_with_dialogue empty groups too? :return:

delete_hvdc_line(obj: HvdcLine)[source]

Delete HVDC line :param obj:

delete_if_measurement(obj: IfMeasurement) None[source]

Add a IfMeasurement object :param obj: IfMeasurement instance

delete_injection_device(obj: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection)[source]

Delete a Branch object from the grid.

Arguments:

obj (Branch): Branch object

delete_investment(obj: Investment, del_group: bool = False)[source]

Delete zone :param obj: index :param del_group: delete_with_dialogue the group?

delete_investment_groups(obj: InvestmentsGroup)[source]

Delete zone :param obj: index

delete_it_measurement(obj: ItMeasurement) None[source]

Add a ItMeasurement object :param obj: ItMeasurement instance

delete_line(obj: Line)[source]

Delete line :param obj: Line instance

delete_line_template_dependency(obj)[source]

Search a branch template from lines and transformers and delete_with_dialogue it :param obj: :return:

delete_load(obj: Load)[source]

Delete a load :param obj: :return:

delete_modelling_authority(obj: ModellingAuthority) None[source]

Add a ModellingAuthority object :param obj: ModellingAuthority instance

delete_municipality(obj: Municipality) None[source]

Add a Municipality object :param obj: Municipality instance

delete_overhead_line(obj: OverheadLineType)[source]

Delete tower from the collection :param obj: OverheadLineType

delete_owner(obj: Owner)[source]

Delete owner :param obj: index

delete_pf_measurement(obj: PfMeasurement) None[source]

Add a PfMeasurement object :param obj: PfMeasurement instance

delete_pg_measurement(obj: PgMeasurement) None[source]

Add a PiMeasurement object :param obj: PiMeasurement instance

delete_pi_measurement(obj: PiMeasurement) None[source]

Add a PiMeasurement object :param obj: PiMeasurement instance

delete_profiles()[source]

Delete the time profiles :return:

delete_pt_measurement(obj: PtMeasurement) None[source]

Add a PtMeasurement object :param obj: PtMeasurement instance

delete_qf_measurement(obj: QfMeasurement) None[source]

Add a QfMeasurement object :param obj: QfMeasurement instance

delete_qg_measurement(obj: QgMeasurement) None[source]

Add a QgMeasurement object :param obj: QgMeasurement instance

delete_qi_measurement(obj: QiMeasurement) None[source]

Add a QiMeasurement object :param obj: QiMeasurement instance

delete_qt_measurement(obj: QtMeasurement) None[source]

Add a QtMeasurement object :param obj: QtMeasurement instance

delete_region(obj: Region) None[source]

Add a Region object :param obj: Region instance

delete_remedial_action(obj, del_group: bool = False)[source]

Delete RemedialAction :param del_group: Delete the group? :param obj: index

delete_remedial_action_group(obj: RemedialActionGroup)[source]

Delete contingency group :param obj: ContingencyGroup

delete_rms_event(obj: RmsEvent, del_group: bool = False)[source]

Delete zone :param obj: index :param del_group: delete_with_dialogue the group?

delete_rms_events_group(obj: RmsEventsGroup)[source]

Delete zone :param obj: index

delete_rms_model(obj: RmsModelTemplate)[source]

Delete RMS model from the collection :param obj: DynamicModel object

delete_sequence_line(obj)[source]

Delete sequence line from the collection :param obj:

delete_series_reactance(obj: SeriesReactance) None[source]

Add a SeriesReactance object :param obj: SeriesReactance instance

delete_short_circuit_event(obj: ShortCircuitEvent)[source]

Delete ShortCircuitDefinition :param obj: index

delete_shunt(obj: Shunt)[source]

Delete a shunt :param obj: :return:

delete_static_generator(obj: StaticGenerator)[source]

Delete a static generators :param obj: :return:

delete_substation(obj: Substation)[source]

Delete Substation :param obj: Substation object

delete_switch(obj: Switch)[source]

Delete transformer :param obj: Transformer2W instance

delete_technology(obj: Technology)[source]

Delete zone :param obj: index

delete_transformer2w(obj: Transformer2W)[source]

Delete transformer :param obj: Transformer2W instance

delete_transformer3w(obj: Transformer3W)[source]

Delete transformer :param obj: Transformer2W instance

delete_transformer_nw(obj: TransformerNW)[source]

Delete N-winding transformer :param obj: TransformerNW instance

delete_transformer_template_dependency(obj: TransformerType)[source]

Search a branch template from lines and transformers and delete_with_dialogue it :param obj: :return:

delete_transformer_type(obj: TransformerType)[source]

Delete transformer type from the collection :param obj

delete_underground_line(obj)[source]

Delete underground line :param obj:

delete_upfc_converter(obj: UPFC)[source]

Delete VSC :param obj: VSC Instance

delete_va_measurement(obj: VaMeasurement) None[source]

Add a VaMeasurement object :param obj: VaMeasurement instance

delete_vm_measurement(obj: VmMeasurement) None[source]

Add a VmMeasurement object :param obj: VmMeasurement instance

delete_voltage_level(obj: VoltageLevel) None[source]

Add a VoltageLevel object :param obj: VoltageLevel instance

delete_vsc_converter(obj: VSC)[source]

Delete VSC :param obj: VSC Instance

delete_winding(obj: Winding)[source]

Delete winding :param obj: Winding instance

delete_wire(obj: Wire)[source]

Delete wire from the collection :param obj: Wire object

delete_zone(obj)[source]

Delete zone :param obj: index

device_associations: Dict[str, List[str]]

self.type_name = β€˜Shunt’

self.properties_with_profile = [β€˜Y’]

device_type_name_dict: Dict[str, DeviceType]
property diagrams: List[MapDiagram | SchematicDiagram]

Get the list of diagrams :return:

property dynamic_plot_entries: List[DynamicPlotEntry]
Returns:

property dynamic_plots: List[DynamicPlot]
Returns:

property emission_gases: List[EmissionGas]

Get list of emission gases :return:

property emt_events: List[EmtEvent]
Returns:

property emt_events_groups: List[EmtEventsGroup]
Returns:

property emt_models: List[EmtModelTemplate]

list of emt models :return:

ensure_profiles_exist() None[source]

Format the pandas profiles in place using a time index.

property external_grids: List[ExternalGrid]

Get list of external grids :return:

property facilities: List[Facility]

Get the list of facilities :return:

property fluid_nodes: List[FluidNode]

Get list of the fluid nodes :return:

property fluid_paths: List[FluidPath]

Get list of fluid path devices :return:

property fmu_templates: List[FmuTemplate]

List of reusable FMU templates.

Returns:

FMU templates.

format_profiles(index: DatetimeIndex)[source]

Format the profiles in place using a time index. :param index: Time profile

property fuels: List[Fuel]

Get list of fuels :return:

property generators: List[Generator]

Get list of generators :return:

get_all_elements_dict(use_secondary_key: bool = False, use_rdfid: bool = False, logger=<VeraGridEngine.basic_structures.Logger object>) Tuple[Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], bool][source]

Get a dictionary of all elements :param use_secondary_key: if true the code i˘s used as key :param use_rdfid: if true the rdfid is used as key :param logger: Logger :return: Dict[idtag] -> object, ok

get_all_elements_dict_by_type(add_locations: bool = False, string_keys: bool = True) Dict[str | DeviceType, Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement] | Any][source]

Get a dictionary of all elements by type :param add_locations: Add locations to dict :param string_keys: make the keys string otherwise use DeviceType :return:

get_all_elements_iter() Generator[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, None, None][source]

Get all elements :return: ALL_DEV_TYPES

get_all_elements_number() int[source]

Get all elements number :return: int

get_all_time_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get array with all the time steps :return: IntVec

get_area_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get array of area names :return: StrVec

get_area_number() int[source]

Get number of areas :return: number of areas

get_areas() List[Area][source]

Get list of areas :return: List[dev.Area]

get_batteries() List[Battery][source]

Returns a list of Battery objects in the grid.

get_batteries_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the battery uuid’s with their index :return: Dict[str, int]

get_batteries_number() int[source]

Returns a list of Battery objects in the grid.

get_battery_capacities()[source]

Returns a list of Battery capacities.

get_battery_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Battery names.

get_branch_FT(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

get the from and to arrays of indices :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: IntVec, IntVec

get_branch_actives(t_idx: int | None, add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) ndarray[tuple[Any, ...], dtype[int64]][source]

Get array of all branch active states :param t_idx: Index of time step :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: StrVec

get_branch_group_at(i: int) BranchGroup[source]

Get branch_group at i :param i: index :return: BranchGroup

get_branch_group_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of branch_group names :return: StrVec

get_branch_groups() List[BranchGroup][source]

List of branch_groups :return: List[dev.BranchGroup]

get_branch_groups_number() int[source]

Size of the list of branch_groups :return: size of branch_groups

get_branch_lists(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) List[List[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance]][source]

Return all the branch objects :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: list of branch devices lists

get_branch_names(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) ndarray[tuple[Any, ...], dtype[str_]][source]

Get array of all branch names :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: StrVec

get_branch_number(add_vsc: bool = False, add_hvdc: bool = False, add_switch: bool = True) int[source]

return the number of Branches (of all types) :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: number

get_branches(add_vsc: bool = False, add_hvdc: bool = False, add_switch: bool = True) List[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance][source]

Return all the branch objects :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: list of branch devices

get_branches_dict(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Dict[str, int][source]

Get dictionary of branches (excluding HVDC) the key is the idtag, the value is the branch position :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: Dict[str, int]

get_branches_idtag_index_dict(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Dict[str, int][source]

Get the branch to index dictionary :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: Branch object to index

get_branches_index_dict(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Dict[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, int][source]

Get the branch to index dictionary :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: Branch object to index

get_branches_index_dict2(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Dict[str, int][source]

Get the branch to index dictionary :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: Branch idtag to index

get_branches_iter(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Generator[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, None, None][source]

Return all the branch objects :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: list of branch devices

get_branches_monitored_indices(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) ndarray[tuple[Any, ...], dtype[int64]][source]

Get the indices of the monitored branche

Parameters:
  • add_vsc – Include the list of VSC?

  • add_hvdc – Include the list of HvdcLine?

  • add_switch – Include the list of Switch?

Returns:

numpy array with the indices of the branches

get_bus_actives(t_idx: int | None = None) ndarray[tuple[Any, ...], dtype[int64]][source]

get a vector of actives :return: Array of bus active

get_bus_at(i: int) Bus[source]

List of buses :param i: index :return:

get_bus_bars() List[BusBar][source]

Get all bus bars

get_bus_bars_number() int[source]

Get all bus-bars number :return:

get_bus_devices(bus: Bus) Tuple[List[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance], List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]][source]

Get the list of associated branches and the list of associated injections :param bus: :return: associated_branches, associated_injections

get_bus_dict(by_idtag=False) Dict[str, Bus][source]

Return dictionary of buses :param by_idtag if true, the key is the idtag else the key is the name :return: dictionary of buses {name:object}

get_bus_idtag_index_dict() Dict[str, int][source]

Return dictionary of buses :return: dictionary of buses {name:object}

get_bus_index_dict() Dict[Bus, int][source]

Return dictionary of buses :return: dictionary of buses {name:object}

get_bus_names() ndarray[tuple[Any, ...], dtype[str_]][source]

List of bus names :return:

get_bus_number() int[source]

Return the number of buses :return: number

get_buses() List[Bus][source]

List of buses :return:

get_buses_by(filter_elements: List[Area | Zone | Country | Community | Region | Municipality]) List[Bus][source]

Get a list of buses that can be found in the list of Areas | Zones | Countries :param filter_elements: list of Areas | Zones | Countries :return: list of buses

get_capex_by_investment_group() ndarray[tuple[Any, ...], dtype[float64]][source]

Get array of CAPEX costs per investment group :return:

get_communities() List[Community][source]

List of communities :return: List[dev.Community]

get_communities_number() int[source]

Size of the list of communities :return: size of communities

get_community_at(i: int) Community[source]

Get community at i :param i: index :return: Community

get_community_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of community names :return: StrVec

get_contingencies_by_group() Dict[ContingencyGroup, List[Contingency]][source]

Get a dictionary of contingency groups as keys and a list of contingencies as value :return: dict[contingency group] -> [contingencies list]

get_contingency_branch_indices_by_group(add_vsc: bool = True, add_hvdc: bool = True, add_switch: bool = False) Dict[ContingencyGroup, List[int]][source]

Get a dictionary of contingency groups as keys and a list of contingencies as value :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: dict[contingency group] -> [contingencies list]

get_contingency_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement][source]

Get a list of devices susceptible to be included in contingencies / remedial actions :return: list of devices

get_contingency_group_dict() Dict[str, List[Contingency]][source]

Get a dictionary of group idtags related to list of contingencies :return:

get_contingency_group_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get list of contingency group names :return:

get_contingency_groups() List[ContingencyGroup][source]

Get contingency_groups :return:List[dev.ContingencyGroup]

get_contingency_groups_active() List[ContingencyGroup][source]

Get contingency_groups :return:List[dev.ContingencyGroup]

get_contingency_groups_in(grouping_elements: List[Area | Zone | Country | Community | Region | Municipality]) List[ContingencyGroup][source]

Get a filtered set of ContingencyGroups :param grouping_elements: list of zones, areas or countries where to locate the contingencies :return: Sorted group filtered ContingencyGroup elements

get_contingency_groups_number() int[source]
Returns:

get_contingency_groups_sensitive_to_monitoring(LODF: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], threshold: float) ndarray[tuple[Any, ...], dtype[bool]][source]

Get a list of contingency groups that are sensitive to the monitoring rule :param LODF: LODF matrix (nbr, nbr) :param threshold: LODF threshold :return: vector of sensitive status

get_contingency_number() int[source]

Get number of contingencies :return:

get_controllable_shunt_at(i: int) ControllableShunt[source]

Get linear_shunt at i :param i: index :return: LinearShunt

get_controllable_shunt_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of linear_shunt names :return: StrVec

get_controllable_shunts() List[ControllableShunt][source]

List of controllable_shunts :return: List[dev.LinearShunt]

get_controllable_shunts_number() int[source]

Size of the list of controllable_shunts :return: size of controllable_shunts

get_countries() List[Country][source]

Get all countries

get_country_number() int[source]

Get country number :return:

get_current_injection_at(i: int) CurrentInjection[source]

Get current_injection at i :param i: index :return: CurrentInjection

get_current_injection_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of current_injection names :return: StrVec

get_current_injections() List[CurrentInjection][source]

List of current_injections :return: List[dev.CurrentInjection]

get_current_injections_number() int[source]

Size of the list of current_injections :return: size of current_injections

get_dc_lines() List[DcLine][source]
Returns:

get_diagrams() List[MapDiagram | SchematicDiagram][source]

Get list of diagrams :return: MapDiagram, SchematicDiagram device

get_dictionary_of_lists(elm_type: DeviceType) Tuple[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, Dict[DeviceType, List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement]]][source]

Function that returns the template of an elements and a dictionary of the lists of elements that contain it’s dependencies :param elm_type: DeviceType :return: Template, dictionary of dependencies

get_dynamic_plot_entries_by_plot() List[Tuple[DynamicPlot, List[DynamicPlotEntry]]][source]

Get a dictionary of dynamic plots and their :return: list of dynamic plots and their list of associated plot entries

get_dynamic_plot_entries_by_plot_index_dict() Dict[int, List[DynamicPlotEntry]][source]

Get a dictionary of dynamic plots :return: Dict[dynamic plot index] = list of dynamic plot entries

get_dynamic_plots_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_dynamic_templates_by_device_type_and_domain(tpe: DeviceType, domain: FmuTemplateDomain) List[RmsModelTemplate | EmtModelTemplate | FmuTemplate][source]

Get all reusable templates for one device type and one simulation domain.

Native templates and FMU templates are both returned because the block editor library must expose both under the same Templates category.

Parameters:
  • tpe – Supported VeraGrid device type.

  • domain – Simulation domain used by the editor.

Returns:

Matching native and FMU templates.

get_dynamic_templates_by_domain(domain: FmuTemplateDomain) List[RmsModelTemplate | EmtModelTemplate | FmuTemplate][source]

Get all reusable templates registered for one simulation domain.

Parameters:

domain – Simulation domain used by the editor.

Returns:

Matching native and FMU templates.

get_elements_by_type(device_type: DeviceType) DatetimeIndex | List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement][source]

Get set of elements and their parent nodes :param device_type: DeviceTYpe instance :return: List of elements, it raises an exception if the elements are unknown

get_elements_dict_by_type(element_type: DeviceType, use_secondary_key: bool = False, use_rdfid: bool = False) Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement][source]

Get dictionary of elements :param element_type: element type (Bus, Line, etc…) :param use_secondary_key: use the code as dictionary key? otherwise the idtag is used :param use_rdfid: if true the rdfid is used as key :return: Dict[str, dev.EditableDevice]

get_emission_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_emission_number() int[source]
Returns:

get_emissions() List[EmissionGas][source]
Returns:

get_emissions_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the fuel uuid’s with their index :return: Dict[str, int]

get_emt_event_by_groups() List[Tuple[EmtEventsGroup, List[EmtEvent]]][source]

Get a dictionary of EMT event groups and their :return: list of EMT event groups and their list of associated EMT events

get_emt_event_by_groups_index_dict() Dict[int, List[EmtEvent]][source]

Get a dictionary of EMT event groups :return: Dict[EMT event group index] = list of EMT events

get_emt_events_groups_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_emt_models_by_device_type(tpe: DeviceType) List[EmtModelTemplate][source]

Get a list of EmtModelTemplate filtering by device type :param tpe: :return:

get_emt_models_number() int[source]

Get number of EMT models

get_external_grid_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of ExternalGrid names.

get_external_grids() List[ExternalGrid][source]

Returns a list of ExternalGrid objects in the grid.

get_external_grids_number() int[source]

Returns a list of ExternalGrid objects in the grid.

get_facilities() List[Facility][source]

Get list of areas :return: List[dev.Facility]

get_facility_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get array of area names :return: StrVec

get_facility_number() int[source]

Get number of facilities :return: number of facilities

get_fluid_injection_lists() List[List[FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump]][source]

Get a list with the fluid injections lists :return:

get_fluid_injection_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Injection names. Sort by order: turbines, pumps, p2xs

get_fluid_injection_number() int[source]

Get number of fluid injections :return: int

get_fluid_injections() List[FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump][source]

Returns a list of Injection names. Sort by order: turbines, pumps, p2xs

get_fluid_node_names() ndarray[tuple[Any, ...], dtype[str_]][source]

List of fluid node names :return:

get_fluid_nodes() List[FluidNode][source]
Returns:

get_fluid_nodes_number() int[source]
Returns:

get_fluid_p2xs() List[FluidP2x][source]

Returns a list of Load objects in the grid.

get_fluid_p2xs_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of P2X names.

get_fluid_p2xs_number() int[source]
Returns:

number of total pumps in the network

get_fluid_path_names() ndarray[tuple[Any, ...], dtype[str_]][source]

List of fluid paths names :return:

get_fluid_paths() List[FluidPath][source]
Returns:

get_fluid_paths_number() int[source]
Returns:

get_fluid_pumps() List[FluidPump][source]

Returns a list of Load objects in the grid.

get_fluid_pumps_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Pump names.

get_fluid_pumps_number() int[source]
Returns:

number of total pumps in the network

get_fluid_turbines() List[FluidTurbine][source]

Returns a list of Load objects in the grid.

get_fluid_turbines_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Turbine names.

get_fluid_turbines_number() int[source]
Returns:

number of total turbines in the network

get_fmu_templates_by_device_type(tpe: DeviceType) List[FmuTemplate][source]

Get FMU templates filtered by supported device type.

Parameters:

tpe – Supported VeraGrid device type.

Returns:

Matching FMU templates.

get_fmu_templates_by_device_type_and_domain(tpe: DeviceType, domain: FmuTemplateDomain) List[FmuTemplate][source]

Get FMU templates filtered by supported device type and simulation domain.

Parameters:
  • tpe – Supported VeraGrid device type.

  • domain – Supported FMU simulation domain.

Returns:

Matching FMU templates.

get_fmu_templates_number() int[source]

Return the number of reusable FMU templates.

Returns:

Number of FMU templates.

get_fuel_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the fuel uuid’s with their index :return: Dict[str, int]

get_fuel_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_fuel_number() int[source]
Returns:

get_fuels() List[Fuel][source]
Returns:

get_generation_like_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection][source]

Returns a list of Injection names. Sort by order: turbines, pumps, p2xs

get_generation_like_lists() List[List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]][source]

Get a list with the fluid injections lists :return:

get_generation_like_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Injection names. Sort by order: turbines, pumps, p2xs

get_generation_like_number() int[source]

Get number of fluid injections :return: int

get_generator_bus_index_dict(bus_index_dict: Dict[Bus, int] = None)[source]

Get a dictionary of generators related to their bus index :param bus_index_dict: bus object to bus index dictionary (optional) :return: generator object to bus index dictionary

get_generator_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the generator uuid’s with their index :return: Dict[str, int]

get_generator_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Generator names.

get_generators() List[Generator][source]

Returns a list of Generator objects in the grid.

get_generators_number() int[source]

Get the number of generators :return: int

get_hvdc() List[HvdcLine][source]
Returns:

get_hvdc_FT() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

get the from and to arrays of indices of HVDC lines :return: IntVec, IntVec

get_hvdc_actives(t_idx: int | None = None) ndarray[tuple[Any, ...], dtype[int64]][source]

get a vector of actives :return: Array of bus active

get_hvdc_dict() Dict[str, HvdcLine][source]

Get dictionary of HVDC lines :return: idtag -> HvdcLine

get_hvdc_index_dict() Dict[str, int][source]

Get dictionary of HVDC lines :return: idtag -> HvdcLine

get_hvdc_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_hvdc_number() int[source]
Returns:

get_if_measurement_at(i: int) IfMeasurement[source]

Get if_measurement at i :param i: index :return: IfMeasurement

get_if_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of if_measurement names :return: StrVec

get_if_measurements() List[IfMeasurement][source]

List of if_measurements :return: List[dev.IfMeasurement]

get_if_measurements_number() int[source]

Size of the list of if_measurements :return: size of if_measurements

get_injection_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_injection_devices_iter() Generator[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection, None, None][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_injection_devices_lists() List[List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_injections_bus_index_dict(bus_index_dict: Dict[Bus, int] = None)[source]

Get a dictionary of generators related to their bus index :param bus_index_dict: bus object to bus index dictionary (optional) :return: generator object to bus index dictionary

get_injections_device_types() List[DeviceType][source]

Get a list of all devices types that can inject or subtract power from a node :return: List of DeviceType

get_investment_by_groups_dict() Dict[InvestmentsGroup, List[Investment]][source]

Get a dictionary of investments groups :return: Dict[investment group index] = list of investments

get_investment_by_groups_index_dict() Dict[int, List[Investment]][source]

Get a dictionary of investments groups :return: Dict[investment group index] = list of investments

get_investment_groups_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_investments_by_groups() List[Tuple[InvestmentsGroup, List[Investment]]][source]

Get a dictionary of investments groups and their :return: list of investment groups and their list of associated investments

get_it_measurement_at(i: int) ItMeasurement[source]

Get it_measurement at i :param i: index :return: ItMeasurement

get_it_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of it_measurement names :return: StrVec

get_it_measurements() List[ItMeasurement][source]

List of it_measurements :return: List[dev.ItMeasurement]

get_it_measurements_number() int[source]

Size of the list of it_measurements :return: size of it_measurements

get_lines() List[Line][source]

get list of ac lines :return: list of lines

get_lines_number() int[source]
Returns:

get_load_like_device_number() int[source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_load_like_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_load_like_devices_iter() Generator[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection, None, None][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_load_like_devices_lists() List[List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]][source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_load_like_devices_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get a list of names of the load like devices :return: array of str

get_load_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of Load names.

get_loaded_emt_models_by_device_type(tpe: DeviceType) List[EmtModelTemplate][source]

Return already materialized EMT templates without triggering lazy loading.

Parameters:

tpe – Supported device type.

Returns:

Matching loaded EMT templates.

get_loaded_rms_models_by_device_type(tpe: DeviceType) List[RmsModelTemplate][source]

Return already materialized RMS templates without triggering lazy loading.

Parameters:

tpe – Supported device type.

Returns:

Matching loaded RMS templates.

get_loads() List[Load][source]

Returns a list of Load objects in the grid.

get_loads_number() int[source]

Returns a list of Load objects in the grid.

get_modelling_authorities() List[ModellingAuthority][source]

List of modelling_authorities :return: List[dev.ModellingAuthority]

get_modelling_authorities_number() int[source]

Size of the list of modelling_authorities :return: size of modelling_authorities

get_modelling_authority_at(i: int) ModellingAuthority[source]

Get modelling_authority at i :param i: index :return: ModellingAuthority

get_modelling_authority_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of modelling_authority names :return: StrVec

get_municipalities() List[Municipality][source]

List of municipalities :return: List[dev.Municipality]

get_municipalities_number() int[source]

Size of the list of municipalities :return: size of municipalities

get_municipality_at(i: int) Municipality[source]

Get municipality at i :param i: index :return: Municipality

get_municipality_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of municipality names :return: StrVec

get_owner_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the fuel uuid’s with their index :return: Dict[str, int]

get_owner_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_p_measurements() List[PiMeasurement][source]

List of pi_measurements :return: List[dev.PiMeasurement]

get_pf_measurement_at(i: int) PfMeasurement[source]

Get pf_measurement at i :param i: index :return: PfMeasurement

get_pf_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of pf_measurement names :return: StrVec

get_pf_measurements() List[PfMeasurement][source]

List of pf_measurements :return: List[dev.PfMeasurement]

get_pf_measurements_number() int[source]

Size of the list of pf_measurements :return: size of pf_measurements

get_pg_measurement_at(i: int) PgMeasurement[source]

Get pg_measurement at i :param i: index :return: PgMeasurement

get_pg_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of pi_measurement names :return: StrVec

get_pg_measurements() List[PgMeasurement][source]

List of pg_measurements :return: List[dev.PgMeasurement]

get_pg_measurements_number() int[source]

Size of the list of pg_measurements :return: size of pg_measurements

get_pi_measurement_at(i: int) PiMeasurement[source]

Get pi_measurement at i :param i: index :return: PiMeasurement

get_pi_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of pi_measurement names :return: StrVec

get_pi_measurements_number() int[source]

Size of the list of pi_measurements :return: size of pi_measurements

get_pt_measurement_at(i: int) PtMeasurement[source]

Get pt_measurement at i :param i: index :return: PfMeasurement

get_pt_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of pt_measurement names :return: StrVec

get_pt_measurements() List[PtMeasurement][source]

List of pt_measurements :return: List[dev.PtMeasurement]

get_pt_measurements_number() int[source]

Size of the list of pt_measurements :return: size of pt_measurements

get_q_measurements() List[QiMeasurement][source]

List of qi_measurements :return: List[dev.QiMeasurement]

get_qf_measurement_at(i: int) QfMeasurement[source]

Get qf_measurement at i :param i: index :return: QfMeasurement

get_qf_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of qf_measurement names :return: StrVec

get_qf_measurements() List[QfMeasurement][source]

List of qf_measurements :return: List[dev.QfMeasurement]

get_qf_measurements_number() int[source]

Size of the list of qf_measurements :return: size of qf_measurements

get_qg_measurement_at(i: int) QgMeasurement[source]

Get qg_measurement at i :param i: index :return: QgMeasurement

get_qg_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of qg_measurement names :return: StrVec

get_qg_measurements() List[QgMeasurement][source]

List of qg_measurements :return: List[dev.QgMeasurement]

get_qg_measurements_number() int[source]

Size of the list of qg_measurements :return: size of qg_measurements

get_qi_measurement_at(i: int) QiMeasurement[source]

Get qi_measurement at i :param i: index :return: QiMeasurement

get_qi_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of qi_measurement names :return: StrVec

get_qi_measurements_number() int[source]

Size of the list of qi_measurements :return: size of qi_measurements

get_qt_measurement_at(i: int) QtMeasurement[source]

Get qt_measurement at i :param i: index :return: QtMeasurement

get_qt_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of qt_measurement names :return: StrVec

get_qt_measurements() List[QtMeasurement][source]

List of qt_measurements :return: List[dev.QtMeasurement]

get_qt_measurements_number() int[source]

Size of the list of qt_measurements :return: size of qt_measurements

get_region_at(i: int) Region[source]

Get region at i :param i: index :return: Region

get_region_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of region names :return: StrVec

get_regions() List[Region][source]

List of regions :return: List[dev.Region]

get_regions_number() int[source]

Size of the list of regions :return: size of regions

get_remedial_action_group_names() List[str][source]

Get list of contingency group names :return:

get_remedial_action_groups() List[RemedialActionGroup][source]

Get contingency_groups :return:List[dev.ContingencyGroup]

get_remedial_action_groups_dict() Dict[str, List[RemedialAction]][source]

Get a dictionary of group idtags related to list of contingencies :return:

get_remedial_action_groups_in(grouping_elements: List[Area | Country | Zone]) List[RemedialActionGroup][source]

Get a filtered set of ContingencyGroups :param grouping_elements: list of zones, areas or countries where to locate the contingencies :return: Sorted group filtered ContingencyGroup elements

get_remedial_action_groups_number() int[source]
Returns:

get_remedial_action_number() int[source]

Get number of remedial actions :return:

get_rms_event_by_groups() List[Tuple[RmsEventsGroup, List[RmsEvent]]][source]

Get a dictionary of RMS event groups and their :return: list of RMS event groups and their list of associated RMS events

get_rms_event_by_groups_index_dict() Dict[int, List[RmsEvent]][source]

Get a dictionary of investments groups :return: Dict[investment group index] = list of investments

get_rms_events_groups_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_rms_models_by_device_type(tpe: DeviceType) List[RmsModelTemplate][source]

Get a list of RmsModelTemplate filtering by device type :param tpe: :return:

get_rms_models_number() int[source]

Get number of RMS models

get_series_reactance_at(i: int) SeriesReactance[source]

Get series_reactance at i :param i: index :return: SeriesReactance

get_series_reactance_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of series_reactance names :return: StrVec

get_series_reactances() List[SeriesReactance][source]

List of series_reactances :return: List[dev.SeriesReactance]

get_series_reactances_number() int[source]

Size of the list of series_reactances :return: size of series_reactances

get_short_circuit_event_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get the short circuit definition names :return: Names

get_short_circuit_event_number() int[source]

Get the short circuit definition names :return: Names

get_shunt_like_device_number() int[source]

Get a list of all devices that can inject or subtract power from a node :return: List of EditableDevice

get_shunt_like_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection][source]

Get a list of all devices that can inject or subtract power from a node :return: List of Shunt devices

get_shunt_like_devices_lists() List[List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]][source]

Get a list of all devices that behave like a shunt :return: List of Lists of Shunt devices

get_shunt_like_devices_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get a list of all devices names that can inject or subtract power from a node :return: Array of Shunt devices’ names

get_shunt_names()[source]

Returns a list of Shunt names.

get_shunts() List[Shunt][source]

Returns a list of Shunt objects in the grid.

get_shunts_number() int[source]

Get the number of shunts

get_snapshot_time_unix() float[source]

Get the unix representation of the snapshot time :return: float

get_static_generators() List[StaticGenerator][source]

Returns a list of StaticGenerator objects in the grid.

get_static_generators_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Returns a list of StaticGenerator names.

get_static_generators_number() int[source]

Return number of static generators :return:

get_substation_number() int[source]

Get number of areas :return: number of areas

get_substations() List[Substation][source]

Get a list of substations :return: List[dev.Substation]

get_switches() List[Switch][source]
Returns:

get_switches_number() int[source]
Returns:

get_technology_indexing_dict() Dict[str, int][source]

Get a dictionary that relates the fuel uuid’s with their index :return: Dict[str, int]

get_technology_names() ndarray[tuple[Any, ...], dtype[str_]][source]
Returns:

get_time_array() DatetimeIndex[source]

Get the time array :return: pd.DatetimeIndex

get_time_deltas_in_hours() ndarray[tuple[Any, ...], dtype[float64]][source]

Get the time increments in hours :return: array of time deltas where the first delta is 1

get_time_number() int[source]

Return the number of buses :return: number

get_time_profile_as_list()[source]

Get the profiles dictionary mainly used in json export

get_transformers2w() List[Transformer2W][source]

get list of 2-winding transformers :return: list of transformers

get_transformers2w_names() List[str][source]

get a list of names of the 2-winding transformers :return: list of names

get_transformers2w_number() int[source]

get the number of 2-winding transformers :return: int

get_transformers3w() List[Transformer3W][source]
Returns:

get_transformers3w_names() List[str][source]
Returns:

get_transformers3w_number() int[source]
Returns:

get_transformers_nw() List[TransformerNW][source]
Returns:

get_transformers_nw_names() List[str][source]
Returns:

get_transformers_nw_number() int[source]
Returns:

get_unix_time() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the unix time representation of the time :return:

get_upfc() List[UPFC][source]
Returns:

get_va_measurement_at(i: int) VaMeasurement[source]

Get va_measurement at i :param i: index :return: VaMeasurement

get_va_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of va_measurement names :return: StrVec

get_va_measurements() List[VaMeasurement][source]

List of va_measurements :return: List[dev.VaMeasurement]

get_va_measurements_number() int[source]

Size of the list of va_measurements :return: size of va_measurements

get_vm_measurement_at(i: int) VmMeasurement[source]

Get vm_measurement at i :param i: index :return: VmMeasurement

get_vm_measurement_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of vm_measurement names :return: StrVec

get_vm_measurements() List[VmMeasurement][source]

List of vm_measurements :return: List[dev.VmMeasurement]

get_vm_measurements_number() int[source]

Size of the list of vm_measurements :return: size of vm_measurements

get_voltage_level_at(i: int) VoltageLevel[source]

Get voltage_level at i :param i: index :return: VoltageLevel

get_voltage_level_buses(vl: VoltageLevel) List[Bus][source]

Get the list of buses of this substation :param vl: :return:

get_voltage_level_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Array of voltage_level names :return: StrVec

get_voltage_levels() List[VoltageLevel][source]

List of voltage_levels :return: List[dev.VoltageLevel]

get_voltage_levels_number() int[source]

Size of the list of voltage_levels :return: size of voltage_levels

get_vsc() List[VSC][source]
Returns:

get_vsc_actives(t_idx: int | None = None) ndarray[tuple[Any, ...], dtype[int64]][source]

get a vector of actives :return: Array of bus active

get_vsc_dict() Dict[str, VSC][source]

Get dictionary of VSC converters :return: idtag -> VSC

get_vsc_index_dict() Dict[str, int][source]

Get index dictionary of VSC lines :return: idtag -> i

get_vsc_names() ndarray[tuple[Any, ...], dtype[str_]][source]

Get Vsc names

get_vsc_number() int[source]
Returns:

get_windings() List[Winding][source]
Returns:

get_windings_names() List[str][source]
Returns:

get_windings_number() int[source]
Returns:

get_zone_number() int[source]

Get number of areas :return: number of areas

get_zones() List[Zone][source]

Get list of zones :return: List[dev.Zone]

has_diagrams() bool[source]

Check if there are diagrams stored :return:

property has_time_series: bool

Area there time series? :return: True / False

property hvdc_lines: List[HvdcLine]

Get list of hvdc lines :return:

property if_measurements: List[IfMeasurement]

Get list of If measurements :return:

property investments: List[Investment]
Returns:

property investments_groups: List[InvestmentsGroup]
Returns:

property it_measurements: List[ItMeasurement]

Get list of It measurements :return:

item_types() Generator[DeviceType, None, None][source]

Iterator of all the objects in the MultiCircuit

items() Generator[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, None, None][source]

Iterator of all the objects in the MultiCircuit

property lines: List[Line]

get list of ac lines :return: list of lines

property loads: List[Load]

Get list of loads :return:

merge_object(api_obj: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, all_elms_base_dict: Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], logger: Logger) bool[source]

Add, Delete or Modify an object based on the UUID :param api_obj: Any asset (from a diff presumably) :param all_elms_base_dict: All elements dict from the base circuit (idtag-> object) :param logger: Logger object :return: replaced?

merge_substations(selected_objects: List[Substation])[source]

Merge selected substations into the first one :param selected_objects: :return:

property modelling_authorities: List[ModellingAuthority]
Returns:

property municipalities: List[Municipality]

Get list of Municipalities :return:

new_idtags() None[source]

Generates new idtags for every object in this assets class

property overhead_line_types: List[OverheadLineType]

Get :return:

property owners: List[Owner]

Get list of owners :return:

property p2xs: List[FluidP2x]

Get list of power-to-x devices :return:

property pf_measurements: List[PfMeasurement]

Get list of PfMeasuremnts :return:

property pg_measurements: List[PgMeasurement]

Get list of PiMeasurements :return:

property pi_measurements: List[PiMeasurement]

Get list of PiMeasurements :return:

profile_magnitudes: Dict[str, Tuple[List[str], List[Type[int] | Type[bool] | Type[float] | Type[str] | DeviceType | SubObjectType | Type[HvdcControlType] | Type[BuildStatus] | Type[WindingsConnection] | Type[TapModuleControl] | Type[TapPhaseControl] | Type[ActionType] | Type[AvailableTransferMode] | Type[ContingencyMethod] | Type[CpfParametrization] | Type[CpfStopAt] | Type[InvestmentEvaluationMethod] | Type[InvestmentsEvaluationObjectives] | Type[NodalCapacityMethod] | Type[ShuntControlMode] | Type[SolverType] | Type[TimeGrouping] | Type[ZonalGrouping] | Type[MIPSolvers] | Type[AcOpfMode] | Type[BranchImpedanceMode] | Type[FaultType] | Type[TapChangerTypes] | Type[VoltageLevelTypes] | Type[ContingencyOperationTypes] | Type[BranchGroupTypes] | Type[ConverterControlType] | Type[WindingType] | Type[MethodShortCircuit] | Type[PhasesShortCircuit] | Type[DeviceType] | Type[ShuntConnectionType] | Type[BusGraphicType] | Type[SwitchGraphicType] | Type[DynamicIntegrationMethod] | Type[RmsInitializationMethod] | Type[OpfDispatchMode] | Type[EmtLineTypes] | Type[EmtSolverTypes] | Type[EmtProblemTypes] | Type[EmtInitializationMethod] | Type[RmsProblemTypes] | Type[SmallSignalEmtBuildTypes] | Type[EraSvdSolverType] | Type[FmuTemplateDomain] | Type[FmuTemplateMode] | Type[PlotSimulationType] | Type[DynamicEventTransitionType] | Type[DynamicPlotMode] | Type[DynamicPlotEntryKind] | Type[DynamicPlotEntryRole]]]]
property pt_measurements: List[PtMeasurement]

Get list of PtMeasuremnts :return:

property pumps: List[FluidPump]

Get the list of fluid pumps :return:

property qf_measurements: List[QfMeasurement]

Get list of Qf measurements :return:

property qg_measurements: List[QgMeasurement]

Get list of QgMeasurements :return:

property qi_measurements: List[QiMeasurement]

Get list of QiMeasurements :return:

property qt_measurements: List[QtMeasurement]

Get list of Qt measurements :return:

re_index_time(year=None, hours_per_step=1.0)[source]

Generate sequential time steps to correct the time_profile :param year: base year, if None, this year is taken :param hours_per_step: number of hours per step, by default 1 hour by step

re_index_time2(t0, step_size, step_unit)[source]

Generate sequential time steps to correct the time_profile :param t0: base time :param step_size: number of hours per step, by default 1 hour by step :param step_unit: β€˜h’, β€˜m’, β€˜s’

refine_pointer_objects(logger: Logger, all_elements_dict: Tuple[Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], bool] | None = None)[source]

Find the device types of pointer objects :param logger: :param all_elements_dict: :return:

property regions: List[Region]
Returns:

property remedial_action_groups: List[RemedialActionGroup]

Get list of contingency groups :return:

property remedial_actions: List[RemedialAction]

Get list of remedial actions :return:

remove_diagram(diagram: MapDiagram | SchematicDiagram)[source]

Remove diagrams :param diagram: MapDiagram, SchematicDiagram device

replace_objects(old_object: Any, new_obj: Any, logger: Logger) None[source]

Replace object for every object in this assets class :param old_object: object to replace :param new_obj: object used to replace the old one :param logger: Logger to record what happened

resample_profiles(indices: ndarray[tuple[Any, ...], dtype[int64]])[source]

resample the given profiles to the indices :param indices: array of indices to keep

resample_profiles2(t0: int, t1: int)[source]

Resample profiles :param t0: first time index :param t1: second time index

restore_investments()[source]

Restore investments to the circuit by removing them one by one. This is useful to restore the dependencies of the investments with the devices after a copy or a load.

property rms_events: List[RmsEvent]
Returns:

property rms_events_groups: List[RmsEventsGroup]
Returns:

property rms_models: List[RmsModelTemplate]

list of rms models :return:

property sequence_line_types: List[SequenceLineType]
Returns:

property series_reactances: List[SeriesReactance]

Get list of series reactances :return:

set_contingencies(contingencies: List[Contingency])[source]

Set contingencies and contingency groups to circuit :param contingencies: List of contingencies :return:

set_elements_list_by_type(device_type: ~VeraGridEngine.enumerations.DeviceType, devices: ~typing.List[~VeraGridEngine.Devices.Injections.generator.Generator | ~VeraGridEngine.Devices.Injections.battery.Battery | ~VeraGridEngine.Devices.Injections.load.Load | ~VeraGridEngine.Devices.Injections.external_grid.ExternalGrid | ~VeraGridEngine.Devices.Injections.static_generator.StaticGenerator | ~VeraGridEngine.Devices.Injections.shunt.Shunt | ~VeraGridEngine.Devices.Injections.controllable_shunt.ControllableShunt | ~VeraGridEngine.Devices.Injections.current_injection.CurrentInjection | ~VeraGridEngine.Devices.Branches.line.Line | ~VeraGridEngine.Devices.Branches.dc_line.DcLine | ~VeraGridEngine.Devices.Branches.transformer.Transformer2W | ~VeraGridEngine.Devices.Branches.hvdc_line.HvdcLine | ~VeraGridEngine.Devices.Branches.vsc.VSC | ~VeraGridEngine.Devices.Branches.upfc.UPFC | ~VeraGridEngine.Devices.Branches.winding.Winding | ~VeraGridEngine.Devices.Branches.switch.Switch | ~VeraGridEngine.Devices.Branches.series_reactance.SeriesReactance | ~VeraGridEngine.Devices.Fluid.fluid_node.FluidNode | ~VeraGridEngine.Devices.Fluid.fluid_path.FluidPath | ~VeraGridEngine.Devices.Fluid.fluid_p2x.FluidP2x | ~VeraGridEngine.Devices.Fluid.fluid_turbine.FluidTurbine | ~VeraGridEngine.Devices.Fluid.fluid_pump.FluidPump | ~VeraGridEngine.Devices.Substation.substation.Substation | ~VeraGridEngine.Devices.Substation.bus.Bus | ~VeraGridEngine.Devices.Substation.busbar.BusBar | ~VeraGridEngine.Devices.Substation.voltage_level.VoltageLevel | ~VeraGridEngine.Devices.Aggregation.country.Country | ~VeraGridEngine.Devices.Aggregation.region.Region | ~VeraGridEngine.Devices.Aggregation.community.Community | ~VeraGridEngine.Devices.Aggregation.municipality.Municipality | ~VeraGridEngine.Devices.Aggregation.area.Area | ~VeraGridEngine.Devices.Aggregation.zone.Zone | ~VeraGridEngine.Devices.Branches.transformer3w.Transformer3W | ~VeraGridEngine.Devices.Branches.transformerNw.TransformerNW | ~VeraGridEngine.Devices.Branches.overhead_line_type.OverheadLineType | ~VeraGridEngine.Devices.Branches.wire.Wire | ~VeraGridEngine.Devices.Branches.transformer_type.TransformerType | ~VeraGridEngine.Devices.Associations.emission_gas.EmissionGas | ~VeraGridEngine.Devices.Aggregation.branch_group.BranchGroup | ~VeraGridEngine.Devices.Branches.line_locations.LineLocations | ~VeraGridEngine.Devices.Branches.line_locations.LineLocation | ~VeraGridEngine.Devices.Aggregation.modelling_authority.ModellingAuthority | ~VeraGridEngine.Devices.Aggregation.facility.Facility | ~VeraGridEngine.Devices.Associations.fuel.Fuel | ~VeraGridEngine.Devices.Aggregation.investment.Investment | ~VeraGridEngine.Devices.Aggregation.investments_group.InvestmentsGroup | ~VeraGridEngine.Devices.Events.contingency.Contingency | ~VeraGridEngine.Devices.Events.contingency_group.ContingencyGroup | ~VeraGridEngine.Devices.Events.remedial_action.RemedialAction | ~VeraGridEngine.Devices.Events.remedial_action_group.RemedialActionGroup | ~VeraGridEngine.Devices.Associations.technology.Technology | ~VeraGridEngine.Devices.Associations.owner.Owner | ~VeraGridEngine.Devices.Branches.underground_line_type.UndergroundLineType | ~VeraGridEngine.Devices.Branches.sequence_line_type.SequenceLineType | ~VeraGridEngine.Devices.Dynamic.rms_template.RmsModelTemplate | ~VeraGridEngine.Devices.Dynamic.emt_template.EmtModelTemplate | ~VeraGridEngine.Devices.Dynamic.fmu_template.FmuTemplate | ~VeraGridEngine.Devices.Events.rms_event.RmsEvent | ~VeraGridEngine.Devices.Events.rms_events_group.RmsEventsGroup | ~VeraGridEngine.Devices.Events.short_cirtcuit_event.ShortCircuitEvent | ~VeraGridEngine.Devices.measurement.IfMeasurement | ~VeraGridEngine.Devices.measurement.ItMeasurement | ~VeraGridEngine.Devices.measurement.QfMeasurement | ~VeraGridEngine.Devices.measurement.PfMeasurement | ~VeraGridEngine.Devices.measurement.QtMeasurement | ~VeraGridEngine.Devices.measurement.PtMeasurement | ~VeraGridEngine.Devices.measurement.QiMeasurement | ~VeraGridEngine.Devices.measurement.PiMeasurement | ~VeraGridEngine.Devices.measurement.VmMeasurement | ~VeraGridEngine.Devices.measurement.VaMeasurement | ~VeraGridEngine.Devices.measurement.PgMeasurement | ~VeraGridEngine.Devices.measurement.QgMeasurement], logger: ~VeraGridEngine.basic_structures.Logger = <VeraGridEngine.basic_structures.Logger object>)[source]

Set a list of elements all at once :param device_type: DeviceType :param devices: list of devices :param logger: Logger

set_remedial_actions(remedial_actions: List[RemedialAction])[source]

Set contingencies and contingency groups to circuit :param remedial_actions: List of contingencies :return:

set_snapshot_time_unix(val: float) None[source]

Convert unix datetime to python datetime :param val: seconds since 1970-01-01T00:00:00

set_time_profile(unix_data: ndarray[tuple[Any, ...], dtype[int64]])[source]

Set unix array as time array :param unix_data: array of seconds since 1970

set_unix_time(arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Set the time with a unix time :param arr: UNIX time iterable

property short_circuit_event: List[ShortCircuitEvent]

Get list of ShortCircuitDefinition :return:

short_circuit_event_exist(scd: ShortCircuitEvent) bool[source]

Check if a short circuit definition has been added already :param scd: ShortCircuitDefinition :return: Bool

property shunts: List[Shunt]

Get list of shunts :return:

property snapshot_time: datetime

Returns the current snapshot time :return: Datetime

property static_generators: List[StaticGenerator]

Get lis of static generators :return:

property substations: List[Substation]

Get list of substations :return:

property switch_devices: List[Switch]

Get list of switch devices :return:

property technologies: List[Technology]

Get list of technologies :return:

template_items() Generator[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, None, None][source]

Iterator of the declared objects in the MultiCircuit. These are the object types that you see in the App DataBase tree

template_objects_dict
property time_profile: DatetimeIndex

Get the time array :return: pd.DatetimeIndex

property transformer_types: List[TransformerType]
Returns:

property transformers2w: List[Transformer2W]

Get list of transformers :return:

property transformers3w: List[Transformer3W]

Get list of 3W transformers :return:

property transformers_nw: List[TransformerNW]

Get list of N-winding transformers :return:

property turbines: List[FluidTurbine]

Get list of fluid turbines :return:

property underground_cable_types: List[UndergroundLineType]
Returns:

property upfc_devices: List[UPFC]

Get list of upfc devices :return:

property va_measurements: List[VaMeasurement]

Get list of VaMeasurements :return:

property var_factory: VarFactory

Get the RMS VarFactory object :return: VarFactory

property vm_measurements: List[VmMeasurement]

Get list of VmMeasurements :return:

property voltage_levels: List[VoltageLevel]

Get voltage level devices list :return:

property vsc_devices: List[VSC]

Get list of vsc devices :return:

property windings: List[Winding]

Get list of windings :return:

property wire_types: List[Wire]
Returns:

property zones: List[Zone]

Get list of zones :return:

VeraGridEngine.Devices.assets.add_devices_list(original_list: List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], new_list: List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement])[source]

Add a list of devices to another keeping coherence :param original_list: :param new_list: :return:

VeraGridEngine.Devices.comparison module

class VeraGridEngine.Devices.comparison.CircuitComparison(circuit_a: MultiCircuit, circuit_b: MultiCircuit)[source]

Bases: object

Comparison between two circuits

merge_b_into_a()[source]

Compare two circuits :return: stored in place

class VeraGridEngine.Devices.comparison.PropertyConflict(obj_a: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, obj_b: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, prop_name: str)[source]

Bases: object

Objects conflict

preffer_a()[source]

Prefer the object A :return:

preffer_b()[source]

Prefer the object B :return:

VeraGridEngine.Devices.measurement module

class VeraGridEngine.Devices.measurement.IfMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
get_standard_deviation_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit standard deviation at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

get_value_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit value at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

class VeraGridEngine.Devices.measurement.ItMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
property device: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator

device getter :return:

get_standard_deviation_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit standard deviation at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

get_value_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit value at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

class VeraGridEngine.Devices.measurement.MeasurementTemplate(value: float, uncertainty: float, api_obj: Bus | Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator, name: str, idtag: str | None, device_type: DeviceType)[source]

Bases: PointerDeviceParent

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
LOCAL_PROPERTY_DECLARATIONS: Tuple[GCProp, ...] = (prop:value, prop:sigma)
get_sigma_at(t: int | None) float[source]
Parameters:

t

Returns:

get_standard_deviation_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit standard deviation at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

get_value_at(t: int | None) float[source]
Parameters:

t

Returns:

get_value_pu_at(t: int | None, Sbase: float)[source]

Get measurement per-unit value at a given point :param t: None for snapshot, integer for time point :param Sbase: Base power (100 MVA) :return: value in p.u.

property sigma: float

Get sigma.

Returns:

float

property sigma_prof: ProfileFloat

Cost profile :return: Profile

property value: float

Get value.

Returns:

float

property value_prof: ProfileFloat

Cost profile :return: Profile

class VeraGridEngine.Devices.measurement.PfMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.PgMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.PiMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Bus | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.PtMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.QfMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.QgMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.QiMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Bus | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.QtMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Line | DcLine | Transformer2W | UPFC | Winding | Switch | SeriesReactance | Generator | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.VaMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Bus | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
class VeraGridEngine.Devices.measurement.VmMeasurement(value: float = 0.0, uncertainty: float = 0.0, api_obj: Bus | None = None, name='', idtag: str | None = None)[source]

Bases: MeasurementTemplate

Measurement class

CLASS_NON_EDITABLE_PROPERTIES = ('idtag', 'diff_changes', 'device_idtag', 'tpe', 'device_name')
CLASS_PROPERTIES_WITH_PROFILE = {'sigma': 'sigma_prof', 'value': 'value_prof'}
CLASS_PROPERTY_DECLARATIONS = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_PROPERTY_LIST = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:device_idtag, prop:tpe, prop:device_name, prop:value, prop:sigma)
CLASS_REGISTERED_PROPERTIES = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'device_idtag': prop:device_idtag, 'device_name': prop:device_name, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'name': prop:name, 'rdfid': prop:rdfid, 'sigma': prop:sigma, 'tpe': prop:tpe, 'value': prop:value}
VeraGridEngine.Devices.measurement.get_i_base(Sbase, Vbase)[source]

VeraGridEngine.Devices.multi_circuit module

class VeraGridEngine.Devices.multi_circuit.MultiCircuit(name: str = '', Sbase: float = 100, fbase: float = 50.0, idtag: str | None = None)[source]

Bases: Assets

The concept of circuit should be easy enough to understand. It represents a set of nodes (buses) and Branches (lines, transformers or other impedances).

The MultiCircuit class is the main object in VeraGrid. It represents a circuit that may contain islands. It is important to understand that a circuit split in two or more islands cannot be simulated as is, because the admittance matrix would be singular. The solution to this is to split the circuit in island-circuits. Therefore MultiCircuit identifies the islands and creates individual Circuit objects for each of them.

VeraGrid uses an object oriented approach for the data management. This allows to group the data in a smart way. In VeraGrid there are only two types of object directly declared in a Circuit or MultiCircuit object. These are the Bus and the Branch. The Branches connect the buses and the buses contain all the other possible devices like loads, generators, batteries, etc. This simplifies enormously the management of element when adding, associating and deleting.

from VeraGridEngine.multi_circuit import MultiCircuit
grid = MultiCircuit(name="My grid")
Sbase: float
add_catalogue(data: Assets)[source]

Add the catalogue from another circuit :param data: :return:

add_circuit(new_grid: MultiCircuit, re_id_new_grid: bool = True) Logger[source]

Add a circuit to this circuit, keeping all elements (this is not equal to a circuit merge) :param new_grid: Circuit to insert :param re_id_new_grid: Create new idtags for the new grid :return: Logger

apply_all_branch_types() Logger[source]

Apply all the branch types

build_graph() MultiDiGraph[source]

Returns a networkx DiGraph object of the grid.

build_graph_real_power_flow(current_flow)[source]

Returns a networkx DiGraph object of the grid.

Arguments:

current_flow (list): power_flow.results.If object

change_base(Sbase_new: float)[source]

Change the elements base impedance :param Sbase_new: new base impedance in MVA

check_emt_models() Logger[source]

This function checks that a device has a valid emt model :return:

check_rms_models() Logger[source]

This function checks that a device has a valid rms model :return:

clean() Logger[source]

Clean dead references

clean_branches(bus_set: Set[Bus], logger: Logger) None[source]

Clean the branch references :param bus_set: Set of Buses :param logger: Logger

clean_contingencies(all_dev: Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], logger: Logger) None[source]

Clean the contingencies and contingency groups :param all_dev: :param logger: Logger

clean_injections(bus_set: Set[Bus], logger: Logger) None[source]

Clean the branch references :param bus_set: Set of Buses :param logger: Logger

clean_investments(all_dev: Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], logger: Logger) None[source]

Clean the investments and investment groups :param all_dev: :param logger: Logger

clean_remedial_actions(all_dev: Dict[str, Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], logger: Logger) None[source]

Clean the remedial actons and remedial actons groups :param all_dev: :param logger: Logger

clean_technologies() None[source]

Clean the technology associations to deleted technologies

comments: str
compare_circuits(grid2: MultiCircuit, detailed_profile_comparison: bool = True, skip_internals: bool = False, tolerance: float = 1e-06) Tuple[bool, Logger][source]

Compare this circuit with another circuits for equality :param grid2: MultiCircuit :param detailed_profile_comparison: if true, profiles are compared element-wise with the getters :param skip_internals: skip non visible properties :param tolerance :return: equal?, Logger with the comparison information

compose_bus_blocks() Dict[Bus, Block][source]

this function returns a dictionary with keys, the device bus, mand values, a block containing all the rms models of the elements connected to that bus. Returns β€”β€”-

convert_fluid_path_to_line(fluid_path: FluidPath) Line[source]

Convert a line to voltage source converter :param fluid_path: FluidPath :return: Line

convert_generator_to_battery(gen: Generator) Battery[source]

Convert a generator to battery :param gen: Generator instance :return: Transformer2W

convert_hvdc_line_to_vsc_system(hvdc_line: HvdcLine)[source]

Convert a HvdcLine to the corresponding VSC-DcLine-VSC system :param hvdc_line: HvdcLine :return: ac_bus_1, ac_bus_2, dc_bus_1, dc_bus_2, conv1, conv2, dc_line

convert_line_to_hvdc(line: Line) HvdcLine[source]

Convert a line to HVDC, this is the GUI way to create HVDC objects :param line: Line instance :return: HvdcLine

convert_line_to_series_reactance(line: Line) SeriesReactance[source]

Convert a line to voltage source converter :param line: Line instance :return: SeriesReactance

convert_line_to_switch(line: Line) Switch[source]

Convert a line to voltage source converter :param line: Line instance :return: SeriesReactance

convert_line_to_transformer(line: Line) Transformer2W[source]

Convert a line to Transformer :param line: Line instance :return: Transformer2W

convert_line_to_upfc(line: Line) UPFC[source]

Convert a line to voltage source converter :param line: Line instance :return: UPFC

convert_line_to_vsc(line: Line) VSC[source]

Convert a line to voltage source converter :param line: Line instance :return: Nothing

copy() MultiCircuit[source]

Returns a deep (true) copy of this circuit.

differentiate_circuits(base_grid: MultiCircuit, detailed_profile_comparison: bool = True, force_second_pass: bool = False) Tuple[bool, Logger, MultiCircuit][source]

Compare this circuit with another circuits for equality :param base_grid: MultiCircuit used as comparison base :param detailed_profile_comparison: if true, profiles are compared element-wise with the getters :param force_second_pass: if true, the base grid is inspected for elements that it contains that

this grid doesn’t (deletions)

Returns:

equal?, Logger with the comparison information, MultiCircuit with the elements that have changed

export_pf(file_name, power_flow_results)[source]

Export power flow results to file.

Arguments:

file_name (str): Excel file name

export_profiles(file_name)[source]

Export object profiles to file.

Arguments:

file_name (str): Excel file name

fBase: float
fill_lat_lon_from_xy(destructive=True, factor=1.0, offset_x=0, offset_y=0)[source]

Convert the coordinates to some random lat lon :param destructive: :param factor: :param offset_x: :param offset_y: :return:

fill_xy_from_lat_lon(destructive: bool = True, factor: float = 0.01, remove_offset: bool = True) Logger[source]

fill the x and y value from the latitude and longitude values :param destructive: if true, the values are overwritten regardless, otherwise only if x and y are 0 :param factor: Explosion factor :param remove_offset: delete the sometimes huge offset coming from pyproj :return Logger object

fuse_devices() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection][source]

Fuse all the different devices in a node to a single device per node :return:

get_Pbus(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]

Get snapshot active power array per bus :return: Vec

get_Pbus_prof(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]][source]

Get profiles active power per bus :return: Mat

get_Pgen(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the complex bus power Injections :param apply_active: Apply the active state? :return: (nbus) [MW + j MVAr]

get_Pload(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the complex bus power Injections :param apply_active: Apply the active state? :return: (nbus) [MW + j MVAr]

get_Sbus(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the complex bus power Injections :param apply_active: Apply the active state? :return: (nbus) [MW + j MVAr]

get_Sbus_prof(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the complex bus power Injections :param apply_active: Apply the active state? :return: (ntime, nbus) [MW + j MVAr]

get_Sbus_prof_dispatchable(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the complex bus power Injections only considering those devices that can be dispatched This is, generators and batteries with enabled_dispatch=True :param apply_active: Apply the active state? :return: (ntime, nbus) [MW + j MVAr]

get_Sbus_prof_fixed(apply_active: bool = False) ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the complex bus power Injections considering those devices that cannot be dispatched This is, all devices except generators and batteries with enabled_dispatch=True :param apply_active: Apply the active state? :return: (ntime, nbus) [MW + j MVAr]

static get_adjacent_buses(A: csc_matrix, bus_idx)[source]

Return array of indices of the buses adjacent to the bus given by it’s index :param A: Adjacent matrix :param bus_idx: bus index :return: array of adjacent bus indices

get_adjacent_matrix() csc_matrix[source]

Get the bus adjacent matrix :return: Adjacent matrix

get_aggregation_buses(aggregations: List[Area | Zone | Country | Community | Region | Municipality]) List[Tuple[int, Bus]][source]

Get the selected buses :param aggregations: :return: list of bus indices and bus ptr

get_areas_buses(areas: List[Area]) List[Tuple[int, Bus]][source]

Get the selected buses :return: list of bus indices and bus ptr

get_automatic_precision()[source]

Get the precision that simulates correctly the power flow :return: tolerance parameter for the power flow options, exponent

get_batt_technology_connectivity_matrix() csc_matrix[source]

Get the technology connectivity matrix with relation to the generators should be used to get the generation per technology by: Tech_mat x Pgen :return: CSC sparse matrix (n_tech, n_gen)

get_batteries_by_bus() Dict[Bus, List[Battery]][source]

Get the injection devices grouped by bus and by device type :return: Dict[bus, Dict[DeviceType, List[Injection devs]]

get_branch_active_time_array() ndarray[tuple[Any, ...], dtype[int64]][source]

Get branch active matrix :return: array with branch active status

get_branch_area_connectivity_matrix(a1: List[Area], a2: List[Area]) csc_matrix[source]

Get the inter area connectivity matrix :param a1: list of sending areas :param a2: list of receiving areas :return: Connectivity of the Branches to each sending or receiving area groups (Branches, 2)

get_branch_areas_info() Tuple[List[str], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

Get the area-branches information :return: area_names, bus_area_indices, F, T, hvdc_F, hvdc_T

get_branch_contingency_rates(add_hvdc=False, add_vsc=False, add_switch=True) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the complex bus power Injections :return: (nbr) [MVA]

get_branch_contingency_rates_prof(add_hvdc=False, add_vsc=False, add_switch=True) ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]][source]

Get the complex bus power Injections :return: (ntime, nbr) [MVA]

get_branch_rates(add_hvdc=False, add_vsc=False, add_switch=True) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the complex bus power Injections :return: (nbr) [MVA]

get_branch_rates_prof(add_hvdc=False, add_vsc=False, add_switch=True) ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]][source]

Get the complex bus power Injections :return: (ntime, nbr) [MVA]

get_bus_area_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get array of area indices for each bus :return:

get_bus_branch_connectivity_matrix() Tuple[csc_matrix, csc_matrix, csc_matrix][source]

Get the branch-bus connectivity :return: Cf, Ct, C

get_bus_branch_dict() Dict[Bus, List[Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance]][source]

Get the branch-bus dictionary :return: dict[bus] -> list of branches

get_bus_default_types() ndarray[tuple[Any, ...], dtype[int64]][source]

Return an array of bus types :return: number

get_buses_from_objects(elements: List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement], dtype: DeviceType) Set[Bus][source]

Returns set of buses belonging to the list elements

Parameters:
  • elements – list of objects

  • dtype – DeviceType of all the elements

Returns:

set of buses

get_center_location() Tuple[float, float][source]

Get the mean coordinates of the system (lat, lon)

get_country_buses(countries: List[Country]) List[Tuple[int, Bus]][source]

Get the selected buses :return: list of bus indices and bus ptr

get_dimensions()[source]

Get the three dimensions of the circuit: number of buses, number of Branches, number of time steps :return: (nbus, nbranch, ntime)

get_gen_emission_rates_sparse_matrix() csc_matrix[source]

Get the emission rates matrix with relation to the generators should be used to get the fuel amounts by: Rates_mat x Pgen :return: CSC sparse matrix (n_emissions, n_gen)

get_gen_fuel_rates_sparse_matrix() csc_matrix[source]

Get the fuel rates matrix with relation to the generators should be used to get the fuel amounts by: Rates_mat x Pgen :return: CSC sparse matrix (n_fuel, n_gen)

get_gen_technology_connectivity_matrix() csc_matrix[source]

Get the technology connectivity matrix with relation to the generators should be used to get the generation per technology by: Tech_mat x Pgen :return: CSC sparse matrix (n_tech, n_gen)

get_imbalance(apply_active: bool = False) float[source]

Get the system imbalance in per unit :return:

get_injection_devices_grouped_by_bus() Dict[Bus, Dict[DeviceType, List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]]][source]

Get the injection devices grouped by bus and by device type :return: Dict[bus, Dict[DeviceType, List[Injection devs]]

get_injection_devices_grouped_by_fluid_node() Dict[FluidNode, Dict[DeviceType, List[FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump]]][source]

Get the injection devices grouped by bus and by device type :return: Dict[bus, Dict[DeviceType, List[Injection devs]]

get_injection_devices_grouped_by_group_type(group_type: DeviceType) List[Dict[DeviceType, List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]]][source]

Get the injection devices grouped by bus and by device type :param group_type: some grouping Device Type (Region, Substation, Area, Country, etc…) :return: Dict[bus, Dict[DeviceType, List[Injection devs]]

get_injection_devices_grouped_by_substation() Dict[Substation, Dict[DeviceType, List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection]]][source]

Get the injection devices grouped by bus and by device type :return: Dict[bus, Dict[DeviceType, List[Injection devs]]

get_inter_aggregation_info(objects_from: List[Area | Zone | Country | Community | Region | Municipality], objects_to: List[Area | Zone | Country | Community | Region | Municipality]) InterAggregationInfo[source]

Get the lists that help defining the inter area objects :param objects_from: list of objects from :param objects_to: list of objects to :return: InterAggregationInfo

get_inter_areas_branches(a1: List[Area], a2: List[Area]) List[Tuple[int, Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, float]][source]

Get the inter-area Branches. HVDC Branches are not considered :param a1: Area from :param a2: Area to :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_areas_hvdc_branches(a1: List[Area], a2: List[Area]) List[Tuple[int, Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, float]][source]

Get the inter-area Branches :param a1: Area from :param a2: Area to :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_areas_vsc_branches(a1: List[Area], a2: List[Area]) List[Tuple[int, VSC, float]][source]

Get the inter-area VSC :param a1: Area from :param a2: Area to :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_buses_branches(a1: Set[Bus], a2: Set[Bus]) List[Tuple[int, Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, float]][source]

Get the inter-buses Branches. HVDC Branches are not considered :param a1: Group of Buses 1 :param a2: Group of Buses 1 :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_buses_hvdc_branches(a1: Set[Bus], a2: Set[Bus]) List[Tuple[int, HvdcLine, float]][source]

Get the inter-area Branches :param a1: Group of Buses 1 :param a2: Group of Buses 1 :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_buses_vsc_branches(a1: Set[Bus], a2: Set[Bus]) List[Tuple[int, VSC, float]][source]

Get the inter-area VSC :param a1: Group of Buses 1 :param a2: Group of Buses 1 :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_inter_zone_branches(z1: Zone, z2: Zone) List[Tuple[int, Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance, float]][source]

Get the inter-area Branches :param z1: Zone from :param z2: Zone to :return: List of (branch index, branch object, flow sense w.r.t the area exchange)

get_reduction_sets(reduction_bus_indices: Sequence[int], add_vsc=False, add_hvdc=False, add_switch=True) Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

Generate the set of bus indices for grid reduction :param reduction_bus_indices: array of bus indices to reduce (external set) :param add_vsc: Include the list of VSC? :param add_hvdc: Include the list of HvdcLine? :param add_switch: Include the list of Switch? :return: external, boundary, internal, boundary_branches

get_snapshot_time_str() str[source]

Get the snapshot datetime as a string :return: snapshot datetime string

get_substation_buses(substation: Substation) List[Bus][source]

Get the list of buses of this substation :param substation: :return:

get_substations_set_from_grouping(selected_objects: List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement]) Set[Substation][source]

Get substation from place :param selected_objects: Regions, Areas, country, etc… :return: Set of substations

get_template_objects_list() List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement][source]

get objects_with_profiles in the form of list :return: List[dev.EditableDevice]

get_template_objects_str_dict() Dict[str, List[str]][source]

get objects_with_profiles as a strings dictionary :return:

get_topologic_group_dict() Dict[int, List[int]][source]

Get numerical circuit time groups :return: Dictionary with the time: [array of times] represented by the index, for instance

{0: [0, 1, 2, 3, 4], 5: [5, 6, 7, 8]} This means that [0, 1, 2, 3, 4] are represented by the topology of 0 and that [5, 6, 7, 8] are represented by the topology of 5

get_topology_data(t_idx: int | None = None)[source]

Get the topology data :param t_idx: time_index (None for the snapshot) :return:

get_voltage_guess() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the buses stored voltage guess :return: array of complex voltages per bus

get_zone_buses(zones: List[Zone]) List[Tuple[int, Bus]][source]

Get the selected buses :return: list of bus indices and bus ptr

idtag: str
import_bus_lat_lon(df: DataFrame, bus_col: str, lat_col: str, lon_col: str) Logger[source]

Import the buses’ latitude and longitude :param df: Pandas DataFrame with the information :param bus_col: bus column name :param lat_col: latitude column name :param lon_col: longitude column name :return: Logger

logger: Logger
merge_buses(bus1: Bus, bus2: Bus)[source]

Transfer the injection elements’ associations from bus2 to bus 1 :param bus1: Bus that will receive the devices :param bus2: Bus that β€œdonates” the devices

merge_circuit(new_grid: MultiCircuit) Logger[source]

Add a circuit to this circuit, keeping all elements (this is not equal to a circuit merge) :param new_grid: Circuit to insert :return: Logger

model_version: int
move_behind_converter(api_object: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection) Tuple[Bus, VSC][source]
Parameters:

api_object

Returns:

name: str
parent
parse(data: Dict[str, str | int | float])[source]

Parse grid configuration data :param data: :return:

plot_graph(ax=None)[source]

Plot the grid. :param ax: Matplotlib axis object :return:

rebind_internal_device_references() None[source]

Rebind copied device-pointer properties to the canonical objects in this circuit.

MultiCircuit.copy() copies device lists independently for historical compatibility. Any pointer crossing from one list to another must therefore be repaired by idtag after all lists have been copied.

scale_power(factor)[source]

Modify the loads and generators :param factor: multiplier :return: Nothing

set_batteries_active_profile_from_their_active_power()[source]

Modify the batteries active profile to match the active power profile if P=0, active = False else active=True

set_generators_active_profile_from_their_active_power()[source]

Modify the generators active profile to match the active power profile if P=0, active = False else active=True

set_investments_status(investments_list: List[Investment], status: bool, all_elements_dict: None | dict[str, EditableDevice] = None) None[source]

Set the active (and active profile) status of a list of investments’ objects :param investments_list: list of investments :param status: status to set in the internal structures :param all_elements_dict: Dictionary of all elements (idtag -> object), if None if is computed

set_loads_active_profile_from_their_active_power()[source]

Modify the loads active profile to match the active power profile if P=0, active = False else active=True

set_opf_snapshot_results(results: OptimalPowerFlowResults)[source]

Assign OptimalPowerFlowResults to the objects :param results:OptimalPowerFlowResults :return:

set_opf_ts_results(results: OptimalPowerFlowTimeSeriesResults)[source]

Assign OptimalPowerFlowTimeSeriesResults to the objects :param results: OptimalPowerFlowTimeSeriesResults :return:

set_state(t: int)[source]

Set the profiles’ state at the index t as the default values.

slice_buses(buses: List[Bus]) MultiCircuit[source]

Get a subset of the grid :param buses: list of buses to slice te grid :return: new MultiCircuit

snapshot_balance()[source]

Creates a report DataFrame with the snapshot active power balance :return: DataFrame

split_line(original_line: Line, position: float, extra_km: float)[source]
Parameters:
  • original_line

  • position

  • extra_km

Returns:

split_line_int_out(original_line: Line, position: float, km_io: float)[source]

Split line with in/out :param original_line: Line device to split :param position: Position in per-unit (0, 1) measured from the β€œfrom” side where the splits happens :param km_io: Amount of kilometers to the Substation to connect with the in/out :return: mid_sub, mid_vl, B1, B2, B3, br1, br2, br3, br4

to_dict()[source]

Create grid configuration data :return:

user_name: str
valid_for_simulation() bool[source]

Checks if the data could be simulated :return: true / false

VeraGridEngine.Devices.multi_circuit.get_fused_device_lst(elm_list: List[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection], property_names: list)[source]

Fuse all the devices of a list by adding their selected properties :param elm_list: list of devices :param property_names: properties to fuse :return: list of one element

VeraGridEngine.Devices.multi_circuit.get_system_user() str[source]

Get the system mac + user name :return: string with the system mac address and the current user

VeraGridEngine.Devices.multiverse module

class VeraGridEngine.Devices.multiverse.MultiVerse(current_model: MultiCircuit | None = None)[source]

Bases: object

activate_scenario(node_id: int) MultiCircuit[source]

Switch the active scenario to the node identified by node_id.

  1. Commits the current node’s unsaved edits (non-root only).

  2. Composes the target node’s full circuit via checkout().

  3. Updates current_model and current_node.

Root nodes use root.data directly so in-place edits are reflected immediately. Non-root nodes always get a fresh composed copy.

Parameters:

node_id – ID of the node to activate

Returns:

The MultiCircuit that is now active

property base_model: MultiCircuit
static checkout(node: ScenarioNode) MultiCircuit[source]

Reconstruct the full MultiCircuit for node by replaying its delta chain from the root. Always returns a fresh copy β€” safe to mutate without affecting stored data.

  • Root nodes: returns root.data.copy().

  • Non-root nodes: walks root β†’ … β†’ node, copies the root circuit, then applies each ancestor’s delta (node.data) in order via merge_circuit().

Parameters:

node – Target ScenarioNode

Returns:

Fully composed MultiCircuit for that node

clear() None[source]
Returns:

commit_current() None[source]

Persist edits made to the currently active scenario.

  • Root: no structural delta is computed because root.data is authoritative and edited in-place. We only synchronize scenario-owned diagrams.

  • Non-root: computes differentiate_circuits(current_model, parent_composed) and stores the result back into node.data, replacing the previous delta. The scenario name is preserved on the new delta.

create_node(data: MultiCircuit, parent_id: int | None = None, position: int | None = None) ScenarioNode[source]
Parameters:
  • data

  • parent_id

  • position

Returns:

property current_model: MultiCircuit
property current_node: ScenarioNode
delete_node(node_id: int) ScenarioNode[source]

Delete a node and its entire subtree from the multiverse.

The non-obvious part of this operation is active-state repair. The GUI and the save path both assume that current_node and current_model always point to a valid scenario still owned by this tree. If the deleted subtree contains the active node, leaving those references untouched would keep them pointing at detached objects that are no longer in _nodes_by_id nor reachable from any root.

The fallback policy is: - if the deleted subtree had a parent, activate that parent - otherwise, activate the first remaining root if one exists - otherwise, clear current/base state because the multiverse became empty

Parameters:

node_id

Returns:

exists(node_id: int) bool[source]
Parameters:

node_id

Returns:

get_node(node_id: int) ScenarioNode[source]
Parameters:

node_id

Returns:

get_save_data() Tuple[Dict[str, Dict[str, str]], Dict[str, MultiCircuit], Dict[str, List[DriverToSave]]][source]
Returns:

get_sorted_node_data() List[MultiCircuit][source]

Deterministic preorder traversal. Good if you only want the MultiCircuit objects in a stable order.

insert_node(position: int, node: ScenarioNode)[source]
Parameters:
  • position

  • node

Returns:

iter_nodes_depth_first() List[ScenarioNode][source]
Returns:

merge_children_into_parent(parent_id: int) ScenarioNode[source]

Merge all direct children into the specified parent node.

Child deltas are merged into the parent in the current sibling order. After the merge: - the parent keeps the merged scenario - direct child nodes are removed - former grandchildren are rebased and attached directly under the parent

If several children modify the same objects, later children win because they are merged after earlier siblings.

move_node(node_id: int, new_parent_id: int | None, position: int | None = None) ScenarioNode[source]
Parameters:
  • node_id

  • new_parent_id

  • position

Returns:

parse_json(diffs_dict: Dict[str, MultiCircuit], metadata: Dict[str, Dict[str | int | float] | int | None])[source]

Parse the json metadata to fill this object

Parameters:
  • diffs_dict

  • metadata – json file name or zip file pointer

Returns:

property root_nodes: List[ScenarioNode]
roots_number()[source]
set_node(node_id: int, node: ScenarioNode)[source]
Parameters:
  • node_id

  • node

Returns:

to_record_list() List[Dict[str, Any]][source]

Export full tree structure as a flat ordered list. This is the correct format for JSON if you want to rebuild the tree later.

update_node_data(node_id: int, data: MultiCircuit) ScenarioNode[source]
Parameters:
  • node_id

  • data

Returns:

class VeraGridEngine.Devices.multiverse.ScenarioNode(node_id: int, data: MultiCircuit, diagrams: list[Any] | None = None, parent: ScenarioNode | None = None, children: list[ScenarioNode] | None = None)[source]

Bases: object

append_child(child: ScenarioNode) None[source]
Parameters:

child

Returns:

child(row: int) ScenarioNode[source]
Parameters:

row

Returns:

child_count() int[source]
Returns:

children: list[ScenarioNode]
circuit: MultiCircuit
diagrams: list[Any]
drivers: Dict[SimulationTypes, DRIVER_OBJECTS]
get_drivers_to_save() List[DriverToSave][source]
insert_child(position: int, child: ScenarioNode) None[source]
Parameters:
  • position

  • child

Returns:

node_id: int
parent: ScenarioNode | None
remove_child(child: ScenarioNode) None[source]
Parameters:

child

Returns:

remove_child_at(position: int) ScenarioNode[source]
Parameters:

position

Returns:

row() int[source]

VeraGridEngine.Devices.types module

Module contents