-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chained Relay Power Provided Fluctuating Wildly #7864
Comments
Duplicate of #6471 |
This is not the same bug at all. That was a load bug, this is a supply bug. This is also a new bug; this bug didn't exist before the new patch. |
I found this on #baro-sub-builder: Relays are really fantastic for signaling, so don't discredit them, but for power transfer they are only useful in very specific scenarios. The biggest drawback of relays is that there is a delay between calculating the load on the Power_Out grid, and requesting the power from the Power_In grid. This can and will cause all sorts of issues if theres any "dynamic" load device, or one that fluctuates at all. What will happen is a ripple effect through your relay(s), where before the request for power can be sent to the generator, the load will have shifted, and the two numbers will never match up. This is what causes the flickering that so many people have seen in lights. There are a couple best practices for using relays to transfer power. As a result, the reactor is caught in a constant game of keep-up with the delayed output of the relay. The relay will provide power values either higher or lower than current grid load if grid load is fluctuating (depending on relay power throughput). Due to the nature in which reactors provide power, they must first produce heat to spin up their turbine. The amount of time between the reactor adjusting and outputting power is long enough for the relay to incorrectly fulfill grid load. This usually results in the reactor attempting to provide overall less power so it does not overheat. In grids where load fluctuates quickly, (a majority of functional submarine grids) the reactor will never be able to heat up enough to provide majority grid power. This results in effectively a "low output" mode of the reactor, as it will produce just enough power to maintain minimal fission levels, but won't ever increase to assist in grid load. In grids where load is stable, either constant or with slow gradual transitions, the reactor and relay will oscillate between whom provides majority load. This is most likely a result of the relay's delay. The effect I've witnessed is when the relay is providing a substantial amount of power, the reactor will spin down until around minimum fission levels, where it will balance out and begin to climb. Power output from the reactor will increase and near 100% grid load. However right before providing 100% load, the relay's delay will once again cause the reactor to see a higher grid power and will attempt to provide less and less, until it gradually drops back down to minimum fission levels. Then the process repeats itself. Stable grids with the above setups will benefit from more efficient reactor fuel rods. Higher heat output will mitigate the effects of the oscillation, but it will not resolve it completely. You will witness more majority output from the reactor, and after an oscillation less time in relay majority output as the reactor is able to recover quicker. If you've got a relay between the grid and the battery power_input, it's mostly fine...UNLESS your batteries loop back into the grid, which is most systems. What I mean by looping, is that the battery can output power into the same power grid that it can charge itself with. If that's your setup, and you've got a relay, the relay will actually somehow magically eat HALF the power that goes into the batteries, effectively causing your batteries to discharge twice as fast as they normally would. Further, chaining relays with lights on them, as in more than one relay, would in theory be fine. But if anywhere on that grid, including at the beginning even before a relay, is a device that has a dynamic load, it will cause the lights to undervolt, then overvolt to compensate, then the ripple effect can occur and could be impossible to get rid of. There are a couple best practices for using relays to transfer power. |
Serial Relay Connection. |
Since FakeFish was nice enough to share the source I spent my evening looking into this bug. To debug the issue created a setup in the editor like what @MaaiG has above and set the MaxPower for the relays to 100. I tracked the value back to line 116 where it appears that there is an order of operations issue. |
Oh wow, I'm glad you spotted that! Thank you so much for taking the time to debug this. Merged the fix to our private repo now (Regalis11/Barotrauma-development@504e141) and moving this ticket to QA. |
On a closer look, this was not an issue with the order of operations. The throttling was supposed to decrease at a speed relative to the maximum output of the relay. Now it drops immediately to zero, which essentially inverts the problem: now chained relays with a large maximum output and low load cause this kind of rapid fluctuation. |
Tested, working correctly. Closing. |
Description
If you daisy chain relays together to power any load, the relays from the second relay onward from the junction box have something wrong with their power supply. Power available seems to wildly jump up and down for no apparent reason. This is despite the fact that all relays can handle the loads provided. In fact if it cannot handle the load provided it seems to not do the fluctuations which is even more strange.
This isnt the load jumping around, this is the power. But the power supply is totally stable as measured from the first relay or the junction box. This happens with any load, but only if 2 or more relays are combined. This only started recently. This was in single player on the berilia and also in the editor.
Steps To Reproduce
Power a load with at least 3 relays that are daisy chained together. Inspect the second relay from the junction box, or any thereafter. Watch the power jump around. Ive tested it on lamps, diving suit racks, and charging docks.
Version
0.15.22.1 Windows 10 x64
Additional information
The text was updated successfully, but these errors were encountered: