Building your first eHS circuit with SPS Software

Building your first eHS circuit with SPS Software

If you're anything like me, I love making circuits and connecting components to form a special function of my choice. What's great about eHS is that I get to configure the components and their specific details without being bound to limited off-the-shelf manufactured options, and actually test their performance in real time!

With eHS, you can draw your circuit and run it on an FPGA in real time or run a pure offline simulation with a clean UI and straightforward workflow.

In this tutorial, you'll learn how to:

  • Build your circuit using only the blocks eHS supports
  • Name your blocks properly so they're easy to identify in RT-LAB
  • Avoid a common trap where your diode unexpectedly shows up as an input

Let's get straight into it!


🧰 What you'll need

  • RT-LAB
  • MATLAB / Simulink
  • OPAL-RT SPS Software (formerly known as SimPowerSystems / Simscape Electrical Specialized Power Systems)

Step 1: Build your circuit with supported blocks

When building your circuit model in Simulink, keep in mind that the eHS solver cannot read every standard block. Stick strictly to supported blocks from the SPS libraries so your model translates smoothly:

From Elements:

  • Series RLC Branch / Load
  • Parallel RLC Branch / Load
  • Ground / Neutral
  • Breaker
  • Pi Section Lines
  • Linear Transformers
  • Mutual Inductances
  • Inductance Matrix Type Transformers
  • Saturable Transformers (supported only in specific firmware versions)

From Power Electronics:

  • Breaker, Diode, IGBT, IGBT/Diode, Ideal Switch, Thyristor
  • Three-Level Bridge, Universal Bridge


Step 2: Name your blocks (order matters!)

The eHS solver identifies your switches, sources, and measurements and lists them in alphabetical order by name. That exact alphabetical order dictates how they are mapped and accessed inside Simulink and RT-LAB.

If you leave default names like Diode3 or AC Voltage Source1, your I/O signal routing quickly becomes confusing!

Follow this recommended naming convention:

Component Type Prefix Description & Example
Switches SW + 2 digits SW01, SW02_upper (Diode, IGBT, Breaker, Ideal Switch)
Sources U + 2 digits U01, U02_Vdc (Controlled or independent current/voltage sources)
Measurements Y + 2 digits Y01, Y02_Ia (Voltage or current measurements)
R, L, and C No prefix needed Handled internally by the passive network equations

Rules to remember:

  • Always use two digits: write SW01 or U01, not SW1 or U1 (otherwise alphabetical sorting will place U10 before U2).
  • Descriptive suffixes are allowed: e.g., SW01_PhaseA_High, Y03_Vload.
  • Three-phase sources take three indices: label them starting with phase A, e.g., U05 U06 U07 Vabc.


Step 3: Check your switches' Forward Voltage (Vf) ⚠️

This one catches a lot of people by surprise!

Many SPS switching blocks (like Diodes, Thyristors, and IGBTs) have a configurable Forward voltage (Vf) parameter (often defaulting to 0.8 V).

Here's the catch:

When the eHS solver analyzes your circuit, any non-zero Forward Voltage (Vf > 0) is treated as an eHS input.

Because of this, your diode or switch will suddenly pop up in your eHS inputs list right alongside your actual power sources (Uxx). This shuffles your expected input indexing and can mess up your control wiring!


💡 Good to know: Universal Bridges and LCA

  • If you are using a Universal Bridge or Three-Level Bridge block with the Loss Compensation Algorithm (LCA) enabled, the eHS solver automatically ignores the mask's Forward Voltage parameter during extraction. Setting Vf in these bridge blocks will not create extra input channels.
  • LCA is intended for Gen3 eHS blocks on 2-level and 3-level NPC topologies.
  • For bridge blocks using LCA, ensure all switch conductance (Gs) values within the bridge remain identical.

Have you run into other tricky quirks when prepping models for eHS? Drop your questions or tips below!

Hello,

Why use SPS to develop an electrical network with eHS instead of using eFPGASim?

Hey!

To put it simply:

  • No long FPGA builds: With custom eFPGASim (System Generator / HDL), any small circuit change means a 1–3 hour Vivado bitstream compilation. With SPS + eHS, the FPGA solver is pre-compiled. It reads your SPS schematic, calculates the state-space matrices, and pushes them to the FPGA in seconds—so you can tweak component values on the fly without recompiling.
  • Schematic vs. math blocks: In SPS, you just draw the circuit with standard switches, sources, and RLC branches. In eFPGASim, you'd have to derive the differential equations yourself and wire up custom DSP multipliers, delays, and fixed-point math.
  • Floating-point accuracy: eHS runs in 32-bit floating point down to tens of nanoseconds, with built-in algorithms for power electronics (like PWM time-stamping and switching loss compensation).

A good rule of thumb: use SPS + eHS for the electrical circuit/converters, and use eFPGASim if you need custom, ultra-fast digital controllers or communication blocks running alongside it on the FPGA.