Gas Turbine Hardware-in-the-Loop Test Bench

Building a Gas Turbine Hardware-in-the-Loop Test Bench with an STM32 and a BeagleBone
Controls · Hardware-in-the-Loop · Part 1

Building a Gas Turbine Hardware-in-the-Loop Test Bench with an STM32 and a BeagleBone

I have spent six years around turbine control systems, including GE Mark VIe & Bently Nevada(Asset monitoring system) projects in Italy and Singapore. The most expensive lesson in that work never changes: a control program is only as good as the testing you could do before the turbine was spinning. You cannot casually trip a real machine to see if your logic works.

Hardware-in-the-loop (HIL) testing solves this. You replace the machine with a simulation that behaves like it, wire the real controller to that simulation, and then break things on purpose. I wanted to understand every layer of that idea, so I built a small one from scratch. This post is the overview. Later posts go deep on each part.

The idea in one picture

Two boards, three wires, one protocol. The BeagleBone Black plays the gas turbine. The STM32 plays the control system. They talk Modbus RTU over a serial link, the same way a real controller would talk to field devices.

STM32 Nucleo-F446RE Controller Modbus RTU master 50 ms control period governor, protection, voting BeagleBone Black Gas turbine plant model Modbus RTU slave, address 1 10 ms simulation step rotor, gas path, sensors PA9 → P9_26 (RX) PA10 ← P9_24 (TX) GND ↔ P9_1 115200 baud, 8 data bits, even parity, 1 stop bit
The whole bench: the controller reads sensors and writes commands; the plant answers with what a turbine would do.

Why a plant model needs real physics

A lookup table that says “fuel up, speed up” is not enough. Controllers behave badly when the plant has the wrong dynamics, so the model has to push back the way a real machine does. I used a simplified Brayton cycle with five dynamic states:

PieceWhat it does
RotorSpeed changes from the balance of gas power, friction and load, with a starter assisting at low speed
CompressorPressure ratio and discharge temperature depend on speed
CombustorTurbine inlet temperature follows fuel flow and flame state
TurbineExhaust temperature follows from the expansion across the turbine
Actuators and sensorsValve (0.2 s), fuel flow (0.3 s) and thermocouple (3 s) lags

Those lags matter more than they look. A 3-second thermocouple means the controller sees a temperature spike seconds after it happened. Any limiter that ignores that will overshoot, and a HIL bench shows you exactly how far.

The rated point is 22.72 MW at 3500 RPM. The model steps every 10 ms using plain Euler integration, which is accurate enough here because the fastest lag is 0.2 s.

The controller: three jobs

The STM32 runs the logic you would expect in a turbine control system, kept deliberately small and readable.

1. Min-select fuel control

Several limiters each ask for a fuel command, and the lowest one wins. The governor wants speed, the acceleration schedule protects against surge, and the temperature limiter protects the hot section. Whichever is most restrictive controls the valve.

/* illustrative pseudocode, not the exact source */
fuel_cmd = min( governor_demand,
                accel_limit,
                temperature_limit );

2. Protection that latches

A trip is not a suggestion. Once overspeed or over-temperature trips, it stays tripped until an operator resets it, and the controller records which condition came first. That “first-out” record is the first thing an investigator reads after a real event.

3. Voting on bad sensors

Speed uses a 2-out-of-3 vote, so one failed probe cannot cause a trip or hide a real overspeed. Exhaust temperature takes the median of four thermocouples, which throws out a single wild reading without a special case.

The wire is part of the test

I chose Modbus RTU because it is what real equipment speaks, and because bugs in framing and timing show up on a real wire in ways they never do in a function call. The controller polls every 50 ms. A full request and response is roughly 85 bytes on the wire, which is about 8 ms at 115200 baud, or around 16 percent of the cycle. That leaves room, but not unlimited room.

Both sides run a watchdog. If the plant stops hearing from the controller, it assumes the controller has died. If the controller stops hearing from the plant, it trips. Pull the cable and both ends react, which is exactly what you want to be able to test.

What is verified, and what is not yet. The plant model, controller logic, Modbus framing and test scenarios all run in software, and the test suite passes. The serial link on the BeagleBone has passed a loopback test at 115200 8E1. The STM32 firmware has so far only been checked against a stub, not run on the real chip. I will publish real-wire timing numbers once they are measured, not before.

Scenarios, not manual poking

Tests are small JSON files that describe a sequence: start, ramp to rated, apply load, inject a fault at a given time. A runner replays them against the bench and records the result. That means every change to the control logic can be checked against the same set of events, the habit that separates a bench from a demo.

What I would do differently

  • Settle the network early. Half of my bring-up time went to SSH drops and a misrouted default gateway on the BeagleBone. That is its own post.
  • Write down the register map first. Everything else depends on it, and changing it later breaks both boards at once.
  • Test the failure paths before the happy path. Starting up is easy. Watching a trip latch correctly is the point.

Next in the series

The next posts go one layer down at a time: the plant physics, the min-select governor, the protection and voting logic, Modbus from scratch, and the real-time details on both boards. The full code is on GitHub: github.com/jdram82/gt-hil.

Durgaram Jayavanan is the Solution Architect of Jdsan Controls, working on LV/MV Electrical Design and Industrial automation, turbine control and HIL testing. If you test control systems for a living, I would like to hear which failure case you would add to this bench first.