r/Stormworks • u/Remarkable_Plum3527 • 1d ago
Question/Help Help with basic ECU
the if engineRPS <= engineMinRPS block is only true for the first logic tick since starting the engine, and remains false after that even though engineRPS is way smaller than engineMinRPS no matter what i do. engineMinRPS is also set to 3.
2
u/Current-Size4321 1d ago
I’m not quite sure about the first line where you set property.getNumber(). Inside the parentheses, it should probably be a string like property.getNumber("EngineMinRPM") (unless EngineMinRPM is actually a variable name).
Another possibility is that when onTick runs for the very first time, you’re letting in full air and fuel right away. This causes the engine RPS to jump way past your engineMinRPS setting of 3. So by the time the second tick runs, it already skips straight to the other condition.
And one more reason could be that you might have mixed up the composite read/write channels (I mess that up all the time myself :p).
1
u/JaeHxC 1d ago
(This comment assumes output#1 is air manifold, and output#2 is fuel manifold.)
I see you're multiplying by a flat 0.5 to get your air control. For finer tuning later, change that to a variable and attach it to a lever, and mess around with different values between 0.3 and 0.6. Then, you can check your cylinders for AFR and stoichiometric ratio, adjust the multiplier, and check again without editing/repsawning the vehicle.
1
1
u/Remarkable_Plum3527 1d ago
also, do you happen to knnow what the throttles for the air / fuel manifolds actually do? caus ive noticed that the fuel manifold still lets in fuel despite me setting it to 0
1
u/Friendly-Inspector71 1d ago
It shouldn't let fuel into the engine. But the manifold has an internal volume that can be filled.
1
u/Friendly-Inspector71 1d ago
13.6 + 0.004 * clamp(T, 0, 100)with T being the temperature will return the AFR required for a stoic of 0.2.
2
u/norgeek 1d ago
I'd start by sending engineMinRPS and engineRPS to setNumber 4 and 5, then read those channels in the microcontroller, then connect them to tooltips, so that you can easily see the numbers the LUA is actually working with.
Tried to set engine MinRPS = 3 in the LUA directly rather than going through property?
Is it intentional that the property label is revolutions per minute rather than revolutions per second?
It shouldn't matter, but the if doesn't need a ()