VeraGridEngine.Simulations.NTC package

Submodules

VeraGridEngine.Simulations.NTC.ntc_driver module

class VeraGridEngine.Simulations.NTC.ntc_driver.OptimalNetTransferCapacityDriver(grid: MultiCircuit, options: OptimalNetTransferCapacityOptions)[source]

Bases: DriverTemplate

all_solved
get_steps() List[int][source]

Get time steps list of strings

name = 'Optimal net transfer capacity'
opf() OptimalNetTransferCapacityResults[source]

Run a power flow for every circuit @return: OptimalPowerFlowResults object

options: OptimalNetTransferCapacityOptions
run() None[source]

Run this study

tpe = 'Optimal net transfer capacity'

VeraGridEngine.Simulations.NTC.ntc_opf module

This file implements a DC-OPF for time series That means that solves the OPF problem for a complete time series at once

class VeraGridEngine.Simulations.NTC.ntc_opf.BatteryVars(nt: int, n_elm: int)[source]

Bases: GenerationVars

struct extending the generation vars to handle the battery vars

get_values(Sbase: float, model: PulpLpModel | None) BatteryVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: BatteryVars

class VeraGridEngine.Simulations.NTC.ntc_opf.BranchNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the branch related vars

add_contingency_flow(t: int, m: int, c: int, flow_var: float | LpVariable | None | LpAffineExpression, neg_slack: LpVariable | None, pos_slack: LpVariable | None)[source]

Add contingency flow :param t: time index :param m: monitored index :param c: contingency group index :param flow_var: flow var :param neg_slack: negative flow slack variable :param pos_slack: positive flow slack variable

get_total_flow_slack()[source]

Get total flow slacks :return:

get_values(Sbase: float, model: PulpLpModel | None) BranchNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :param Sbase: :param model: :return: BranchVars

class VeraGridEngine.Simulations.NTC.ntc_opf.BusNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the bus related vars

get_values(Sbase: float, model: PulpLpModel | None) BusNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: BusVars

class VeraGridEngine.Simulations.NTC.ntc_opf.GenerationVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the generation vars

get_values(Sbase: float, model: PulpLpModel | None) GenerationVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :param Sbase: Base power (100 MVA) :param model: LpModel :return: GenerationVars

class VeraGridEngine.Simulations.NTC.ntc_opf.HvdcNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the generation vars

get_values(Sbase: float, model: PulpLpModel | None) HvdcNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: HvdcVars

class VeraGridEngine.Simulations.NTC.ntc_opf.LoadVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the load related vars

get_values(Sbase: float, model: PulpLpModel | None) LoadVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: LoadVars

class VeraGridEngine.Simulations.NTC.ntc_opf.NtcVars(nt: int, nbus: int, ng: int, nb: int, nl: int, nbr: int, n_hvdc: int, n_vsc: int, model: PulpLpModel | None)[source]

Bases: object

Structure to host the opf variables

check_kirchhoff(tol: float = 1e-10)[source]
Parameters:

tol

get_values(Sbase: float, model: PulpLpModel | None) NtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :param Sbase :param model: :return: OpfVars instance

get_voltages() ndarray[tuple[Any, ...], dtype[complex128]][source]
Returns:

class VeraGridEngine.Simulations.NTC.ntc_opf.VscNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the VSC vars

get_values(Sbase: float, model: PulpLpModel | None) VscNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: HvdcVars

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_branches_contingencies_formulation(t_idx: int, Sbase: float, branch_data_t: PassiveBranchData, branch_vars: BranchNtcVars, bus_vars: BusNtcVars, hvdc_vars: HvdcNtcVars, vsc_vars: VscNtcVars, prob: PulpLpModel | None, linear_multi_contingencies: LinearMultiContingencies, monitor_only_ntc_load_rule_branches: bool, monitor_only_sensitive_branches: bool, structural_ntc: float, ntc_load_rule: float, alpha_threshold: float, alpha_n1: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]], base_loading: ndarray[tuple[Any, ...], dtype[float64]], con_loading: ndarray[tuple[Any, ...], dtype[float64]], logger: Logger)[source]

Formulate the branches :param t_idx: time index :param Sbase: base power (100 MVA) :param branch_data_t: BranchData :param branch_vars: BranchVars :param bus_vars: BusVars :param hvdc_vars: HvdcNtcVars :param vsc_vars: VscNtcVars :param prob: OR problem :param linear_multi_contingencies: LinearMultiContingencies :param monitor_only_ntc_load_rule_branches: :param monitor_only_sensitive_branches: :param structural_ntc: :param ntc_load_rule: :param alpha_threshold: :param alpha_n1: :param base_loading: loading w.r.t the normal ratings :param con_loading: Loading w.r.t the contingency rates :param logger :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_branches_formulation(t_idx: int, Sbase: float, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, branch_vars: BranchNtcVars, bus_vars: BusNtcVars, prob: PulpLpModel | None, monitor_only_sensitive_branches: bool, monitor_only_ntc_load_rule_branches: bool, alpha: ndarray[tuple[Any, ...], dtype[float64]], alpha_threshold: float, structural_ntc: float, ntc_load_rule: float, loading: ndarray[tuple[Any, ...], dtype[float64]], logger: Logger, inf=1e+20) LpAffineExpression | None[source]

Formulate the branches :param t_idx: time index :param Sbase: base power (100 MVA) :param branch_data_t: BranchData :param branch_vars: BranchVars :param active_branch_data_t: :param bus_vars: BusVars :param prob: OR problem :param monitor_only_ntc_load_rule_branches: :param monitor_only_sensitive_branches: :param alpha: Array of branch sensitivity to the exchange :param alpha_threshold: Threshold for sensitivity consideration :param structural_ntc :param ntc_load_rule :param loading :param logger :param inf: number considered infinite :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_hvdc_formulation(t_idx: int, Sbase: float, hvdc_data_t: HvdcData, hvdc_vars: HvdcNtcVars, vars_bus: BusNtcVars, prob: PulpLpModel | None, logger: Logger, saturate: bool = True)[source]
Parameters:
  • t_idx

  • Sbase

  • hvdc_data_t

  • hvdc_vars

  • vars_bus

  • prob

  • logger

  • saturate

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_injections_formulation(t: int | None, Sbase: float, gen_data_t: GeneratorData, batt_data_t: BatteryData, load_data_t: LoadData, bus_data_t: BusData, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, hvdc_data_t: HvdcData, bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]], transfer_method: AvailableTransferMode, skip_generation_limits: bool, ntc_vars: NtcVars, prob: PulpLpModel | None, logger: Logger)[source]

Add MIP injections formulation :param t: time step :param Sbase: base power (100 MVA) :param gen_data_t: GeneratorData structure :param batt_data_t: BatteryData structure :param load_data_t: LoadData structure :param bus_data_t: BusData structure :param branch_data_t: :param active_branch_data_t: :param hvdc_data_t: :param bus_a1_idx: bus indices within area β€œfrom” :param bus_a2_idx: bus indices within area β€œto” :param transfer_method: Exchange transfer method :param skip_generation_limits: Skip generation limits? :param ntc_vars: MIP variables structure :param prob: MIP problem :param logger: logger instance :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_node_balance(t_idx: int, vd: ndarray[tuple[Any, ...], dtype[int64]], bus_data: BusData, bus_vars: BusNtcVars, prob: PulpLpModel | None, logger: Logger)[source]

Add the kirchhoff nodal equality :param t_idx: time step :param vd: Array of slack indices :param bus_data: BusData :param bus_vars: BusVars :param prob: LpModel :param logger: Logger

VeraGridEngine.Simulations.NTC.ntc_opf.add_linear_vsc_formulation(t_idx: int, Sbase: float, vsc_data_t: VscData, vsc_vars: VscNtcVars, bus_vars: BusNtcVars, prob: PulpLpModel | None, logger: Logger, saturate: bool = True)[source]
Parameters:
  • t_idx

  • Sbase

  • vsc_data_t

  • vsc_vars

  • bus_vars

  • bus_vars

  • prob

  • logger

  • saturate

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf.formulate_hvdc_Pmode3_single_flow(solver: PulpLpModel | None, active, P0, rate, Sbase, angle_droop, angle_max_f, angle_max_t, suffix, angle_f, angle_t, inf)[source]

Formulate the HVDC flow :param solver: Solver instance to which add the equations :param rate: HVDC rate :param P0: Power offset for HVDC :param angle_f: bus voltage angle node from (LP Variable) :param angle_t: bus voltage angle node to (LP Variable) :param angle_max_f: maximum bus voltage angle node from (LP Variable) :param angle_max_t: maximum bus voltage angle node to (LP Variable) :param active: Boolean. HVDC active status (True / False) :param angle_droop: Flow multiplier constant (MW/decimal degree). :param Sbase: Base power (i.e. 100 MVA) :param suffix: suffix to add to the constraints names. :param inf: Value representing the infinite (i.e. 1e20) :return:

  • flow_f: Array of formulated HVDC flows (mix of values and variables)

VeraGridEngine.Simulations.NTC.ntc_opf.formulate_lp_abs_value(prob: PulpLpModel | None, lp_var: LpVariable | None, ub: float, M: float, name: str)[source]

Generic function to compute lp abs variable :param prob: lp solver instance :param lp_var: variable to make abs :param ub: variable upper bound :param M: float value represents infinity :param name: variable name :return: abs variable, boolean to define sense

VeraGridEngine.Simulations.NTC.ntc_opf.formulate_lp_piece_wise(solver: PulpLpModel | None, lp_var: float | LpVariable | None, higher_exp: float | LpAffineExpression | None | LpVariable, lower_exp: float | LpAffineExpression | None | LpVariable, condition: float | LpAffineExpression | None | LpVariable, name: str, M: float)[source]

Generic function to implement piece wise linear function :param solver: lp solver instance :param lp_var: output variable :param higher_exp: expresion when condition >= 0 :param lower_exp: expresion when condition <= 0 :param condition: bounding condition :param name: output variable name :param M: Value representing the infinite (i.e. 1e20) :return: lp_var, boolean indicating condition behavior

VeraGridEngine.Simulations.NTC.ntc_opf.formulate_monitorization_logic(monitor_only_sensitive_branches: bool, monitor_only_ntc_load_rule_branches: bool, monitor_loading: ndarray[tuple[Any, ...], dtype[bool]], alpha: ndarray[tuple[Any, ...], dtype[float64]], alpha_n1: ndarray[tuple[Any, ...], dtype[float64]], branch_sensitivity_threshold: float, base_flows: ndarray[tuple[Any, ...], dtype[float64]], structural_ntc: float, ntc_load_rule: float, rates: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[ndarray[tuple[Any, ...], dtype[bool]], ndarray[tuple[Any, ...], dtype[object_]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Function to formulate branch monitor status due the given logic :param monitor_only_sensitive_branches: boolean to apply sensitivity threshold to the monitorization logic. :param monitor_only_ntc_load_rule_branches: boolean to apply ntc load rule to the monitorization logic. :param monitor_loading: Array of branch monitor loading status given by the user (True / False) :param alpha: Array of branch sensitivity to the exchange in n condition :param alpha_n1: Array of branch sensitivity to the exchange in n-1 condition :param branch_sensitivity_threshold: branch sensitivity to the exchange threshold :param base_flows: branch base flows :param structural_ntc: Maximum NTC available by thermal interconnection rates. :param ntc_load_rule: percentage of loading reserved to exchange flow (Clean Energy Package rule by ACER). :param rates: array of branch rates return:

  • monitor: Array of final monitor status per branch after applying the logic

  • monitor_type: monitor type chosen depending on the rules

  • branch_ntc_load_rule: branch minimum ntc to be considered as limiting element

  • branch_zero_exchange_load: branch load for zero exchange situation.

VeraGridEngine.Simulations.NTC.ntc_opf.get_base_power(Sbase: float, gen_data_t: GeneratorData, batt_data_t: BatteryData, load_data_t: LoadData, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, hvdc_data_t: HvdcData, logger: Logger) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the perfectly balanced base power :param Sbase: :param gen_data_t: :param batt_data_t: :param load_data_t: :param branch_data_t :param active_branch_data_t :param logger: :return:

VeraGridEngine.Simulations.NTC.ntc_opf.get_exchange_proportions(power: ndarray[tuple[Any, ...], dtype[float64]], bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger, decimals: int)[source]

Get generation proportions by transfer method with sign consideration. :param power: Vec. Power reference :param bus_a1_idx: bus indices within area 1 :param bus_a2_idx: bus indices within area 2 :param logger: logger instance :param decimals: Number of decimals to round to :return: proportions (rounded)

VeraGridEngine.Simulations.NTC.ntc_opf.get_sensed_proportions(power: ndarray[tuple[Any, ...], dtype[float64]], idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger) ndarray[tuple[Any, ...], dtype[float64]][source]
Parameters:
  • power

  • idx

  • logger

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf.get_transfer_power_scaling_per_bus(bus_data_t: BusData, gen_data_t: GeneratorData, load_data_t: LoadData, transfer_method: AvailableTransferMode, skip_generation_limits: bool, inf_value: float, Sbase: float) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Get nodal power, nodal pmax and nodal pmin according to the transfer_method. :param bus_data_t: BusData structure :param gen_data_t: GenData structure :param load_data_t: LoadData structure :param transfer_method: Exchange transfer method :param skip_generation_limits: Skip generation limits? :param inf_value: infinity value. Ex 1e-20 :param Sbase: base power (100 MVA) :return: nodal power (p.u.), pmax (p.u.), pmin(p.u.)

VeraGridEngine.Simulations.NTC.ntc_opf.pmode3_formulation(prob, t_idx, m, rate, P0, droop, theta_f, theta_t)[source]

Formulation

  1. Region selector:

    z_neg + z_mid + z_pos == 1

  2. Linear flow equation:

    flow_lin == P0 + k * (theta_f - theta_t)

  3. Lower region: flow = -rate if z_neg == 1

    flow <= -rate + M * (1 - z_neg) flow >= -rate - M * (1 - z_neg) flow_lin <= -rate + M * (1 - z_neg)

  4. Mid region: flow = flow_lin if z_mid == 1

    flow <= flow_lin + M * (1 - z_mid) flow >= flow_lin - M * (1 - z_mid) flow_lin <= rate - epsilon + M * (1 - z_mid) flow_lin >= -rate + epsilon - M * (1 - z_mid)

  5. Upper region: flow = rate if z_pos == 1

    flow <= rate + M * (1 - z_pos) flow >= rate - M * (1 - z_pos) flow_lin >= rate - M * (1 - z_pos)

VeraGridEngine.Simulations.NTC.ntc_opf.pmode3_formulation2(prob, t_idx, m, rate, P0, droop, theta_f, theta_t, base_name: str = 'hvdc')[source]

Formulation

Variables:

flow continuous flow_lin continuous z1 binary z2 binary

Constraints:

pmode3_eq: flow_lin = P0 + k * (th_f - th_t)

upper_bound_flow_le: flow <= rate + M * z1 upper_bound_flowlin_le: flow_lin - rate <= M * (1 - z1) upper_bound_flow_ge: flow >= rate - M * (1 - z1)

lower_bound_flow_ge: flow >= -rate - M * z2 lower_bound_flowlin_ge: -rate - flow_lin <= M * (1 - z2) lower_bound_flow_le: flow <= -rate + M * (1 - z2)

intermediate_flow_le: flow <= flow_lin + M * (z1 + z2) intermediate_flow_ge: flow >= flow_lin - M * (z1 + z2) intermediate_always_true: 1 - z1 - z2 <= 1

single_case_active: z1 + z2 <= 1

VeraGridEngine.Simulations.NTC.ntc_opf.pmode3_formulation3(prob, t_idx, m, rate, P0, droop, theta_f, theta_t, base_name: str = 'hvdc')[source]

Formulation

Variables:

flow continuous flow_lin continuous z1 binary z2 binary

Constraints:

pmode3_eq: flow_lin = P0 + k * (th_f - th_t)

upper_bound_flow_le: flow <= rate + M * (1 - z1) # (less or equal) upper_bound_flow_ge: flow >= rate - M * (1 - z1) # (greater or equal)

lower_bound_flow_le: flow <= -rate + M * (1 - z2) lower_bound_flow_ge: flow >= -rate - M * (1 - z2)

droop_active_le: flow_lin - (P0 + k*(th_f - th_t)) <= M * (z1 + z2) droop_active_ge: flow_lin - (P0 + k*(th_f - th_t)) >= -M * (z1 + z2)

flow_match_le: flow - flow_lin <= M * (z1 + z2) flow_match_ge: flow - flow_lin >= -M * (z1 + z2)

single_case_active: z1 + z2 <= 1

Note that we add M for the so-called big M disjunction, to virtually remove conditionals There is no hard rule to determine the value of M. However, something like 6 * rate is a good starting point. 2 * rate is too small, and 10 * rate is too large.

VeraGridEngine.Simulations.NTC.ntc_opf.pmode3_formulation_convex_hull(prob, t_idx, m, rate, P0, droop, theta_f, theta_t, f_obj, dtheta_max=1.57, base_name: str = 'hvdc')[source]

Convex-hull (Balas) formulation for HVDC Pmode3.

There are three areas, mutually exclusive, only one can be active: - Droop (central): flow = g, where g = P0 + k * (theta_f - theta_t) - Upper sat: flow = +rate - Lower sat: flow = -rate

Variables: flow continuous between -rate and +rate g continuous, g = P0 + k * (th_f - th_t) lam_d binary (droop region) lam_u binary (upper saturation) lam_l binary (lower saturation) f_d continuous droop component of flow f_u continuous upper-sat component of flow f_l continuous lower-sat component of flow g_d continuous disaggregated copy of g used only in droop set

Constraints: region_sum_eq: lam_d + lam_u + lam_l = 1 droop_eq: g = P0 + k * (th_f - th_t) flow_decomp_eq: flow = f_d + f_u + f_l upper_sat_eq: f_u = +rate * lam_u lower_sat_eq: f_l = -rate * lam_l droop_comp_flow_link: f_d = g_d

Disaggregated box for g_d (scaled by lam_d) g_d_box_le: g_d <= gU * lam_d g_d_box_ge: g_d >= gL * lam_d

Convex-hull link: droop_link_hull_le: g_d - g <= gU * (1 - lam_d) droop_link_hull_ge: g_d - g >= gL * (1 - lam_d)

  • No explicit constraints on (theta_f - theta_t) are added.

  • The parameters gL,gU are used only to bound the droop value (g_d) tightly.

VeraGridEngine.Simulations.NTC.ntc_opf.pmode3_formulation_impr(prob, t_idx, m, rate, P0, droop, theta_f, theta_t, base_name: str = 'hvdc')[source]

Formulation for HVDC link with three operating regions using big-M and binary variables.

VeraGridEngine.Simulations.NTC.ntc_opf.run_linear_ntc_opf(grid: ~VeraGridEngine.Devices.multi_circuit.MultiCircuit, t: int | None, solver_type: ~VeraGridEngine.enumerations.MIPSolvers = HIGHS, zonal_grouping: ~VeraGridEngine.enumerations.ZonalGrouping = No grouping, skip_generation_limits: bool = False, consider_contingencies: bool = False, contingency_groups_used: ~typing.List[~VeraGridEngine.Devices.Events.contingency_group.ContingencyGroup] = (), alpha_threshold: float = 0.001, lodf_threshold: float = 0.001, bus_a1_idx: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.int64]] | None = None, bus_a2_idx: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.int64]] | None = None, transfer_method: ~VeraGridEngine.enumerations.AvailableTransferMode = InstalledPower, monitor_only_sensitive_branches: bool = True, monitor_only_ntc_load_rule_branches: bool = False, ntc_load_rule: float = 0.7, logger: ~VeraGridEngine.basic_structures.Logger = <VeraGridEngine.basic_structures.Logger object>, progress_text: None | ~typing.Callable[[str], None] = None, progress_func: None | ~typing.Callable[[float], None] = None, verbose: int = 0, robust: bool = False, mip_framework: ~VeraGridEngine.enumerations.MIPFramework = PuLP) Tuple[NtcVars, PulpLpModel | None][source]
Parameters:
  • grid – MultiCircuit instance

  • t – Time indices (in the general scheme)

  • solver_type – MIP solver to use

  • zonal_grouping – Zonal grouping?

  • skip_generation_limits – Skip the generation limits?

  • consider_contingencies – Consider the contingencies?

  • contingency_groups_used – List of contingency groups to simulate

  • alpha_threshold – threshold to consider the exchange sensitivity

  • lodf_threshold – threshold to consider LODF sensitivities

  • bus_a1_idx – array of bus indices in the area 1

  • bus_a2_idx – array of bus indices in the area 2

  • transfer_method – AvailableTransferMode

:param monitor_only_sensitive_branches :param monitor_only_ntc_load_rule_branches :param ntc_load_rule: Amount of exchange branches power that should be dedicated to exchange :param logger: logger instance :param progress_text: function to report text messages :param progress_func: function to report progress :param verbose: Verbosity level :param robust: Robust optimization? :param mip_framework: MIPFramework to use :return: NtcVars class with the results

VeraGridEngine.Simulations.NTC.ntc_opf_strict module

This file implements a DC-OPF for time series That means that solves the OPF problem for a complete time series at once

class VeraGridEngine.Simulations.NTC.ntc_opf_strict.BranchNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the branch related vars

add_contingency_flow(t: int, m: int, c: int, flow_var: float | LpVariable | None | LpAffineExpression)[source]

Add contingency flow :param t: time index :param m: monitored index :param c: contingency group index :param flow_var: flow var :param neg_slack: negative flow slack variable :param pos_slack: positive flow slack variable

get_values(Sbase: float, model: None) BranchNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :param Sbase: :param model: :return: BranchVars

class VeraGridEngine.Simulations.NTC.ntc_opf_strict.BusNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the bus related vars

get_values(Sbase: float, model: None) BusNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: BusVars

class VeraGridEngine.Simulations.NTC.ntc_opf_strict.HvdcNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the generation vars

get_values(Sbase: float, model: None) HvdcNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: HvdcVars

class VeraGridEngine.Simulations.NTC.ntc_opf_strict.NtcVars(nt: int, nbus: int, ng: int, nb: int, nl: int, nbr: int, n_hvdc: int, n_vsc: int, model: None)[source]

Bases: object

Structure to host the opf variables

check_kirchhoff(tol: float = 1e-10)[source]
get_values(Sbase: float, model: None) NtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :param Sbase :param model: :return: OpfVars instance

get_voltages() ndarray[tuple[Any, ...], dtype[complex128]][source]
Returns:

class VeraGridEngine.Simulations.NTC.ntc_opf_strict.VscNtcVars(nt: int, n_elm: int)[source]

Bases: object

Struct to store the VSC vars

get_values(Sbase: float, model: None) VscNtcVars[source]

Return an instance of this class where the arrays content are not LP vars but their value :return: HvdcVars

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_branches_contingencies_formulation(t_idx: int, Sbase: float, branch_data_t: PassiveBranchData, branch_vars: BranchNtcVars, bus_vars: BusNtcVars, hvdc_vars: HvdcNtcVars, vsc_vars: VscNtcVars, prob: None, linear_multi_contingencies: LinearMultiContingencies, monitor_only_ntc_load_rule_branches: bool, monitor_only_sensitive_branches: bool, structural_ntc: float, ntc_load_rule: float, alpha_threshold: float, alpha_n1_abs: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]])[source]

Formulate the branches :param t_idx: time index :param Sbase: base power (100 MVA) :param branch_data_t: BranchData :param branch_vars: BranchVars :param bus_vars: BusVars :param hvdc_vars: HvdcNtcVars :param vsc_vars: VscNtcVars :param prob: OR problem :param linear_multi_contingencies: LinearMultiContingencies :param monitor_only_ntc_load_rule_branches: :param monitor_only_sensitive_branches: :param structural_ntc: :param ntc_load_rule: :param alpha_threshold: :param alpha_n1_abs: :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_branches_formulation(t_idx: int, Sbase: float, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, branch_vars: BranchNtcVars, bus_vars: BusNtcVars, prob: None, monitor_only_sensitive_branches: bool, monitor_only_ntc_load_rule_branches: bool, alpha: ndarray[tuple[Any, ...], dtype[float64]], alpha_threshold: float, structural_ntc: float, ntc_load_rule: float, inf=1e+20) LpAffineExpression | None[source]

Formulate the branches :param t_idx: time index :param Sbase: base power (100 MVA) :param branch_data_t: BranchData :param branch_vars: BranchVars :param active_branch_data_t: :param bus_vars: BusVars :param prob: OR problem :param monitor_only_ntc_load_rule_branches: :param monitor_only_sensitive_branches: :param alpha: Array of branch sensitivity to the exchange :param alpha_threshold: Threshold for sensitivity consideration :param structural_ntc :param ntc_load_rule :param inf: number considered infinite :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_hvdc_formulation(t_idx: int, Sbase: float, hvdc_data_t: HvdcData, hvdc_vars: HvdcNtcVars, vars_bus: BusNtcVars, prob: None, saturate: bool = True)[source]
Parameters:
  • t_idx

  • Sbase

  • hvdc_data_t

  • hvdc_vars

  • vars_bus

  • prob

  • saturate

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_injections_formulation(t: int | None, Sbase: float, gen_data_t: GeneratorData, batt_data_t: BatteryData, load_data_t: LoadData, bus_data_t: BusData, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, hvdc_data_t: HvdcData, bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]], transfer_method: AvailableTransferMode, skip_generation_limits: bool, ntc_vars: NtcVars, prob: None, logger: Logger)[source]

Add MIP injections formulation :param t: time step :param Sbase: base power (100 MVA) :param gen_data_t: GeneratorData structure :param batt_data_t: BatteryData structure :param load_data_t: LoadData structure :param bus_data_t: BusData structure :param branch_data_t: :param active_branch_data_t: :param hvdc_data_t: :param bus_a1_idx: bus indices within area β€œfrom” :param bus_a2_idx: bus indices within area β€œto” :param transfer_method: Exchange transfer method :param skip_generation_limits: Skip generation limits? :param ntc_vars: MIP variables structure :param prob: MIP problem :param logger: logger instance :return objective function

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_node_balance(t_idx: int, vd: ndarray[tuple[Any, ...], dtype[int64]], bus_data: BusData, bus_vars: BusNtcVars, prob: None, logger: Logger)[source]

Add the kirchhoff nodal equality :param t_idx: time step :param vd: Array of slack indices :param bus_data: BusData :param bus_vars: BusVars :param prob: LpModel :param logger: Logger

VeraGridEngine.Simulations.NTC.ntc_opf_strict.add_linear_vsc_formulation(t_idx: int, Sbase: float, vsc_data_t: VscData, vsc_vars: VscNtcVars, bus_vars: BusNtcVars, prob: None, logger: Logger, saturate: bool = True)[source]
Parameters:
  • t_idx

  • Sbase

  • vsc_data_t

  • vsc_vars

  • bus_vars

  • bus_vars

  • prob

  • logger

  • saturate

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf_strict.formulate_hvdc_Pmode3_single_flow(solver: None, active, P0, rate, Sbase, angle_droop, angle_max_f, angle_max_t, suffix, angle_f, angle_t, inf)[source]

Formulate the HVDC flow :param solver: Solver instance to which add the equations :param rate: HVDC rate :param P0: Power offset for HVDC :param angle_f: bus voltage angle node from (LP Variable) :param angle_t: bus voltage angle node to (LP Variable) :param angle_max_f: maximum bus voltage angle node from (LP Variable) :param angle_max_t: maximum bus voltage angle node to (LP Variable) :param active: Boolean. HVDC active status (True / False) :param angle_droop: Flow multiplier constant (MW/decimal degree). :param Sbase: Base power (i.e. 100 MVA) :param suffix: suffix to add to the constraints names. :param inf: Value representing the infinite (i.e. 1e20) :return:

  • flow_f: Array of formulated HVDC flows (mix of values and variables)

VeraGridEngine.Simulations.NTC.ntc_opf_strict.formulate_lp_abs_value(prob: None, lp_var: LpVariable | None, ub: float, M: float, name: str)[source]

Generic function to compute lp abs variable :param prob: lp solver instance :param lp_var: variable to make abs :param ub: variable upper bound :param M: float value represents infinity :param name: variable name :return: abs variable, boolean to define sense

VeraGridEngine.Simulations.NTC.ntc_opf_strict.formulate_lp_piece_wise(solver: None, lp_var: float | LpVariable | None, higher_exp: float | LpAffineExpression | None | LpVariable, lower_exp: float | LpAffineExpression | None | LpVariable, condition: float | LpAffineExpression | None | LpVariable, name: str, M: float)[source]

Generic function to implement piece wise linear function :param solver: lp solver instance :param lp_var: output variable :param higher_exp: expression when condition >= 0 :param lower_exp: expression when condition <= 0 :param condition: bounding condition :param name: output variable name :param M: Value representing the infinite (i.e. 1e20) :return: lp_var, boolean indicating condition behavior

VeraGridEngine.Simulations.NTC.ntc_opf_strict.formulate_monitorization_logic(monitor_only_sensitive_branches: bool, monitor_only_ntc_load_rule_branches: bool, monitor_loading: ndarray[tuple[Any, ...], dtype[bool]], alpha: ndarray[tuple[Any, ...], dtype[float64]], alpha_n1: ndarray[tuple[Any, ...], dtype[float64]], branch_sensitivity_threshold: float, base_flows: ndarray[tuple[Any, ...], dtype[float64]], structural_ntc: float, ntc_load_rule: float, rates: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[ndarray[tuple[Any, ...], dtype[bool]], ndarray[tuple[Any, ...], dtype[object_]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Function to formulate branch monitor status due the given logic :param monitor_only_sensitive_branches: boolean to apply sensitivity threshold to the monitorization logic. :param monitor_only_ntc_load_rule_branches: boolean to apply ntc load rule to the monitorization logic. :param monitor_loading: Array of branch monitor loading status given by the user (True / False) :param alpha: Array of branch sensitivity to the exchange in n condition :param alpha_n1: Array of branch sensitivity to the exchange in n-1 condition :param branch_sensitivity_threshold: branch sensitivity to the exchange threshold :param base_flows: branch base flows :param structural_ntc: Maximum NTC available by thermal interconnection rates. :param ntc_load_rule: percentage of loading reserved to exchange flow (Clean Energy Package rule by ACER). :param rates: array of branch rates return:

  • monitor: Array of final monitor status per branch after applying the logic

  • monitor_type: monitor type chosen depending on the rules

  • branch_ntc_load_rule: branch minimum ntc to be considered as limiting element

  • branch_zero_exchange_load: branch load for zero exchange situation.

VeraGridEngine.Simulations.NTC.ntc_opf_strict.get_base_power(Sbase: float, gen_data_t: GeneratorData, batt_data_t: BatteryData, load_data_t: LoadData, branch_data_t: PassiveBranchData, active_branch_data_t: ActiveBranchData, hvdc_data_t: HvdcData, logger: Logger) ndarray[tuple[Any, ...], dtype[float64]][source]

Get the perfectly balanced base power :param Sbase: :param gen_data_t: :param batt_data_t: :param load_data_t: :param branch_data_t :param active_branch_data_t :param logger: :return:

VeraGridEngine.Simulations.NTC.ntc_opf_strict.get_exchange_proportions(power: ndarray[tuple[Any, ...], dtype[float64]], bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger, decimals: int)[source]

Get generation proportions by transfer method with sign consideration. :param power: Vec. Power reference :param bus_a1_idx: bus indices within area 1 :param bus_a2_idx: bus indices within area 2 :param logger: logger instance :param decimals: Number of decimals to round to :return: proportions (rounded)

VeraGridEngine.Simulations.NTC.ntc_opf_strict.get_sensed_proportions(power: ndarray[tuple[Any, ...], dtype[float64]], idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger) ndarray[tuple[Any, ...], dtype[float64]][source]
Parameters:
  • power

  • idx

  • logger

Returns:

VeraGridEngine.Simulations.NTC.ntc_opf_strict.get_transfer_power_scaling_per_bus(bus_data_t: BusData, gen_data_t: GeneratorData, load_data_t: LoadData, transfer_method: AvailableTransferMode, skip_generation_limits: bool, inf_value: float, Sbase: float) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Get nodal power, nodal pmax and nodal pmin according to the transfer_method. :param bus_data_t: BusData structure :param gen_data_t: GenData structure :param load_data_t: LoadData structure :param transfer_method: Exchange transfer method :param skip_generation_limits: Skip generation limits? :param inf_value: infinity value. Ex 1e-20 :param Sbase: base power (100 MVA) :return: nodal power (p.u.), pmax (p.u.), pmin(p.u.)

VeraGridEngine.Simulations.NTC.ntc_opf_strict.pmode3_formulation(prob, t_idx, m, rate, P0, droop, theta_f, theta_t)[source]

Formulation

  1. Region selector:

    z_neg + z_mid + z_pos == 1

  2. Linear flow equation:

    flow_lin == P0 + k * (theta_f - theta_t)

  3. Lower region: flow = -rate if z_neg == 1

    flow <= -rate + M * (1 - z_neg) flow >= -rate - M * (1 - z_neg) flow_lin <= -rate + M * (1 - z_neg)

  4. Mid region: flow = flow_lin if z_mid == 1

    flow <= flow_lin + M * (1 - z_mid) flow >= flow_lin - M * (1 - z_mid) flow_lin <= rate - epsilon + M * (1 - z_mid) flow_lin >= -rate + epsilon - M * (1 - z_mid)

  5. Upper region: flow = rate if z_pos == 1

    flow <= rate + M * (1 - z_pos) flow >= rate - M * (1 - z_pos) flow_lin >= rate - M * (1 - z_pos)

VeraGridEngine.Simulations.NTC.ntc_opf_strict.pmode3_formulation2(prob, t_idx, m, rate, P0, droop, theta_f, theta_t, base_name: str = 'hvdc')[source]

Formulation

Variables:

flow continuous flow_lin continuous z1 binary z2 binary

Constraints:

pmode3_eq: flow_lin = P0 + k * (th_f - th_t)

upper_bound_flow_le: flow <= rate + M * z1 upper_bound_flowlin_le: flow_lin - rate <= M * (1 - z1) upper_bound_flow_ge: flow >= rate - M * (1 - z1)

lower_bound_flow_ge: flow >= -rate - M * z2 lower_bound_flowlin_ge: -rate - flow_lin <= M * (1 - z2) lower_bound_flow_le: flow <= -rate + M * (1 - z2)

intermediate_flow_le: flow <= flow_lin + M * (z1 + z2) intermediate_flow_ge: flow >= flow_lin - M * (z1 + z2) intermediate_always_true: 1 - z1 - z2 <= 1

single_case_active: z1 + z2 <= 1

VeraGridEngine.Simulations.NTC.ntc_opf_strict.run_linear_ntc_opf_strict(grid: ~VeraGridEngine.Devices.multi_circuit.MultiCircuit, t: int | None, solver_type: ~VeraGridEngine.enumerations.MIPSolvers = HIGHS, zonal_grouping: ~VeraGridEngine.enumerations.ZonalGrouping = No grouping, skip_generation_limits: bool = False, consider_contingencies: bool = False, contingency_groups_used: ~typing.List[~VeraGridEngine.Devices.Events.contingency_group.ContingencyGroup] = (), alpha_threshold: float = 0.001, lodf_threshold: float = 0.001, bus_a1_idx: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.int64]] | None = None, bus_a2_idx: ~numpy.ndarray[tuple[~typing.Any, ...], ~numpy.dtype[~numpy.int64]] | None = None, transfer_method: ~VeraGridEngine.enumerations.AvailableTransferMode = InstalledPower, monitor_only_sensitive_branches: bool = True, monitor_only_ntc_load_rule_branches: bool = False, ntc_load_rule: float = 0.7, logger: ~VeraGridEngine.basic_structures.Logger = <VeraGridEngine.basic_structures.Logger object>, progress_text: None | ~typing.Callable[[str], None] = None, progress_func: None | ~typing.Callable[[float], None] = None, verbose: int = 0, robust: bool = False, mip_framework: ~VeraGridEngine.enumerations.MIPFramework = PuLP) Tuple[NtcVars, PulpLpModel | None][source]
Parameters:
  • grid – MultiCircuit instance

  • t – Time indices (in the general scheme)

  • solver_type – MIP solver to use

  • zonal_grouping – Zonal grouping?

  • skip_generation_limits – Skip the generation limits?

  • consider_contingencies – Consider the contingencies?

  • contingency_groups_used – List of contingency groups to simulate

  • alpha_threshold – threshold to consider the exchange sensitivity

  • lodf_threshold – threshold to consider LODF sensitivities

  • bus_a1_idx – array of bus indices in the area 1

  • bus_a2_idx – array of bus indices in the area 2

  • transfer_method – AvailableTransferMode

:param monitor_only_sensitive_branches :param monitor_only_ntc_load_rule_branches :param ntc_load_rule: Amount of exchange branches power that should be dedicated to exchange :param logger: logger instance :param progress_text: function to report text messages :param progress_func: function to report progress :param verbose: Verbosity level :param robust: Robust optimization? :return: NtcVars class with the results

VeraGridEngine.Simulations.NTC.ntc_options module

class VeraGridEngine.Simulations.NTC.ntc_options.OptimalNetTransferCapacityOptions[source]

Bases: OptionsTemplate

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:sending_bus_idx, prop:receiving_bus_idx, prop:transfer_method, prop:loading_threshold_to_report, prop:skip_generation_limits, prop:transmission_reliability_margin, prop:branch_exchange_sensitivity, prop:use_branch_exchange_sensitivity, prop:branch_rating_contribution, prop:monitor_only_ntc_load_rule_branches, prop:consider_contingencies, prop:strict_formulation, prop:opf_options, prop:lin_options)
CLASS_PROPERTY_LIST: Tuple[GCProp, ...] = (prop:idtag, prop:name, prop:code, prop:rdfid, prop:action, prop:comment, prop:diff_changes, prop:sending_bus_idx, prop:receiving_bus_idx, prop:transfer_method, prop:loading_threshold_to_report, prop:skip_generation_limits, prop:transmission_reliability_margin, prop:branch_exchange_sensitivity, prop:use_branch_exchange_sensitivity, prop:branch_rating_contribution, prop:monitor_only_ntc_load_rule_branches, prop:consider_contingencies, prop:strict_formulation, prop:opf_options, prop:lin_options)
CLASS_REGISTERED_PROPERTIES: Dict[str, GCProp] = {'action': prop:action, 'branch_exchange_sensitivity': prop:branch_exchange_sensitivity, 'branch_rating_contribution': prop:branch_rating_contribution, 'code': prop:code, 'comment': prop:comment, 'consider_contingencies': prop:consider_contingencies, 'diff_changes': prop:diff_changes, 'idtag': prop:idtag, 'lin_options': prop:lin_options, 'loading_threshold_to_report': prop:loading_threshold_to_report, 'monitor_only_ntc_load_rule_branches': prop:monitor_only_ntc_load_rule_branches, 'name': prop:name, 'opf_options': prop:opf_options, 'rdfid': prop:rdfid, 'receiving_bus_idx': prop:receiving_bus_idx, 'sending_bus_idx': prop:sending_bus_idx, 'skip_generation_limits': prop:skip_generation_limits, 'strict_formulation': prop:strict_formulation, 'transfer_method': prop:transfer_method, 'transmission_reliability_margin': prop:transmission_reliability_margin, 'use_branch_exchange_sensitivity': prop:use_branch_exchange_sensitivity}
LOCAL_PROPERTY_DECLARATIONS: Tuple[GCProp, ...] = (prop:sending_bus_idx, prop:receiving_bus_idx, prop:transfer_method, prop:loading_threshold_to_report, prop:skip_generation_limits, prop:transmission_reliability_margin, prop:branch_exchange_sensitivity, prop:use_branch_exchange_sensitivity, prop:branch_rating_contribution, prop:monitor_only_ntc_load_rule_branches, prop:consider_contingencies, prop:strict_formulation, prop:opf_options, prop:lin_options)
action: ActionType
comment: str
device_type: DeviceType
diff_changes
selected_to_merge

VeraGridEngine.Simulations.NTC.ntc_results module

class VeraGridEngine.Simulations.NTC.ntc_results.OptimalNetTransferCapacityResults(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_]], contingency_group_names: ndarray[tuple[Any, ...], dtype[str_]])[source]

Bases: ResultsTemplate

OPF results. Arguments:

Sbus: bus power Injections voltage: bus voltages load_shedding: load shedding values Sf: branch power values overloads: branch overloading values loading: branch loading values losses: branch losses converged: converged?

CLASS_DATA_VARIABLES = {'Sbus': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Sf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'alpha': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'branch_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_shadow_prices': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_types': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_flows_list': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_group_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_rates': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'converged': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'dSbus': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_Pf': <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>, 'inter_area_flows': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_branches': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'load_shedding': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'monitor_logic': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'nodal_balance': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'overloads': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'phase_shift': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'rates': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'receiving_bus_idx': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'sending_bus_idx': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'strict_formulation': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'structural_inter_area_flows': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'voltage': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_Pf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_losses': <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>)
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>)
Sbus
Sf
St
alpha
branch_names
bus_names
bus_shadow_prices
bus_types
contingency_flows_list
contingency_group_names
contingency_rates
converged
dSbus
get_branch_df() DataFrame[source]

Get a DataFrame with the branches results :return: DataFrame

get_bus_df() DataFrame[source]

Get a DataFrame with the buses results :return: DataFrame

get_hvdc_df() DataFrame[source]

Get a DataFrame with the battery results :return: DataFrame

hvdc_Pf
hvdc_loading
hvdc_losses
hvdc_names
inter_area_flows
inter_space_branches: List[tuple[int, float]]
inter_space_hvdc: List[tuple[int, float]]
inter_space_vsc: List[tuple[int, float]]
load_shedding
loading
losses
mdl(result_type) ResultsTable[source]

Plot the results :param result_type: type of results (string) :return: DataFrame of the results (or None if the result was not understood)

monitor_logic
nodal_balance
overloads
phase_shift
rates
receiving_bus_idx: List[int]
sending_bus_idx: List[int]
strict_formulation
structural_inter_area_flows
voltage
vsc_Pf
vsc_loading
vsc_losses
vsc_names

VeraGridEngine.Simulations.NTC.ntc_ts_driver module

class VeraGridEngine.Simulations.NTC.ntc_ts_driver.OptimalNetTransferCapacityTimeSeriesDriver(grid: MultiCircuit, options: OptimalNetTransferCapacityOptions, time_indices: ndarray, clustering_results: ClusteringResults | None = None)[source]

Bases: TimeSeriesDriverTemplate

installed_alpha
installed_alpha_n1
opf()[source]

Run thread

options: OptimalNetTransferCapacityOptions
run()[source]
Returns:

tpe = 'Optimal net transfer capacity time series'
unresolved_counter

VeraGridEngine.Simulations.NTC.ntc_ts_results module

class VeraGridEngine.Simulations.NTC.ntc_ts_results.OptimalNetTransferCapacityTimeSeriesResults(bus_names: StrVec, branch_names: StrVec, hvdc_names: StrVec, vsc_names: StrVec, contingency_group_names: StrVec, time_array: DateVec, time_indices: IntVec, clustering_results: ClusteringResults | None = None)[source]

Bases: ResultsTemplate

CLASS_DATA_VARIABLES = {'Sbus': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'Sf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'St': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'alpha': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'branch_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_shadow_prices': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'bus_types': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_flows_list': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_group_names': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'contingency_rates': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'converged': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'dSbus': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'hvdc_Pf': <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>, 'inter_area_flows': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_branches': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_hvdc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'inter_space_vsc': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'load_shedding': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'losses': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'monitor_logic': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'nodal_balance': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'overloads': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'phase_shift': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'rates': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'receiving_bus_idx': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'sending_bus_idx': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'strict_formulation': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'time_indices': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'voltage': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_Pf': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_loading': <VeraGridEngine.Simulations.results_template.ResultsProperty object>, 'vsc_losses': <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>)
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>)
Sbus
Sf
St
alpha
branch_names
bus_names
bus_shadow_prices
bus_types
contingency_flows_list
contingency_group_names
contingency_rates
converged
dSbus
hvdc_Pf
hvdc_loading
hvdc_losses
hvdc_names
inter_area_flows
inter_space_branches: List[tuple[int, float]]
inter_space_hvdc: List[tuple[int, float]]
inter_space_vsc: List[tuple[int, float]]
load_shedding
loading
losses
mdl(result_type) ResultsTable[source]

Plot the results :param result_type: type of results (string) :return: DataFrame of the results (or None if the result was not understood)

monitor_logic
nodal_balance
overloads
phase_shift
rates
receiving_bus_idx: List[int]
sending_bus_idx: List[int]
strict_formulation
voltage
vsc_Pf
vsc_loading
vsc_losses
vsc_names

Module contents