VeraGridEngine.Simulations.SmallSignalStabilityRms packageο
Submodulesο
VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver moduleο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.SmallSignalStabilityRmsDriver(grid: MultiCircuit, rms_options: RmsOptions | None = None, sss_options: RmsSmallSignalStabilityOptions | None = None, pf_results: PowerFlowResults | None = None, engine: EngineType = VeraGrid)[source]ο
Bases:
DriverTemplateSmall Signal Stability RMS driver
- assessment_timeο
- integration_methods_dict: dict[DynamicIntegrationMethod, type]ο
- kο
- name = 'Small Signal Stability Simulation'ο
- problemο
- results: SmallSignalStabilityRmsResultsο
- rms_options: RmsOptionsο
- run() None[source]ο
Main function to initialize and run the system simulation.
This function sets up logging, starts the dynamic simulation, and logs the outcome. It handles and logs any exceptions raised during execution. :return:
- run_small_signal_stability() None[source]ο
Performs the numerical integration using the chosen method and the small signal stability assessment. :return:
- sss_options: RmsSmallSignalStabilityOptionsο
- tpe = 'RMS Small Signal stability'ο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.SparseGeneralizedShiftInvertMethods(n_states: int, total_size: int, J_aug_lu, E: spmatrix)[source]ο
Bases:
objectHelper class to hold the matvec and rmatvec operations for the Sparse LinearOperator for generalized eigenvalues.
- Eο
- J_aug_luο
- n_statesο
- total_sizeο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.SparseShiftAndInvertMethods(n_states: int, total_size: int, J_aug_lu: SuperLU)[source]ο
Bases:
objectHelper class to hold the matvec and rmatvec operations for the Sparse LinearOperator.
- matvec(b: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Matrix-vector multiplication.
- Parameters:
b (Vec) β Input vector.
- Returns:
Result vector.
- n_states: intο
- rmatvec(b: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Adjoint matrix-vector multiplication.
- Parameters:
b (Vec) β Input vector.
- Returns:
Result vector.
- total_size: intο
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.compute_damping_ratios_and_frequencies(eigenvalues: ndarray[tuple[Any, ...], dtype[float64]], eig_no_conjugates: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]ο
- Parameters:
eigenvalues β row np array with modes
eig_no_conjugates β row np array with only the positive complex conjugate modes
- Returns:
damping_ratios: list with damping ratios for the positive complex conjugate modes. Nan for other modes
- Returns:
conjugate_frequencies: list with oscillation frequencies for the positive complex conjugate modes. Nan for other modes
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.compute_participation_factors(v: ndarray, w: ndarray) ndarray[source]ο
Calculates normalized participation factors correctly for both dense and sparse. Compatible with strict Numba (without keep dims). :param v: right eigenvectors (columns) - should be complex128 :param w: left eigenvectors (columns) - should be complex128 :return PF_norm: Return normalized participation factors
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.compute_participation_factors_generalized(v: ndarray, w: ndarray, E: ndarray | spmatrix) ndarray[source]ο
Participation factors for generalized eigenproblems A x = lambda E x. Normalization uses w^T E v = 1 per mode.
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.compute_state_matrix(problem: RmsProblemTemplate, x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]]][source]ο
Small Signal Stability analysis state matrix computation. Handles rank-deficient (singular) Jacobian matrices using SVD-based pseudo-inverse. :param problem: RmsProblemTemplate :param x: Vec. Variables value at assessment time :param dx: Vec. Derivatives value at assessment time :return
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.plot_stability(eigenvalues: ndarray[tuple[Any, ...], dtype[float64]], plot_units: str = 'rad/s') None[source]ο
- Parameters:
eigenvalues β row np array with modes
plot_units β string with the imaginary units βrad/sβ or βHzβ
- Returns:
plot S-domain modes
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.run_dense_small_signal_stability(problem: RmsProblemTemplate, x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], verbose: int = 0) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], None][source]ο
Run small signal stability analysis using dense matrices calculations. The operation returns all the eigenvalues. :param problem: RmsProblemTemplate :param x: Vec. Variables value at assessment time :param dx: Vec. Derivatives value at assessment time :param verbose: verbosity :return eigenvalues: Vec. Modes :return participation_factors: Mat. Normalized participation factors :return damping_ratios: Vec. Damping ratios of oscillatory modes. :return conjugate_freq: Vec. Frequency of oscillatory modes. :return A_orig: Mat. Original state matrix
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.run_sparse_small_signal_stability(problem: RmsProblemTemplate, x: ndarray[tuple[Any, ...], dtype[float64]], dx: ndarray[tuple[Any, ...], dtype[float64]], k: int, verbose: int = 0) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], None][source]ο
Run small signal stability analysis using sparse matrices calculations. The operation returns k eigenvalues. :param problem: RmsProblemTemplate :param x: Vec. Variables value at assessment time :param dx: Vec. Derivatives value at assessment time :param k: int. Number of modes to be calculated. k max = N-2 :param verbose: verbosity :return eigenvalues: Vec. Modes :return participation_factors: Mat. Normalized participation factors :return damping_ratios: Vec. Damping ratios of oscillatory modes. :return conjugate_freq: Vec. Frequency of oscillatory modes. :return A_orig: Mat. Original state matrix
- VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_driver.select_eigs_without_conjugates(eigenvalues: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]ο
Select oscillatory modes. Conjugate modes appear only once in the selection. :param eigenvalues: row np array with modes :return: row np array with only the positive complex conjugate modes
VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_options moduleο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_options.RmsSmallSignalStabilityOptions(k: int | None = None, ss_assessment_time: float = 5.0, verbose: int = 0)[source]ο
Bases:
OptionsTemplateSmall Signal Stability RMS simulation options.
- CLASS_NON_EDITABLE_PROPERTIES: Tuple[str, ...] = ('idtag', 'diff_changes')ο
- CLASS_PROPERTIES_WITH_PROFILE: Dict[str, str] = {}ο
- CLASS_PROPERTY_DECLARATIONS: Tuple[GCProp, ...] = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:ss_assessment_time, prop:k, prop:verbose)ο
- CLASS_PROPERTY_LIST: Tuple[GCProp, ...] = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:ss_assessment_time, prop:k, prop:verbose)ο
- CLASS_REGISTERED_PROPERTIES: Dict[str, GCProp] = {'action': prop:action, 'code': prop:code, 'comment': prop:comment, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'k': prop:k, 'name': prop:name, 'rdfid': prop:rdfid, 'ss_assessment_time': prop:ss_assessment_time, 'verbose': prop:verbose}ο
- LOCAL_PROPERTY_DECLARATIONS: Tuple[GCProp, ...] = (prop:ss_assessment_time, prop:k, prop:verbose)ο
- k: int | Noneο
- ss_assessment_time: floatο
- verbose: intο
VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_results moduleο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_results.SPlotInteractionHandler(sc: Any, annot: Any, fig: Any, ax: Any)[source]ο
Bases:
objectHandles interactive annotations and hover events for S-Domain stability plots.
- annot: Anyο
- ax: Anyο
- fig: Anyο
- sc: Anyο
- class VeraGridEngine.Simulations.SmallSignalStabilityRms.small_signal_results.SmallSignalStabilityRmsResults(eigenvalues: ndarray[tuple[Any, ...], dtype[float64]], participation_factors: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], damping_ratios: ndarray[tuple[Any, ...], dtype[float64]], conjugate_frequencies: ndarray[tuple[Any, ...], dtype[float64]], state_matrix: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], stat_vars: List[Var])[source]ο
Bases:
ResultsTemplateSmall-signal Analysis results storage and visualization.
- CLASS_DATA_VARIABLES = {'conjugate_frequencies': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'damping_ratios': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'eigenvalues': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'participation_factors': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'stat_vars_array': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'state_matrix': <VeraGridEngine.Simulations.results_template.ResultsProperty object>}ο
- CLASS_RESULTS_DECLARATIONS = (<VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>)ο
- LOCAL_RESULTS_DECLARATIONS = (<VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>)ο
- conjugate_frequencies: Vecο
- damping_ratios: Vecο
- eigenvalues: Vecο
- mdl(result_type: ResultTypes) ResultsTable[source]ο
Export the results as a ResultsTable for plotting.
- participation_factors: Matο
- stat_vars_array: Vecο
- state_matrix: Matο