VeraGridEngine.DataStructures packageο
Submodulesο
VeraGridEngine.DataStructures.active_branch_data moduleο
- class VeraGridEngine.DataStructures.active_branch_data.ActiveBranchData(nelm: int, nbus: int)[source]ο
Bases:
objectControllableBranchData
- Pset: ndarray[tuple[Any, ...], dtype[float64]]ο
- Qset: ndarray[tuple[Any, ...], dtype[float64]]ο
- property any_pf_controlο
- Returns:
- compare(other: ActiveBranchData, tol: float, logger: Logger) None[source]ο
Compare active-branch fields used by NumericalCircuit.compare().
- copy() ActiveBranchData[source]ο
- Returns:
- is_controlled: ndarray[tuple[Any, ...], dtype[int64]]ο
- m_tapsο
- nbus: intο
- nelm: intο
- remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]]) None[source]ο
Remapping of the branch-controlled bus indices. :param bus_map_arr: array of old-to-new buses
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) ActiveBranchData[source]ο
Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: array of bus indices to re index main to island indices :param logger: Logger (optional) :return: new BranchData instance
- property tap: ndarray[tuple[Any, ...], dtype[complex128]]ο
- Returns:
- tap_angle: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_angle_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_angle_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_controlled_buses: ndarray[tuple[Any, ...], dtype[int64]]ο
- tap_module: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_module_control_mode: ndarray[tuple[Any, ...], dtype[int64]]ο
- tap_module_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_module_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- tap_phase_control_mode: ndarray[tuple[Any, ...], dtype[int64]]ο
- tau_tapsο
- vset: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.battery_data moduleο
- class VeraGridEngine.DataStructures.battery_data.BatteryData(nelm: int, nbus: int)[source]ο
Bases:
GeneratorDataStructure to host the battery compiled data
- charge_efficiency: ndarray[tuple[Any, ...], dtype[float64]]ο
- copy() BatteryData[source]ο
Get a deep copy of this object :return: new BatteryData instance
- discharge_efficiency: ndarray[tuple[Any, ...], dtype[float64]]ο
- e_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- e_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- efficiency: ndarray[tuple[Any, ...], dtype[float64]]ο
- enom: ndarray[tuple[Any, ...], dtype[float64]]ο
- max_soc: ndarray[tuple[Any, ...], dtype[float64]]ο
- min_soc: ndarray[tuple[Any, ...], dtype[float64]]ο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) BatteryData[source]ο
Slice battery data by given indices :param elm_idx: array of element indices :param bus_idx: array of bus indices :param bus_map: map from bus to index :return: new BatteryData instance
- soc_0: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.branch_parent_data moduleο
- class VeraGridEngine.DataStructures.branch_parent_data.BranchParentData(nelm: int, nbus: int)[source]ο
Bases:
objectStructure to host all branches data for calculation
- property C: csc_matrixο
Branch-bus connectivity matrix :return:
- property Cf: csc_matrixο
Bras-bus from connectivity :return:
- property Ct: csc_matrixο
Bras-bus to connectivity :return:
- F: ndarray[tuple[Any, ...], dtype[int64]]ο
- T: ndarray[tuple[Any, ...], dtype[int64]]ο
- active: ndarray[tuple[Any, ...], dtype[bool]]ο
- compare(other: BranchParentData, tol: float, logger: Logger) None[source]ο
Compare branch-parent fields shared by branch-like structures.
- contingency_enabled: ndarray[tuple[Any, ...], dtype[int64]]ο
- contingency_rates: ndarray[tuple[Any, ...], dtype[float64]]ο
- copy() BranchParentData[source]ο
Get a deep copy of this object :return: new BranchData instance
- dc: ndarray[tuple[Any, ...], dtype[int64]]ο
- get_contingency_enabled_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get contingency branch indices :return:
- get_inter_areas(bus_idx_from: ndarray[tuple[Any, ...], dtype[int64]] | Set[int], bus_idx_to: ndarray[tuple[Any, ...], dtype[int64]] | Set[int])[source]ο
Get the Branches that join two areas :param bus_idx_from: Area from :param bus_idx_to: Area to :return: List of (branch index, flow sense w.r.t the area exchange)
- get_monitor_enabled_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get monitored branch indices :return:
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- monitor_loading: ndarray[tuple[Any, ...], dtype[int64]]ο
- monitored_Cf(idx) csc_matrix[source]ο
Bras-bus from connectivity for monitored branches :param idx: Monitored branches ids :return:
- monitored_Ct(idx) csc_matrix[source]ο
Bras-bus to connectivity for monitored branches :param idx: Monitored branches ids :return:
- mttf: ndarray[tuple[Any, ...], dtype[float64]]ο
- mttr: ndarray[tuple[Any, ...], dtype[float64]]ο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nbus: intο
- nelm: intο
- original_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- overload_cost: ndarray[tuple[Any, ...], dtype[float64]]ο
- protection_rates: ndarray[tuple[Any, ...], dtype[float64]]ο
- rates: ndarray[tuple[Any, ...], dtype[float64]]ο
- reducible: ndarray[tuple[Any, ...], dtype[int64]]ο
- remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
Remapping of the branch buses :param bus_map_arr: array of old-to-new buses
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) Tuple[BranchParentData, ndarray[tuple[Any, ...], dtype[int64]]][source]ο
Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :param logger: Logger :return: new BranchData instance
VeraGridEngine.DataStructures.bus_data moduleο
- class VeraGridEngine.DataStructures.bus_data.BusData[source]ο
Bases:
object- Vbus: ndarray[tuple[Any, ...], dtype[complex128]]ο
- Vmax: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vmin: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vnom: ndarray[tuple[Any, ...], dtype[float64]]ο
- active: ndarray[tuple[Any, ...], dtype[int64]]ο
- angle_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- angle_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- areas: ndarray[tuple[Any, ...], dtype[int64]]ο
- b_fixedο
- bus_types: ndarray[tuple[Any, ...], dtype[int64]]ο
- compare(other: BusData, tol: float, logger: Logger) None[source]ο
Compare bus data arrays used by NumericalCircuit.compare().
- cost_v: ndarray[tuple[Any, ...], dtype[float64]]ο
- get_idtag_dict() Dict[str, int][source]ο
Get dictionary of bus idtagd related to the island bus index :return:
- get_original_to_island_bus_dict() Dict[int, int][source]ο
Dictionary that relates the original bus index to the island bus index :return: dict[original idx] -> island index
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- ii_fixedο
- installed_power: ndarray[tuple[Any, ...], dtype[float64]]ο
- is_dc: ndarray[tuple[Any, ...], dtype[bool]]ο
- is_grounded: ndarray[tuple[Any, ...], dtype[bool]]ο
- is_p_controlledο
- is_q_controlledο
- is_va_controlledο
- is_vm_controlledο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nbus: intο
- original_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- propagate_controls(chosen_idx: int, other_idx: ndarray[tuple[Any, ...], dtype[int64]]) None[source]ο
Propagate the strongest control status of the reduced buses into
chosen_idx.
- q_fixedο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]]) BusData[source]ο
Slice this data structure :param elm_idx: array of bus indices :return: instance of BusData
- srap_available_power: ndarray[tuple[Any, ...], dtype[float64]]ο
- substations: ndarray[tuple[Any, ...], dtype[int64]]ο
- VeraGridEngine.DataStructures.bus_data.propagate_controls(chosen_idx: int, other_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_types: ndarray[tuple[Any, ...], dtype[int64]], Vbus: ndarray[tuple[Any, ...], dtype[complex128]], is_p_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_q_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_vm_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_va_controlled: ndarray[tuple[Any, ...], dtype[bool]]) None[source]ο
Propagate the strongest control status of a reduced bus cluster to the surviving bus.
The donor bus is chosen from
chosen_idxandother_idxusing the actual control flags, not only the bus type, so VSC/HVDC-added controls are preserved as well. :param chosen_idx: island of the island chosen by the topological reduction process to represent the reduction set :param other_idx: rest of buses in the set that are going to be reduced but may contain important information :param bus_types: :param Vbus: :param is_p_controlled: :param is_q_controlled: :param is_vm_controlled: :param is_va_controlled: :return:
VeraGridEngine.DataStructures.fluid_node_data moduleο
- class VeraGridEngine.DataStructures.fluid_node_data.FluidNodeData[source]ο
Bases:
object- copy() FluidNodeData[source]ο
Get deep copy of this structure :return: new FluidNodeData instance
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- inflowο
- initial_levelο
- max_levelο
- max_socο
- min_levelο
- min_socο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nelm: intο
- spillage_costο
VeraGridEngine.DataStructures.fluid_p2x_data moduleο
- class VeraGridEngine.DataStructures.fluid_p2x_data.FluidP2XData[source]ο
Bases:
FluidTurbineData- copy() FluidP2XData[source]ο
Get deep copy of this structure :return: new FluidP2XData instance
VeraGridEngine.DataStructures.fluid_path_data moduleο
- class VeraGridEngine.DataStructures.fluid_path_data.FluidPathData[source]ο
Bases:
object- copy() FluidPathData[source]ο
Get deep copy of this structure :return: new FluidPathData instance
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- max_flowο
- min_flowο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nelm: intο
- source_idxο
- target_idxο
VeraGridEngine.DataStructures.fluid_pump_data moduleο
- class VeraGridEngine.DataStructures.fluid_pump_data.FluidPumpData[source]ο
Bases:
FluidTurbineData- copy() FluidPumpData[source]ο
Get deep copy of this structure :return: new FluidPumpData instance
VeraGridEngine.DataStructures.fluid_turbine_data moduleο
- class VeraGridEngine.DataStructures.fluid_turbine_data.FluidTurbineData[source]ο
Bases:
object- copy() FluidTurbineData[source]ο
Get deep copy of this structure :return: new FluidTurbineData instance
- efficiencyο
- generator_idxο
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- max_flow_rateο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nelm: intο
- plant_idxο
VeraGridEngine.DataStructures.generator_data moduleο
- class VeraGridEngine.DataStructures.generator_data.GeneratorData[source]ο
Bases:
object- Rr: ndarray[tuple[Any, ...], dtype[float64]]ο
- Rs: ndarray[tuple[Any, ...], dtype[float64]]ο
- Xm: ndarray[tuple[Any, ...], dtype[float64]]ο
- Xr: ndarray[tuple[Any, ...], dtype[float64]]ο
- Xs: ndarray[tuple[Any, ...], dtype[float64]]ο
- active: ndarray[tuple[Any, ...], dtype[bool]]ο
- bus_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- capex: ndarray[tuple[Any, ...], dtype[float64]]ο
- compare(other: GeneratorData, tol: float, logger: Logger) None[source]ο
Compare generator fields used by NumericalCircuit.compare().
- control_mode_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- controllable_bus_idxο
- cost_0: ndarray[tuple[Any, ...], dtype[float64]]ο
- cost_1: ndarray[tuple[Any, ...], dtype[float64]]ο
- cost_2: ndarray[tuple[Any, ...], dtype[float64]]ο
- dead_band: ndarray[tuple[Any, ...], dtype[float64]]ο
- dev_per_bus() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get number of devices per bus :return: array with the number of elements per bus
- discount_rate: ndarray[tuple[Any, ...], dtype[float64]]ο
- dispatchable: ndarray[tuple[Any, ...], dtype[bool]]ο
- get_Yshunt(seq: int = 1) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Obtain the vector of shunt admittances of a given sequence per bus :param seq: sequence (0, 1 or 2)
- get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator array per bus :param arr: :return:
- get_array_per_bus_obj(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Sum per bus in python mode (it can add objects) :param arr: any array of size nelm :return: array of size nbus
- get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the bus indices :return: array with the bus indices
- get_controllable_and_not_controllable_indices() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]ο
Get the indices of controllable generators :return: idx_controllable, idx_non_controllable
- get_dispatchable_active_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the indices of dispatchable generators :return:
- get_dispatchable_active_indices_per_area(bus_area_indices: ndarray[tuple[Any, ...], dtype[int64]], area_count: int) list[ndarray[tuple[Any, ...], dtype[int64]]][source]ο
Get the active dispatchable generator indices grouped by area.
- Parameters:
bus_area_indices β Area index of each bus. A value of
-1means that the bus does not belong to any area.area_count β Number of declared areas.
- Returns:
List where position
astores the generator-index array for areaa.
- get_dispatchable_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the indices of dispatchable generators :return:
- get_dispatchable_per_bus() ndarray[tuple[Any, ...], dtype[bool]][source]ο
Get generator Injections per bus :return:
- get_effective_generation() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator effective power :return:
- get_gen_indices_at_buses(bus_indices: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]][source]ο
- get_injections() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Compute the active and reactive power of non-controlled generators (assuming all) :return:
- get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get generator Injections per bus :return:
- get_installed_power_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator installed power per bus :return:
- get_non_dispatchable_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the indices of dispatchable generators :return:
- get_pf() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get the array of power factors :return:
- get_pmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Pmax per bus :return:
- get_pmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Pmin per bus :return:
- get_qmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Qmax per bus :return:
- get_qmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Qmin per bus :return:
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- installed_p: ndarray[tuple[Any, ...], dtype[float64]]ο
- is_at_dc_bus: ndarray[tuple[Any, ...], dtype[bool]]ο
- is_candidate: ndarray[tuple[Any, ...], dtype[bool]]ο
- is_static_generator: ndarray[tuple[Any, ...], dtype[bool]]ο
- k_droop: ndarray[tuple[Any, ...], dtype[float64]]ο
- min_time_down: ndarray[tuple[Any, ...], dtype[float64]]ο
- min_time_up: ndarray[tuple[Any, ...], dtype[float64]]ο
- mttf: ndarray[tuple[Any, ...], dtype[float64]]ο
- mttr: ndarray[tuple[Any, ...], dtype[float64]]ο
- must_run: ndarray[tuple[Any, ...], dtype[bool]]ο
- name_to_idx: dictο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nbus: intο
- nelm: intο
- original_idxο
- p: ndarray[tuple[Any, ...], dtype[float64]]ο
- p3_starο
- pmax: ndarray[tuple[Any, ...], dtype[float64]]ο
- pmin: ndarray[tuple[Any, ...], dtype[float64]]ο
- q: ndarray[tuple[Any, ...], dtype[float64]]ο
- qmax: ndarray[tuple[Any, ...], dtype[float64]]ο
- qmin: ndarray[tuple[Any, ...], dtype[float64]]ο
- r0: ndarray[tuple[Any, ...], dtype[float64]]ο
- r1: ndarray[tuple[Any, ...], dtype[float64]]ο
- r2: ndarray[tuple[Any, ...], dtype[float64]]ο
- ramp_down: ndarray[tuple[Any, ...], dtype[float64]]ο
- ramp_up: ndarray[tuple[Any, ...], dtype[float64]]ο
- remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
Remapping of the elm buses :param bus_map_arr: array of old-to-new buses
- scalable: ndarray[tuple[Any, ...], dtype[bool]]ο
- shift_key: ndarray[tuple[Any, ...], dtype[float64]]ο
- shut_down_cost: ndarray[tuple[Any, ...], dtype[float64]]ο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
Slice generator data by given indices :param elm_idx: array of element indices :param bus_idx: array of bus indices :param bus_map: map from bus index to element index :return: new GeneratorData instance
- snom: ndarray[tuple[Any, ...], dtype[float64]]ο
- startup_cost: ndarray[tuple[Any, ...], dtype[float64]]ο
- tpe_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- v: ndarray[tuple[Any, ...], dtype[float64]]ο
- x0: ndarray[tuple[Any, ...], dtype[float64]]ο
- x1: ndarray[tuple[Any, ...], dtype[float64]]ο
- x2: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.hvdc_data moduleο
- class VeraGridEngine.DataStructures.hvdc_data.HvdcData[source]ο
Bases:
BranchParentData- Pset: ndarray[tuple[Any, ...], dtype[float64]]ο
- Pt: ndarray[tuple[Any, ...], dtype[float64]]ο
- Qmax_f: ndarray[tuple[Any, ...], dtype[float64]]ο
- Qmax_t: ndarray[tuple[Any, ...], dtype[float64]]ο
- Qmin_f: ndarray[tuple[Any, ...], dtype[float64]]ο
- Qmin_t: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vnf: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vnt: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vset_f: ndarray[tuple[Any, ...], dtype[float64]]ο
- Vset_t: ndarray[tuple[Any, ...], dtype[float64]]ο
- angle_droop: ndarray[tuple[Any, ...], dtype[float64]]ο
- control_mode_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- dispatchable: ndarray[tuple[Any, ...], dtype[int64]]ο
- get_angle_droop_in_pu_rad(Sbase: float)[source]ο
Get the angle droop in pu/rad :param Sbase: base power :return:
- get_angle_droop_in_pu_rad_at(i: int, Sbase: float)[source]ο
Get the angle droop in pu/rad :param i: index :param Sbase: base power :return:
- get_bus_indices_f() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get bus indices βfromβ :return:
- get_bus_indices_t() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get bus indices βtoβ :return:
- get_inter_areas(bus_idx_from: ndarray[tuple[Any, ...], dtype[int64]] | Set[int], bus_idx_to: ndarray[tuple[Any, ...], dtype[int64]] | Set[int])[source]ο
Get the hvdcs that join two areas :param bus_idx_from: Area from :param bus_idx_to: Area to :return: List of (branch index, flow sense w.r.t the area exchange)
- get_power(Sbase: float, theta: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], int][source]ο
Get hvdc power :param Sbase: base power :param theta: bus angles array :return: Pbus, Losses, Pf, Pt, loading, nfree
- get_qmax_from_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Max reactive power in the From Bus :return: (nbus, nt) Qmax From
- get_qmax_to_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Max reactive power in the To Bus :return: (nbus, nt) Qmax To
- get_qmin_from_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Min reactive power in the From Bus :return: (nbus, nt) Qmin From
- get_qmin_to_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Min reactive power in the To Bus :return: (nbus, nt) Qmin To
- r: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.load_data moduleο
- class VeraGridEngine.DataStructures.load_data.LoadData(nelm: int, nbus: int)[source]ο
Bases:
objectStructure to host the load calculation information
- A_floatingstarο
- B_floatingstarο
- C_floatingstarο
- I: ndarray[tuple[Any, ...], dtype[float64]]ο
- I3_deltaο
- I3_floatingstarο
- I3_starο
- S: ndarray[tuple[Any, ...], dtype[float64]]ο
- S3_deltaο
- S3_floatingstarο
- S3_starο
- Y: ndarray[tuple[Any, ...], dtype[float64]]ο
- Y3_deltaο
- Y3_starο
- active: ndarray[tuple[Any, ...], dtype[bool]]ο
- bus_idxο
- compare(other: LoadData, tol: float, logger: Logger) None[source]ο
Compare load fields used by NumericalCircuit.compare().
- cost: ndarray[tuple[Any, ...], dtype[float64]]ο
- get_admittance_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get admittance Injections per bus with sign :return:
- get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator array per bus :param arr: :return:
- get_array_per_bus_obj(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Sum per bus in python mode (it can add objects) :param arr: any array of size nelm :return: array of size nbus
- get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the bus indices :return: array with the bus indices
- get_current_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get current Injections per bus with sign :return:
- get_effective_load() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get effective load :return:
- get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get Injections per bus with sign :return:
- get_linear_effective_load() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get effective load :return:
- get_linear_injections_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get Injections per bus with sign :return:
- get_non_static_generator_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get the non-static-generator injections per bus with sign. :return:
- get_static_generator_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get the static generator injections per bus with sign. Static generators are stored in the load data structure with negative load values. :return:
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- is_static_generator: ndarray[tuple[Any, ...], dtype[bool]]ο
- mttf: ndarray[tuple[Any, ...], dtype[float64]]ο
- mttr: ndarray[tuple[Any, ...], dtype[float64]]ο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nbus: intο
- nelm: intο
- original_idxο
- remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
Remapping of the elm buses :param bus_map_arr: array of old-to-new buses
- scalable: ndarray[tuple[Any, ...], dtype[bool]]ο
- shift_key: ndarray[tuple[Any, ...], dtype[float64]]ο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) LoadData[source]ο
Slice load data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :return: new LoadData instance
VeraGridEngine.DataStructures.numerical_circuit moduleο
- class VeraGridEngine.DataStructures.numerical_circuit.DataStructType(*values)[source]ο
Bases:
Enum- BATTERYDATA = 5ο
- BRANCHDATA = 2ο
- BUSDATA = 1ο
- GENERATORDATA = 4ο
- HVDCDATA = 3ο
- LOADDATA = 6ο
- NOSTRUCT = 0ο
- SHUNTDATA = 7ο
- VSCDATA = 8ο
- class VeraGridEngine.DataStructures.numerical_circuit.NumericalCircuit(nbus: int, nbr: int, nhvdc: int, nvsc: int, nload: int, ngen: int, nbatt: int, nshunt: int, nfluidnode: int, nfluidturbine: int, nfluidpump: int, nfluidp2x: int, nfluidpath: int, sbase: float, t_idx: int | None = None)[source]ο
Bases:
objectClass storing the calculation information of the devices
- Sbase: floatο
- active_branch_data: ActiveBranchDataο
- battery_data: BatteryDataο
- bus_dict: Dict[Any, int] | Noneο
- compare(nc_2: NumericalCircuit, tol=1e-06, by_idtag: bool = False) Tuple[bool, Logger][source]ο
Compare this numerical circuit with another numerical circuit. :param nc_2: other NumericalCircuit :param tol: tolerance for numerical values :param by_idtag: comparison mode (if true the comparison is made by idtag instead of by raw shape) :return: all ok?, Logger with the errors and warning events
- compare_sums(nc_2: NumericalCircuit, tol=1e-06) Tuple[bool, Logger][source]ο
Compare raw injection sums.
- compute_adjacency_matrix(consider_hvdc_as_island_links: bool = False) csc_matrix[source]ο
Compute the adjacency matrix :param consider_hvdc_as_island_links: Does the HVDCLine works for the topology as a normal line? :return: csc_matrix
- copy() NumericalCircuit[source]ο
Deep copy of ths object :return: NumericalCircuit instance
- fluid_node_data: FluidNodeDataο
- fluid_p2x_data: FluidP2XDataο
- fluid_path_data: FluidPathDataο
- fluid_pump_data: FluidPumpDataο
- fluid_turbine_data: FluidTurbineDataο
- generator_data: GeneratorDataο
- get_admittance_matrices() AdmittanceMatrices[source]ο
Get Admittance structures :return: Admittance object
- get_connectivity_matrices() ConnectivityMatrices[source]ο
Get connectivity matrices :return:
- get_fast_decoupled_amittances() FastDecoupledAdmittanceMatrices[source]ο
- Returns:
- get_island(bus_idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None = None) NumericalCircuit[source]ο
Get the island corresponding to the given buses :param bus_idx: array of bus indices :param logger: Logger :return: NumericalCircuit
- get_linear_admittance_matrices(indices: SimulationIndices | None = None) LinearAdmittanceMatrices[source]ο
Get the linear admittances :return:LinearAdmittanceMatrices
- get_linear_power_injections() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Compute the bus power injections seen by the linear studies (DC PF, PTDF).
Those models assume a flat voltage of 1 p.u.
- Returns:
array of power injections in MW
- get_power_injections() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Compute the power :return: return the array of power Injections in MW if normalized is false, in p.u. otherwise
- get_power_injections_pu() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Compute the power :return: return the array of power Injections in MW if normalized is false, in p.u. otherwise
- get_reactive_power_limits() Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
compute the reactive power limits in place :return: Qmax_bus, Qmin_bus in per unit
- get_reduction_bus_mapping() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get array is used to keep track of the bus topological reduction :return: IntVec
- get_series_admittance_matrices() SeriesAdmittanceMatrices[source]ο
- Returns:
- get_simulation_indices(Sbus: ndarray[tuple[Any, ...], dtype[complex128]] | None = None, bus_types: ndarray[tuple[Any, ...], dtype[int64]] | None = None, force_only_pq_pv_vd_types=False) SimulationIndices[source]ο
Get the simulation indices :param Sbus: Array of bus powers (optional) :param bus_types: different array of bus_types (optional) :param force_only_pq_pv_vd_types: if true, all bus types are forced into PQ PV or VD,
for certain types of simulations that cannot handle other bus types
- Returns:
SimulationIndices
- get_structural_ntc(bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]]) float[source]ο
Get the structural NTC :param bus_a1_idx: array of bus indices of the area from :param bus_a2_idx: array of bus indices of the area to :return: structural NTC in MVA
- is_dc() Tuple[int, str][source]ο
Check if this island is DC :return: int, str -> 1: all DC, 0: all AC, 2: AC and DC
- nbatt: intο
- nbr: intο
- nbus: intο
- nfluidnode: intο
- nfluidp2x: intο
- nfluidpath: intο
- nfluidpump: intο
- nfluidturbine: intο
- ngen: intο
- nhvdc: intο
- nload: intο
- nshunt: intο
- nvsc: intο
- passive_branch_data: PassiveBranchDataο
- process_reducible_branches() int[source]ο
Process the reducible branches (i.e. reduce branches like the switches) in-place :return: Number of reduced branches
- propagate_bus_result(bus_magnitude: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]])[source]ο
This function applies the __bus_map_arr to a calculated magnitude to propagate the calculated nodal result :param bus_magnitude: some array of the size of buses (all) :return: propagated results
- propagate_bus_result_mat(bus_magnitude: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]])[source]ο
This function applies the __bus_map_arr to a calculated magnitude to propagate the calculated nodal result :param bus_magnitude: some array of the size of buses (all) :return: propagated results
- query_idtag(idtag: str) Tuple[DataStructType, int][source]ο
Query the structure and index where an idtag exists :param idtag: idtag :return: DataStructType, integer position
- set_con_or_ra_status(event_list: List[Contingency | RemedialAction], revert: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Set the status of a list of contingencies or remedial actions :param event_list: list of contingencies and or remedial actions :param revert: if false, the contingencies are applied, else they are reversed :return: vector of power injection increments
- set_investments_status(investments_list: List[Investment], status: int) None[source]ο
Set the status of a list of investments :param investments_list: list of investments :param status: status to set in the internal structures
- split_into_islands(ignore_single_node_islands: bool = False, consider_hvdc_as_island_links: bool = False, logger: Logger | None = None) List[NumericalCircuit][source]ο
Split circuit into islands :param ignore_single_node_islands: ignore islands composed of only one bus :param consider_hvdc_as_island_links: Does the HVDCLine works for the topology as a normal line? :param logger: Logger :return: List[NumericCircuit]
- structs_idtag_dict: Dict[str, Tuple[DataStructType, int]]ο
- t_idx: int | Noneο
- property topology_performed: boolο
Flag indicating if topology processing happened here :return:
- VeraGridEngine.DataStructures.numerical_circuit.build_q_limits(nbus: int, Sbase: float, gen_idx, q_min_gen, q_max_gen, active_gen, control_mode_int_gen, batt_idx, q_min_batt, q_max_batt, active_batt, control_mode_int_batt, sh_idx, q_min_sh, q_max_sh, active_sh, control_mode_int_sh, hvdc_f, hvdc_t, q_min_hvdc_f, q_max_hvdc_f, q_min_hvdc_t, q_max_hvdc_t, active_hvdc, v_ctrl_val_gen: int, v_ctrl_val_sh: int)[source]ο
- Parameters:
nbus
Sbase
gen_idx
q_min_gen
q_max_gen
active_gen
control_mode_int_gen
batt_idx
q_min_batt
q_max_batt
active_batt
control_mode_int_batt
sh_idx
q_min_sh
q_max_sh
active_sh
control_mode_int_sh
hvdc_f
hvdc_t
q_min_hvdc_f
q_max_hvdc_f
q_min_hvdc_t
q_max_hvdc_t
active_hvdc
v_ctrl_val_gen
:param v_ctrl_val_sh :return:
- VeraGridEngine.DataStructures.numerical_circuit.check_arr(arr: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[int64]] | ndarray[tuple[Any, ...], dtype[bool]] | ndarray[tuple[Any, ...], dtype[complex128]], arr_expected: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[int64]] | ndarray[tuple[Any, ...], dtype[bool]] | ndarray[tuple[Any, ...], dtype[complex128]], tol: float, name: str, test: str, logger: Logger) int[source]ο
- Parameters:
arr
arr_expected
tol
name
test
logger
- Returns:
- VeraGridEngine.DataStructures.numerical_circuit.correct_bus_types(gen_idx: ndarray[tuple[Any, ...], dtype[int64]], control_mode_int: ndarray[tuple[Any, ...], dtype[int64]], gen_controllable_bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_types: ndarray[tuple[Any, ...], dtype[int64]], v_ctrl_val: int) None[source]ο
Correct remote voltage-controlled bus types after topology processing.
- Parameters:
gen_idx
control_mode_int
gen_controllable_bus_idx
bus_types
v_ctrl_val β value for GeneratorControlMode.V
- Returns:
None.
- VeraGridEngine.DataStructures.numerical_circuit.select_ac_phase_reference_buses(bus_types: ndarray[tuple[Any, ...], dtype[int64]], active_power: ndarray[tuple[Any, ...], dtype[float64]], bus_active: ndarray[tuple[Any, ...], dtype[bool]], is_dc_bus: ndarray[tuple[Any, ...], dtype[bool]], branch_from: ndarray[tuple[Any, ...], dtype[int64]], branch_to: ndarray[tuple[Any, ...], dtype[int64]], branch_active: ndarray[tuple[Any, ...], dtype[bool]]) ndarray[tuple[Any, ...], dtype[int64]][source]ο
Select missing angular references in independent AC phase regions.
Passive AC branches couple voltage angles. VSC and DC connections transfer power without coupling the absolute AC phase, so they must not merge the regions used to select one reference bus.
- Parameters:
bus_types β Compiled bus modes before automatic promotion.
active_power β Active-power injections used to rank PV candidates.
bus_active β Active state of every bus.
is_dc_bus β DC classification of every bus.
branch_from β From-bus indices of passive branches.
branch_to β To-bus indices of passive branches.
branch_active β Active state of passive branches.
- Returns:
PV bus indices that must become angular references.
VeraGridEngine.DataStructures.passive_branch_data moduleο
- class VeraGridEngine.DataStructures.passive_branch_data.PassiveBranchData(nelm: int, nbus: int)[source]ο
Bases:
BranchParentDataStructure to host all branches data for calculation
- B: ndarray[tuple[Any, ...], dtype[float64]]ο
- B0: ndarray[tuple[Any, ...], dtype[float64]]ο
- B2: ndarray[tuple[Any, ...], dtype[float64]]ο
- G: ndarray[tuple[Any, ...], dtype[float64]]ο
- G0: ndarray[tuple[Any, ...], dtype[float64]]ο
- G2: ndarray[tuple[Any, ...], dtype[float64]]ο
- R: ndarray[tuple[Any, ...], dtype[float64]]ο
- R0: ndarray[tuple[Any, ...], dtype[float64]]ο
- R2: ndarray[tuple[Any, ...], dtype[float64]]ο
- X: ndarray[tuple[Any, ...], dtype[float64]]ο
- X0: ndarray[tuple[Any, ...], dtype[float64]]ο
- X2: ndarray[tuple[Any, ...], dtype[float64]]ο
- Yff3ο
- Yft3ο
- Ytf3ο
- Ytt3ο
- compare(other: PassiveBranchData, tol: float, logger: Logger) None[source]ο
Compare passive-branch fields used by NumericalCircuit.compare().
- conn: ndarray[tuple[Any, ...], dtype[int64]]ο
- conn_f: ndarray[tuple[Any, ...], dtype[int64]]ο
- conn_t: ndarray[tuple[Any, ...], dtype[int64]]ο
- copy() PassiveBranchData[source]ο
Get a deep copy of this object :return: new BranchData instance
- detect_superconductor_at(k) None[source]ο
There is a beyond terrible practice of setting branches with R=0 and X=0 as βsuperconductorββ¦. Those must be reduced of course :param k: index
- get_series_admittance() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get the series admittance of the branches :return: complex vector
- m_tapsο
- phA: ndarray[tuple[Any, ...], dtype[bool]]ο
- phB: ndarray[tuple[Any, ...], dtype[bool]]ο
- phC: ndarray[tuple[Any, ...], dtype[bool]]ο
- phN: ndarray[tuple[Any, ...], dtype[bool]]ο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) PassiveBranchData[source]ο
Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :param logger: Logger :return: new BranchData instance
- tau_tapsο
- virtual_tap_f: ndarray[tuple[Any, ...], dtype[float64]]ο
- virtual_tap_t: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.shunt_data moduleο
- class VeraGridEngine.DataStructures.shunt_data.ShuntData[source]ο
Bases:
object- A_floating_starο
- B_floating_starο
- C_floating_starο
- Y: ndarray[tuple[Any, ...], dtype[complex128]]ο
- Y3_deltaο
- Y3_starο
- active: ndarray[tuple[Any, ...], dtype[bool]]ο
- b_stepsο
- bus_idxο
- compare(other: ShuntData, tol: float, logger: Logger) None[source]ο
Compare shunt fields used by NumericalCircuit.compare().
- control_mode_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- controllable_bus_idxο
- cost: ndarray[tuple[Any, ...], dtype[float64]]ο
- g_stepsο
- get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator array per bus :param arr: :return:
- get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]ο
Get the bus indices :return: array with the bus indices
- get_controllable_and_not_controllable_indices() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]ο
Get the indices of controllable generators :return: idx_controllable, idx_non_controllable
- get_fix_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get fixed Injections per bus :return:
- get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Get Injections per bus :return:
- get_qmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Qmax per bus :return:
- get_qmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Get generator Qmin per bus :return:
- grounds_neutral: ndarray[tuple[Any, ...], dtype[bool]]ο
- idtag: ndarray[tuple[Any, ...], dtype[str_]]ο
- mttf: ndarray[tuple[Any, ...], dtype[float64]]ο
- mttr: ndarray[tuple[Any, ...], dtype[float64]]ο
- names: ndarray[tuple[Any, ...], dtype[str_]]ο
- nbus: intο
- nelm: intο
- original_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- qmax: ndarray[tuple[Any, ...], dtype[float64]]ο
- qmin: ndarray[tuple[Any, ...], dtype[float64]]ο
- remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
Remapping of the elm buses :param bus_map_arr: array of old-to-new buses
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) ShuntData[source]ο
Slice shunt data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to branch index :return: new ShuntData instance
- stepο
- tapsο
- vmax: ndarray[tuple[Any, ...], dtype[float64]]ο
- vmin: ndarray[tuple[Any, ...], dtype[float64]]ο
- vset: ndarray[tuple[Any, ...], dtype[float64]]ο
VeraGridEngine.DataStructures.vsc_data moduleο
- class VeraGridEngine.DataStructures.vsc_data.VscData(nelm: int, nbus: int)[source]ο
Bases:
BranchParentDataVscData class provides a structured model for managing data related to Voltage Source Converters (VSC) in power grid simulations.
- F_dcnο
- alpha1: ndarray[tuple[Any, ...], dtype[float64]]ο
- alpha2: ndarray[tuple[Any, ...], dtype[float64]]ο
- alpha3: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_branch_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- control1_bus_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- control1_droop_val: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_droop_val_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_droop_val_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- control1_val: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_val_droop: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_val_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- control1_val_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_branch_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- control2_bus_idx: ndarray[tuple[Any, ...], dtype[int64]]ο
- control2_droop_val: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_droop_val_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_droop_val_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- control2_val: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_val_droop: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_val_max: ndarray[tuple[Any, ...], dtype[float64]]ο
- control2_val_min: ndarray[tuple[Any, ...], dtype[float64]]ο
- fault_control_int: ndarray[tuple[Any, ...], dtype[int64]]ο
- min_ac_voltage: ndarray[tuple[Any, ...], dtype[float64]]ο
- slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) VscData[source]ο
Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to branch index :param logger: Logger :return: new BranchData instance
- ysvs: ndarray[tuple[Any, ...], dtype[float64]]ο