VeraGridEngine.Compilers.Gslv package

Subpackages

Submodules

VeraGridEngine.Compilers.Gslv.activation module

VeraGridEngine.Compilers.Gslv.activation.install_gslv_license(fname: str) → Tuple[bool, str][source]

Copy one GSLV license file into VeraGrid’s managed folder.

Parameters:

fname – Source license file path.

Returns:

Success flag and status message.

VeraGridEngine.Compilers.Gslv.common module

VeraGridEngine.Compilers.Gslv.common.apply_three_phase_load_data(gslv_load: Load, elm: Load, time_index: int | None) → None[source]

Copy explicit three-phase load data into one GSLV load object.

Parameters:
  • gslv_load – Target GSLV load.

  • elm – Source VeraGrid load.

  • time_index – Source time index when exporting one time slice.

Returns:

None.

VeraGridEngine.Compilers.Gslv.common.apply_three_phase_shunt_data(gslv_shunt: Shunt | ControllableShunt, elm: ShuntParent, time_index: int | None) → None[source]

Copy explicit three-phase shunt data into one GSLV shunt-like object.

Parameters:
  • gslv_shunt – Target GSLV shunt-like object.

  • elm – Source VeraGrid shunt-like object.

  • time_index – Source time index when exporting one time slice.

Returns:

None.

VeraGridEngine.Compilers.Gslv.common.convert_tap_module_control_mode_dict(data: Dict[int, TapModuleControl]) → Dict[int, TapModuleControl][source]

Function to convert a dictionary of TapModuleControl modes to pg.TapModuleControl modes :param data: :return:

VeraGridEngine.Compilers.Gslv.common.convert_tap_module_control_mode_lst(data: List[TapModuleControl]) → List[TapModuleControl][source]

Function to convert a list of TapModuleControl modes to pg.TapModuleControl modes :param data: :return:

VeraGridEngine.Compilers.Gslv.common.convert_tap_phase_control_mode_dict(data: Dict[int, TapPhaseControl]) → Dict[int, TapPhaseControl][source]

Function to convert a dictionary of TapPhaseControl modes to pg.TapPhaseControl modes :param data: :return:

VeraGridEngine.Compilers.Gslv.common.convert_tap_phase_control_mode_lst(data: List[TapPhaseControl]) → List[TapPhaseControl][source]

Function to convert a list of TapPhaseControl modes to pg.TapPhaseControl modes :param data: :return:

VeraGridEngine.Compilers.Gslv.common.fill_profile(gslv_profile: Profiledouble | Profilebool | Profileint | Profileuint, gc_profile: ProfileFloat | ProfileInt | ProfileBool | ProfileDevice | ProfileEnum, use_time_series: bool, time_indices: ndarray[tuple[Any, ...], dtype[int64]] | None, n_time: int = 1, default_val: int | float | bool | TapPhaseControl | TapModuleControl = 0) → Profiledouble | Profilebool | Profileint | Profileuint[source]

Generates a default time series :param gslv_profile: Profile from gslv to fill in :param gc_profile: Profile from veragrid to convert :param use_time_series: use time series? :param time_indices: time series indices if any (optional) :param n_time: number of time steps :param default_val: Default value :return: Filled GSLV profile.

VeraGridEngine.Compilers.Gslv.common.fill_profile_with_array(gslv_profile: Profiledouble, arr: ndarray[tuple[Any, ...], dtype[float64]], use_time_series: bool, time_indices: ndarray[tuple[Any, ...], dtype[int64]] | None, n_time: int = 1, default_val: float = 0.0) → Profiledouble[source]

Generate one profile from a dense array.

Parameters:
  • gslv_profile – GSLV profile to fill.

  • arr – Dense VeraGrid array.

  • use_time_series – Whether time-series data is being exported.

  • time_indices – Optional time-series selection.

  • n_time – Number of exported time steps.

  • default_val – Scalar fallback value for snapshot exports.

Returns:

Filled GSLV profile.

VeraGridEngine.Compilers.Gslv.common.get_gslv_mip_solvers_list() → List[str][source]

Get list of available MIP solvers :return:

VeraGridEngine.Compilers.Gslv.common.get_single_three_phase_snapshot_index(use_time_series: bool, time_indices: ndarray[tuple[Any, ...], dtype[int64]] | None, n_time: int) → int | None[source]

Return the original VeraGrid snapshot index when one three-phase slice is being exported.

Parameters:
  • use_time_series – Whether the conversion uses time-series slicing.

  • time_indices – Requested time indices.

  • n_time – Number of exported time steps.

Returns:

Original time index when there is exactly one slice, else None.

VeraGridEngine.Compilers.Gslv.common.set_generator_associations(gslv_elm: Generator, elm: Generator, facility_dict: Dict[Facility, Facility], technology_dict: Dict[Technology, Technology], fuel_dict: Dict[Fuel, Fuel], emission_gas_dict: Dict[EmissionGas, EmissionGas]) → None[source]

Copy VeraGrid generator associations into one GSLV generator-like injection.

Parameters:
  • gslv_elm – Target GSLV generator or battery.

  • elm – Source VeraGrid generator or battery.

  • facility_dict – VeraGrid-to-GSLV facility lookup.

  • technology_dict – VeraGrid-to-GSLV technology lookup.

  • fuel_dict – VeraGrid-to-GSLV fuel lookup.

  • emission_gas_dict – VeraGrid-to-GSLV emission gas lookup.

Returns:

None.

VeraGridEngine.Compilers.Gslv.common.set_injection_associations(gslv_elm: InjectionParent, elm: Load | Generator | StaticGenerator | Shunt | ControllableShunt, facility_dict: Dict[Facility, Facility], technology_dict: Dict[Technology, Technology]) → None[source]

Copy common VeraGrid injection associations into one GSLV injection.

Parameters:
  • gslv_elm – Target GSLV injection.

  • elm – Source VeraGrid injection.

  • facility_dict – VeraGrid-to-GSLV facility lookup.

  • technology_dict – VeraGrid-to-GSLV technology lookup.

Returns:

None.

VeraGridEngine.Compilers.Gslv.compare module

VeraGridEngine.Compilers.Gslv.compare.CheckArr(arr: ndarray[tuple[Any, ...], dtype[float64]], arr_expected: ndarray[tuple[Any, ...], dtype[float64]], tol: float, name: str, test: str, verbose=False)[source]
Parameters:
  • arr

  • arr_expected

  • tol

  • name

  • test

  • verbose

Returns:

VeraGridEngine.Compilers.Gslv.compare.CheckArrEq(arr: ndarray, arr_expected: ndarray, name: str, test: str, verbose=False)[source]
Parameters:
  • arr

  • arr_expected

  • name

  • test

  • verbose

Returns:

VeraGridEngine.Compilers.Gslv.compare.compare_branch_parent_data(gslv_branch_data: BranchParentData, gc_branch_data: BranchParentData, tol: float, parent_name: str)[source]
Parameters:
  • gslv_branch_data

  • gc_branch_data

  • tol

  • parent_name

Returns:

VeraGridEngine.Compilers.Gslv.compare.compare_nc(nc_gslv: NumericalCircuit, nc_gc: NumericalCircuit, tol: float)[source]
Parameters:
  • nc_gslv

  • nc_gc

  • tol

Returns:

VeraGridEngine.Compilers.Gslv.compare.convert_arr(arr, d: Dict)[source]
VeraGridEngine.Compilers.Gslv.compare.convert_gslv_arr_to_idx(arr, d: Dict)[source]

VeraGridEngine.Compilers.Gslv.conversion module

class VeraGridEngine.Compilers.Gslv.conversion.FakeAdmittances[source]

Bases: object

Fake admittances class needed to make the translation

Ybus
Yf
Yt
class VeraGridEngine.Compilers.Gslv.conversion.GslvDicts[source]

Bases: object

Hold the VeraGrid-to-GSLV object lookup dictionaries produced during conversion.

area_dict: Dict[Area, Area]
branch_groups_dict: Dict[BranchGroup, BranchGroup]
con_groups_dict: Dict[ContingencyGroup, ContingencyGroup]
country_dict: Dict[Country, Country]
emission_gas_dict: Dict[EmissionGas, EmissionGas]
facility_dict: Dict[Facility, Facility]
fuel_dict: Dict[Fuel, Fuel]
inv_groups_dict: Dict[InvestmentsGroup, InvestmentGroup]
market_unit_dict: Dict[MarketUnit, MarketUnit]
modelling_authorities_dict: Dict[ModellingAuthority, ModellingAuthority]
municipalities_dict: Dict[Municipality, Municipality]
regions_dict: Dict[Region, Region]
substation_dict: Dict[Substation, Substation]
technology_dict: Dict[Technology, Technology]
voltage_level_dict: Dict[VoltageLevel, VoltageLevel]
zone_dict: Dict[Zone, Zone]
VeraGridEngine.Compilers.Gslv.conversion.get_snapshots_from_gslv(circuit: MultiCircuit, override_branch_controls: bool = False) → List[NumericalCircuit][source]
Parameters:
  • circuit

  • override_branch_controls

Returns:

VeraGridEngine.Compilers.Gslv.conversion.to_gslv(circuit: MultiCircuit, use_time_series: bool, time_indices: IntVec | None = None, override_branch_controls: bool = False, opf_results: None | OptimalPowerFlowResults = None, add_three_phase_data: bool = False) → Tuple['pg.MultiCircuit', GslvDicts][source]

Convert VeraGrid circuit to GSLV :param circuit: MultiCircuit :param use_time_series: compile the time series from VeraGrid? otherwise just the snapshot :param time_indices: Array of time indices :param override_branch_controls: If true the branch controls are set to Fix :param opf_results: :param add_three_phase_data: Export explicit three-phase device data when possible. :return: pg.MultiCircuit instance

Module contents