VeraGridEngine.Simulations.PowerFlow package

Subpackages

Submodules

VeraGridEngine.Simulations.PowerFlow.grid_analysis module

class VeraGridEngine.Simulations.PowerFlow.grid_analysis.TimeSeriesResultsAnalysis[source]

Bases: object

branch_overload_accumulated
branch_overload_frequency
branches_selected_for_reactance_compensation
bus_over_voltage_accumulated
bus_over_voltage_frequency
bus_under_voltage_accumulated
bus_under_voltage_frequency
buses_selected_for_storage_frequency
grid
res

VeraGridEngine.Simulations.PowerFlow.power_flow_driver module

class VeraGridEngine.Simulations.PowerFlow.power_flow_driver.PowerFlowDriver(grid: MultiCircuit, options: PowerFlowOptions | None = None, opf_results: OptimalPowerFlowResults | None = None, t_idx: int | None = None, engine: EngineType = VeraGrid)[source]

Bases: DriverTemplate

add_report() → None[source]

Add a report of the results (in-place)

convergence_reports
get_steps() → List[str][source]
Returns:

name = 'Power Flow'
opf_results: OptimalPowerFlowResults | None
options: PowerFlowOptions
run() → None[source]

Pack run_pf for the QThread

t_idx: int | None
tpe = 'Power flow'

Power flow wrapper to use with Qt

VeraGridEngine.Simulations.PowerFlow.power_flow_options module

class VeraGridEngine.Simulations.PowerFlow.power_flow_options.PowerFlowOptions(solver_type: SolverType = Newton Raphson, retry_with_other_methods: bool = True, verbose: int = 0, initialize_with_existing_solution: bool = False, tolerance: float = 1e-06, max_iter: int = 25, limit_i_vsc: bool = False, control_q: bool = False, control_taps_modules: bool = True, control_taps_phase: bool = True, control_remote_voltage: bool = True, orthogonalize_controls: bool = True, apply_temperature_correction: bool = True, branch_impedance_tolerance_mode=0, distributed_slack: bool = False, ignore_single_node_islands: bool = False, trust_radius: float = 1.0, backtracking_parameter: float = 0.05, use_stored_guess: bool = False, initialize_angles: bool = False, use_autodiff_jacobian: bool = False, generate_report: bool = False, controls_start_tolerance: float = 0.01)[source]

Bases: OptionsTemplate

Power flow options

CLASS_NON_EDITABLE_PROPERTIES: Tuple[str, ...] = ('idtag', 'selected_to_merge', '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:selected_to_merge, prop:comment, prop:diff_changes, prop:solver_type, prop:retry_with_other_methods, prop:tolerance, prop:controls_start_tolerance, prop:max_iter, prop:limit_i_vsc, prop:control_Q, prop:verbose, prop:initialize_with_existing_solution, prop:control_taps_modules, prop:control_taps_phase, prop:control_remote_voltage, prop:orthogonalize_controls, prop:apply_temperature_correction, prop:branch_impedance_tolerance_mode, prop:distributed_slack, prop:ignore_single_node_islands, prop:trust_radius, prop:backtracking_parameter, prop:use_stored_guess, prop:initialize_angles, prop:use_autodiff_jacobian, prop:generate_report)
CLASS_PROPERTY_LIST: Tuple[GCProp, ...] = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:selected_to_merge, prop:comment, prop:diff_changes, prop:solver_type, prop:retry_with_other_methods, prop:tolerance, prop:controls_start_tolerance, prop:max_iter, prop:limit_i_vsc, prop:control_Q, prop:verbose, prop:initialize_with_existing_solution, prop:control_taps_modules, prop:control_taps_phase, prop:control_remote_voltage, prop:orthogonalize_controls, prop:apply_temperature_correction, prop:branch_impedance_tolerance_mode, prop:distributed_slack, prop:ignore_single_node_islands, prop:trust_radius, prop:backtracking_parameter, prop:use_stored_guess, prop:initialize_angles, prop:use_autodiff_jacobian, prop:generate_report)
CLASS_REGISTERED_PROPERTIES: Dict[str, GCProp] = {'action': prop:action, 'apply_temperature_correction': prop:apply_temperature_correction, 'backtracking_parameter': prop:backtracking_parameter, 'branch_impedance_tolerance_mode': prop:branch_impedance_tolerance_mode, 'code': prop:code, 'comment': prop:comment, 'control_Q': prop:control_Q, 'control_remote_voltage': prop:control_remote_voltage, 'control_taps_modules': prop:control_taps_modules, 'control_taps_phase': prop:control_taps_phase, 'controls_start_tolerance': prop:controls_start_tolerance, 'diff_changes': prop:diff_changes, 'distributed_slack': prop:distributed_slack, 'generate_report': prop:generate_report, 'idtag': prop:idtag, 'ignore_single_node_islands': prop:ignore_single_node_islands, 'initialize_angles': prop:initialize_angles, 'initialize_with_existing_solution': prop:initialize_with_existing_solution, 'limit_i_vsc': prop:limit_i_vsc, 'max_iter': prop:max_iter, 'name': prop:name, 'orthogonalize_controls': prop:orthogonalize_controls, 'rdfid': prop:rdfid, 'retry_with_other_methods': prop:retry_with_other_methods, 'selected_to_merge': prop:selected_to_merge, 'solver_type': prop:solver_type, 'tolerance': prop:tolerance, 'trust_radius': prop:trust_radius, 'use_autodiff_jacobian': prop:use_autodiff_jacobian, 'use_stored_guess': prop:use_stored_guess, 'verbose': prop:verbose}
LOCAL_PROPERTY_DECLARATIONS: Tuple[GCProp, ...] = (prop:solver_type, prop:retry_with_other_methods, prop:tolerance, prop:controls_start_tolerance, prop:max_iter, prop:limit_i_vsc, prop:control_Q, prop:verbose, prop:initialize_with_existing_solution, prop:control_taps_modules, prop:control_taps_phase, prop:control_remote_voltage, prop:orthogonalize_controls, prop:apply_temperature_correction, prop:branch_impedance_tolerance_mode, prop:distributed_slack, prop:ignore_single_node_islands, prop:trust_radius, prop:backtracking_parameter, prop:use_stored_guess, prop:initialize_angles, prop:use_autodiff_jacobian, prop:generate_report)
apply_temperature_correction
backtracking_parameter
branch_impedance_tolerance_mode
control_Q
control_remote_voltage
control_taps_modules
control_taps_phase
controls_start_tolerance
distributed_slack
generate_report
ignore_single_node_islands
initialize_angles
initialize_with_existing_solution
limit_i_vsc
max_iter
orthogonalize_controls
retry_with_other_methods
solver_type
tolerance
trust_radius
use_autodiff_jacobian
use_stored_guess
verbose

VeraGridEngine.Simulations.PowerFlow.power_flow_results module

class VeraGridEngine.Simulations.PowerFlow.power_flow_results.NumericPowerFlowResults(V: ndarray[tuple[Any, ...], dtype[complex128]], Scalc: ndarray[tuple[Any, ...], dtype[complex128]], m: ndarray[tuple[Any, ...], dtype[float64]], tau: ndarray[tuple[Any, ...], dtype[float64]], Sf: ndarray[tuple[Any, ...], dtype[complex128]], St: ndarray[tuple[Any, ...], dtype[complex128]], If: ndarray[tuple[Any, ...], dtype[complex128]], It: ndarray[tuple[Any, ...], dtype[complex128]], loading: ndarray[tuple[Any, ...], dtype[complex128]], losses: ndarray[tuple[Any, ...], dtype[complex128]], Pfp_vsc: ndarray[tuple[Any, ...], dtype[float64]], Pfn_vsc: ndarray[tuple[Any, ...], dtype[float64]], St_vsc: ndarray[tuple[Any, ...], dtype[complex128]], If_vsc: ndarray[tuple[Any, ...], dtype[float64]], It_vsc: ndarray[tuple[Any, ...], dtype[complex128]], losses_vsc: ndarray[tuple[Any, ...], dtype[float64]], loading_vsc: ndarray[tuple[Any, ...], dtype[float64]], Sf_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], St_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], losses_hvdc: ndarray[tuple[Any, ...], dtype[complex128]], loading_hvdc: ndarray[tuple[Any, ...], dtype[float64]], norm_f: float, converged: bool, iterations: int, elapsed: float, Vdc_vsc: ndarray[tuple[Any, ...], dtype[float64]] | None = None)[source]

Bases: object

NumericPowerFlowResults, used to return values from the numerical methods

If
If_vsc
It
It_vsc
Pfn_vsc
Pfp_vsc
Scalc
Sf
Sf_hvdc
St
St_hvdc
St_vsc
V
Vdc_vsc
converged
elapsed
iterations
loading
loading_hvdc
loading_vsc
losses
losses_hvdc
losses_vsc
method
norm_f
tap_angle
tap_module
class VeraGridEngine.Simulations.PowerFlow.power_flow_results.PowerFlowResults(n: int, m: int, n_hvdc: int, n_vsc: int, n_gen: int, n_batt: int, n_sh: int, bus_names: ndarray, branch_names: ndarray, hvdc_names: ndarray, vsc_names: ndarray, gen_names: ndarray, batt_names: ndarray, sh_names: ndarray, bus_types: ndarray, clustering_results=None)[source]

Bases: ResultsTemplate

CLASS_DATA_VARIABLES = {'F': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'If': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'If_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'It': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'It_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pf_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pfn_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pfp_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pt_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Sbus': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Sf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'T': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Vbranch': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Vdc_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'area_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'batt_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'battery_p': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'battery_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'branch_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_area_indices': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_types': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_p': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_F': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_T': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'sh_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'shunt_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'tap_angle': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'tap_module': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'voltage': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_names': <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>, <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>, <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>, <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>, <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>, <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>, <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>)
If: ndarray[tuple[Any, ...], dtype[complex128]]
If_vsc
It: ndarray[tuple[Any, ...], dtype[complex128]]
It_vsc
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>, <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>, <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>, <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>, <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>, <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>, <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>)
Pf_hvdc: ndarray[tuple[Any, ...], dtype[float64]]
Pfn_vsc
Pfp_vsc
Pt_hvdc: ndarray[tuple[Any, ...], dtype[float64]]
Sbus: ndarray[tuple[Any, ...], dtype[complex128]]
Sf: ndarray[tuple[Any, ...], dtype[complex128]]
St: ndarray[tuple[Any, ...], dtype[complex128]]
St_vsc
Vbranch: ndarray[tuple[Any, ...], dtype[complex128]]
Vdc_vsc
apply_from_island(results: NumericPowerFlowResults, b_idx: ndarray, br_idx: ndarray, hvdc_idx: ndarray, vsc_idx: ndarray) → None[source]

Apply results from another island circuit to the circuit results represented here. :param results: NumericPowerFlowResults from an island circuit :param b_idx: bus original indices :param br_idx: branch original indices :param hvdc_idx: hvdc original indices :param vsc_idx: vsc original indices :return: None

apply_new_rates(nc: NumericalCircuit)[source]
Parameters:

nc

Returns:

batt_names
battery_p: ndarray[tuple[Any, ...], dtype[float64]]
battery_q: ndarray[tuple[Any, ...], dtype[float64]]
branch_names: ndarray[tuple[Any, ...], dtype[str_]]
bus_names: ndarray[tuple[Any, ...], dtype[str_]]
bus_types: ndarray[tuple[Any, ...], dtype[int64]]
compare(other: PowerFlowResults, tol=1e-06) → Tuple[bool, Logger][source]

Compare this results with another :param other: PowerFlowResults :param tol: absolute comparison tolerance :return: all ok?, Logger

property converged

Check if converged in all modes :return: True / False

convergence_reports: List[ConvergenceReport]
property elapsed

Check if converged in all modes :return: True / False

property error

Check if converged in all modes :return: True / False

export_all()[source]

Exports all the results to DataFrames.

Returns:

Bus results, Branch reuslts

gen_names
gen_p: ndarray[tuple[Any, ...], dtype[float64]]
gen_q: ndarray[tuple[Any, ...], dtype[float64]]
get_branch_df() → DataFrame[source]

Get a DataFrame with the branches results :return: DataFrame, Pf in MW, Qf in MVAr, Pt in MW, Qt in MVAr, loading in %, Ploss in MW, Qloss in MVAr

get_bus_df() → DataFrame[source]

Get a DataFrame with the buses results :return: DataFrame, Vm in p.u., Va in deg, P in MW, Q in MVAr

get_current_df()[source]
get_overload_score(branch_prices: ndarray[tuple[Any, ...], dtype[float64]])[source]

Compute the cost of overload :param branch_prices: array of branch prices :return:

get_report_dataframe(island_idx=0)[source]

Get a DataFrame containing the convergence report.

Arguments:

island_idx: (optional) island index

Returns:

DataFrame

get_voltage_df()[source]
hvdc_names: ndarray[tuple[Any, ...], dtype[str_]]
property iterations

Check if converged in all modes :return: True / False

loading: ndarray[tuple[Any, ...], dtype[complex128]]
loading_hvdc: ndarray[tuple[Any, ...], dtype[float64]]
loading_vsc
losses: ndarray[tuple[Any, ...], dtype[complex128]]
losses_hvdc: ndarray[tuple[Any, ...], dtype[float64]]
losses_vsc
mdl(result_type: ResultTypes) → ResultsTable[source]

get the ResultsTable model :param result_type: ResultTypes :return: ResultsTable instance

plot_bars_limit: int
sh_names
shunt_q: ndarray[tuple[Any, ...], dtype[float64]]
tap_angle: ndarray[tuple[Any, ...], dtype[float64]]
tap_module: ndarray[tuple[Any, ...], dtype[float64]]
voltage: ndarray[tuple[Any, ...], dtype[complex128]]
vsc_names: ndarray[tuple[Any, ...], dtype[str_]]

VeraGridEngine.Simulations.PowerFlow.power_flow_ts_driver module

class VeraGridEngine.Simulations.PowerFlow.power_flow_ts_driver.PowerFlowTimeSeriesDriver(grid: MultiCircuit, options: PowerFlowOptions | None = None, time_indices: ndarray[tuple[Any, ...], dtype[int64]] | None = None, opf_time_series_results=None, clustering_results: ClusteringResults | None = None, engine: EngineType = VeraGrid)[source]

Bases: TimeSeriesDriverTemplate

name = 'Power flow time series'
opf_time_series_results
options
run()[source]

Run the time series simulation @return:

run_gslv(time_indices=None) → PowerFlowTimeSeriesResults[source]

Run with GSLV :param time_indices: array of time indices :return:

run_single_thread(time_indices) → PowerFlowTimeSeriesResults[source]

Run single thread time series :param time_indices: array of time indices to consider :return: TimeSeriesResults instance

tpe = 'Power flow time series'

VeraGridEngine.Simulations.PowerFlow.power_flow_ts_input module

class VeraGridEngine.Simulations.PowerFlow.power_flow_ts_input.PowerFlowTimeSeriesInput(s_profile: DataFrame = None, i_profile: DataFrame = None, y_profile: DataFrame = None)[source]

Bases: object

I
Iprof
S
Sprof
Y
Yprof
compile()[source]

Generate time-consistent arrays @return:

copy()[source]
get_at(t)[source]

Returns the necessary values @param t: time index @return:

get_from_buses(bus_idx)[source]

@param bus_idx: @return:

time_array
valid

VeraGridEngine.Simulations.PowerFlow.power_flow_ts_results module

class VeraGridEngine.Simulations.PowerFlow.power_flow_ts_results.PowerFlowTimeSeriesResults(n: int, m: int, n_hvdc: int, n_vsc: int, bus_names: ndarray[tuple[Any, ...], dtype[str_]], branch_names: ndarray[tuple[Any, ...], dtype[str_]], hvdc_names: ndarray[tuple[Any, ...], dtype[str_]], vsc_names: ndarray[tuple[Any, ...], dtype[str_]], time_array: DatetimeIndex, bus_types: ndarray[tuple[Any, ...], dtype[int64]], n_gen: int, n_batt: int, n_sh: int, gen_names: ndarray[tuple[Any, ...], dtype[str_]], batt_names: ndarray[tuple[Any, ...], dtype[str_]], sh_names: ndarray[tuple[Any, ...], dtype[str_]], area_names: ndarray[tuple[Any, ...], dtype[str_]], clustering_results: ClusteringResults | None = None)[source]

Bases: ResultsTemplate

CLASS_DATA_VARIABLES = {'F': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'If': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'If_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'It': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'It_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pf_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Pfn_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'S': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Sf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'T': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Vbranch': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'area_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'batt_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'battery_p': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'battery_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'branch_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_area_indices': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_types': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'converged_values': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'error_values': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_p': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'gen_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_F': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_Pf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_Pt': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_T': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_losses': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'sh_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'shunt_q': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'tap_angle': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'tap_module': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'time_array': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'voltage': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_names': <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>, <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>, <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>, <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>, <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>, <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>, <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>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>)
If: ndarray[tuple[Any, ...], dtype[complex128]]
If_vsc
It: ndarray[tuple[Any, ...], dtype[complex128]]
It_vsc
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>, <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>, <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>, <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>, <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>, <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>, <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>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>, <VeraGridEngine.Simulations.results_template.ResultsProperty object>)
Pf_vsc
Pfn_vsc
S
Sf
St
St_vsc
Vbranch
apply_new_time_series_rates(nc: NumericalCircuit) → None[source]

Recompute the loading with new rates

Parameters:

nc – NumericalCircuit instance.

batt_names: ndarray[tuple[Any, ...], dtype[str_]]
battery_p
battery_q
branch_names: ndarray[tuple[Any, ...], dtype[str_]]
bus_names: ndarray[tuple[Any, ...], dtype[str_]]
bus_types: ndarray[tuple[Any, ...], dtype[int64]]
converged_values
error_values
fill_circuit_info(grid: MultiCircuit) → None[source]
Parameters:

grid

Returns:

gen_names: ndarray[tuple[Any, ...], dtype[str_]]
gen_p
gen_q
get_branch_values_per_area(branch_values: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]]) → ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]][source]
Parameters:

branch_values

Returns:

get_bus_values_per_area(bus_values: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]]) → ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]][source]

Aggregate bus-related time-series values per area.

Parameters:

bus_values – Time-series bus values with shape (nt, nbus).

Returns:

Area-aggregated values with shape (nt, n_area).

get_hvdc_values_per_area(hvdc_values: ndarray)[source]
Parameters:

hvdc_values

Returns:

get_inter_area_flows()[source]
Returns:

get_ordered_area_names()[source]
Returns:

hvdc_Pf
hvdc_Pt
hvdc_loading
hvdc_losses
hvdc_names: ndarray[tuple[Any, ...], dtype[str_]]
loading
loading_vsc
losses
losses_vsc
mdl(result_type: ResultTypes) → ResultsTable[source]
Parameters:

result_type

Returns:

static merge_if(df, arr, ind, cols)[source]

@param df: @param arr: @param ind: @param cols: @return:

set_at(t: int, results: PowerFlowResults) → None[source]

Store one snapshot power-flow solution into a time position.

Parameters:
  • t – Time index.

  • results – Snapshot power-flow results.

sh_names: ndarray[tuple[Any, ...], dtype[str_]]
shunt_q
tap_angle: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]]
tap_module: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]]
to_json(fname)[source]

Export as json

voltage
vsc_names: ndarray[tuple[Any, ...], dtype[str_]]

VeraGridEngine.Simulations.PowerFlow.power_flow_worker module

VeraGridEngine.Simulations.PowerFlow.power_flow_worker.multi_island_pf(multi_circuit: MultiCircuit, options: PowerFlowOptions, opf_results: VALID_OPF_RESULTS | None = None, t: Union[int, None] = None, logger: Logger = <VeraGridEngine.basic_structures.Logger object>, bus_dict: Union[Dict[Bus, int], None] = None, areas_dict: Union[Dict[Area, int], None] = None) → PowerFlowResults[source]

Multiple islands power flow (this is the most generic power flow function) :param multi_circuit: MultiCircuit instance :param options: PowerFlowOptions instance :param opf_results: OPF results, to be used if not None :param t: time step, if None, the snapshot is compiled :param logger: list of events to add to :param bus_dict: Dus object to index dictionary :param areas_dict: Area to area index dictionary :return: PowerFlowResults instance

VeraGridEngine.Simulations.PowerFlow.power_flow_worker.multi_island_pf_nc(nc: NumericalCircuit, options: PowerFlowOptions, logger: Logger | None = None, V_guess: ndarray[tuple[Any, ...], dtype[complex128]] | None = None, Sbus_input: ndarray[tuple[Any, ...], dtype[complex128]] | None = None) → PowerFlowResults[source]

Multiple islands power flow (this is the most generic power flow function) :param nc: SnapshotData instance :param options: PowerFlowOptions instance :param logger: logger :param V_guess: voltage guess :param Sbus_input: Use this power injections if provided (in p.u.) :return: PowerFlowResults instance

VeraGridEngine.Simulations.PowerFlow.power_flow_worker.voltage_guess_is_usable(V: ndarray[tuple[Any, ...], dtype[complex128]]) → bool[source]

Check whether a voltage guess can safely seed nonlinear sparse solvers.

Parameters:

V – Voltage vector.

Returns:

True if the voltage vector is finite and numerically bounded.

Module contents