API Reference
Power Flow Algorithm
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.adaptive_damped_newton — Functionadaptive_damped_newton(baseMVA, bus, gen, load, pvarray, Ybus, V0, ref, p, tol0, max_it0, alg="")Solve power flow using an adaptive damped Newton-Raphson method.
This function implements a Newton-Raphson method with adaptive damping factor to improve convergence in difficult cases. The damping factor is automatically adjusted based on the mismatch norm during iterations.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrixgen: Generator data matrixload: Load data matrixpvarray: PV array dataYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference bus indexp: Vector of bus indicestol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Linear solver algorithm (optional)
Returns
V: Final voltage solution vectorconverged: Boolean indicating convergence statusi: Number of iterations performed
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.currentinjectionpf — Functioncurrentinjectionpf(baseMVA, bus, gen, load, pvarray, Ybus, V0, ref, p, tol0, max_it0, alg="")Solve power flow using the Current Injection method, particularly suitable for resistive networks.
Arguments
baseMVA: Base MVA for power system normalizationbus: Matrix containing bus datagen: Matrix containing generator dataload: Matrix containing load datapvarray: Array of PV bus informationYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference (slack) bus indexp: Array of PQ bus indicestol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Algorithm variant (optional)
Returns
V: Final complex voltage vector solutionconverged: Boolean indicating whether the algorithm convergedi: Number of iterations performed
Description
This function implements the Current Injection power flow method, which is particularly effective for networks with high R/X ratios (resistive networks). The method works by:
- Converting power injections to current injections
- Calculating current mismatches
- Solving for voltage updates using the real part of the admittance matrix
- Iterating until convergence or maximum iterations reached
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.newtonpf — Functionnewtonpf(baseMVA::Float64, bus::Matrix{Float64}, gen::Matrix{Float64},
Ybus::SparseArrays.SparseMatrixCSC{ComplexF64}, V0::Vector{ComplexF64},
ref::Vector{Int}, pv::Vector{Int}, pq::Vector{Int},
tol0::Float64, max_it0::Int, alg::String="bicgstab")Solve AC power flow using Newton-Raphson method.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrixgen: Generator data matrixYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference bus indicespv: PV bus indicespq: PQ bus indicestol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Algorithm specification for linear solver (default: "bicgstab")
Returns
V: Final voltage vector solutionconverged: Boolean indicating whether the algorithm convergedi: Number of iterations performednorm_history: Array of norm values for each iteration
Description
This function implements the Newton-Raphson method to solve AC power flow equations. It iteratively updates voltage magnitudes and angles until the power mismatch falls below the specified tolerance or the maximum number of iterations is reached.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.newtonpf — Functionnewtonpf(baseMVA::Float64, bus::Matrix{Float64}, gen::Matrix{Float64},
load::Matrix{Float64}, pvarray, Ybus::SparseArrays.SparseMatrixCSC{ComplexF64}, V0::Vector{ComplexF64},
ref::Vector{Int}, pv::Vector{Int}, pq::Vector{Int},
tol0::Float64, max_it0::Int, alg::String="bicgstab")Solve AC power flow using Newton-Raphson method with load and PV array models.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrixgen: Generator data matrixload: Load data matrixpvarray: PV array dataYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference bus indicespv: PV bus indicespq: PQ bus indicestol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Algorithm specification for linear solver (default: "bicgstab")
Returns
V: Final voltage vector solutionconverged: Boolean indicating whether the algorithm convergedi: Number of iterations performednorm_history: Array of norm values for each iteration
Description
This function implements the Newton-Raphson method to solve AC power flow equations with load and PV array models. It iteratively updates voltage magnitudes and angles until the power mismatch falls below the specified tolerance or the maximum number of iterations is reached.
DC Power Flow Algorithm
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.newtondcpf — Functionnewtondcpf(baseMVA, bus, gen, load, pvarray, Ybus, V0, ref, p, tol0, max_it0, alg="")Solve DC power flow using Newton's method.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrixgen: Generator data matrixload: Load data matrixpvarray: PV array dataYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference bus indexp: Vector of indices for buses to be included in the calculationtol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Algorithm specification for linear solver (optional)
Returns
V: Final voltage vector solutionconverged: Boolean indicating whether the algorithm convergedi: Number of iterations performed
Description
This function implements the Newton-Raphson method to solve DC power flow equations. It iteratively updates voltage values until the power mismatch falls below the specified tolerance or the maximum number of iterations is reached.
The algorithm:
- Initializes voltage values from the provided starting point
- Calculates initial power mismatches
- Constructs the Jacobian matrix for each iteration
- Updates voltage values using Newton's method
- Checks convergence based on power mismatch norm
Notes
- The Jacobian matrix represents the partial derivatives of power with respect to voltage
- This implementation handles both real power balance constraints
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.newtondcpf_sp — Functionnewtondcpf_sp(baseMVA, bus, gen, load, pvarray, Ybus, V0, ref, p, tol0, max_it0, alg="")Solve DC power flow using Newton's method with sparse matrices.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrixgen: Generator data matrixload: Load data matrixpvarray: PV array dataYbus: Bus admittance matrixV0: Initial voltage vectorref: Reference bus indexp: Vector of indices for buses to be included in the calculationtol0: Convergence tolerancemax_it0: Maximum number of iterationsalg: Algorithm specification (optional)
Returns
V: Final voltage vector solutionconverged: Boolean indicating whether the algorithm convergedi: Number of iterations performed
Description
This function solves DC power flow using Newton's method. In DC systems, power P = V * I, where I = G * V (G is the conductance matrix). The function iteratively updates voltage magnitudes until the power mismatch falls below the specified tolerance or the maximum number of iterations is reached.
The algorithm:
- Initializes voltage values from the provided starting point
- Calculates initial power mismatches
- Constructs the Jacobian matrix for each iteration
- Updates voltage values using Newton's method
- Checks convergence based on power mismatch norm
Notes
- For DC systems, only active power is considered
- The Jacobian matrix represents the partial derivatives of power with respect to voltage
Linear Problem Solution Algorithm
GPU Acceleration
Other Functions
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.calculate_pv_power — Methodcalculate_pv_power(pvarray, bus, Vm, baseMVA)Calculate power injection from PV arrays and its derivative with respect to voltage magnitude.
Arguments
pvarray: PV array data matrix with columns representing PV parametersbus: Bus data matrix with columns representing bus parametersVm: Vector of bus voltage magnitudesbaseMVA: Base MVA for the system
Returns
Spv: Vector of complex power injections from PV arraysdSpv_dVm: Sparse matrix of partial derivatives of PV power injections with respect to voltage magnitude
Description
This function calculates the power injection from PV arrays based on a modified power function model that accounts for the PV array characteristics including open circuit voltage, short circuit current, and maximum power point voltage. It also computes the derivatives of these injections with respect to bus voltage magnitudes, which are needed for power flow Jacobian calculations.
The PV model uses a modified power function with correction terms to better represent the current-voltage characteristics of PV panels: I = Isc * (1 - (V/Voc)^a)^b * (1 - c * ((V/Vmpp) - 1)^2)
Notes
- Only active PV arrays (PVINSERVICE > 0) are considered
- The function maps PV arrays to their respective buses using the bus numbering
- Power output is converted to per-unit on system MVA base
- Only real power (no reactive power) is considered for PV arrays
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.makeSbus — FunctionmakeSbus(baseMVA, bus, gen, Vm, Sg=nothing, return_derivative=false)Build the vector of complex bus power injections (simplified version without PV arrays).
Arguments
baseMVA: Base MVA for the systembus: Bus data matrix with columns representing bus parametersgen: Generator data matrix with columns representing generator parametersVm: Vector of bus voltage magnitudes
Keyword Arguments
Sg: Optional pre-computed generator complex power injections (default: nothing)return_derivative: Boolean indicating whether to return derivative of Sbus with respect to Vm (default: false)
Returns
- If
return_derivative=false: Vector of complex bus power injections (Sbus) - If
return_derivative=true: Sparse matrix of partial derivatives of power injections with respect to voltage magnitude (dSbus_dVm)
Description
This is a simplified version of the makeSbus function that does not include PV array contributions. It computes the vector of complex bus power injections (Sbus) for power flow analysis, accounting for ZIP load models and generator injections.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.makeSbus — MethodmakeSbus(baseMVA, bus, gen, Vm, load::Matrix{Float64}, pvarray; dc=false, Sg=nothing, return_derivative=false)Build the vector of complex bus power injections, including PV array contributions.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrix with columns representing bus parametersgen: Generator data matrix with columns representing generator parametersVm: Vector of bus voltage magnitudesload: Load data matrix with columns representing load parameterspvarray: PV array data matrix with columns representing PV parameters
Keyword Arguments
dc: Boolean indicating whether to use DC power flow assumptions (default: false)Sg: Optional pre-computed generator complex power injections (default: nothing)return_derivative: Boolean indicating whether to return derivative of Sbus with respect to Vm (default: false)
Returns
- If
return_derivative=false: Vector of complex bus power injections (Sbus) - If
return_derivative=true: Sparse matrix of partial derivatives of power injections with respect to voltage magnitude (dSbus_dVm)
Description
This function computes the vector of complex bus power injections (Sbus) for power flow analysis. It accounts for ZIP load models, generator injections, and PV array contributions.
When return_derivative=true, it returns the partial derivatives of the power injections with respect to voltage magnitude, which is useful for power flow Jacobian calculations.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.Sd — TypeSdA mutable structure to store ZIP load model components.
Fields
z: Complex vector representing constant impedance component of loadi: Complex vector representing constant current component of loadp: Complex vector representing constant power component of load
This structure is used to store the components of the ZIP load model for efficient power flow calculations.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.makeSdzip — MethodmakeSdzip(baseMVA, bus, pw_1, pw_2, pw_3)Create a ZIP load model structure from bus data and specified ZIP percentages.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrix with columns representing bus parameterspw_1: Vector of constant power percentages for active powerpw_2: Vector of constant current percentages for active powerpw_3: Vector of constant impedance percentages for active power
Returns
sd: An Sd structure containing the ZIP load model components
Description
This function creates a ZIP (constant impedance, constant current, constant power) load model for power flow calculations. It converts the load data from the bus matrix to per-unit values based on the system MVA base and the specified percentages for each component.
The function assumes that the same percentage distribution applies to both active and reactive power, so it uses the same percentages (pw1, pw2, pw_3) for both P and Q components.
Notes
- All power values are converted to per-unit on system MVA base
- PD and QD columns in bus represent the total active and reactive power demand
- pw1, pw2, pw_3 represent the percentages of constant power, constant current, and constant impedance components
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.makeSdzip — MethodmakeSdzip(baseMVA, bus)Create a ZIP load model structure from bus data with default constant power model.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrix with columns representing bus parameters
Returns
sd: An Sd structure containing the ZIP load model components
Description
This is a simplified version of the makeSdzip function that assumes a constant power model (100% constant power, 0% constant current, 0% constant impedance).
Notes
- All power values are converted to per-unit on system MVA base
- PD and QD columns in bus represent the total active and reactive power demand
- By default, all load is modeled as constant power (P-Q) load
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.makeYbus — MethodmakeYbus(baseMVA, bus, branch)Build the bus admittance matrix and branch admittance matrices.
Arguments
baseMVA: Base MVA for the systembus: Bus data matrix with columns representing bus parametersbranch: Branch data matrix with columns representing branch parameters
Returns
Ybus: Bus admittance matrixYf: Branch admittance matrix for "from" end of branchesYt: Branch admittance matrix for "to" end of branches
Description
This function builds the bus admittance matrix (Ybus) and branch admittance matrices (Yf and Yt) for a given power system network. The admittance matrices are essential components for power flow and other power system analyses.
The function:
- Computes branch series admittances and line charging susceptances
- Handles tap ratios and phase shifters
- Incorporates bus shunt admittances
- Builds connection matrices between branches and buses
- Constructs the complete bus admittance matrix
Notes
- All admittance values are in per-unit on system MVA base
- Requires buses to be numbered consecutively (internal ordering)
- Branch status values determine which branches are in service
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.merge_results — Methodmerge_results(results)Merge power flow calculation results from multiple isolated islands.
Arguments
results: An array of JPC objects containing power flow results for different islands
Returns
merged_result: A single JPC object containing the combined resultsarea: The number of islands that were merged
Description
This function combines power flow results from multiple isolated islands into a single comprehensive result. It merges all data matrices (buses, branches, generators, etc.) from the individual island results and sorts them by their ID numbers.
The function:
- Creates a new JPC object to hold the merged results
- Combines basic result fields like success status and iteration counts
- Merges all data matrices from the input results
- Sorts the merged matrices by their first column (typically ID numbers)
Notes
- Assumes all input results use the same base MVA
- Success is determined by the logical AND of all individual results' success flags
- Iteration count is the maximum of all individual results' iteration counts
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.extract_bus_data — MethodExtract bus data from your data structure
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.generate_matpower_report — FunctionFormat power flow calculation results as MATPOWER-style report and save to a text file
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.write_branch_data — MethodWrite branch data section
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.write_bus_data — MethodWrite bus data section
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.write_system_summary — MethodWrite system summary section
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.dcpfsoln — Methoddcpfsoln(baseMVA::Float64, bus0::Matrix{Float64}, gen0::Matrix{Float64},
branch0::Matrix{Float64}, load0::Matrix{Float64}, Ybus, Yf, Yt, V, ref, p)Update power system state variables after a DC power flow solution.
Arguments
baseMVA::Float64: Base MVA value for the systembus0::Matrix{Float64}: Initial bus data matrixgen0::Matrix{Float64}: Initial generator data matrixbranch0::Matrix{Float64}: Initial branch data matrixload0::Matrix{Float64}: Load data matrixYbus: Bus admittance matrixYf: From-bus branch admittance matrixYt: To-bus branch admittance matrixV: Complex bus voltage vector solutionref: Reference (slack) bus indicesp: P bus indices
Returns
bus: Updated bus data matrixgen: Updated generator data matrixbranch: Updated branch data matrix with power flows
Description
This function updates the power system state variables after a DC power flow solution has been obtained. It performs the following operations:
- Updates bus voltage magnitudes
- Updates generator reactive power (Qg) for generators at PV and slack buses
- Distributes reactive power proportionally among multiple generators at the same bus
- Respects generator reactive power limits
- Updates active power (Pg) for generators at slack buses
- Calculates branch power flows
- Expands the branch matrix if needed to store power flow results
The function handles special cases like multiple generators at the same bus and generators with identical reactive power limits.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.pfsoln — MethodUpdate power flow solution with computed voltage values and calculate generator outputs and branch flows. For the version with load data as a separate parameter.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.pfsoln — MethodUpdate power flow solution with computed voltage values and calculate generator outputs and branch flows. Standard version without separate load data parameter.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.process_result — MethodProcess power flow calculation results and generate a report. This function merges results, extracts execution time, and creates a MATPOWER format report.
Parameters:
- results: Array containing calculation results and timing information
- isolated: Information about isolated parts of the network
- file_path: Path where the report will be saved
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.analyze_voltage_results — Methodanalyze_voltage_results(results::NamedTuple, case::JuliaPowerCase, reference_file::String;
tolerance_mag::Float64=1e-4, tolerance_ang::Float64=1e-3,
output_dir::String="./results")Analyze voltage differences between power flow calculation results and reference file, generate comparison reports and charts. Supports both original format and AC/DC mixed format. Parameters:
- results: NamedTuple containing results in JPC format (typically the return value of power flow calculation)
- case: Original JuliaPowerCase object, used to get node names and ID mappings
- reference_file: Path to Excel file containing reference voltage values
- tolerance_mag: Tolerance for voltage magnitude comparison (default: 1e-4)
- tolerance_ang: Tolerance for voltage angle comparison (default: 1e-3)
- output_dir: Output directory (default: "./results")
Returns:
- DataFrame or NamedTuple containing comparison results
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.compare_voltage_results — Methodcompare_voltage_results(results::NamedTuple, case::JuliaPowerCase, reference_file::String;
tolerance_mag::Float64=1e-4, tolerance_ang::Float64=1e-3)Compare power flow calculation results in JPC format with reference voltage values, using JuliaPowerCase for node mapping. Supports both original format and new format with mixed AC/DC data. Parameters:
- results: NamedTuple containing results in JPC format (typically the return value of power flow calculation)
- case: Original JuliaPowerCase object, used to get node names and ID mappings
- reference_file: Path to Excel file containing reference voltage values
- tolerance_mag: Tolerance for voltage magnitude comparison (default: 1e-4)
- tolerance_ang: Tolerance for voltage angle comparison (default: 1e-3)
Returns:
- NamedTuple containing comparison results, including ac and dc DataFrames
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_bus_voltage_results — Methodget_bus_voltage_results(results::NamedTuple, case::JuliaPowerCase)Extract bus voltage information from power flow calculation results in JPC format, and map to node names in JuliaPowerCase. Parameters:
- results: NamedTuple containing results in JPC format (typically the return value of power flow calculation)
- case: Original JuliaPowerCase object, used to get node names and ID mappings
Returns:
- DataFrame containing bus voltage results
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_bus_voltage_results_acdc — Methodget_bus_voltage_results_acdc(results::NamedTuple, case::JuliaPowerCase)Extract both AC and DC bus voltage information from power flow calculation results in JPC format, and map to node names in JuliaPowerCase. Parameters:
- results: NamedTuple containing results in JPC format (typically the return value of power flow calculation)
- case: Original JuliaPowerCase object, used to get node names and ID mappings
Returns:
- NamedTuple containing AC and DC bus voltage results as two DataFrames: ac and dc
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.plot_voltage_comparison — Functionplot_voltage_comparison(comparison_results, output_file::String="voltage_comparison.png";
show_plot::Bool=true)Plot voltage magnitude and angle comparison curves between calculated and reference values. Supports both original format and AC/DC mixed format. Parameters:
- comparison_results: Can be a DataFrame or a NamedTuple containing ac and dc DataFrames
- outputfile: Path to save the chart file (default: "voltagecomparison.png")
- show_plot: Whether to display the chart (default: true)
Returns:
- Generated chart object or NamedTuple containing chart objects
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.plot_voltage_errors — Functionplot_voltage_errors(comparison_results, output_file::String="voltage_errors.png";
show_plot::Bool=true)Plot voltage magnitude and angle error curves. Supports both original format and AC/DC mixed format. Parameters:
- comparison_results: Can be a DataFrame or a NamedTuple containing ac and dc DataFrames
- outputfile: Path to save the chart file (default: "voltageerrors.png")
- show_plot: Whether to display the chart (default: true)
Returns:
- Generated chart object or NamedTuple containing chart objects
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.save_comparison_results — Methodsave_comparison_results(comparison_results, output_file::String)Save comparison results to an Excel file. Supports both original format and AC/DC mixed format. Parameters:
- comparison_results: Can be a DataFrame or a NamedTuple containing ac and dc DataFrames
- output_file: Output file path
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.rundcpf — MethodMain function to call the DC power flow function Input: case file Output: results of the power flow as a dictionary Example: bus, gen, branch = rundcpf(casefile)
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.calculate_droop_voltage — Functioncalculate_droop_voltage(P_dc, k_p, U_dc_ref=1.0, U_dc_min=0.95, U_dc_max=1.05)Calculate DC voltage with droop control using the equation: Udc = Udcref - kp * P_dc Limits the output voltage to be within specified minimum and maximum values.
Parameters:
- P_dc: DC power
- k_p: Droop coefficient
- Udcref: Reference DC voltage (default: 1.0 p.u.)
- Udcmin: Minimum allowed DC voltage (default: 0.95 p.u.)
- Udcmax: Maximum allowed DC voltage (default: 1.05 p.u.)
Returns:
- Limited DC voltage value
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.runhpf — Methodrunhpf(jpc, opt)Run hybrid power flow calculation for integrated AC/DC systems. Iteratively solves AC and DC power flow while updating converter power exchanges. Supports different converter control modes.
Parameters:
- jpc: JPC object containing both AC and DC system data
- opt: Options for power flow calculation
Returns:
- Updated JPC object with power flow results
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_ac_load! — Methodupdate_ac_load!(result_jpc, jpc1, ac_bus_id, P_ac)Helper function to update AC side load with power from converter. Creates a new load if none exists at the specified bus.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- acbusid: ID of the AC bus to update
- P_ac: AC power to add to the load
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_dc_load! — Methodupdate_dc_load!(result_jpc, jpc2, dc_bus_id, P_dc)Helper function to update DC side load with power from converter. Creates a new load if none exists at the specified bus.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc2: JPC object for DC system
- dcbusid: ID of the DC bus to update
- P_dc: DC power to add to the load
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_1_converters! — Methodupdate_mode_1_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode constant δs, Us (CONV_MODE==1). These converters have fixed AC voltage angle and magnitude, and the power is calculated from AC side.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_3_converters! — Methodupdate_mode_3_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode constant Ps, Us (CONV_MODE==3). These converters have fixed active power and AC voltage magnitude.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_4_converters! — Methodupdate_mode_4_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode constant Udc, Qs (CONV_MODE==4). These converters have fixed DC voltage and reactive power.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_5_converters! — Methodupdate_mode_5_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode constant Udc, Us (CONV_MODE==5). These converters have fixed DC voltage and AC voltage magnitude.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_6_converters! — Methodupdate_mode_6_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode Droop Udc, Constant Qs (CONV_MODE==6). These converters use DC voltage droop control and maintain constant reactive power.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.update_mode_7_converters! — Methodupdate_mode_7_converters!(result_jpc, jpc1, jpc2, current_power_values)Update converters with mode Droop Udc, Constant Us (CONV_MODE==7). These converters use DC voltage droop control and maintain constant AC voltage magnitude.
Parameters:
- result_jpc: Main JPC object containing all system data
- jpc1: JPC object for AC system
- jpc2: JPC object for DC system
- currentpowervalues: Dictionary to store current power values for convergence check
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.I0_from_V012 — MethodI0_from_V012(V012, Y)Calculate zero sequence current from sequence voltages and admittance matrix.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.I1_from_V012 — MethodI1_from_V012(V012, Y)Calculate positive sequence current from sequence voltages and admittance matrix.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.I2_from_V012 — MethodI2_from_V012(V012, Y)Calculate negative sequence current from sequence voltages and admittance matrix.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.I_from_SV_elementwise — MethodI_from_SV_elementwise(S, V)Calculate current from complex power and voltage: I = conj(S/V).
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.SVabc_from_SV012 — MethodSVabc_from_SV012(S012, V012; n_res=nothing, idx=nothing)Convert sequence components of power and voltage to phase components.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.S_from_VI_elementwise — MethodS_from_VI_elementwise(v, i)Calculate complex power from voltage and current: S = V * conj(I).
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.V1_from_jpc — MethodV1_from_jpc(jpc)Extract positive sequence voltage from JPC structure.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.V_from_I — MethodV_from_I(Y, I)Calculate voltage from current using V = Y\I.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow._clean_up — Function_clean_up(net, res=true)Clean up temporary data structures after power flow calculation.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow._get_p_q_gen_results_3ph — Method_get_p_q_gen_results_3ph(case, jpc_3ph, jpc0, jpc1, jpc2)Calculate active and reactive power for generators in three-phase system.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow._sum_by_group_nvals — Method_sum_by_group_nvals(bus, vals...)Group values by bus and sum them within each group for multiple value arrays.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.combine_X012 — Methodcombine_X012(X0, X1, X2)Combine zero, positive, and negative sequence components into one matrix.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.current_from_voltage_results — Methodcurrent_from_voltage_results(y_0_pu, y_1_pu, v_012_pu)Calculate sequence currents from sequence voltages and admittance matrices.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.extratct_jpc_3ph — Methodextratct_jpc_3ph(jpc_3ph::PowerFlow.JPC_3ph)Extract individual sequence components from a three-phase JPC object.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_branch_flows_3ph — Methodget_branch_flows_3ph(jpc0, jpc1, jpc2)Calculate branch flows for three-phase system.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_branch_results_3ph — Methodget_branch_results_3ph(jpc_3ph, jpc0, jpc1, jpc2, pq_buses)Extract branch results and write them to the appropriate dataframes.
Parameters: results: result of runpf loadflow calculation p: dict to store "resline" and "restrafo" Dataframes
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_bus_results_3ph — Methodget_bus_results_3ph(case, jpc_3ph, bus_pq)Store three-phase bus results in the appropriate fields.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_bus_v_results_3ph — Methodget_bus_v_results_3ph(jpc_3ph, jpc0, jpc1, jpc2)Calculate and store three-phase voltage results for all buses.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_elements — Methodget_elements(params, case::JuliaPowerCase, element, phase, typ)This function is used to get the elements of the load mapping. Automatically skips elements that don't exist in case.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_ext_grid_results_3ph — Methodget_ext_grid_results_3ph(case, jpc_3ph, jpc0, jpc1, jpc2)Calculate and store three-phase external grid results.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_full_branch_zero — Methodget_full_branch_zero(jpc_3ph)Add non-service branches to zero sequence branch data.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_gen_results_3ph — Methodget_gen_results_3ph(case, jpc_3ph, jpc0, jpc1, jpc2, pq_bus)Calculate and store three-phase generator results.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_internal_variables — Methodget_internal_variables(jpc::JPC)Retrieve stored internal variables for a JPC object.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_p_q_b — Functionget_p_q_b(case, jpc_3ph, element, suffix=nothing)Get active and reactive power values and bus indices for a specific element.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_p_q_b_3ph — Methodget_p_q_b_3ph(net, element)Get three-phase active and reactive power values and bus indices for a specific element.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_p_q_results_3ph — Methodget_p_q_results_3ph(case, jpc_3ph::PowerFlow.JPC_3ph)Calculate and aggregate active and reactive power results for three-phase system.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_pf_variables_from_JPC — Methodget_pf_variables_from_JPC(jpc::JPC)Extract power flow variables from JPC structure.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_pp_gen_results_3ph — Methodget_pp_gen_results_3ph(case, jpc_3ph, jpc0, jpc1, jpc2, b, pA, qA, pB, qB, pC, qC)Calculate and store three-phase generator results.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.get_y_bus — Methodget_y_bus(jpc0, jpc1, jpc2)Build admittance matrices for zero, positive, and negative sequence networks.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.load_mapping — Methodload_mapping(case::JuliaPowerCase, jpc1::JPC)Maps loads from the case to the power flow model, handling both wye and delta connections for all three phases.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.phase_shift_unit_operator — Methodphase_shift_unit_operator(angle_deg)Create a complex number representing a phase shift of the given angle in degrees.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.phase_to_sequence — Methodphase_to_sequence(Xabc)Transform phase components (a, b, c) to sequence components (zero, positive, negative).
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.robust_process — Methodrobust_process(net, jpc)Process network and JPC data to ensure robust operation.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.run_newton_raphson_pf — Methodrun_newton_raphson_pf(jpc::JPC, opt)Run Newton-Raphson power flow calculation.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.runupf — Methodrunupf(case, jpc_3ph, gs_eg, bs_eg, opt)This function is used to run a local unbalanced power flow analysis on unsymmetrical load nodes
#Step1: find the unbalanced nodes in the system #Step2: find the interface branches of the unbalanced nodes and balanced nodes
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.sequence_to_phase — Methodsequence_to_phase(X012)Transform sequence components (zero, positive, negative) to phase components (a, b, c).
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.sum_by_group — Methodsum_by_group(bus, first_val, second_val)Group values by bus and sum them within each group.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.write_pq_results_to_element — Functionwrite_pq_results_to_element(case, jpc_3ph, element, suffix=nothing)Write power results to the specified element in jpc_3ph.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.write_pq_results_to_element_3ph — Methodwrite_pq_results_to_element_3ph(net, element)Get pmw and qmvar for a specific pq element ("load", "sgen"...). This function basically writes values from element table to res_element table.
Parameters: net: pandapower network element: element name (str) Returns: net with updated results
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.total_load — Methodtotal_load(bus, load)Calculate the total fixed and dispatchable load at each bus in the system, considering ZIP load model.
Arguments
bus: Bus data matrix containing bus informationload: Load data matrix containing load model percentages
Returns
Pd: Vector of real power demand at each busQd: Vector of reactive power demand at each bus (if want_Q=1)
This function computes the total load at each bus using the ZIP load model, which represents loads as a combination of constant impedance (Z), constant current (I), and constant power (P) components. The percentages for each component are specified in the load matrix.
TimeSeriesPowerFlow.TimeDomainPowerFlow.PowerFlow.total_load — Methodtotal_load(bus)Calculate the total fixed and dispatchable load at each bus in the system using default ZIP parameters.
Arguments
bus: Bus data matrix containing bus information
Returns
Pd: Vector of real power demand at each busQd: Vector of reactive power demand at each bus (if want_Q=1)
This is an overloaded version of total_load that uses default ZIP model parameters. It computes the total load at each bus using the standard ZIP load model with default percentages for constant impedance (Z), constant current (I), and constant power (P) components.