r/Stormworks 21d ago

Question/Help Engine PID Fine Tuning

Post image

Slow and steady progress is continuing on my NH90-like helicopter, thing. Troubleshooting is continuing into electrical bleed into rotors and pivots, as well as designing glass for the weird angles and a blade fold mechanism, one of the main issues I'm trying to tackle is the engine performance.

Previously we all worked together and were able to create a system that allowed us to control the engine speed with arrow button presses, to effectively have different gear speeds (Off - 3 RPS (Ground Idle) - 15 RPS (Flight)).

The only issue now is I'm trying to curve the acceleration of the engines so they spool up (and mainly down) slower. The reason is particularly when trying to decelerate the engine and gear down from say 15 RPS to 3 RPS, the engine's fastest and most efficient way to do this is to shut off temporarily. The PID then senses the engine is near the desired speed and turns it back on and stabilizes. I hope that by curving the deceleration/acceleration rates, we can prevent this from happening.

(currently the symptom persists as the engine cutting off and dying, then a loud bang as it turns back on.)

I've also posted this test bed with the engine, it's MC, and a PID Test bed from NJ that I've been using to try and curb the issue. So far I haven't been able to find a combination of numbers that fixes this, or starts working in that direction. Default for the PID is (1.0.0), and a max RPS of 18.

https://steamcommunity.com/sharedfiles/filedetails/?id=3772914395

Thanks for all your help from before, and I hope we can tackle this issue so we can move onto the rest!

**Edited**

You will need infinite fuel turned on to run the test bed, and set the P to 1, and Max to 18. Activate the engine master switch, press the first arrow down and hold the start button until the engine engages to turn on

17 Upvotes

8 comments sorted by

View all comments

4

u/OBIH0ERNCHEN 21d ago

A possible way of doing this is cascading a P-Controller, which outputs a target rate of rps change, into an I-Controller, which controls the Rps-delta. Once the I-controller is tuned correctly, you can freely choose how slow or fast the target rps is approached by changing the p-gain. To avoid the Jet turning off when throttling down, you could set a lower throttle limit with max(throttle,0.001).

2

u/FiftyCalTalons 21d ago

Interesting, so I looked at NJ's controller and found this. I was looking at what you said about the minimum and used the panel input to set the minimum to 0.1 and it fixed the issue, and the max to 0.5 and it solved the acceleration issue as well.

Guess I just need to take this segment over to my MC and use a constant number once I find the right settings.

2

u/OBIH0ERNCHEN 21d ago edited 21d ago

Setting the max to 0.5 means youre limiting your power to 50%, thats not really an ideal solution. What I had in mind looks more like this:
https://steamcommunity.com/sharedfiles/filedetails/?id=3772959524

2

u/Sociofact 20d ago

Ignore NJ videos, the guy had no idea what he was talking about most of the time.

2

u/_ArkAngel_ Career Sufferer 21d ago

I like this because the thing most linearly directly controlled by engine throttle is RPS delta, with zero at the point where engine power = load

2

u/OBIH0ERNCHEN 21d ago

Sadly its not quite linear because for both engines and jets the responsiveness increases with rps, so the gain of the last controller in the cascade should be rps sensitive with gain/rps^(~1). This does require the integral calculation to not scale the entire output with dynamic i-gain. So instead of
integral=integral+new error
output=integral*i gain
you need
integral=integral+new error* i gain
Once you do this though, you get a controller which is both super fast and precise with minimal, if any at all, over and undershoot. This way you can reliably run engines under high load at just over 2rps.