Barotrauma

Barotrauma

113 ratings
Component Reactor Control System "Carnot"
By eLeft6
ABSTRACT
The recently added speed limit to the reactor control sliders means that no Component Reactor Control System will ever be perfect or even better than Manual Control (unless something changes). Although previously perfect reactor control systems (PID controller, bang-bang) are still functional they are now far from ideal and many other reactor systems can surpass them in safety and performance.
After many hours spent on thinking, a Component Control System was figured that in terms of performance, safety, simplicity and adaptability/customization options is, as far as the author is concerned, unsurpassed.
The System was named after Nicolas Léonard Sadi Carnot for his contributions on Thermodynamics.
5
3
4
3
3
   
Award
Favorite
Favorited
Unfavorite
INTRODUCTION
The Basics
Do not skip the text! The pictures in the Guide exist to only assist the text, not replace it. If you are in a hurry proceed to the "CORE SYSTEM" part and then start reading normally.

The System that will be presented in this Guide can be considered an older, more direct approach to solving the problem/mystery of the best reactor control system using components. It's based entirely and exactly on the way the Fission Reactors work inside barotrauma, which is, argueably, quite accurate to real life Nuclear Power Plants though extremely simplified for obvious reasons.

In simple words:
  • The Fission Reaction happens in the Reactor. Many fuel types can be used (usually enriched Uranium e.g.10% Uranium-235).
  • The reaction releases vast amounts of heat in the form of rays (alpha, betta and gamma rays) and high-energy fission products.
  • The heat is being absorbed by a coolant (water, molten salt, liquid metal or other) and then used to generate steam (water vapor).
  • The steam passes through a turbine and liquefies through a Rankine Cycle configuration generating usable energy in the process according to the laws of Thermodynamics.

In the game this is translated in to a Fission Rate slider and a Turbine Output slider. The higher the Fission Rate the higher the heat generation while the higher the Turbine Output the higher the heat consumption. The higher the heat consumption the higher the electricity generation. That's right. The in-game reactors basically make and consume heat. Your job is to balance the heat generated and heat consumed and achieve a stable, good performing and at the same time safe temperature. The temperature you're usually looking for is 5000 K . High enough so as to achieve high efficiency while also low enough so as to not present any dangers in form of overheating.

Fission reaction of Uranium-235 and a simple Rankine Cycle as applied in the modern age:

What you'll need
The Component System can be customized in various ways, some of which will be presented in this guide. However, the simplest form that the System can take is the first that will be presented. For that you will need:
  • 3 Divide Components
  • 2 Multiplication Components
  • 2 Memory Components
  • 1 Adder Component
  • 1 RegEx Component
  • 15 wires
  • a screwdriver

WHAT WE KNOW
    Hot Maths
  • Temperature:

    At all times the Temperature of the Reactor is equal to the difference between the Heat Generated and the Heat Consumed. So the Temperature equation should look like that:

    T = Gen_Heat - Cons_Heat (1)

    in which
    T: Temperature


  • Heat Consumed:

    The Heat that is being "consumed" by the Reactor is simply the Turbine Output (percentage) multiplied by 100. So we have the following:

    Cons_Heat = 100*Turbine_Output (2)

    But what is the Turbine Output equal to? The Turbine Output is simply the percentage of the Reactor's maximum Output that is needed to generate the required amount of energy in the form of electricity. The required amount of energy is simply the Load of the Reactor. It's nothing difficult to calculate:

    Turbine_Output = 100*Load/Max_Output (3)


  • Heat Generated:

    Now that we know what the Consumed Heat actually is all we need is to figure out what the Generated Heat is. As mentioned earlier, the Fission Rate is what determines the Generated Heat so it must be somewhere inside the equation we're looking for. At the same time there are many types of fuel in this game and each one has different Fission Power and Durability. The Fission Power of each fuel type is determined by a certain number, the Heat Potential. The Heat Potential of each fuel type is presented in the following table:

    Fuel Rod Type
    Heat Potential
    Uranium
    80
    Thorium
    100
    Fulgurium
    150
    Volatile Fulgurium
    150

    It is another obvious thing that the combined Heat Potential of the Fuel Rods in the Reactor will also be present in the equation we're looking for. Thankfully, this information is given by the Reactor itself. It is simply the "Fuel_Out" value. All that remains now is to actually find the correct equation.

    After rigorous and persistant testing it was found that the Generated Heat is directly proportional to both the Fission Rate and the combined Heat Potential and even more testing resulted in the following equation:

    Gen_Heat = 2*Fiss_Rate*Fuel_Out (4)

    whereas and as mentioned above, the "Fuel_Out" value is the combined Heat Potential of all the Fuel Rods currently in the Reactor.

    Using the equations (1), (2) and (4) the following equation is constructed:

    T = 2*Fiss_Rate*Fuel_Out - 100*Turbine_Output

    or when solved for the Fiss_rate:

    Fiss_Rate = (T + 100*Turbine_Output)/(2*Fuel_Out)

    Add in the Turbine Output equation (3) and a complete model for calculating both the Fiss_Rate and the Turbine Output is made:

    (3) => Turbine_Output = 100*Load/Max_Output
CORE SYSTEM
Equations
In this part the equations will be applied into the game. First, however the Fiss_rate equation will be modified in order to minimise the components needed:



(BE CAREFUL! T is the "ideal" Temperature, the one the Reactor should operate at. It is NOT the current Reactor Temperature.)



Choosing the right temperature

The only thing left is to decide the temperature at which the Reactor will operate at. The best option in terms of simplicity, safety and performance is the Temperature of 5000 degrees and is the Temperature that this first part will utilize. However, systems to minimise fuel usage when possible and manual Temperature control systems can also be used, some of which will be presented further down this guide.

For T=5000 degrees the Fiss_Rate equation looks like this:

Fiss_Rate = 50*(Turbine_Output + 50)/Fuel_Out


Before you start

It is highly advised is to place the components, starting from the top and moving towards the bottom, according to the following configuration:



Start with the Tubine Output

Start by placing a memory component. This one will be used to store the Maximum Output of your Reactor divided by 100. (Be careful! Any Reactor Max Output upgrades must be accounted for!) So if for example your Reactor has a max output of 5200 KW then the value 52.00 will be used. What follows is a table with the Max Output of all the Vanilla submarines taken from https://barotraumagame.com/wiki/Nuclear_Reactor:


Submarine
Max Output (KW)
Azimuth
3500
Barsuk
4200
Berilia
6500
Camel
5200
Dugong
3000
Herja
4800
Humpback
3100
Kastrull
5000
Orca
3500
Orca 2
4000
R-29
5200
Remora
5000
Typhon
5000
Typhon 2
5200
Winterhalter
8500



Then, place a divide component and wire SIGNAL_IN_2 to the memory component's SIGNAL_OUT. The memory component should look like this after you wire it:


Then wire the Reactor's LOAD_VALUE_OUT to the SIGNAL_IN_1 of the divide component:


That's it, you're done! If you did these few steps correctly then the divide component will be successfully calculating the correct Turbine_Output at all times and you wired the divide component's SIGNAL_OUT to the reactor's SET_TURBINE_OUTPUT it would work fine. But don't do it just yet. "Fine" is simply not enough and you haven't even done the Fission Rate part!


The Fission Rate

The Fission Rate is the 2nd and final part of the Core and argueably the most important one. Starting you need to place the second memory component with the value "50" stored in it.


Then place the adder component and wire its both SIGNAL_IN. One to the SIGNAL_OUT of the memory component you just placed and one to the SIGNAL_OUT of the divide component. What you're basically doing is adding "50" to the Turbine_Output value. At the end the adder component should look like this:


Following place a multiply component and wire SIGNAL_IN_1 and SIGNAL_IN_2 to the SIGNAL_OUT of the adder component and the SIGNAL_OUT of the memory (50) component respectively. The multiply component should look like that:


while the system so far should look something like this:


It's starting to look nice, isn't it? But all those components... Switching between the game and the guide for every single one must be tiring, why don't you just take a brea... DON'T STALL NOW! Quickly place a divide component! Wire the SIGNAL_IN_1 of the divide component to the SIGNAL_OUT of the multiply component you just placed. Wire the SIGNAL_IN_2 of the divide component to the FUEL_OUT of the Reactor!


Your divide component should look like this:



Congrats! You finished the Fission Rate part too! The last divide component perfectly calculates the required fission rate to maintain 5000 degrees at the Reactor. Again this system is just fine and much better than the normal, default, "auto" Reactor of the game and if you want you can stop here by wiring the SIGNAL_OUT of the 1st divide component to SET_TURBINE_OUTPUT and the 2nd divide component (SIGNAL_OUT) to SET_FISSION_RATE of the Reactor. But don't do this! You're better than this. You can install a "safety" system in case things go wrong for whatever reason (added too many fuel rods at once, griefers and more). Scroll down to the next part of this Guide!
EMERGENCY SUBSYSTEM
An Explanation

This part of the Guide isn't strictly neccessary. The Core System alone can run a reactor good enough to be worth it. The "Carnot" Component System is very modular and this is the simplest, while at the same time effective, module.

This module is an "Emergency" system. What this means is that the System won't be active at all times but only when bad things happen (e.g. an assistant put 3 fuel rods in the reactor all at the same time). It's purpose will be to avoid overheating (and consequently fires and meltdown) at all costs. But why would you even need something like that since the core system is made in such a way as to keep the temperature stable at 5000 degrees. Simply because the Reactor Control Sliders got a speed limit and the Reactor in many cases just can't adapt fast enough to situatons such as adding many fuel rods at once or huge load fluctuations. No perfect System exists and can exist as long as the slider's speed limit is in place.


The basis of the System

The logic behind this subsystem is very simple. "If the Temperature is above that many degrees then do that" is literally the whole logic behind it. Now remains finding out how to actually drop the temperature faster than it would otherwise drop. As it was revealed in the maths part of this Guide the temperature depends in 3 factors. The Fission Rate, the Fuel_Out value and the Turbine Output. SInce at the moment there is no feature in place to automatically eject fuel rods from the Reactor to lower the Fuel_Out value only 2 factors remain. This System will use both of them. In order to reduce the Temperature the system will reduce the Fission Rate while at the same time increase the Turbine Output. The last part some months ago would be catastrophic as all of the junction boxes would be on fire within seconds of overloading them with power but since a recent update overloaded junction boxes don't break as easily and overvoltage is actually causing most devices to operate better that normally.


The System

The Subsystem is based on 3 components. The core of the whole system is the RegEx component. The RegEx component is able to determine whether or not a signal matches a specific Regular Expression and outputs a specific signal based on the result. This makes the RegEx component the most powerful component in the game allowing you to cut down the amount of components needed by a huge margin. After placing the RegEx component the following Regular Expression must be used along it:

^[0-4]?.?.?.$|5[0-3]?.?.$

The RegEx should look like the one in the picture:


(DO NOT FORGET THE FALSE OUTPUT VALUE!)

The Regular Expression used is a simple one. It matches the numbers 0-4999 or 5000-5399 (and some more but since the Temperature can only be between 0 and 10000 degrees those numbers are the only of any importance). The RegEx can be traslated into "If the Temperature is lower than 5400 degrees then output 1, otherwise output 2." But first the TEMPERATURE_OUT of the Reactor needs to be wired to the SIGNAL_IN of the RegEx component.

After this is complete the output numbers will be explained. When there is an emergency situation (T >= 5400 degrees) the RegEx is outputting the value 2. This value will go into a Multiply and a Divide component. The Turbine Output will be multiplied by 2 while the Fission Rate will be divided by 2 until the Temperature falls below the 5400 limit set by the Regular Expression. So the 2 logical, next steps are placing and wiring the Multiply and Divide components.

Place the Multiply component near the Turbine Output's Divide component. Wire the SIGNAL_OUT of the Divide component into one of the SIGNAL_INs of the multiply component. The other SIGNAL_IN will be wired to the RegEx component's SIGNAL_OUT.

Do the same with the Divide component. This time however place it near the Fission Rate's Divide component and wire SIGNAL_OUT of that divide component to the SIGNAL_IN_1 of the just now placed Divide component. The SIGNAL_IN_2 must be wired to the RegEx component's SIGNAL_OUT.

The only thing remaining is to wire the SIGNAL_OUT of the recently placed Multiply and Divide components to the SET_TURBINE_OUTPUT and to the SET_FISSION_RATE of the Reactor respectively. At the end of it all the 2 components should look like this:


While the RegEx should look like this:



If this Guide has been confusing enough for you so that you are unable to follow it then take a look at the whole System depicted in a single picture and try to slowly make sense of it. It can genuinely help!




Closing

That's it. If everything went right the System should now be completed. The RegEx values can be changed to better suit you. The Regular Expression can be changed so that the Temperature becomes even more constrained and the Emergency System has more time to respond. Or maybe the False Output of the RegEx component can be reduced to somewhere between 1 and 2 to allow for a milder response to emergencies or increased to make it so that the System responds even more aggresively. Those are choices this Guide encourages you to make. Maybe you dislike the Turbine Output slightly overloading your junction boxes during emergencies, you can just take the wires out. Maybe you want to have a different response for the Fission Rate and the Turbine Output, you can just add a second RegEx. Hell, maybe you don't even want an Emergency System, just stop at the Core System. The customisability of the Core System is its power. You can change it however you want or you can leave it as it is.
WHAT'S NEXT

This Guide will be updated every once in a while. At its final form it will containe a handful of other Subsystems, such as a Reactor Temperature Control System for greater fuel efficiency and more.
35 Comments
RAY 25 Mar @ 3:23am 
@greez, I think the easiest way would be to put a multiply component between the load_out of the reactor and the controller itself, so the controller works for a "fake" load which is slightly higher than the actual load. Have the second input of the multiply component fed by a circuit you manually control from e.g. the cockpit, where you have it normally output 1 (normal load) but can have it output 1.5 (to overvolt).

Also, having checked two other reactor controllers (by Ignis and Drfreenote), it looks like this is the best one around right now :) thank you, eLeft6, for taking the time to share it with us!
Greez 14 Oct, 2024 @ 6:07pm 
First of all, I really love the controller! But recently it came up within my group that an overvolting option would be nice for sticky situtations. I have tried numerous methods of implementation but it seems that the controller always fights back, and wins. How could I implement an overclocking that would reach a Power/Load-ratio of say, 1.5?
eLeft6  [author] 6 Jun, 2024 @ 12:05pm 
Thank you very much! Unfortunately I never found enough time to finish the guide and to be honest I might have forgotten some stuff about barotrauma (I'm very rusty) but I'm always happy to see people having ideas. I used to be a great barotrauma Engineer but now I have to focus on becoming an actual one. Continue engineering barotrauma o7, one day I might return. I wish you fulfilling voyages with lots of Uranium ore. Stay safe o7 o7 o7.
Trofogol 6 Jun, 2024 @ 11:23am 
great explanation, now I can pass barotrauma reactors 101 exam

Notes on the emergency subsystem:
- regex component can be replaced with greater component (it has false output field as well);
- the subsystem is designed only to prevent overheating, submerged launch (when reactor room is flooded and water dissipates a lot of heat) is not supported, we'll have to unwire fission rate controller to enable the pumps manually
antigua 21 Jan, 2024 @ 5:47pm 
Nice article, carnot would be proud
Pressure Cooker 23 Aug, 2023 @ 6:48am 
is this how governments secretly trade blueprints now?
LastThymeLord 14 Aug, 2023 @ 1:38pm 
Ahhh, a mechanical explanation instead of a 1:1 guide.
Much appreciated, very easy to comprehend.
Sixian 23 Jul, 2023 @ 3:18pm 
Thanks man, i can now use something that may surprice some caps
eLeft6  [author] 23 Jun, 2023 @ 12:06pm 
Nice! Never got myself to do the economy mode I am talking about in the guide. I'm sure however that with these findings you don't need it and you cna now create it yourself. Also thank you for leaving this comment here as a future reference. If I ever have time to return to barotrauma and want to complete the guide your comment will be very helpful. Have a nice day!
Temstar 23 Jun, 2023 @ 7:41am 
Actually upon further experimentation it turns out maximum power for a given core temperature is a simple liner relationship:
Max power = Core Temp/5000

So for reactor controls that are aiming to implement two modes:
1. For regular mode, just set target temperature to 50 as per this guide
2. For economy mode, set target temperature dynamically to 50 x Turbine_Output