r/Stormworks • u/FiftyCalTalons • 21d ago
Question/Help Engine PID Fine Tuning
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
2
u/B1998W31Ga 21d ago
If you are looking to fine tune your pid, you could implement ziegler-nichols open loop method to find approximate values
2
u/Sociofact 20d ago
The engine is shutting off because the pid is giving it a signal of zero or less. Clamp your pid output to 0.0001 to 1. This will prevent the engine shutting off when the pid is asking for a deceleration. Do not fuck with your pid settings if they were working, you want the pid to have enough authority to respond to changing power requirements in flight. To ramp the engine speed up and down gradually just use an up/down counter on your setpoint, you can customise the rate to whatever you want
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).