Skip to content
Preview.raw@modelscript/psse 13 diagnostic rules
Parser WASM GLR
Diagnostics 13 rules
DAE Arena Lowering
Simulation Native Solvers
Projections Modelica
Live ExampleRegionalGrid4Bus.raw

PSS/E v33 High-Voltage AC Power Flow Network

Transmission power-flow deck with a 500 kV slack bus, 230 kV PV generator station, step-up transformer, and industrial PQ load buses.

Playground
Source (17 lines)
10, 100.0, 33, 0, 1, 60.0 / PSS/E 4-Bus Regional Transmission Grid
21, 'SLACK_500', 500.0, 3, 1, 1, 1, 1.030,  0.00
32, 'GEN_230  ', 230.0, 2, 1, 1, 1, 1.015, -2.40
43, 'SUB_230  ', 230.0, 1, 1, 1, 1, 0.992, -5.85
54, 'LOAD_115 ', 115.0, 1, 1, 1, 1, 0.978, -8.10
60 / END OF BUS DATA, BEGIN LOAD DATA
73, '1 ', 1, 1, 1, 160.0, 55.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0
84, '1 ', 1, 1, 1, 110.0, 35.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0
90 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA
100 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA
111, '1 ', 240.0, 80.0, 200.0, -100.0, 1.030, 0, 100.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1, 100.0, 400.0, 50.0, 1, 1.0
122, '1 ', 150.0, 45.0, 120.0,  -60.0, 1.015, 0, 100.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1, 100.0, 220.0, 30.0, 1, 1.0
130 / END OF GENERATOR DATA, BEGIN BRANCH DATA
141, 2, '1 ', 0.004, 0.048, 0.085, 450.0, 450.0, 500.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0.0, 1, 1.0
152, 3, '1 ', 0.008, 0.072, 0.042, 300.0, 300.0, 350.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0.0, 1, 1.0
163, 4, '1 ', 0.011, 0.095, 0.020, 200.0, 200.0, 240.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0.0, 1, 1.0
170 / END OF BRANCH DATA
PSS/E Single-Line Bus-Branch Diagram
1–2 (X=0.048) 2–3 (X=0.072) 3–4 (X=0.095) Bus 1: SLACK_500 500 kV (Slack · 1.030 pu) Bus 2: GEN_230 230 kV (PV · 1.015 pu) Bus 3: SUB_230 230 kV (PQ · 0.992 pu) Bus 4: LOAD_115 115 kV (PQ · 0.978 pu) ~ ~ Load 160.0 MW 55.0 Mvar Load 110.0 MW 35.0 Mvar
Drag to pan · Click % to reset

PSS/E Transmission Power Flow (.raw) ​

The @modelscript/psse language package (languages/psse) provides native support for Siemens PSS®E RAW (.raw) transmission grid power flow base cases (Revisions 30 through 35). It delivers streaming parsing, round-trip serialization, pre-flight topological linting (P1001–P4001), sparse nodal admittance matrix (Ybus=G+jB) assembly, in-engine non-linear AC power flow solving (Newton-Raphson & Fast Decoupled), multi-domain projections to Modelica and PSCAD/EMT, interactive Single-Line Diagrams (SLD) via AntV X6, and a dual-mode VS Code custom webview editor.


Supported File Specifications ​

RevisionSpecificationKey Structural Features
PSS/E-30Legacy Planning Deck6-character bus names, integer area/zone codes, fixed branch thermal rating blocks
PSS/E-32Extended Format12-character alphanumeric bus names, expanded DC line modeling, switched shunt blocks
PSS/E-33Modern StandardCanonical 12-character names, multi-section lines, 2-terminal & VSC DC transmission, GIC records
PSS/E-34Substation-OrientedNode-breaker topologies, explicit substation IDs, multi-terminal DC grids
PSS/E-35High-Density MatrixExtended branch identifiers, expanded transformer winding data, flexible rating vectors

Architecture & Compilation Pipeline ​

Rendering diagram...

1. Pre-Flight Electrical Diagnostic Rules ​

@modelscript/psse runs pre-flight static checks across electrical topology, connection consistency, and equipment parameter bounds before simulation or projection:

13 rules6 error7 warning Run with msx psse lint

CodeRuleSeverityMessage
P1001bus-not-founderror<entityKind> '<id>' references non-existent <busRole>bus <busId>.
P1002generator-negative-powerwarningGenerator '<genId>' at bus <busId> has negative active power output (<pg> MW).
P1003duplicate-equipment-iderrorDuplicate generator ID '<genId>' at bus <busId>.
P2001isolated-buswarningBus <busId> ('<busName>') is isolated with 0 in-service connecting branches or transformers.
P2002missing-slack-buserrorPower network base case contains 0 slack/swing buses (Bus Type 3). Power flow solution cannot be anchored.
P2003multiple-slack-buseswarningPower network base case contains <count> swing buses without explicit multi-island partitioning.
P2004voltage-out-of-boundswarningInitial voltage magnitude at bus <busId> (<value> pu) is outside standard operational limits [0.8, 1.2 pu].
P3001generator-reactive-limits-invertederrorGenerator '<genId>' at bus <busId> has inverted reactive limits: Qmin (<qMin> MVAR) > Qmax (<qMax> MVAR).
P3002generator-power-limits-invertederrorGenerator '<genId>' at bus <busId> has inverted active power limits: Pmin (<pMin> MW) > Pmax (<pMax> MW).
P3003generator-scheduled-voltage-boundswarningGenerator '<genId>' scheduled voltage Vs = <vs> p.u. is outside the typical operating band [0.8, 1.2].
P4001branch-invalid-reactanceerrorTransmission branch '<ckt>' between bus <fromBus> and <toBus> has zero or negative reactance X = <x> p.u.
P4002branch-base-kv-mismatchwarningBranch '<ckt>' connects bus <fromBus> (<fromKv> kV) to bus <toBus> (<toKv> kV) without a transformer.
P4003transformer-tap-out-of-boundswarningTransformer '<ckt>' between bus <fromBus> and <toBus> has off-nominal tap ratio <ratio> outside typical limits [0.7, 1.3].

Generated from languages/psse/src/errors.ts. All languages →


2. Sparse Nodal Admittance Matrix (Ybus) ​

The network admittance matrix Ybus∈CN×N is extracted via extractPowerFlowNetlist() in languages/psse/src/netlist/powerflow-netlist.ts:

Transmission Lines (π-Equivalent) ​

For a branch connecting buses i and j with series impedance z=r+jx and total charging susceptance b:

ys=1r+jx=r−jxr2+x2=gs+jbsYij=−ys,Yji=−ysYii+=ys+jb2,Yjj+=ys+jb2

Transformers with Complex Tap Ratio ​

For a transformer with off-nominal turns ratio magnitude a and phase shift ϕ, the complex tap is a¯=aejϕ=are+jaim:

Yii+=ys|a¯|2,Yjj+=ysYij=−ysa¯∗,Yji=−ysa¯

3. In-Engine Non-Linear AC Power Flow Solver ​

@modelscript/psse includes an exact, non-linear AC Power Flow engine (solvePowerFlow() in languages/psse/src/solver/ac-powerflow.ts) supporting both Newton-Raphson and Fast Decoupled Power Flow (FDPF):

Mismatch Formulation ​

For each bus i∈{1,…,N} with voltage V¯i=Viejθi:

Pi(V,θ)=Vi∑k=1NVk(Gikcos⁡θik+Biksin⁡θik)Qi(V,θ)=Vi∑k=1NVk(Giksin⁡θik−Bikcos⁡θik)

where θik=θi−θk. Active and reactive mismatches are:

ΔPi=Pispec−Pi(V,θ),ΔQi=Qispec−Qi(V,θ)

Analytical Jacobian & Adaptive Damping ​

The linearized Newton system at each iteration k is:

[ΔPΔQ]=[HNML][ΔθΔV/V]
  • Hik=∂Pi∂θk=ViVk(Giksin⁡θik−Bikcos⁡θik) (k≠i), and Hii=−Qi−BiiVi2.
  • Nik=Vk∂Pi∂Vk=ViVk(Gikcos⁡θik+Biksin⁡θik) (k≠i), and Nii=Pi+GiiVi2.
  • Mik=∂Qi∂θk=−ViVk(Gikcos⁡θik+Biksin⁡θik) (k≠i), and Mii=Pi−GiiVi2.
  • Lik=Vk∂Qi∂Vk=ViVk(Giksin⁡θik−Bikcos⁡θik) (k≠i), and Lii=Qi−BiiVi2.

Generator Q-Limit Clamping & PV-to-PQ Switching ​

When Qg>Qmax or Qg<Qmin, the generator bus is clamped at its reactive limit and dynamically converted to a PQ bus for remaining iterations, preventing unrealistic voltage regulation.


4. Multi-Domain Interoperability Projections ​

Projection to Modelica (psseToModelica) ​

Projects a .raw case into a clean, strongly-typed Modelica physical system model:

  • Buses mapped to equipotential AC pins.
  • Generators mapped to sinusoidal voltage sources (Modelica.Electrical.Analog.Sources.SineVoltage).
  • Branches mapped to series R-L models (Modelica.Electrical.Analog.Basic.Resistor + Inductor).
  • Loads mapped to constant active and reactive impedance networks.
modelica
model Ieee14Test
  Modelica.Electrical.Analog.Basic.Ground ground;
  Modelica.Electrical.Analog.Sources.SineVoltage gen_1_1(V = 106.0, f = 60.0);
  Modelica.Electrical.Analog.Basic.Resistor line_1_2_r(R = 0.01938);
  Modelica.Electrical.Analog.Basic.Inductor line_1_2_l(L = 0.0001569);
equation
  connect(gen_1_1.n, ground.p);
  connect(gen_1_1.p, line_1_2_r.p);
  connect(line_1_2_r.n, line_1_2_l.p);
end Ieee14Test;

Projection to PSCAD / EMT Netlist (psseToEmtNetlist) ​

Generates multi-bus companion-circuit netlists compatible with ModelScript's Dommel EMT solver (@modelscript/simulate) for transient stability and electromagnetic switching studies.


5. Command-Line Interface (msx psse) ​

ModelScript's CLI provides headless inspection, linting, diagram rendering, and power flow solving:

bash
# Display summary of buses, generators, loads, branches, and MW totals
msx psse summary case.raw

# Run pre-flight electrical topology and bounds linter
msx psse lint case.raw

# Solve non-linear AC power flow with Newton-Raphson (default)
msx psse solve case.raw

# Solve with Fast Decoupled algorithm and custom tolerance
msx psse solve case.raw --algorithm=fdpf --tol=1e-5 --max-iter=30

# Export publication-quality Single-Line Diagram SVG
msx psse diagram case.raw --out=grid.svg

# Inspect sparse Ybus non-zero entry metrics
msx psse netlist case.raw

6. Custom Visual Webview Editor (modelscript.rawEditor) ​

Opening any .raw file in the ModelScript IDE or VS Code launches the custom dual-mode editor:

  • Single-Line Diagram View: Interactive pan/zoom SVG canvas with voltage-tier color coding (345 kV red, 138 kV blue, 69 kV green), power flow overlays, and generator/transformer glyphs.
  • High-Density Tabular Grid: Live-filterable tables for Buses, Generators, Branches, Transformers, and Loads with search.
  • Overload & Violation Badges: Automatic highlight of under-voltage (V<0.95 pu), over-voltage (V>1.05 pu), and thermal line overloads (Sij>Rate A).
  • Export Toolbar: Export to SVG diagrams, Modelica .mo packages, and PSCAD/EMT netlists.

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy