Advanced inverter API

The inverter model gives the circuit equations, ratings and returned quantities. The worked examples cover topology selection and parameter values. See the inverter chapter for the derivations and validation studies.

PowerOptLab.AdvancedInverter — Type
AdvancedInverter(; id, bus, s_max, kwargs...)

An experimental inverter with an internal AC node behind an output filter. All parameters are SI. Features are opt-in: with only id, bus, s_max (and a zero filter) it is a plain grid-following converter at the POC.

Required

  • id::String, bus::String — identifier and point-of-connection bus.
  • s_max::Float64 — aggregate fundamental apparent-power rating (VA).
  • power_limit_location=:converter — apply s_max at converter terminals (default), or :poc for net PCC exchange after the entire filter, including b_filter_shunt. Exactly one circle is enforced. It bounds abs(sum(S_phase)), not individual phase powers or harmonic apparent power. Filter and loss equations remain active; converter power may exceed s_max in :poc mode.

Connection

  • phase_terminals=["1"], neutral="n" — phase conductor(s) and return terminal (nothing ⇒ referenced to ground). The three-phase topologies and grid-forming require three phases.

Topology (three-phase switching-polytope DC-utilisation model)

  • topology=:SINGLE_PHASE — one of :SINGLE_PHASE (internal-EMF model), :THREE_LEG, :FOUR_LEG, :SPLIT_DC. The three-phase topologies apply the time-sampled switching-polytope voltage feasibility on the internal-node voltage and require v_dc and c_dc. Current/thermal ratings are optional, including In_max and capacitor ratings on four-wire topologies. Omission removes the bound, not the neutral-path or capacitor-ripple equations. Aggregate power alone does not bound phase-redistribution currents.
  • v_dc — DC-link voltage (V). c_dc — DC-link capacitance (F; per half for split).
  • dc_energy_model=:linearized — retain the first-order ripple model by default. :nonlinear selects monolithic constant-input-power capacitor energy with exactly the declared cycle-mean v_dc; dv2_max bounds the actual Fourier coefficient. Optional v_dc_min / v_dc_max bound voltage extrema in this mode. Finite source branches, split links and implicit forward-controller backoff are outside the nonlinear option. Use constrained/voltage-aware allocation when combining it with embedded PWM thermal limits.
  • c_dc_upper, c_dc_lower — optional split-link half-bank capacitances (F). Each defaults to c_dc; supplying either exposes unequal series capacitance, a mean midpoint offset, and (for a finite or open line-frequency DC source, see dc_source_r) a 2ω midpoint ripple and a fundamental total-bus ripple. The neutral-current share of each bank follows the source model: one half each for an open source, C_u/C_Σ and C_l/C_Σ for an ideal stiff source.
  • m_max=1.0 — utilisation factor applied to the ideal two-level switching hull (dimensionless, 0 < m_max ≤ 1).
  • In_max — neutral current limit (A). For :FOUR_LEG this is the 4th leg's device (thermal) rating. For :SPLIT_DC it is the half-bank capacitor ripple rating net of the 2ω allocation: the same capacitors carry both the fundamental neutral current and the 2ω bus current, which sit at different frequencies and so combine in RMS. For a symmetric link, In_max = 2·√(I_half_rated² − I_2ω,rms² − I_sw,rms²) with I_2ω,rms = |S̃|/(√2·v_dc). Passing the raw bank rating double-counts the capacitors and overstates neutral capability. Prefer i_cap_max, which makes that allocation endogenous instead of asking you to pre-compute it.
  • i_cap_max — capacitor RMS ripple-current rating (A), three-phase topologies only: per half-bank for :SPLIT_DC, the whole DC-link bank otherwise. Supplying it stamps the simultaneous thermal allocation on both split half-banks. In the symmetric, equal-weight case this is (|I_n|/2)² + I_2ω,rms² + i_sw² ≤ i_cap_max²; unequal banks use their capacitance-proportional neutral shares. The neutral term is present only for :SPLIT_DC; the 4-leg's neutral flows through its 4th leg, not the caps. Thus the split between capacitor-rating and neutral-current limits is decided by the solve at the operating point rather than fixed as a nameplate. Composes with In_max — whichever binds, binds. For :SPLIT_DC it can also be supplied instead of In_max, since it bounds |I_n| on its own. Rating convention: because electrolytic ESR falls with frequency, the equal-weight sum above is only conservative if i_cap_max is referred to the lowest frequency in it — the 50/60 Hz neutral term. Refer the datasheet rating to that frequency using the capacitor manufacturer's own multiplier; passing a raw 100/120 Hz rating understates 50/60 Hz heating.
  • i_cap_upper_max, i_cap_lower_max — optional per-half split-link thermal- equivalent current ratings (A). They compose with the common i_cap_max.
  • cap_thermal_weights=(1,1,1) — squared-current weights for the fundamental neutral, 2ω, and switching components, respectively. Use ESR ratios referred to the rating frequency; the default reproduces the original RMS sum.
  • esr_dc — monolithic-bank reference ESR (Ω). esr_dc_upper and esr_dc_lower are the split half-bank values. Together with cap_thermal_weights, these produce capacitor dissipation and add it to p_dc; zero defaults preserve the lossless-link model.
  • q_mid_balance_max — optional split-link charge-transfer authority (C). The actuator can shift mean midpoint voltage by 2q/(C_upper+C_lower).
  • v_mid_mean_max — optional magnitude limit on mean midpoint offset (V).
  • i_sw — optional constant switching-frequency RMS allowance (A) reserved out of a supplied common or half-bank capacitor rating (use when the electrolytics, not a parallel film cap, carry the f_sw component).
  • pwm_strategy=:NONE — optional carrier-level DC-link ripple model. :SPWM uses zero common-mode injection; :CENTERED uses centered carrier PWM (the carrier-based SVM equivalent). The convenience solver closes the resulting capacitor-current reserve by conservative outer iteration; direct device stamping requires pwm_strategy=:NONE and an explicitly calibrated pwm_current_factor (plus any independent i_sw residual).
  • f_sw — switching frequency (Hz), required when pwm_strategy != :NONE. pwm_fundamental_samples and pwm_carrier_samples set the two numerical quadrature grids used by the post-solve switching-state audit.
  • pwm_dc_source_r=nothing, pwm_dc_source_l=0 — optional series R–L impedance of the upstream DC source as seen from the link at carrier frequencies. With no branch the source is open to switching ripple and the capacitors carry all of it. pwm_dc_harmonics controls the finite-branch Fourier truncation.
  • dc_source_r=nothing, dc_source_l=0 — optional series R–L impedance of the DC source at line frequencies (ω and 2ω). With no branch the source is open there, as for an MPPT-regulated DC/DC stage whose control bandwidth lies below 100 Hz: the link capacitors carry all 2ω current and, in :SPLIT_DC, each half-bank carries half the neutral current whatever its capacitance. A branch shares 2ω current with the link and, for unequal half-banks, sets the fundamental neutral-current split and total-bus ripple; dc_source_r=0, dc_source_l=0 is an ideal stiff source at both frequencies. Equal half-banks are unaffected at the fundamental for every source impedance. The carrier-frequency branch is configured separately by pwm_dc_source_*.
  • pwm_current_factor=0 — direct-stamping approximation I_sw = pwm_current_factor*sqrt(sum(I_leg,rms^2)). The convenience solver updates this factor from the carrier audit; set it explicitly only when composing a larger model around an externally calibrated operating region.
  • pwm_ac_ripple=false — pass the ideal pole-voltage carrier harmonics through the conductor-domain reduced-L or LCL network. This reports converter/grid/ shunt and neutral switching currents and closes them into any supplied i_max, i_grid_max, and In_max ratings. pwm_ac_harmonics truncates the carrier Fourier series and must not exceed half the carrier sample count.
  • pwm_ac_converter_reserve, pwm_ac_grid_reserve, and pwm_ac_neutral_reserve are expert direct-stamping inputs (A RMS). The convenience solver calibrates them automatically; leave them zero otherwise.
  • dv2_max — optional cap on the 2ω bus-ripple amplitude (V).
  • dv_mid_max — :SPLIT_DC only: optional cap on the RMS fundamental midpoint-to-ideal-midpoint voltage ripple (V).
  • i_zero_max, i_positive_max, i_negative_max — optional RMS symmetrical- component current limits at the converter arm (A). These are useful for grid-code limits and for separating zero-sequence neutral stress from negative-sequence 2ω stress.
  • n_samples=36 — time-sampling grid for an outer approximation of continuous- time voltage feasibility. Standalone solvers refine violating angles using the independent continuous-time rail oracle.
  • f=50.0 — fundamental frequency (Hz).

Output filter

  • r_filter=0.0, x_filter=0.0 — series filter impedance per phase (Ω).
  • r_filter_neutral=0.0, x_filter_neutral=0.0 — neutral-conductor series impedance (Ω). Its common voltage drop couples all phase-to-neutral KVL equations; it requires a physical neutral terminal.
  • r_filter_matrix=nothing, x_filter_matrix=nothing — optional primitive conductor-domain series-impedance matrices (Ω), ordered as phase_terminals followed by neutral when present. They capture unequal conductors and mutual coupling. Supplying either matrix supersedes the scalar impedances; mixing the two parameterisations is rejected. Matrices must be finite and symmetric, and the resistance matrix must be positive semidefinite.
  • r_filter_grid, x_filter_grid and their _neutral / _matrix variants — optional grid-side series arm. Supplying any grid-side arm or c_filter_mid activates an explicit LCL midpoint; the original filter becomes the converter-side arm.
  • c_filter_mid=0.0 — per-phase midpoint filter capacitance (F). r_filter_damping=0.0 is its optional series damping resistance (Ω).
  • i_grid_max=nothing — optional grid-side arm current limit (A), distinct from converter-side i_max when the midpoint capacitor carries current.
  • b_filter_shunt=0.0 — additional grid-side (POC) shunt susceptance (S), kept separate from the LCL midpoint capacitor for backward compatibility.

Internal EMF box / single-phase modulation

  • v_int_min, v_int_max — per-phase EMF magnitude box (V; applies to all topologies).
  • modulation_max — SINGLEPHASE only: legacy scalar DC-link convention `|Vint| ≤ modulationmax·vdc/√3`. This is not a bridge-specific full-/half-bridge switching model.

Grid-forming

  • grid_forming=false — balanced positive-sequence internal EMF; the magnitude v_gfm ∈ [v_int_min, v_int_max] is a decision variable (composes with a topology). For :THREE_LEG the bridge has no zero-sequence path, so only the internal negative-sequence EMF is set to zero and v_gfm bounds the positive-sequence magnitude; the EMF's zero-sequence component follows the network. Other three-phase topologies hold the full balanced set relative to their reference. The negative-sequence current is then -U2/Z_f, the law also available to controllers as negative_sequence_virtual_impedance.

Converter losses

  • p_loss_fixed=0.0 (W), a_loss=0.0 (W/A), c_loss=0.0 (W/A²).

    The a_loss term needs the current MAGNITUDE, whose exact norm is non-differentiable at zero current. It is stamped as the shifted smooth norm sqrt(|I|² + ε²) − ε, which underestimates the exact norm by at most ε. The modelled loss is therefore biased LOW by at most a_loss·ε per conducting leg — a closed-form, one-sided budget, not a tuning knob. Phase ε is 1e-9 of the leg's own current rating, so the phase-relative bias is identical for every device in a heterogeneous fleet and identical in SI and per-unit. The fourth-leg norm instead uses its share of the absolute watt budget below, capped at 1 mA, because its current can vanish while all three phase currents remain nonzero. This avoids a needlessly stiff neutral-channel Hessian. If no rating is supplied the initial width is 1 mA. Every width is additionally capped so the sum of all conducting-leg linear-loss deficits is at most 0.0001 W per inverter. That absolute watt budget is independent of solver tolerances and does not add an omitted current rating. With a_loss == 0 no magnitude term is stamped at all. Reported currents are recomputed exactly after the solve and carry none of this bias.

Engineering scaling and physical acceptance

Capability inequalities use their engineering ratings as scales by default, including the power/sequence linking rows and current-balance equations. normalize_capability_constraints=false is retained for numerical research; it does not bypass the independent physical publication gate. Single-phase ripple and scalar modulation limits are normalized as well.

Standalone inverter solvers default bound_relax_factor=0 before applying caller options. A caller can override that numerical setting, but the SI feasibility tolerances do not change. physical_feasibility(result) checks the solved phasors independently, including a full-cycle rail enclosure. solve_status(result).publishable requires both a successful solver outcome and a passing physical report. The original MOI statuses remain available.

Double-frequency ripple / current

  • p_ripple_max — SINGLE_PHASE only: bound on the 2ω power-ripple amplitude (VA); it does not by itself calculate capacitor voltage or RMS current.
  • i_max=nothing — optional per-phase-conductor current limit (A). Strongly recommended for every three-phase topology: the aggregate s_max circle does not bound phase-redistribution currents whose per-phase powers cancel.
source
PowerOptLab.solve_advanced_inverter — Function
solve_advanced_inverter(net, inverter; objective=:max_export, kwargs...)
    -> InverterResult

Solve the experimental circuit-aware inverter model. When inverter.pwm_strategy != :NONE, the solver alternates between the smooth NLP and a carrier-level switching audit. A current-norm coefficient is updated until its capacitor allocation covers the modeled carrier ripple; the residual manual i_sw allowance then composes in quadrature. This is a conservative sequential closure, not a mixed-integer switched-converter optimisation.

With inverter.pwm_ac_ripple=true, the same outer loop also updates per-path RMS reserves until the carrier-harmonic converter, grid, and neutral currents are covered by any supplied i_max, i_grid_max, and In_max ratings.

PWM closure keywords are pwm_tolerance=1e-3 (relative current tolerance), pwm_max_iterations=16, and pwm_reserve_factor=1.01. A cold start reaches its fixed point in a handful of solves, so the cap sits well clear of it: a closure that has not converged at the iteration limit is not publishable. Nonfinite carrier predictions and actual capacitor/AC RMS bound violations also prevent publication, even when the final fundamental NLP solved. Inspect result.pwm_reserve_margin, result.pwm_modulation_margin, and result.pwm_iterations for every publishable PWM-enabled solve.

Objective

  • :max_export — maximise active power delivered to the grid at the POC.
  • :min_loss — minimise converter plus capacitor loss subject to p_set.

Other keywords

  • p_set=nothing — required active-power target (W) for :min_loss.
  • q_set=nothing — optional reactive-power constraint at the POC (var).
  • per_unit=false, s_base=1e6, optimizer=Ipopt.Optimizer, verbose=false, solver_options=(). Results are returned in SI regardless of formulation.
source
PowerOptLab.InverterResult — Type
InverterResult

Result of solve_advanced_inverter. Powers SI (W / var / VA), voltages V, currents A.

Fields

  • termination_status::String, topology::Symbol
  • power_limit_location, apparent_power_rating_VA, apparent_power_margin_VA identify the enforced circle and its signed headroom. solve_diagnostics also reports location-specific margins (nothing for the inactive location).
  • p_poc, q_poc — active/reactive power injected at the POC (grid side).
  • p_conv, q_conv — converter-side power (at the internal node).
  • p_loss, p_cap_loss, p_dc — semiconductor loss, capacitor ESR loss, and DC-link power (p_dc = p_conv + p_loss + p_cap_loss).
  • p_filter_loss — total real loss in both series arms and midpoint damping (W).
  • v_int_mag::Vector{Float64} — internal EMF magnitude per phase.
  • v_filter_mag — LCL midpoint phase-to-neutral voltage magnitudes (V); equals the POC voltage in the reduced single-series-arm model.
  • i_mag, i_grid_mag, i_filter_shunt_mag — converter-side, grid-side, and midpoint shunt-branch RMS current magnitudes per phase (A).
  • i_neutral — neutral current magnitude |I_n| (0 for 3-wire / single-phase).
  • i_zero, i_positive, i_negative — RMS symmetrical-component current magnitudes (A; zero for :SINGLE_PHASE). For a four-wire connection, i_neutral = 3i_zero up to numerical tolerance.
  • ripple — 2ω power-ripple magnitude |Σ V_int·I| (VA).
  • dv2 — 2ω bus-ripple amplitude (V; three-phase topologies, else 0).
  • dv_mid — split-link midpoint fundamental-ripple RMS magnitude (V; :SPLIT_DC, else 0), measured from the centre of the total bus.
  • dv_bus_fundamental — split-link total-bus fundamental-ripple RMS magnitude (V). It is zero for equal half-banks or an ideal stiff source; with unequal banks and a finite or open line-frequency source the neutral current also ripples the total bus.
  • v_mid_mean, q_mid_balance — signed mean midpoint shift (V) used by the switching hull and balancing charge transfer (C; split link only).
  • i_cap — total capacitor RMS ripple current (A; three-phase topologies, else 0): the 2ω component, neutral share, and i_sw. For an asymmetric split link it is the larger half-bank RMS current.
  • i_cap_thermal — maximum thermally equivalent current after applying cap_thermal_weights; this is the quantity constrained by current ratings.
  • i_cap_upper, i_cap_lower, i_cap_thermal_upper, i_cap_thermal_lower — split half-bank physical and thermal-equivalent currents (A; zero for monolithic links).
  • i_cap_switching, i_dc_bridge_switching_rms, and i_dc_source_switching_rms — carrier-model RMS currents (A) in the DC-link capacitor, ideal bridge input, and optional upstream source branch. i_cap_switching_reserved is the conservative capacitor value allocated by the NLP's calibrated current-norm term. pwm_reserve_margin is allocated modeled ripple minus the carrier prediction; the user's residual i_sw allowance is added separately in quadrature.
  • p_dc_source_switching_loss — dissipation (W) in pwm_dc_source_r; this is an upstream-network diagnostic and is deliberately not included in p_dc.
  • dv_switching_rms, dv_switching_pp — carrier-model total DC-bus switching voltage ripple (V RMS and maximum local peak-to-peak). These are distinct from the low-frequency dv2 amplitude.
  • dv_switching_upper_rms, dv_switching_lower_rms, dv_switching_upper_pp, and dv_switching_lower_pp resolve that total ripple across the two half-banks of a split link (zero for monolithic links).
  • pwm_dc_network_margin — minimum normalized magnitude of the parallel source-capacitor admittance. Values near zero flag a poorly damped carrier- harmonic parallel resonance; it is one for the default open-source model.
  • pwm_modulation_margin — minimum carrier-reference headroom (V); a negative value or NaN means the selected PWM strategy cannot realize the solved fundamental reference. pwm_iterations reports outer reserve solves.
  • i_ac_switching_rms, i_grid_switching_rms, and i_filter_shunt_switching_rms — carrier-harmonic RMS currents (A) on the converter arm, grid arm, and LCL midpoint branch. The corresponding phase peak-to-peak values are i_ac_switching_pp and i_grid_switching_pp.
  • i_neutral_switching_rms, i_neutral_switching_pp — converter-side neutral switching ripple. i_ac_switching_reserved, i_grid_switching_reserved, and i_neutral_switching_reserved are the values allocated by the smooth current constraints. i_ac_total_rms, i_grid_total_rms, and i_neutral_total_rms combine orthogonal fundamental and switching RMS values.
  • switching_margin — minimum rail headroom (V) on a dense, independent post-solve time grid. Positive values pass that audit; negative values reveal a between-sample violation accepted by the optimisation grid. This is a useful numerical audit, not a formal continuous-time certificate (0 for :SINGLE_PHASE).
  • filter_resonance_hz — undamped scalar LCL resonance estimate (Hz), or NaN when the filter is reduced, matrix-valued, or lacks two positive inductive arms.
  • bus::Dict{String,Any} — the BMOPFTools result["bus"] (POC voltages, …).
source
PowerOptLab.physical_feasibility — Function
physical_feasibility(result)

Return the independent inverter SI-model report (a dictionary for a fleet). Solver success and physical acceptance are separate evidence. A rejected candidate can retain diagnostic quantities; only solve_status(result).publishable permits using it as an accepted result. The certificate covers the declared fundamental model and calibrated reserves. Standalone PWM results additionally check finite carrier predictions, reserve closure and actual thermal/total RMS ratings. Network feasibility, unmodeled harmonics, regional compliance and dynamic converter stability require separate evidence.

source
PowerOptLab.inverter_physical_feasibility — Function
inverter_physical_feasibility(inv; converter_voltage, converter_current,
    grid_voltage, grid_current=converter_current, filter_voltage=grid_voltage,
    midpoint_charge=0, dc_min=nothing, dc_max=nothing,
    tolerances=InverterFeasibilityTolerances())

Recompute engineering bounds and filter/topology equalities from SI RMS phasors, without using the NLP's squared-current, ripple or power auxiliaries. Includes continuous rail feasibility, source-dependent ripple, simultaneous capacitor thermal budgets and the exact fitted converter-loss law. midpoint_charge is signed coulombs. Optional dc_min/dc_max are watts; wrappers supply request/source bounds. The optional reported values audit consistency of the NLP's SI quantities.

source

Audit a stamped plant candidate without promoting unsuccessful solver outcomes.

source
PowerOptLab.continuous_rail_margin — Function
continuous_rail_margin(inv, voltage, ripple=0im;
    midpoint=0im, midpoint_mean=0, bus_fundamental=0im, atol=1e-6)

Enclose the minimum instantaneous rail headroom over the full electrical cycle. Voltage/midpoint/bus-fundamental phasors are RMS volts; ripple is the peak 2ω DC-bus phasor. The result gives conservative lower_V, sampled upper_V, a worst-branch angle and converged. It covers the declared degree-two averaged rail waveform, including unequal split-link banks. It does not cover unmodeled harmonics or switching transients. SINGLE_PHASE has no three-phase rail model.

source
PowerOptLab.dc_source_line_frequency_diagnostics — Function
dc_source_line_frequency_diagnostics(inv; converter_voltage, converter_current)

Reconstruct source-branch current at ω and 2ω and its resistive dissipation from three RMS converter-terminal voltage/current phasors. Fundamental source current exists only for an unequal split link; the 2ω excitation is sum(U .* I)/v_dc (peak). Returned source phasors explicitly distinguish RMS at ω from peak at 2ω. resolved=false flags singular/ill-conditioned source sharing; network_margin is a normalized cancellation screen, not stability.

dc_source_r/l describes the small-signal source impedance at these frequencies. Its dissipation is outside the mean DC-link input boundary used by p_dc, InverterControlRequest.p_available and DCSourceBounds. Those powers include converter and modeled capacitor ESR loss, but no upstream source/DC–DC loss. This diagnostic does not impose an upstream availability bound or model the DC mean-current path, source regulator, switching-frequency loss or DC standby. It is not a source-component thermal rating or dynamic-stability certificate.

source
PowerOptLab.dc_link_energy_diagnostics — Function
dc_link_energy_diagnostics(inv; converter_voltage, converter_current)

Nonlinear monolithic DC-capacitor diagnostics at constant input power and fixed mean converter loss. The energy offset is solved so the cycle mean voltage is exactly v_dc, rather than setting mean energy to C*v_dc^2/2. Returns actual voltage extrema, its peak 2ω coefficient and total low-frequency capacitor RMS. Not a finite-source, split-bank, switching, protection or stability certificate.

source