VeraGridEngine.Simulations.PowerFlow.Formulations packageο
Submodulesο
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_advanced_formulation moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_advanced_formulation.PfAdvancedFormulation(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], I0: ndarray[tuple[Any, ...], dtype[complex128]], Y0: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger)[source]ο
Bases:
PfFormulationTemplate- analyze_branch_controls() List[int][source]ο
Analyze the control branches and compute the indices :return: k_v_m for later comparison with pqv
- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- fx_diff(x: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Fx for autodiff :param x: solutions vector :return: f(x)
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x, fx
- update_bus_types(pq: ndarray[tuple[Any, ...], dtype[int64]], pv: ndarray[tuple[Any, ...], dtype[int64]], pqv: ndarray[tuple[Any, ...], dtype[int64]], p: ndarray[tuple[Any, ...], dtype[int64]]) None[source]ο
Update the bus types :param pq: Array of PQ indices :param pv: Array of PV indices :param pqv: Array of PQV indices :param p: Array of P indices
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_advanced_formulation.adv_jacobian(nbus: int, nbr: int, idx_dva: ndarray[tuple[Any, ...], dtype[int64]], idx_dvm: ndarray[tuple[Any, ...], dtype[int64]], idx_dm: ndarray[tuple[Any, ...], dtype[int64]], idx_dtau: ndarray[tuple[Any, ...], dtype[int64]], idx_dP: ndarray[tuple[Any, ...], dtype[int64]], idx_dQ: ndarray[tuple[Any, ...], dtype[int64]], idx_dPf: ndarray[tuple[Any, ...], dtype[int64]], idx_dQf: ndarray[tuple[Any, ...], dtype[int64]], idx_dPt: ndarray[tuple[Any, ...], dtype[int64]], idx_dQt: ndarray[tuple[Any, ...], dtype[int64]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], Ys: ndarray[tuple[Any, ...], dtype[complex128]], complex_tap: ndarray[tuple[Any, ...], dtype[complex128]], tap_modules: ndarray[tuple[Any, ...], dtype[float64]], Bc: ndarray[tuple[Any, ...], dtype[float64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Vm: ndarray[tuple[Any, ...], dtype[float64]], Va: ndarray[tuple[Any, ...], dtype[float64]], Ybus_x: ndarray[tuple[Any, ...], dtype[complex128]], Ybus_p: ndarray[tuple[Any, ...], dtype[int64]], Ybus_i: ndarray[tuple[Any, ...], dtype[int64]], yff: ndarray[tuple[Any, ...], dtype[complex128]], yft: ndarray[tuple[Any, ...], dtype[complex128]], ytf: ndarray[tuple[Any, ...], dtype[complex128]], ytt: ndarray[tuple[Any, ...], dtype[complex128]]) CSC[source]ο
Compute the advanced jacobian :param nbus: :param nbr: :param idx_dva: :param idx_dvm: :param idx_dm: :param idx_dtau: :param idx_dP: :param idx_dQ: :param idx_dQf: :param idx_dPf: :param idx_dPt: :param idx_dQt: :param F: :param T: :param Ys: Series admittance 1 / (R + jX) :param complex_tap: :param tap_modules: :param Bc: Total changing susceptance :param V: :param Vm: :param Va: :param Ybus_x: :param Ybus_p: :param Ybus_i: :param yff: :param yft: :param ytf: :param ytt: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_advanced_formulation.calc_autodiff_jacobian(func: Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]], x: ndarray[tuple[Any, ...], dtype[float64]], h=1e-08) csc_matrix[source]ο
Compute the Jacobian matrix of func at x using finite differences.
- Parameters:
func β function accepting a vector x and args, and returning either a vector or a tuple where the first argument is a vector and the second.
x β Point at which to evaluate the Jacobian (numpy array).
h β Small step for finite difference.
- Returns:
Jacobian matrix as a CSC matrix.
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation.PfBasicFormulation(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], I0: ndarray[tuple[Any, ...], dtype[complex128]], Y0: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions)[source]ο
Bases:
PfFormulationTemplate- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x
- update_bus_types(pq: ndarray[tuple[Any, ...], dtype[int64]], pv: ndarray[tuple[Any, ...], dtype[int64]], pqv: ndarray[tuple[Any, ...], dtype[int64]], p: ndarray[tuple[Any, ...], dtype[int64]])[source]ο
- Parameters:
pq
pv
pqv
p
- Returns:
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.PfBasicFormulation3Ph(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger)[source]ο
Bases:
PfFormulationTemplate- Jacobian(autodiff: bool = True) CSC[source]ο
- Parameters:
autodiff β If True, use autodiff to compute the Jacobian
- Returns:
- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- compute_f(x: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute the function residual :param x: Solution vector :return: f
- fx() ndarray[tuple[Any, ...], dtype[float64]][source]ο
# Scalc = V Β· (Y x V - I)^* # Sbus = S0 + I0*Vm + Y0*Vm^2 :return:
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x
- update_bus_types(pq: ndarray[tuple[Any, ...], dtype[int64]], pv: ndarray[tuple[Any, ...], dtype[int64]], pqv: ndarray[tuple[Any, ...], dtype[int64]], p: ndarray[tuple[Any, ...], dtype[int64]]) None[source]ο
- Parameters:
pq
pv
pqv
p
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.calc_autodiff_jacobian(func: Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]], x: ndarray[tuple[Any, ...], dtype[float64]], h: float = 1e-06) CSC[source]ο
Compute the Jacobian matrix of func at x using finite differences. df/dx = (f(x+h) - f(x)) / h
- Parameters:
func β function accepting a vector x and args, and returning either a vector or a tuple where the first argument is a vector and the second.
x β Point at which to evaluate the Jacobian (numpy array).
h β Small step for finite difference.
- Returns:
Jacobian matrix as a CSC matrix.
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.compute_current_loads(bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_lookup: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Istar: ndarray[tuple[Any, ...], dtype[complex128]], Idelta: ndarray[tuple[Any, ...], dtype[complex128]], Ifloating: ndarray[tuple[Any, ...], dtype[complex128]]) Tuple[ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[complex128]]][source]ο
- Parameters:
bus_idx
bus_lookup
V
Istar
Idelta
Ifloating
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.compute_generators(bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_lookup: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], P: ndarray[tuple[Any, ...], dtype[float64]], Q: ndarray[tuple[Any, ...], dtype[float64]], control_mode_int: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
- Parameters:
bus_idx
bus_lookup
V
P
Q
control_mode_int
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.compute_power_loads(bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_lookup: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Sstar: ndarray[tuple[Any, ...], dtype[complex128]], Sfloating: ndarray[tuple[Any, ...], dtype[complex128]], Sdelta: ndarray[tuple[Any, ...], dtype[complex128]]) Tuple[ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[complex128]]][source]ο
- Parameters:
bus_idx
bus_lookup
V
Sstar
Sfloating
Sdelta
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.compute_ybus(nc: NumericalCircuit) Tuple[csc_matrix, csc_matrix, csc_matrix, ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[bool]], ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]ο
Compute admittances and masks
The mask is a boolean vector that indicates which bus phases are active
The bus_idx_lookup will relate the original bus indices with the sliced bus indices This is useful for managing the sliced bus indices in the power flow problem. For instance:
original_pq_buses = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] mask = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
And the lookup becomes: bus_idx_lookup = [0, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, -1, 9, -1, 10, -1]
And then it will be simple to get the sliced bus indices that we finally need: sliced_pq_buses = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- Parameters:
nc β NumericalCircuit
- Returns:
Ybus, Yf, Yt, Yshunt_bus, mask, bus_idx_lookup
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.compute_ybus_generator(nc: NumericalCircuit) Tuple[csc_matrix][source]ο
Compute the Ybus matrix for a generator in a 3-phase system with neutral. It is used only during the short-circuit analysis, not in power flow simulations. :param nc: NumericalCircuit :return: Ybus
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expand3ph(x: ndarray) ndarray[source]ο
Expands a numpy array to 3-pase copying the same values :param x: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expandVoltage3ph(V0: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Expands a numpy array to 3-pase copying the same values :param V0: array of bus voltages in positive sequence :return: Array of three-phase voltages in 3-phase ABC
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expand_indices_3ph(x: ndarray) ndarray[source]ο
Expands a numpy array to 3-pase copying the same values :param x: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expand_magnitudes(magnitude: ndarray[tuple[Any, ...], dtype[complex128]], lookup: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Expands the masked magnitude using the lookup saving zeros where the lookup is -1, which means that this bus did not exist, and it was previously eliminated. :param magnitude: The magnitude to expand, for instance, the voltage vector at each bus :param lookup: The vector which contains the information about the existing and eliminated buses :return: magnitude_expanded
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expand_matrix(magnitude: ndarray, lookup: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Expands a matrix by adding zero rows and columns based on the lookup indices. If a lookup value is negative, the corresponding row and column in the matrix will be replaced by zeros.
- Parameters:
magnitude β 2D numpy array (matrix to expand)
lookup β List of indices for lookup
- Returns:
Expanded matrix with zeros in the rows and columns where lookup values are negative
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.expand_slice_indices_3ph(x: ndarray, bus_lookup: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[source]ο
Expands and slices a numpy array to 3-phase copying the same values :param x: :param bus_lookup: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.lookup_from_mask(mask: ndarray[tuple[Any, ...], dtype[bool]]) ndarray[tuple[Any, ...], dtype[int64]][source]ο
This function builds the lookup vector based on the information provided by the mask vector. The mask is a boolean vector with True for existing buses and False for non-existing buses. The lookup vector will save a -1 for non-existing buses and will order the existing buses from 0 to n. :param mask: Boolean vector with True for existing buses and False for non-existing buses. :return: lookup
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_basic_formulation_3ph.slice_indices(pq: ndarray[tuple[Any, ...], dtype[int64]], bus_lookup: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]][source]ο
Slice the indices based on the bus_lookup :param pq: original bus indices :param bus_lookup: mapping between original and sliced bus indices :return:
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_formulation_template moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_formulation_template.PfFormulationTemplate(V0: ndarray[tuple[Any, ...], dtype[complex128]], options: PowerFlowOptions)[source]ο
Bases:
objectBase Power Flow Formulation class
- property Va: ndarray[tuple[Any, ...], dtype[float64]]ο
Voltage angles :return:
- property Vm: ndarray[tuple[Any, ...], dtype[float64]]ο
Voltage modules :return:
- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- property converged: boolο
Converged? :return:
- property error: floatο
Converged? :return:
- property f: ndarray[tuple[Any, ...], dtype[float64]]ο
Converged? :return:
- get_jacobian_df(J=None, autodiff=False) DataFrame[source]ο
Get the Jacobian DataFrame :return: DataFrame
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
- Returns:
- solve_step_from_f(f: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[ndarray[tuple[Any, ...], dtype[float64]], bool][source]ο
- Parameters:
f β Function residual
- Returns:
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update the problem :param x: Solution vector :param update_controls: Update controls :return: error, converged, x, f
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.PfAcDcWithNegativePoles(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], I0: ndarray[tuple[Any, ...], dtype[complex128]], Y0: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger)[source]ο
Bases:
PfFormulationTemplate- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- compute_f(x: ndarray[tuple[Any, ...], dtype[float64]], update_class_vars: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute the residual vector :param x: Solution vector :param update_class_vars: Update the class vars related to the calculation step :return: Residual vector
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x, fx
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.adv_jacobian(nbus: int, nbr: int, nvsc: int, nhvdc: int, F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], tap_angles: ndarray[tuple[Any, ...], dtype[float64]], tap_modules: ndarray[tuple[Any, ...], dtype[float64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Vm: ndarray[tuple[Any, ...], dtype[float64]], Va: ndarray[tuple[Any, ...], dtype[float64]], I0: ndarray[tuple[Any, ...], dtype[complex128]], u_cbr_m: ndarray[tuple[Any, ...], dtype[int64]], u_cbr_tau: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pt: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pfp: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pfn: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_qt: ndarray[tuple[Any, ...], dtype[int64]], k_vsc_has_dc_n: ndarray[tuple[Any, ...], dtype[int64]], k_vsc_imax: ndarray[tuple[Any, ...], dtype[int64]], alpha1: ndarray[tuple[Any, ...], dtype[float64]], alpha2: ndarray[tuple[Any, ...], dtype[float64]], alpha3: ndarray[tuple[Any, ...], dtype[float64]], hvdc_r: ndarray[tuple[Any, ...], dtype[float64]], hvdc_droop: ndarray[tuple[Any, ...], dtype[float64]], i_u_vm: ndarray[tuple[Any, ...], dtype[int64]], i_u_va: ndarray[tuple[Any, ...], dtype[int64]], i_k_p: ndarray[tuple[Any, ...], dtype[int64]], i_k_q: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], k_vsc_pfp_droop: ndarray[tuple[Any, ...], dtype[int64]], dpfp_droop_slope: ndarray[tuple[Any, ...], dtype[float64]], Pt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Qt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pf_hvdc: ndarray[tuple[Any, ...], dtype[float64]], Ys: ndarray[tuple[Any, ...], dtype[complex128]], Bc: ndarray[tuple[Any, ...], dtype[float64]], yff_cbr: ndarray[tuple[Any, ...], dtype[complex128]], yft_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytf_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytt_cbr: ndarray[tuple[Any, ...], dtype[complex128]], Yi: ndarray[tuple[Any, ...], dtype[int64]], Yp: ndarray[tuple[Any, ...], dtype[int64]], Yx: ndarray[tuple[Any, ...], dtype[complex128]]) CSC[source]ο
- Parameters:
nbus
nbr
nvsc
nhvdc
F
T
Fdcp_vsc
Fdcn_vsc
T_vsc
F_hvdc
T_hvdc
tap_angles
tap_modules
V
Vm
Va
I0 β Current injections vector (for Norton equivalent in short-circuit)
u_cbr_m
u_cbr_tau
k_cbr_pf
k_cbr_pt
k_cbr_qf
k_cbr_qt
u_vsc_pfp
u_vsc_pfn
u_vsc_pt
u_vsc_qt
alpha1
alpha2
alpha3
hvdc_r
hvdc_droop
i_u_vm
i_u_va
i_k_p
i_k_q
Pfp_vsc
Pfn_vsc
k_vsc_pfp_droop
dpfp_droop_slope
Pt_vsc
Qt_vsc
Pf_hvdc
Ys
Bc
yff_cbr
yft_cbr
ytf_cbr
ytt_cbr
Yi
Yp
Yx
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.calcSf(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute Sf for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.calcSt(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute St for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.calc_autodiff_jacobian(func: Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]], x: ndarray[tuple[Any, ...], dtype[float64]], h=1e-08) CSC[source]ο
Compute the Jacobian matrix of func at x using finite differences.
- Parameters:
func β function accepting a vector x and args, and returning either a vector or a tuple where the first argument is a vector and the second.
x β Point at which to evaluate the Jacobian (numpy array).
h β Small step for finite difference.
- Returns:
Jacobian matrix as a CSC matrix.
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.calc_flows_active_branch_per_bus(nbus: int, F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Used to add effects of VSCs and HVDCs to the traditional branches (lines and controllable transformers) :param nbus: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param Fdcp_vsc: :param Fdcn_vsc: :param T_vsc: :param Pfp_vsc: :param Pfn_vsc: :param St_vsc: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles.calc_flows_summation_per_bus(nbus: int, F_br: ndarray[tuple[Any, ...], dtype[int64]], T_br: ndarray[tuple[Any, ...], dtype[int64]], Sf_br: ndarray[tuple[Any, ...], dtype[complex128]], St_br: ndarray[tuple[Any, ...], dtype[complex128]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Includes everything: VSCs, HVDCs, and all traditional branches (lines and controllable transformers) :param nbus: :param F_br: :param T_br: :param Sf_br: :param St_br: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param Fdcp_vsc: :param Fdcn_vsc: :param T_vsc: :param Pfp_vsc: :param Pfn_vsc: :param St_vsc: :return:
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.PfAcDcWithNegativePolesSc(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], I0: ndarray[tuple[Any, ...], dtype[complex128]], Y0: ndarray[tuple[Any, ...], dtype[complex128]], St_vsc_pf: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger)[source]ο
Bases:
PfFormulationTemplate- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- compute_f(x: ndarray[tuple[Any, ...], dtype[float64]], update_class_vars: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute the residual vector :param x: Solution vector :param update_class_vars: Update the class vars related to the calculation step :return: Residual vector
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x, fx
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.adv_jacobian(nbus: int, nbr: int, nvsc: int, nhvdc: int, F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], tap_angles: ndarray[tuple[Any, ...], dtype[float64]], tap_modules: ndarray[tuple[Any, ...], dtype[float64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Vm: ndarray[tuple[Any, ...], dtype[float64]], Va: ndarray[tuple[Any, ...], dtype[float64]], I0: ndarray[tuple[Any, ...], dtype[complex128]], u_cbr_m: ndarray[tuple[Any, ...], dtype[int64]], u_cbr_tau: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pt: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pfp: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pfn: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_qt: ndarray[tuple[Any, ...], dtype[int64]], k_vsc_has_dc_n: ndarray[tuple[Any, ...], dtype[int64]], k_vsc_imax: ndarray[tuple[Any, ...], dtype[int64]], alpha1: ndarray[tuple[Any, ...], dtype[float64]], alpha2: ndarray[tuple[Any, ...], dtype[float64]], alpha3: ndarray[tuple[Any, ...], dtype[float64]], hvdc_r: ndarray[tuple[Any, ...], dtype[float64]], hvdc_droop: ndarray[tuple[Any, ...], dtype[float64]], i_u_vm: ndarray[tuple[Any, ...], dtype[int64]], i_u_va: ndarray[tuple[Any, ...], dtype[int64]], i_k_p: ndarray[tuple[Any, ...], dtype[int64]], i_k_q: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Qt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pf_hvdc: ndarray[tuple[Any, ...], dtype[float64]], Ys: ndarray[tuple[Any, ...], dtype[complex128]], Bc: ndarray[tuple[Any, ...], dtype[float64]], yff_cbr: ndarray[tuple[Any, ...], dtype[complex128]], yft_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytf_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytt_cbr: ndarray[tuple[Any, ...], dtype[complex128]], Yi: ndarray[tuple[Any, ...], dtype[int64]], Yp: ndarray[tuple[Any, ...], dtype[int64]], Yx: ndarray[tuple[Any, ...], dtype[complex128]]) CSC[source]ο
- Parameters:
nbus
nbr
nvsc
nhvdc
F
T
Fdcp_vsc
Fdcn_vsc
T_vsc
F_hvdc
T_hvdc
tap_angles
tap_modules
V
Vm
Va
I0 β Current injections vector (for Norton equivalent in short-circuit)
u_cbr_m
u_cbr_tau
k_cbr_pf
k_cbr_pt
k_cbr_qf
k_cbr_qt
u_vsc_pfp
u_vsc_pfn
u_vsc_pt
u_vsc_qt
alpha1
alpha2
alpha3
hvdc_r
hvdc_droop
i_u_vm
i_u_va
i_k_p
i_k_q
Pfp_vsc
Pfn_vsc
Pt_vsc
Qt_vsc
Pf_hvdc
Ys
Bc
yff_cbr
yft_cbr
ytf_cbr
ytt_cbr
Yi
Yp
Yx
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.calcSf(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute Sf for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.calcSt(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute St for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.calc_autodiff_jacobian(func: Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]], x: ndarray[tuple[Any, ...], dtype[float64]], h=1e-08) CSC[source]ο
Compute the Jacobian matrix of func at x using finite differences.
- Parameters:
func β function accepting a vector x and args, and returning either a vector or a tuple where the first argument is a vector and the second.
x β Point at which to evaluate the Jacobian (numpy array).
h β Small step for finite difference.
- Returns:
Jacobian matrix as a CSC matrix.
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.calc_flows_active_branch_per_bus(nbus: int, F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Used to add effects of VSCs and HVDCs to the traditional branches (lines and controllable transformers) :param nbus: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param Fdcp_vsc: :param Fdcn_vsc: :param T_vsc: :param Pfp_vsc: :param Pfn_vsc: :param St_vsc: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_full_acdc_with_negative_poles_sc.calc_flows_summation_per_bus(nbus: int, F_br: ndarray[tuple[Any, ...], dtype[int64]], T_br: ndarray[tuple[Any, ...], dtype[int64]], Sf_br: ndarray[tuple[Any, ...], dtype[complex128]], St_br: ndarray[tuple[Any, ...], dtype[complex128]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], Fdcp_vsc: ndarray[tuple[Any, ...], dtype[int64]], Fdcn_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Includes everything: VSCs, HVDCs, and all traditional branches (lines and controllable transformers) :param nbus: :param F_br: :param T_br: :param Sf_br: :param St_br: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param Fdcp_vsc: :param Fdcn_vsc: :param T_vsc: :param Pfp_vsc: :param Pfn_vsc: :param St_vsc: :return:
VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation moduleο
- class VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.PfGeneralizedFormulation(V0: ndarray[tuple[Any, ...], dtype[complex128]], S0: ndarray[tuple[Any, ...], dtype[complex128]], I0: ndarray[tuple[Any, ...], dtype[complex128]], Y0: ndarray[tuple[Any, ...], dtype[complex128]], Qmin: ndarray[tuple[Any, ...], dtype[float64]], Qmax: ndarray[tuple[Any, ...], dtype[float64]], nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger)[source]ο
Bases:
PfFormulationTemplate- check_error(x: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[float, ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Check error of the solution without affecting the problem :param x: Solution vector :return: error
- compute_f(x: ndarray[tuple[Any, ...], dtype[float64]], update_class_vars: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute the residual vector :param x: Solution vector :param update_class_vars: Update the class vars related to the calculation step :return: Residual vector
- get_solution(elapsed: float, iterations: int) NumericPowerFlowResults[source]ο
Get the problem solution :param elapsed: Elapsed seconds :param iterations: Iteration number :return: NumericPowerFlowResults
- update(x: ndarray[tuple[Any, ...], dtype[float64]], update_controls: bool = False) Tuple[float, bool, ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Update step :param x: Solution vector :param update_controls: :return: error, converged?, x, fx
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.adv_jacobian(nbus: int, nbr: int, nvsc: int, nhvdc: int, F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], F_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], tap_angles: ndarray[tuple[Any, ...], dtype[float64]], tap_modules: ndarray[tuple[Any, ...], dtype[float64]], V: ndarray[tuple[Any, ...], dtype[complex128]], Vm: ndarray[tuple[Any, ...], dtype[float64]], Va: ndarray[tuple[Any, ...], dtype[float64]], u_cbr_m: ndarray[tuple[Any, ...], dtype[int64]], u_cbr_tau: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_pt: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qf: ndarray[tuple[Any, ...], dtype[int64]], k_cbr_qt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pf: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_pt: ndarray[tuple[Any, ...], dtype[int64]], u_vsc_qt: ndarray[tuple[Any, ...], dtype[int64]], alpha1: ndarray[tuple[Any, ...], dtype[float64]], alpha2: ndarray[tuple[Any, ...], dtype[float64]], alpha3: ndarray[tuple[Any, ...], dtype[float64]], hvdc_r: ndarray[tuple[Any, ...], dtype[float64]], hvdc_droop: ndarray[tuple[Any, ...], dtype[float64]], i_u_vm: ndarray[tuple[Any, ...], dtype[int64]], i_u_va: ndarray[tuple[Any, ...], dtype[int64]], i_k_p: ndarray[tuple[Any, ...], dtype[int64]], i_k_q: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Qt_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pf_hvdc: ndarray[tuple[Any, ...], dtype[float64]], Ys: ndarray[tuple[Any, ...], dtype[complex128]], Bc: ndarray[tuple[Any, ...], dtype[float64]], yff_cbr: ndarray[tuple[Any, ...], dtype[complex128]], yft_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytf_cbr: ndarray[tuple[Any, ...], dtype[complex128]], ytt_cbr: ndarray[tuple[Any, ...], dtype[complex128]], Yi: ndarray[tuple[Any, ...], dtype[int64]], Yp: ndarray[tuple[Any, ...], dtype[int64]], Yx: ndarray[tuple[Any, ...], dtype[complex128]]) CSC[source]ο
- Parameters:
nbus
nbr
nvsc
nhvdc
F
T
F_vsc
T_vsc
F_hvdc
T_hvdc
tap_angles
tap_modules
V
Vm
Va
u_cbr_m
u_cbr_tau
k_cbr_pf
k_cbr_pt
k_cbr_qf
k_cbr_qt
u_vsc_pf
u_vsc_pt
u_vsc_qt
alpha1
alpha2
alpha3
hvdc_r
hvdc_droop
i_u_vm
i_u_va
i_k_p
i_k_q
Pfp_vsc
Pt_vsc
Qt_vsc
Pf_hvdc
Ys
Bc
yff_cbr
yft_cbr
ytf_cbr
ytt_cbr
Yi
Yp
Yx
- Returns:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.calcSf(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute Sf for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.calcSt(k: ndarray[tuple[Any, ...], dtype[int64]], V: ndarray[tuple[Any, ...], dtype[complex128]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], G: ndarray[tuple[Any, ...], dtype[float64]], B: ndarray[tuple[Any, ...], dtype[float64]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], vtap_f: ndarray[tuple[Any, ...], dtype[float64]], vtap_t: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
Compute St for pi branches :param k: :param V: :param F: :param T: :param R: :param X: :param G: :param B: :param m: :param tau: :param vtap_f: :param vtap_t: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.calc_autodiff_jacobian(func: Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]], x: ndarray[tuple[Any, ...], dtype[float64]], h=1e-08) CSC[source]ο
Compute the Jacobian matrix of func at x using finite differences.
- Parameters:
func β function accepting a vector x and args, and returning either a vector or a tuple where the first argument is a vector and the second.
x β Point at which to evaluate the Jacobian (numpy array).
h β Small step for finite difference.
- Returns:
Jacobian matrix as a CSC matrix.
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.calc_flows_active_branch_per_bus(nbus: int, F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], F_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Used to add effects of VSCs and HVDCs to the traditional branches (lines and controllable transformers) :param nbus: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param F_vsc: :param T_vsc: :param Pfp_vsc: :param St_vsc: :return:
- VeraGridEngine.Simulations.PowerFlow.Formulations.pf_generalized_formulation.calc_flows_summation_per_bus(nbus: int, F_br: ndarray[tuple[Any, ...], dtype[int64]], T_br: ndarray[tuple[Any, ...], dtype[int64]], Sf_br: ndarray[tuple[Any, ...], dtype[complex128]], St_br: ndarray[tuple[Any, ...], dtype[complex128]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], F_vsc: ndarray[tuple[Any, ...], dtype[int64]], T_vsc: ndarray[tuple[Any, ...], dtype[int64]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]]) ndarray[tuple[Any, ...], dtype[complex128]][source]ο
Summation of magnitudes per bus (complex) Includes everything: VSCs, HVDCs, and all traditional branches (lines and controllable transformers) :param nbus: :param F_br: :param T_br: :param Sf_br: :param St_br: :param F_hvdc: :param T_hvdc: :param Sf_hvdc: :param St_hvdc: :param F_vsc: :param T_vsc: :param Pfp_vsc: :param St_vsc: :return: