VeraGridEngine.Simulations.Rms.problems packageο
Submodulesο
VeraGridEngine.Simulations.Rms.problems.mti_hybrid_structure moduleο
- class VeraGridEngine.Simulations.Rms.problems.mti_hybrid_structure.MTISubProblemRow(var_idx: 'int', eq_idx: 'int', explicit: 'int', subset: 'int', subproblem: 'int')[source]ο
Bases:
object- eq_idx: intο
- explicit: intο
- subproblem: intο
- subset: intο
- var_idx: intο
- VeraGridEngine.Simulations.Rms.problems.mti_hybrid_structure.build_connected_subproblem_order(incidence: ndarray) list[MTISubProblemRow][source]ο
Build a solving-order-like structure from equation-variable connectivity.
We build a bipartite graph [eq | var] and use connected components as subsets/subproblems. Rows are paired (eq_i, var_i) within each subset.
- VeraGridEngine.Simulations.Rms.problems.mti_hybrid_structure.build_incidence_from_jacobian(jac: spmatrix, tol: float = 0.0) ndarray[source]ο
Build a boolean incidence matrix from a sparse Jacobian.
The matrix format follows the MTI-toolbox convention at a high level: rows are equations and columns are variables, with 1 where dependency exists.
- VeraGridEngine.Simulations.Rms.problems.mti_hybrid_structure.build_single_subproblem_order(n_eq: int, n_vars: int) list[MTISubProblemRow][source]ο
Create a deterministic fallback solving-order where all equations/variables belong to one subset and one subproblem.
This mirrors the toolbox row schema, while keeping the current VeraGrid implementation conservative until full incidence-based decomposition is ported.
VeraGridEngine.Simulations.Rms.problems.rms_problem_MTI moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_MTI.RmsProblemMTI(*args, **kwargs)[source]ο
Bases:
RmsProblemPhasorRMS problem exposing MTI-style equality/inequality evaluation.
Equalities are the same implicit residuals used by the DAE solver. Inequalities are compiled locally in this MTI class from
Block.inequalitiesand evaluated at runtime viarhs_inequalities.- add_variables_to_compilation_dicts(elm, mdl)[source]ο
add variables and parameters info to the system block
- Parameters:
- Returns:
- Return type:
None
- build_mti_incidence_and_order(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
- compute_mti_equalities(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute equality residual vector F.
- compute_mti_inequalities(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Compute inequality vector G (constraint convention: G <= 0).
- evaluate_boolean_guard(bool_position: int, x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) float | None[source]ο
- evaluate_mti_step(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], h: float) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
Evaluate one MTI step and return (F, G, z).
- get_continuous_equality_row_indices(row_idx: ndarray) ndarray[source]ο
Return equality rows that still involve continuous unknowns [xp;y].
- get_equality_row_indices(row_idx: ndarray) ndarray[source]ο
Map MTI incidence row indices to equality residual row indices.
- get_event_local_boolean_candidates(ineq_idx: int, z_prev: ndarray[tuple[Any, ...], dtype[float64]]) list[ndarray][source]ο
Enumerate boolean candidates local to the subset touched by inequality.
Prefer direct guard/inequality variable overlap. A coarse solving order can collapse to one subset, and using that subset would enumerate every boolean in the model.
- get_event_solving_stages(ineq_idx: int) tuple[list[tuple[ndarray, ndarray]], list[tuple[ndarray, ndarray]], list[tuple[ndarray, ndarray]]][source]ο
Return (previous, event, following) stage groups from current solving order.
Each group entry is (eq_indices0, var_indices0) with 0-based indices.
- get_event_subset_ids(ineq_idx: int) set[int][source]ο
Return solving-order subset ids touched by an inequality.
- get_fixed_boolean_equality_row_indices(row_idx: ndarray) ndarray[source]ο
Return equality rows that only constrain fixed boolean columns.
- get_group_subset_ids(eq_idx: ndarray, var_idx: ndarray) set[int][source]ο
Return solving-order subset ids touched by a stage group.
- get_inequality_row_indices(row_idx: ndarray) ndarray[source]ο
Map MTI incidence row indices to inequality residual row indices.
- property get_mti_boolean_parameter_indices: list[int]ο
- get_mti_solving_order() list[MTISubProblemRow][source]ο
- get_subproblem_boolean_positions(eq_idx: ndarray, var_idx: ndarray) list[int][source]ο
Return local boolean positions structurally coupled to a subproblem.
The solver works in continuous variable space, while the MTI incidence matrix is [diff vars; continuous vars; booleans]. This method maps a continuous subproblem back to boolean incidence columns so following subproblems can use toolbox-like variable-z propagation.
- static inequalities_satisfied(g: ndarray[tuple[Any, ...], dtype[float64]], tol: float = 1e-09) bool[source]ο
Check if all inequalities satisfy G <= tol.
- property non_bool_idx_params: ndarrayο
- rhs_inequalities(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_events_group(rms_events_group)[source]ο
Keep base phasor event-group behavior, then re-apply MTI boolean init.
The base implementation recompiles event parameters and rebuilds _variable_parameters_values, which can reset MTI boolean entries.
- split_direct_and_coupled_booleans() tuple[list[int], list[int]][source]ο
Return all booleans as coupled for inequality-driven MTI selection.
- split_explicit_subproblem_pairs(eq_idx: ndarray, var_idx: ndarray) tuple[list[tuple[int, int]], ndarray, ndarray][source]ο
Split a subproblem into toolbox-marked explicit pairs and implicit rest.
Returns explicit (eq0, var0) pairs in continuous variable space, followed by remaining equation and continuous-variable indices.
- total_derivative_inequalities(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], xpp: ndarray[tuple[Any, ...], dtype[float64]] | None = None) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Jacobian-based approximation of dG/dt for active inequality checks.
Uses dG/dt = (dG/dx) * xdot + (dG/ddx) * xddot. When xpp is not available from the event-stage linearization, xpp=0 is used as a conservative fallback.
- update_mti_boolean_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Update MTI boolean parameters using inequality feasibility only.
This mirrors MTI-style logic where region/mode selection is driven by inequality residuals (G <= 0), not by direct boolean guard evaluation.
VeraGridEngine.Simulations.Rms.problems.rms_problem_complex moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_complex.RmsProblemComplex(grid: MultiCircuit, options: RmsOptions, pf_results: PowerFlowResults | None)[source]ο
Bases:
RmsProblemTemplateComplex Phasor-based DAE (Differential-Algebraic Equation) class with MULTILINEAR equations.
This class uses complex phasor representation with a single complex voltage variable per bus. The key innovation is TRULY MULTILINEAR current equations:
I = Y * (Vf - Vt) [Linear in voltage!]
where Y = g + j*b is the complex admittance.
- When expanded:
Ir = g*(Vrf - Vrt) - b*(Vif - Vit) Ii = g*(Vif - Vit) + b*(Vrf - Vrt)
These are truly linear - no products of voltage variables, no squares!
The current balance at each node (Ξ£I = 0) provides linear conservation equations.
- Responsibilities:
Store state and algebraic variables using complex phasor representation
Store Jacobian matrices
Store residual equations using multilinear current-based equations
Store sparsity patterns
Convert between polar (power flow) and complex phasor representations
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- TIME_NAME = 'glob_time'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_NAME = 'vars'ο
- add_device_var(dev: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, var: Var)[source]ο
Associate a variable with a device.
- add_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
Add variables and parameters to the compilation dictionaries. :param elm: Device type to add variables to :param mdl: Block type to add variables to
- property algebraic_varsο
- get_device_vars_dict() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
Get dictionary of device variables.
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_init_guess_info() DataFrame[source]ο
Returns a df with uid, name, and initial value for the system variables.
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector.
- rhs_algebraic(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_init_guess(mdl: Block, reference_powerflow: VarPowerFlowReferenceType, val: float)[source]ο
Add values from powerflow to initial guess.
- property state_varsο
- property uid2idx_varsο
- update_variable_params(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]] | None = None)[source]ο
Update the variable parameters.
- property vars_glob_name2uidο
VeraGridEngine.Simulations.Rms.problems.rms_problem_dae moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_dae.RmsProblemDae(grid: MultiCircuit, options: RmsOptions, pf_results: PowerFlowResults, progress_signal: DummySignal | None = None, progress_text: DummySignal | None = None)[source]ο
Bases:
RmsProblemTemplateDAE (Differential-Algebraic Equation) class to store and manage.
- Responsibilities:
Store state and algebraic variables (x, y)
Store Jacobian matrices
Store residual equations
Store sparsity patterns
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- TIME_NAME = 'glob_time'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_NAME = 'vrs'ο
- add_block_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
add variables and parameters info to the system block
- Parameters:
- Returns:
- Return type:
None
- add_device_var(dev: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, var: Var)[source]ο
Associate a variable with a device :param dev: Device :param var: Variable
- add_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
- advance_fmu_cs_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Co-Simulation devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- advance_fmu_me_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Model Exchange devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- property algebraic_eqsο
- Returns:
- property algebraic_varsο
- property boundary_updateο
- close_fmu_cs_devices() None[source]ο
Release imported FMU Co-Simulation devices after the RMS simulation ends.
- Returns:
None.
- close_fmu_me_devices() None[source]ο
Release imported FMU Model Exchange devices after the RMS simulation ends.
- Returns:
None.
- def_event_params_fn(ev_param: ndarray[tuple[Any, ...], dtype[float64]], t: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Evaluate runtime event parameter expressions while preserving mode latches.
- Parameters:
ev_param β Current runtime parameter vector.
t β Simulation time.
- Returns:
Updated runtime parameter vector.
- property event_parameters_eqsο
- Returns:
- property event_parameters_eqs0ο
- Returns:
- get_E_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- property get_algebraic_varsο
- Returns:
- get_device_vars_dict() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
- Returns:
- Return type:
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_dx0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- get_eventparams0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- get_init_guess_info() DataFrame[source]ο
returns a df with uid, name, and initial value for the system variables :return: :rtype:
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_static_state_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- property glob_timeο
- initialize_fmu_cs_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Co-Simulation devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- initialize_fmu_me_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Model Exchange devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- rhs_algebraic(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_events_group(rms_events_group: RmsEventsGroup)[source]ο
add events modifying values of event_parameters equations :param rms_events_group: :return:
- set_init_guess(mdl: Block, reference_powerflow: VarPowerFlowReferenceType, val: float)[source]ο
add values from powerflow to initial guess
- Parameters:
mdl
reference_powerflow
val
- Returns:
:rtype:self._
- property state_eqsο
- Returns:
- property state_varsο
- Returns:
- property uid2idx_event_paramsο
- property uid2idx_paramsο
- property uid2idx_varsο
- Returns:
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
- update_variable_params(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]] | None = None, scheduled_t: float | None = None) None[source]ο
Update the variable parameters. Continuous runtime parameters are re-evaluated, while retained mode parameters are left untouched unless updated by boundary logic.
The RMS implicit solve needs two distinct time views. Continuous ramp-like parameters must be evaluated at the current local target time so the nonlinear solve sees the interpolated value inside the step. Historical scheduled step events, however, must keep the pre-event value on the sample aligned with the event instant and only latch afterwards. The optional
scheduled_targument therefore lets the caller decouple the continuous symbolic evaluation time from the scheduled event boundary time without duplicating the update logic.- Parameters:
t β Continuous symbolic evaluation time.
x_snapshot β Current state snapshot used by boundary logic.
scheduled_t β Optional time used by scheduled step logic.
- Returns:
None.
- property variable_parametersο
- Returns:
- property vars_glob_name2uidο
- Returns:
- VeraGridEngine.Simulations.Rms.problems.rms_problem_dae.assign_line_static_parameters(elm: Any, parameter_reference: ParamPowerFlowReferenceType) Const[source]ο
VeraGridEngine.Simulations.Rms.problems.rms_problem_dae_vectorized moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_dae_vectorized.RmsProblemDaeVec(grid: MultiCircuit, options: RmsOptions, pf_results: PowerFlowResults, progress_signal: DummySignal | None = None, progress_text: DummySignal | None = None)[source]ο
Bases:
RmsProblemTemplateDAE (Differential-Algebraic Equation) class to store and manage.
- Responsibilities:
Store state and algebraic variables (x, y)
Store Jacobian matrices
Store residual equations
Store sparsity patterns
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- TIME_NAME = 'glob_time'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_BUS_VAF_NAME = 'varsbusvaf'ο
- VARS_BUS_VAT_NAME = 'varsbusvat'ο
- VARS_BUS_VA_NAME = 'varsbusva'ο
- VARS_BUS_VMF_NAME = 'varsbusvmf'ο
- VARS_BUS_VMT_NAME = 'varsbusvmt'ο
- VARS_BUS_VM_NAME = 'varsbusvm'ο
- VARS_NAME = 'vrs'ο
- add_block_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
add variables and parameters info to the system block
- Parameters:
- Returns:
- Return type:
None
- add_device_var(dev: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, var: Var)[source]ο
Associate a variable with a device :param dev: Device :param var: Variable
- add_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
- advance_fmu_cs_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Co-Simulation devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- advance_fmu_me_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Model Exchange devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- property algebraic_eqsο
- Returns:
- property algebraic_varsο
- property boundary_updateο
- close_fmu_cs_devices() None[source]ο
Release imported FMU Co-Simulation devices after the RMS simulation ends.
- Returns:
None.
- close_fmu_me_devices() None[source]ο
Release imported FMU Model Exchange devices after the RMS simulation ends.
- Returns:
None.
- def_event_params_fn(ev_param: ndarray[tuple[Any, ...], dtype[float64]], t: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Evaluate runtime event parameter expressions while preserving mode latches.
- Parameters:
ev_param β Current runtime parameter vector.
t β Simulation time.
- Returns:
Updated runtime parameter vector.
- property event_parameters_eqsο
- Returns:
- property event_parameters_eqs0ο
- Returns:
- get_E_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- property get_algebraic_varsο
- Returns:
- get_device_vars_dict() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
- Returns:
- Return type:
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_dx0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- get_eventparams0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- get_init_guess_info() DataFrame[source]ο
returns a df with uid, name, and initial value for the system variables :return: :rtype:
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22_vec(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) csc_matrix[source]ο
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- property glob_timeο
- initialize_fmu_cs_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Co-Simulation devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- initialize_fmu_me_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Model Exchange devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- rhs_algebraic(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_algebraic_vec(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_events_group(rms_events_group: RmsEventsGroup)[source]ο
add events modifying values of event_parameters equations :param rms_events_group: :return:
- set_init_guess(mdl: Block, reference_powerflow: VarPowerFlowReferenceType, val: float)[source]ο
add values from powerflow to initial guess
- Parameters:
mdl
reference_powerflow
val
- Returns:
- Return type:
- property state_eqsο
- Returns:
- property state_varsο
- Returns:
- property uid2idx_event_paramsο
- property uid2idx_paramsο
- property uid2idx_varsο
- Returns:
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
- update_input_matrices_by_model(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- update_variable_params(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]] | None = None, scheduled_t: float | None = None) None[source]ο
Update the variable parameters. Continuous runtime parameters are re-evaluated, while retained mode parameters are left untouched unless updated by boundary logic.
The RMS implicit solve needs two distinct time views. Continuous ramp-like parameters must be evaluated at the current local target time so the nonlinear solve sees the interpolated value inside the step. Historical scheduled step events, however, must keep the pre-event value on the sample aligned with the event instant and only latch afterwards. The optional
scheduled_targument therefore lets the caller decouple the continuous symbolic evaluation time from the scheduled event boundary time without duplicating the update logic.- Parameters:
t β Continuous symbolic evaluation time.
x_snapshot β Current state snapshot used by boundary logic.
scheduled_t β Optional time used by scheduled step logic.
- Returns:
None.
- property variable_parametersο
- Returns:
- property vars_glob_name2uidο
- Returns:
- VeraGridEngine.Simulations.Rms.problems.rms_problem_dae_vectorized.assign_line_static_parameters(elm: Any, parameter_reference: ParamPowerFlowReferenceType) Const[source]ο
- VeraGridEngine.Simulations.Rms.problems.rms_problem_dae_vectorized.assign_static_parameters(elm: Any, parameter_reference: ParamPowerFlowReferenceType) Const[source]ο
- VeraGridEngine.Simulations.Rms.problems.rms_problem_dae_vectorized.get_all_uids_from_block_composition_dict(block_composition_dict: Dict[int, List[int]]) List[int][source]ο
VeraGridEngine.Simulations.Rms.problems.rms_problem_phasor moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_phasor.RmsProblemPhasor(grid: MultiCircuit, options: RmsOptions, pf_results: PowerFlowResults | None, progress_signal: DummySignal | None = None)[source]ο
Bases:
RmsProblemTemplatePhasor-based DAE (Differential-Algebraic Equation) class.
This class uses phasor representation (Vr, Vi) for voltages instead of polar coordinates (Vm, Va). The phasor representation makes current equations linear and is more suitable for certain analysis.
- Responsibilities:
Store state and algebraic variables (x, y) using phasor representation
Store Jacobian matrices
Store residual equations using phasor-based power flow equations
Store sparsity patterns
Convert between polar (power flow) and phasor (RMS) representations
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- TIME_NAME = 'glob_time'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_NAME = 'vars'ο
- add_device_var(dev: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, var: Var)[source]ο
Associate a variable with a device.
- add_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
add variables and parameters info to the system block
- Parameters:
- Returns:
- Return type:
None
- advance_fmu_cs_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Co-Simulation devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- advance_fmu_me_devices(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], h: float) None[source]ο
Advance imported FMU Model Exchange devices for one RMS communication step.
- Parameters:
t β Current simulation time.
x_snapshot β Current accepted state vector.
h β RMS communication step.
- Returns:
None.
- property algebraic_varsο
- close_fmu_cs_devices() None[source]ο
Release imported FMU Co-Simulation devices after the RMS simulation ends.
- Returns:
None.
- close_fmu_me_devices() None[source]ο
Release imported FMU Model Exchange devices after the RMS simulation ends.
- Returns:
None.
- get_E_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- property get_algebraic_eqsο
- get_device_vars_dict() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
Get dictionary of device variables.
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_init_guess_info() DataFrame[source]ο
Returns a df with uid, name, and initial value for the system variables.
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_next_forced_event_time(t_prev: float, t_target: float)[source]ο
Phasor RMS currently has no forced sub-step events.
- property get_state_eqsο
- get_static_state_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector.
- initialize_fmu_cs_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Co-Simulation devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- initialize_fmu_me_devices(x_snapshot: ndarray[tuple[Any, ...], dtype[float64]], t: float = 0.0) None[source]ο
Initialize imported FMU Model Exchange devices before the RMS time loop starts.
- Parameters:
x_snapshot β Initial accepted state vector.
t β Initial simulation time.
- Returns:
None.
- reset_boundary_update_state(t0: float = 0.0) None[source]ο
Reset runtime event-parameter state to the initial simulation time.
- rhs_algebraic(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_events_group(rms_events_group: RmsEventsGroup)[source]ο
Set the events group to use for this simulation. This filters events by group and recompiles the event parameters function.
- Parameters:
rms_events_group β The RmsEventsGroup to use
- set_init_guess(mdl: Block, reference_powerflow: VarPowerFlowReferenceType, val: float)[source]ο
Add values from powerflow to initial guess.
- property state_varsο
- property uid2idx_varsο
- update(t: float, x: ndarray[tuple[Any, ...], dtype[float64]], params: ndarray[tuple[Any, ...], dtype[float64]]) None[source]ο
Store runtime event parameters for the current Newton step.
- update_variable_params(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]] | None = None, scheduled_t: float | None = None)[source]ο
Update the variable parameters.
- property vars_glob_name2uidο
- VeraGridEngine.Simulations.Rms.problems.rms_problem_phasor.setIi(Ii: ndarray[tuple[Any, ...], dtype[object_]], Ii_used: ndarray[tuple[Any, ...], dtype[bool]], k: int, val: object)[source]ο
Set or add to Ii (imaginary current) value at index k.
- VeraGridEngine.Simulations.Rms.problems.rms_problem_phasor.setIr(Ir: ndarray[tuple[Any, ...], dtype[object_]], Ir_used: ndarray[tuple[Any, ...], dtype[bool]], k: int, val: object)[source]ο
Set or add to Ir (real current) value at index k.
VeraGridEngine.Simulations.Rms.problems.rms_problem_template moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_template.RmsProblemTemplate(progress_signal: DummySignal | None = None, progress_text: DummySignal | None = None)[source]ο
Bases:
ABC- get_E_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_static_state_matrix(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]])[source]ο
- get_vars_info() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
- report_progress2(current: int, total: int)[source]ο
Report progress :param current: current value (zero based) :param total: total value
- rhs_algebraic(values: ndarray[tuple[Any, ...], dtype[float64]], diff_values: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
VeraGridEngine.Simulations.Rms.problems.rms_problem_tensygrid moduleο
- class VeraGridEngine.Simulations.Rms.problems.rms_problem_tensygrid.RmsProblemTensygrid(grid: MultiCircuit, options: RmsOptions, pf_results: PowerFlowResults | None, progress_signal: DummySignal | None = None)[source]ο
Bases:
RmsProblemTemplateDAE (Differential-Algebraic Equation) class to store and manage.
- Responsibilities:
Store state and algebraic variables (x, y)
Store Jacobian matrices
Store residual equations
Store sparsity patterns
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- TIME_NAME = 'glob_time'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_NAME = 'vars'ο
- add_device_var(dev: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, var: Var)[source]ο
Associate a variable with a device :param dev: Device :param var: Variable
- add_variables_to_compilation_dicts(elm: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, mdl: Block)[source]ο
add variables and parameters info to the system block
- Parameters:
- Returns:
- Return type:
None
- property algebraic_varsο
- Returns:
- get_device_vars_dict() Dict[Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement, List[Var]][source]ο
- Returns:
- Return type:
- get_dx(x: ndarray[tuple[Any, ...], dtype[float64]], xn: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- get_init_guess_info() DataFrame[source]ο
returns a df with uid, name, and initial value for the system variables :return: :rtype:
- get_j11(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j12(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j21(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_j22(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], h: float)[source]ο
- get_x0() ndarray[tuple[Any, ...], dtype[float64]][source]ο
Helper function to build the initial vector :return: array matching with the mapping, matching the solver ordering
- rhs_algebraic(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- rhs_state(x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
- set_events_group(rms_events_group: RmsEventsGroup)[source]ο
Set the events group to use for this simulation. This filters events by group and recompiles the event parameters function.
- Parameters:
rms_events_group β The RmsEventsGroup to use
- set_init_guess(mdl: Block, reference_powerflow: VarPowerFlowReferenceType, val: float)[source]ο
add values from powerflow to initial guess
- Parameters:
mdl
reference_powerflow
val
- Returns:
- Return type:
- property state_varsο
- Returns:
- property uid2idx_varsο
- Returns:
- update_variable_params(t: float, x_snapshot: ndarray[tuple[Any, ...], dtype[float64]] | None = None)[source]ο
Update the variable parameters :param t: :return:
- update_variable_params_ts(x: ndarray[tuple[Any, ...], dtype[float64]], t: float)[source]ο
Update the variable parameters :param t: :return:
- property vars_glob_name2uidο
- Returns:
VeraGridEngine.Simulations.Rms.problems.single_block_dae_problem moduleο
- class VeraGridEngine.Simulations.Rms.problems.single_block_dae_problem.SingleBlockDaeProblem(block: Block)[source]ο
Bases:
objectGeneric single-block DAE problem adapter.
This class is shaped like the problem API consumed by implicit RMS solvers, but focuses on one symbolic block and optional externally-driven inputs.
- CONSTANT_PARAMS_NAME = 'cprms'ο
- DIFF_NAME = 'diff'ο
- VARIABLE_PARAMS_NAME = 'vprms'ο
- VARS_NAME = 'vrs'ο
- property algebraic_varsο