Constants and enums

Shared domain constants and string enums live in pyflow_acdc.constants. They centralise magic values used across OPF, TEP, and array sizing.

Array sizing enums

class CssMode(value)[source]

Cable-string-sizing solve mode in Array_OPT (NL argument).

NL=False selects the linear model; NL=True is normalized to OPF. Only the non-linear string values are enumerated here.

Cable-string-sizing mode for sequential_CSS() and wind_farm_CSS() (NL argument). False selects the linear model; CssMode.PF runs linear CSS then a post-solve power_flow() for losses; CssMode.OPF uses the nonlinear OPF path.

class MIPBackend(value)[source]

Solver backend for the array-MIP path problem in Array_OPT.

Backend for the inter-array route MIP in MIP_path_graph().

OPF objective components

class ObjComponent(value)[source]

OPF objective components (keys of the ObjRule / weights_def dict).

Values are the public string keys users pass via ObjRule (e.g. Optimal_PF(grid, ObjRule={'Energy_cost': 1})). Being a str Enum, members compare and hash equal to their string value, so they can be used interchangeably as dict keys/lookups while giving fail-fast typo protection on comparisons.

Keys for optimal_pf() / TEP ObjRule weight dicts.

Economics and solver defaults

pyflow_acdc.constants.HOURS_PER_YEAR

Hours per year (8760). Used in NPV and present-value calculations.

pyflow_acdc.constants.DEFAULT_TIME_LIMIT

Default solver time limit in seconds (300).

present_value_factor(Hy=8760, discount_rate=0.02, n_years=25)[source]

Annuity factor scaled by hours-per-year.

Returns Hy * (1 - (1 + r)^{-n}) / r which converts a per-hour operational cost into its net-present-value over n_years at a constant annual discount_rate.

default_obj_weights()[source]

Return a fresh OPF objective-weights dict with every component at w=0.

Single source of truth for the weights_def / Grid.OPF_obj layout (used by obj_w_rule, Grid.__init__ and TS_ACDC_OPF). A new dict with fresh inner dicts is built on every call so each caller can mutate its own copy. Key order follows ObjComponent declaration order; keys are plain strings (.value) so existing serialization/display is unchanged.