GridCal.Engine.Devices package¶
Submodules¶
GridCal.Engine.Devices.battery module¶
-
class
GridCal.Engine.Devices.battery.
Battery
(name='batt', active_power=0.0, power_factor=0.8, voltage_module=1.0, is_controlled=True, Qmin=-9999, Qmax=9999, Snom=9999, Enom=9999, p_min=-9999, p_max=9999, op_cost=1.0, power_prof=None, power_factor_prof=None, vset_prof=None, active=True, Sbase=100, enabled_dispatch=True, mttf=0.0, mttr=0.0, charge_efficiency=0.9, discharge_efficiency=0.9, max_soc=0.99, min_soc=0.3, soc=0.8, charge_per_cycle=0.1, discharge_per_cycle=0.1)¶ Bases:
GridCal.Engine.Devices.generator.Generator
Battery (voltage controlled and dispatchable).
Arguments:
name (str, “batt”): Name of the battery
active_power (float, 0.0): Active power in MW
power_factor (float, 0.8): Power factor
voltage_module (float, 1.0): Voltage setpoint in per unit
is_controlled (bool, True): Is the unit voltage controlled (if so, the connection bus becomes a PV bus)
Qmin (float, -9999): Minimum reactive power in MVAr
Qmax (float, 9999): Maximum reactive power in MVAr
Snom (float, 9999): Nominal apparent power in MVA
Enom (float, 9999): Nominal energy capacity in MWh
p_min (float, -9999): Minimum dispatchable power in MW
p_max (float, 9999): Maximum dispatchable power in MW
op_cost (float, 1.0): Operational cost in Eur (or other currency) per MW
power_prof (DataFrame, None): Pandas DataFrame with the active power profile in MW
power_factor_prof (DataFrame, None): Pandas DataFrame with the power factor profile
vset_prof (DataFrame, None): Pandas DataFrame with the voltage setpoint profile in per unit
active (bool, True): Is the battery active?
Sbase (float, 100): Base apparent power in MVA
enabled_dispatch (bool, True): Is the battery enabled for OPF?
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
charge_efficiency (float, 0.9): Efficiency when charging
discharge_efficiency (float, 0.9): Efficiency when discharging
max_soc (float, 0.99): Maximum state of charge
min_soc (float, 0.3): Minimum state of charge
soc (float, 0.8): Current state of charge
charge_per_cycle (float, 0.1): Per unit of power to take per cycle when charging
discharge_per_cycle (float, 0.1): Per unit of power to deliver per cycle when discharging
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return: json-compatible dictionary
-
get_processed_at
(t, dt, store_values=True)¶ Get the processed power at the time index t :param t: time index :param dt: time step in hours :param store_values: store the values? :return: active power processed by the battery control in MW
-
initialize_arrays
(index, arr=None, arr_in_pu=False)¶ Create power profile based on index :param index: time index associated :param arr: array of values :param arr_in_pu: is the array in per unit?
-
process
(P, dt, charge_if_needed=False)¶ process a cycle in the battery :param P: proposed power in MW :param dt: time increment in hours :param charge_if_needed: True / False :param store_values: Store the values into the internal arrays? :return: Amount of power actually processed in MW
-
reset
()¶ Set the battery to its initial state
-
GridCal.Engine.Devices.branch module¶
-
class
GridCal.Engine.Devices.branch.
Branch
(bus_from: GridCal.Engine.Devices.bus.Bus, bus_to: GridCal.Engine.Devices.bus.Bus, name='Branch', r=1e-20, x=1e-20, g=1e-20, b=1e-20, rate=1.0, tap=1.0, shift_angle=0, active=True, tolerance=0, cost=0.0, mttf=0, mttr=0, r_fault=0.0, x_fault=0.0, fault_pos=0.5, branch_type: GridCal.Engine.Devices.types.BranchType = <BranchType.Line: ('line', )>, length=1, vset=1.0, temp_base=20, temp_oper=20, alpha=0.0033, bus_to_regulated=False, template=<GridCal.Engine.Devices.branch.BranchTemplate object>)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
The Branch class represents the connections between nodes (i.e. buses) in GridCal. A branch is an element (cable, line, capacitor, transformer, etc.) with an electrical impedance. The basic Branch class includes basic electrical attributes for most passive elements, but other device types may be passed to the Branch constructor to configure it as a specific type.
For example, a transformer may be created with the following code:
from GridCal.Engine.Core.multi_circuit import MultiCircuit from GridCal.Engine.Devices import * from GridCal.Engine.Devices.types import * # Create grid grid = MultiCircuit() # Create buses POI = Bus(name="POI", vnom=100, #kV is_slack=True) grid.add_bus(POI) B_C3 = Bus(name="B_C3", vnom=10) #kV grid.add_bus(B_C3) # Create transformer types SS = TransformerType(name="SS", hv_nominal_voltage=100, # kV lv_nominal_voltage=10, # kV nominal_power=100, # MVA copper_losses=10000, # kW iron_losses=125, # kW no_load_current=0.5, # % short_circuit_voltage=8) # % grid.add_transformer_type(SS) # Create transformer X_C3 = Branch(bus_from=POI, bus_to=B_C3, name="X_C3", branch_type=BranchType.Transformer, template=SS, ) # Add transformer to grid grid.add_branch(X_C3)
Refer to the
GridCal.Engine.Devices.branch.TapChanger
class for an example using a voltage regulator.Arguments:
bus_from (GridCal.Engine.Devices.bus module): “From” bus object
bus_to (GridCal.Engine.Devices.bus module): “To” bus object
name (str, “Branch”): Name of the branch
r (float, 1e-20): Branch resistance in per unit
x (float, 1e-20): Branch reactance in per unit
g (float, 1e-20): Branch shunt conductance in per unit
b (float, 1e-20): Branch shunt susceptance in per unit
rate (float, 1.0): Branch rate in MVA
tap (float, 1.0): Branch tap module
shift_angle (int, 0): Tap shift angle in radians
active (bool, True): Is the branch active?
tolerance (float, 0): Tolerance specified for the branch impedance in %
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
r_fault (float, 0.0): Mid-line fault resistance in per unit (SC only)
x_fault (float, 0.0): Mid-line fault reactance in per unit (SC only)
fault_pos (float, 0.0): Mid-line fault position in per unit (0.0 = bus_from, 0.5 = middle, 1.0 = bus_to)
branch_type (BranchType, BranchType.Line): Device type enumeration (ex.:
GridCal.Engine.Devices.transformer.TransformerType
)length (float, 0.0): Length of the branch in km
vset (float, 1.0): Voltage set-point of the voltage controlled bus in per unit
temp_base (float, 20.0): Base temperature at which r is measured in °C
temp_oper (float, 20.0): Operating temperature in °C
alpha (float, 0.0033): Thermal constant of the material in °C
bus_to_regulated (bool, False): Is the bus_to voltage regulated by this branch?
template (BranchTemplate, BranchTemplate()): Basic branch template
-
R_corrected
¶ Returns a temperature corrected resistance based on a formula provided by: NFPA 70-2005, National Electrical Code, Table 8, footnote #2; and https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity#Linear_approximation (version of 2019-01-03 at 15:20 EST).
-
apply_tap_changer
(tap_changer: GridCal.Engine.Devices.branch.TapChanger)¶ Apply a new tap changer
Argument:
tap_changer (GridCal.Engine.Devices.branch.TapChanger
): Tap changer object
-
apply_template
(obj, Sbase, logger=[])¶ Apply a branch template to this object
Arguments:
obj: TransformerType or Tower object
Sbase (float): Nominal power in MVA
logger (list, []): Log list
-
branch_type_converter
(val_string)¶ function to convert the branch type string into the BranchType :param val_string: :return: branch type conversion
-
copy
(bus_dict=None)¶ Returns a copy of the branch @return: A new with the same content as this
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return:
-
get_save_data
()¶ Return the data that matches the edit_headers :return:
-
get_virtual_taps
()¶ Get the branch virtual taps
The virtual taps generate when a transformer nominal winding voltage differs from the bus nominal voltage.
Returns:
tap_f (float, 1.0): Virtual tap at the from side
tap_t (float, 1.0): Virtual tap at the to side
-
plot_profiles
(time_series=None, my_index=0, show_fig=True)¶ Plot the time series results of this object :param time_series: TimeSeries Instance :param my_index: index of this object in the simulation :param show_fig: Show the figure?
-
tap_down
()¶ Move the tap changer one position up
-
tap_up
()¶ Move the tap changer one position up
-
-
class
GridCal.Engine.Devices.branch.
BranchTemplate
(name='BranchTemplate', tpe=<BranchType.Branch: ('branch', )>)¶ Bases:
object
-
get_save_data
()¶
-
-
class
GridCal.Engine.Devices.branch.
BranchTypeConverter
(tpe: GridCal.Engine.Devices.types.BranchType)¶ Bases:
object
-
class
GridCal.Engine.Devices.branch.
TapChanger
(taps_up=5, taps_down=5, max_reg=1.1, min_reg=0.9)¶ Bases:
object
The TapChanger class defines a transformer’s tap changer, either onload or offload. It needs to be attached to a predefined transformer (i.e. a Branch object).
The following example shows how to attach a tap changer to a transformer tied to a voltage regulated GridCal.Engine.Devices.bus module:
from GridCal.Engine.Core.multi_circuit import MultiCircuit from GridCal.Engine.devices import * from GridCal.Engine.device_types import * # Create grid grid = MultiCircuit() # Create buses POI = Bus(name="POI", vnom=100, #kV is_slack=True) grid.add_bus(POI) B_C3 = Bus(name="B_C3", vnom=10) #kV grid.add_bus(B_C3) # Create transformer types SS = TransformerType(name="SS", hv_nominal_voltage=100, # kV lv_nominal_voltage=10, # kV nominal_power=100, # MVA copper_losses=10000, # kW iron_losses=125, # kW no_load_current=0.5, # % short_circuit_voltage=8) # % grid.add_transformer_type(SS) # Create transformer X_C3 = Branch(bus_from=POI, bus_to=B_C3, name="X_C3", branch_type=BranchType.Transformer, template=SS, bus_to_regulated=True, vset=1.05) # Attach tap changer X_C3.tap_changer = TapChanger(taps_up=16, taps_down=16, max_reg=1.1, min_reg=0.9) X_C3.tap_changer.set_tap(X_C3.tap_module) # Add transformer to grid grid.add_branch(X_C3)
Arguments:
taps_up (int, 5): Number of taps position up
taps_down (int, 5): Number of tap positions down
max_reg (float, 1.1): Maximum regulation up i.e 1.1 -> +10%
min_reg (float, 0.9): Maximum regulation down i.e 0.9 -> -10%
Additional Properties:
tap (int, 0): Current tap position-
get_tap
()¶ Get the tap voltage regulation module
-
set_tap
(tap_module)¶ Set the integer tap position corresponding to a tap value
Attribute:
tap_module (float): Tap module centered around 1.0
-
tap_down
()¶ Go to the next upper tap position
-
tap_up
()¶ Go to the next upper tap position
-
GridCal.Engine.Devices.bus module¶
-
class
GridCal.Engine.Devices.bus.
Bus
(name='Bus', vnom=10, vmin=0.9, vmax=1.1, r_fault=0.0, x_fault=0.0, xpos=0, ypos=0, height=0, width=0, active=True, is_slack=False, area='Default', zone='Default', substation='Default')¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
The Bus object is the container of all the possible devices that can be attached to a bus bar or substation. Such objects can be loads, voltage controlled generators, static generators, batteries, shunt elements, etc.
Arguments:
name (str, “Bus”): Name of the bus
vnom (float, 10.0): Nominal voltage in kV
vmin (float, 0.9): Minimum per unit voltage
vmax (float, 1.1): Maximum per unit voltage
r_fault (float, 0.0): Resistance of the fault in per unit (SC only)
x_fault (float, 0.0): Reactance of the fault in per unit (SC only)
xpos (int, 0): X position in pixels (GUI only)
ypos (int, 0): Y position in pixels (GUI only)
height (int, 0): Height of the graphic object (GUI only)
width (int, 0): Width of the graphic object (GUI only)
active (bool, True): Is the bus active?
is_slack (bool, False): Is this bus a slack bus?
area (str, “Default”): Name of the area
zone (str, “Default”): Name of the zone
substation (str, “Default”): Name of the substation
Additional Properties:
Qmin_sum (float, 0): Minimum reactive power of this bus (inferred from the devices)
Qmax_sum (float, 0): Maximum reactive power of this bus (inferred from the devices)
loads (list, list()): List of loads attached to this bus
controlled_generators (list, list()): List of controlled generators attached to this bus
shunts (list, list()): List of shunts attached to this bus
batteries (list, list()): List of batteries attached to this bus
static_generators (list, list()): List of static generators attached to this bus
measurements (list, list()): List of measurements
-
apply_lp_profiles
(Sbase)¶ Sets the lp solution to the regular generators profile
-
copy
()¶ Deep copy of this object :return: New instance of this object
-
create_profiles
(index)¶ Delete all profiles
-
delete_profiles
()¶ Delete all profiles
-
determine_bus_type
()¶ Infer the bus type from the devices attached to it @return: Nothing
-
get_fault_impedance
()¶ Get the fault impedance :return: complex value of fault impedance
-
get_json_dict
(id)¶ Return Json-like dictionary :return: Dictionary
-
initialize_lp_profiles
()¶ Dimension the LP var profiles :return: Nothing
-
merge
(other_bus)¶ Add the elements of the “Other bus” to this bus :param other_bus: Another instance of Bus
-
plot_profiles
(time_profile, ax_load=None, ax_voltage=None, time_series_driver=None, my_index=0)¶ plot the profiles of this bus :param time_profile: Master profile of time steps (stored in the MultiCircuit) :param time_series_driver: time series driver :param ax_load: Load axis, if not provided one will be created :param ax_voltage: Voltage axis, if not provided one will be created :param my_index: index of this object in the time series results
-
retrieve_graphic_position
()¶ Get the position set by the graphic object into this object’s variables :return: Nothing
-
set_profile_values
(t)¶ Set the default values from the profiles at time index t :param t: profile time index
-
set_state
(t)¶ Set the profiles state of the objects in this bus to the value given in the profiles at the index t :param t: index of the profile :return: Nothing
-
GridCal.Engine.Devices.generator module¶
-
class
GridCal.Engine.Devices.generator.
Generator
(name='gen', active_power=0.0, power_factor=0.8, voltage_module=1.0, is_controlled=True, Qmin=-9999, Qmax=9999, Snom=9999, power_prof=None, power_factor_prof=None, vset_prof=None, Cost_prof=None, active=True, p_min=0.0, p_max=9999.0, op_cost=1.0, Sbase=100, enabled_dispatch=True, mttf=0.0, mttr=0.0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
Voltage controlled generator. This generators supports several reactive power control modes (see
GridCal.Engine.Simulations.PowerFlow.power_flow_driver.ReactivePowerControlMode
) to regulate the voltage on its GridCal.Engine.Devices.bus module during power flow simulations.Arguments:
name (str, “gen”): Name of the generator
active_power (float, 0.0): Active power in MW
power_factor (float, 0.8): Power factor
voltage_module (float, 1.0): Voltage setpoint in per unit
is_controlled (bool, True): Is the generator voltage controlled?
Qmin (float, -9999): Minimum reactive power in MVAr
Qmax (float, 9999): Maximum reactive power in MVAr
Snom (float, 9999): Nominal apparent power in MVA
power_prof (DataFrame, None): Pandas DataFrame with the active power profile in MW
power_factor_prof (DataFrame, None): Pandas DataFrame with the power factor profile
vset_prof (DataFrame, None): Pandas DataFrame with the voltage setpoint profile in per unit
active (bool, True): Is the generator active?
p_min (float, 0.0): Minimum dispatchable power in MW
p_max (float, 9999): Maximum dispatchable power in MW
op_cost (float, 1.0): Operational cost in Eur (or other currency) per MW
Sbase (float, 100): Nominal apparent power in MVA
enabled_dispatch (bool, True): Is the generator enabled for OPF?
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
-
apply_lp_profile
(Sbase)¶ Set LP profile to the regular profile :return:
-
apply_lp_vars
(at=None)¶ Set the LP vars to the main value or the profile
-
copy
()¶ Make a deep copy of this object :return: Copy of this object
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return: json-compatible dictionary
-
get_lp_var_profile
(index)¶ Get the profile of the LP solved values into a Pandas DataFrame :param index: time index :return: DataFrame with the LP values
-
initialize_lp_vars
()¶ Initialize the LP variables
-
GridCal.Engine.Devices.load module¶
-
class
GridCal.Engine.Devices.load.
Load
(name='Load', G=0.0, B=0.0, Ir=0.0, Ii=0.0, P=0.0, Q=0.0, cost=0.0, G_prof=None, B_prof=None, Ir_prof=None, Ii_prof=None, P_prof=None, Q_prof=None, active=True, mttf=0.0, mttr=0.0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
The load object implements the so-called ZIP model, in which the load can be represented by a combination of power (P), current(I), and impedance (Z).
The sign convention is: Positive to act as a load, negative to act as a generator.
Arguments:
name (str, “Load”): Name of the load
G (float, 0.0): Conductance in equivalent MW
B (float, 0.0): Susceptance in equivalent MVAr
Ir (float, 0.0): Real current in equivalent MW
Ii (float, 0.0): Imaginary current in equivalent MVAr
P (float, 0.0): Active power in MW
Q (float, 0.0): Reactive power in MVAr
G_prof (DataFrame, None): Pandas DataFrame with the conductance profile in equivalent MW
B_prof (DataFrame, None): Pandas DataFrame with the susceptance profile in equivalent MVAr
Ir_prof (DataFrame, None): Pandas DataFrame with the real current profile in equivalent MW
Ii_prof (DataFrame, None): Pandas DataFrame with the imaginary current profile in equivalent MVAr
P_prof (DataFrame, None): Pandas DataFrame with the active power profile in equivalent MW
Q_prof (DataFrame, None): Pandas DataFrame with the reactive power profile in equivalent MVAr
active (bool, True): Is the load active?
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
-
copy
()¶
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return:
-
GridCal.Engine.Devices.measurement module¶
-
class
GridCal.Engine.Devices.measurement.
Measurement
(value, uncertainty, mtype: GridCal.Engine.Devices.measurement.MeasurementType)¶ Bases:
object
GridCal.Engine.Devices.meta_devices module¶
-
class
GridCal.Engine.Devices.meta_devices.
DeviceType
¶ Bases:
enum.Enum
An enumeration.
-
BatteryDevice
= 'Battery'¶
-
BranchDevice
= 'Branch'¶
-
BusDevice
= 'Bus'¶
-
GeneratorDevice
= 'Generator'¶
-
LoadDevice
= 'Load'¶
-
SequenceLineDevice
= 'Sequence line'¶
-
ShuntDevice
= 'Shunt'¶
-
StaticGeneratorDevice
= 'Static Generator'¶
-
TowerDevice
= 'Tower'¶
-
TransformerTypeDevice
= 'Transformer type'¶
-
UnderGroundLineDevice
= 'Underground line'¶
-
WireDevice
= 'Wire'¶
-
-
class
GridCal.Engine.Devices.meta_devices.
EditableDevice
(name, active, device_type: GridCal.Engine.Devices.meta_devices.DeviceType, editable_headers: Dict[str, GridCal.Engine.Devices.meta_devices.GCProp], non_editable_attributes: List[str], properties_with_profile: Dict[str, Optional[Any]])¶ Bases:
object
-
create_profile
(magnitude, index, arr=None, arr_in_pu=False)¶ Create power profile based on index :param magnitude: name of the property :param index: pandas time index :param arr: array of values to set :param arr_in_pu: is the array in per-unit?
-
create_profiles
(index)¶ Create the load object default profiles Args: :param index: pandas time index
-
delete_profiles
()¶ Delete the object profiles (set all to None)
-
ensure_profiles_exist
(index)¶ It might be that when loading the GridCal Model has properties that the file has not. Those properties must be initialized as well :param index: Time series index (timestamps)
-
get_headers
() → List[AnyStr]¶ Return a list of headers
-
get_save_data
()¶ Return the data that matches the edit_headers :return:
-
resize_profiles
(index, time_frame: GridCal.Engine.Devices.meta_devices.TimeFrame)¶ Resize the profiles in this object :param index: pandas time index :param time_frame: Time frame to use (Short term, Long term)
-
set_profile_values
(t)¶ Set the profile values at t :param t: time index (integer)
-
-
class
GridCal.Engine.Devices.meta_devices.
GCProp
(units, tpe, definition, profile_name='')¶ Bases:
object
GridCal.Engine.Devices.sequence_line module¶
-
class
GridCal.Engine.Devices.sequence_line.
SequenceLineType
(name='SequenceLine', rating=1, R=0, X=0, G=0, B=0, R0=0, X0=0, G0=0, B0=0, tpe=<BranchType.Line: ('line', )>)¶
GridCal.Engine.Devices.shunt module¶
-
class
GridCal.Engine.Devices.shunt.
Shunt
(name='shunt', G=0.0, B=0.0, G_prof=None, B_prof=None, active=True, mttf=0.0, mttr=0.0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
Arguments:
name (str, “shunt”): Name of the shunt
G (float, 0.0): Conductance in MW at 1 p.u. voltage
B (float, 0.0): Susceptance in MW at 1 p.u. voltage
G_prof (DataFrame, None): Pandas DataFrame with the conductance profile in MW at 1 p.u. voltage
B_prof (DataFrame, None): Pandas DataFrame with the susceptance profile in MW at 1 p.u. voltage
active (bool, True): Is the shunt active?
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
-
copy
()¶ Copy of this object :return: a copy of this object
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return:
-
GridCal.Engine.Devices.static_generator module¶
-
class
GridCal.Engine.Devices.static_generator.
StaticGenerator
(name='StaticGen', P=0.0, Q=0.0, P_prof=None, Q_prof=None, active=True, mttf=0.0, mttr=0.0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
Arguments:
name (str, “StaticGen”): Name of the static generator
P (float, 0.0): Active power in MW
Q (float, 0.0): Reactive power in MVAr
P_prof (DataFrame, None): Pandas DataFrame with the active power profile in MW
Q_prof (DataFrame, None): Pandas DataFrame with the reactive power profile in MVAr
active (bool, True): Is the static generator active?
mttf (float, 0.0): Mean time to failure in hours
mttr (float, 0.0): Mean time to recovery in hours
-
copy
()¶ Deep copy of this object :return:
-
get_json_dict
(id, bus_dict)¶ Get json dictionary :param id: ID: Id for this object :param bus_dict: Dictionary of buses [object] -> ID :return:
-
GridCal.Engine.Devices.tower module¶
-
class
GridCal.Engine.Devices.tower.
Tower
(parent=None, edit_callback=None, name='Tower', tpe=<BranchType.Branch: ('branch', )>)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
-
check
(logger=[])¶ Check that the wires configuration make sense :return:
-
compute
()¶ Compute the tower matrices :return:
-
compute_rating
()¶ Compute the sum of the wires max current in A :return: max current iof the tower in A
-
get_save_data
(dta_list=[])¶ store the tower data into dta_list in a SQL-like fashion to avoid 3D like structures :param dta_list: list to append the data to :return: nothing
-
get_save_headers
()¶ Return the tower header + wire header :return:
-
get_wire_properties
()¶ Get the wire properties in a list :return: list of properties (list of lists)
-
is_used
(wire)¶ Parameters: wire – Returns:
-
plot
(ax=None)¶ Plot wires position :param ax: Axis object
-
y_shunt
()¶ positive sequence shunt admittance in S per unit of length
-
z_series
()¶ positive sequence series impedance in Ohm per unit of length
-
-
GridCal.Engine.Devices.tower.
abc_2_seq
(mat)¶ Convert to sequence components Args:
mat:Returns:
-
GridCal.Engine.Devices.tower.
calc_y_matrix
(wires: list, f=50, rho=100)¶ Impedance matrix :param wires: list of wire objects :param f: system frequency (Hz) :param rho: earth resistivity :return: 4 by 4 impedance matrix where the order of the phases is: N, A, B, C
-
GridCal.Engine.Devices.tower.
calc_z_matrix
(wires: list, f=50, rho=100)¶ Impedance matrix :param wires: list of wire objects :param f: system frequency (Hz) :param rho: earth resistivity :return: 4 by 4 impedance matrix where the order of the phases is: N, A, B, C
-
GridCal.Engine.Devices.tower.
get_D_ij
(xi, yi, xj, yj)¶ Distance module between the wire i and the image of the wire j :param xi: x position of the wire i :param yi: y position of the wire i :param xj: x position of the wire j :param yj: y position of the wire j :return: Distance module between the wire i and the image of the wire j
-
GridCal.Engine.Devices.tower.
get_d_ij
(xi, yi, xj, yj)¶ Distance module between wires :param xi: x position of the wire i :param yi: y position of the wire i :param xj: x position of the wire j :param yj: y position of the wire j :return: distance module
-
GridCal.Engine.Devices.tower.
kron_reduction
(mat, keep, embed)¶ Perform the Kron reduction :param mat: primitive matrix :param keep: indices to keep :param embed: indices to remove / embed :return:
-
GridCal.Engine.Devices.tower.
wire_bundling
(phases_set, primitive, phases_vector)¶ Algorithm to bundle wires per phase :param phases_set: set of phases (list with unique occurrences of each phase values, i.e. [0, 1, 2, 3]) :param primitive: Primitive matrix to reduce by bundling wires :param phases_vector: Vector that contains the phase of each wire :return: reduced primitive matrix, corresponding phases
-
GridCal.Engine.Devices.tower.
z_ii
(r_i, x_i, h_i, gmr_i, f, rho)¶ Self impedance Formula 4.3 from ATP-EMTP theory book :param r_i: wire resistance :param x_i: wire reactance :param h_i: wire vertical position (m) :param gmr_i: wire geometric mean radius (m) :param f: system frequency (Hz) :param rho: earth resistivity (Ohm / m^3) :return: self impedance in Ohm / m
-
GridCal.Engine.Devices.tower.
z_ij
(x_i, x_j, h_i, h_j, d_ij, f, rho)¶ Mutual impedance Formula 4.4 from ATP-EMTP theory book :param x_i: wire i horizontal position (m) :param x_j: wire j horizontal position (m) :param h_i: wire i vertical position (m) :param h_j: wire j vertical position (m) :param d_ij: Distance module between the wires i and j :param f: system frequency (Hz) :param rho: earth resistivity (Ohm / m^3) :return: mutual impedance in Ohm / m
GridCal.Engine.Devices.transformer module¶
-
class
GridCal.Engine.Devices.transformer.
TransformerType
(hv_nominal_voltage=0, lv_nominal_voltage=0, nominal_power=0.001, copper_losses=0, iron_losses=0, no_load_current=0, short_circuit_voltage=0, gr_hv1=0.5, gx_hv1=0.5, name='TransformerType', tpe=<BranchType.Transformer: ('transformer', )>)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
Arguments:
hv_nominal_voltage (float, 0.0): Primary side nominal voltage in kV (tied to the Branch’s bus_from)
lv_nominal_voltage (float, 0.0): Secondary side nominal voltage in kV (tied to the Branch’s bus_to)
nominal_power (float, 0.0): Transformer nominal apparent power in MVA
copper_losses (float, 0.0): Copper losses in kW (also known as short circuit power)
iron_losses (float, 0.0): Iron losses in kW (also known as no-load power)
no_load_current (float, 0.0): No load current in %
short_circuit_voltage (float, 0.0): Short circuit voltage in %
gr_hv1 (float, 0.5): Resistive contribution to the primary side in per unit (at the Branch’s bus_from)
gx_hv1 (float, 0.5): Reactive contribution to the primary side in per unit (at the Branch’s bus_from)
name (str, “TransformerType”): Name of the type
tpe (BranchType, BranchType.Transformer): Device type enumeration
-
get_impedances
()¶ Compute the branch parameters of a transformer from the short circuit test values.
Returns:
zs (complex): Series impedance in per unit
zsh (complex): Shunt impedance in per unit
-
GridCal.Engine.Devices.types module¶
GridCal.Engine.Devices.underground_line module¶
-
class
GridCal.Engine.Devices.underground_line.
UndergroundLineType
(name='UndergroundLine', rating=1, R=0, X=0, G=0, B=0, R0=0, X0=0, G0=0, B0=0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
-
y_shunt
()¶ positive sequence shunt admittance in S per unit of length
-
z_series
()¶ positive sequence series impedance in Ohm per unit of length
-
GridCal.Engine.Devices.wire module¶
-
class
GridCal.Engine.Devices.wire.
Wire
(name='', xpos=0, ypos=0, gmr=0.01, r=0.01, x=0.0, max_current=1, phase=0)¶ Bases:
GridCal.Engine.Devices.meta_devices.EditableDevice
-
copy
()¶ Copy of the wire :return:
-
-
class
GridCal.Engine.Devices.wire.
WiresCollection
(parent=None)¶ Bases:
PySide2.QtCore.QAbstractTableModel
-
add
(wire: GridCal.Engine.Devices.wire.Wire)¶ Add wire :param wire: :return:
-
columnCount
(self, parent:PySide2.QtCore.QModelIndex=Invalid(PySide2.QtCore.QModelIndex)) → int¶
-
data
(self, index:PySide2.QtCore.QModelIndex, role:int=PySide2.QtCore.Qt.ItemDataRole.DisplayRole) → typing.Any¶
-
delete
(index)¶ Delete wire :param index: :return:
-
flags
(self, index:PySide2.QtCore.QModelIndex) → PySide2.QtCore.Qt.ItemFlags¶
-
headerData
(self, section:int, orientation:PySide2.QtCore.Qt.Orientation, role:int=PySide2.QtCore.Qt.ItemDataRole.DisplayRole) → typing.Any¶
-
is_used
(name)¶ checks if the name is used
-
parent
(self) → PySide2.QtCore.QObject¶ parent(self, child:PySide2.QtCore.QModelIndex) -> PySide2.QtCore.QModelIndex
-
rowCount
(self, parent:PySide2.QtCore.QModelIndex=Invalid(PySide2.QtCore.QModelIndex)) → int¶
-
setData
(index, value, role=PySide2.QtCore.Qt.ItemDataRole.DisplayRole)¶ Set data by simple editor (whatever text) :param index: :param value: :param role:
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-