Electricity Reference & Design

#1
This guide is intended to be an overview of all power-producing and power-consuming devices in Barotrauma, the effects of the various tweakable editor fields, and solve common problems when creating a functional power network.


OVERVIEW
There are three key concepts to understanding the Barotrauma power network: Power, Load and Voltage.

Power is all energy contributed to the power network. Load is the sum total of all power consumption. Some devices can toggle their load, and some can vary it along a range.
Voltage is power divided by load. 1000kw power / 1000kw load = 1 voltage. Devices function or fail depending on the current voltage level. Voltage can cause issues if it is too high or too low.

Power does not cause problems. Load does not cause problems. A significant difference between power and load causes problems.


DEVICES
A powered device is any placeable ship component that interacts with the power network. There are several such devices, each with their own purpose and tweakables. Whenever a powered device (most of the Machine tab and some of the Electrical tab) is selected in the editor, an additional GUI element appears at the top of the screen. This window displays all relevant fields for that device and their current setting. These fields can be changed to alter the behavior of the device, sometimes dramatically. Several fields effect how the device interacts with the power network. Two fields are common to all powered devices and are described below.
  • MinVoltage: lowest voltage at which this device functions.
  • PowerConsumption: amount of load contributed by this device.
It will be noted when these fields have a different function. The following is an overview of each such device and the effect of each editor field.

Deconstructor
Spoiler
The deconstructor disassembles an item into its component materials. Not all items can be reduced to materials, check the fabricator in-game for a list of functional recipes.

Fields:
  • MinVoltage: as described. Additionally progress is not lost but paused when below voltage.
  • PowerConsumption: as described.
Engine
Spoiler
An engine is required to shift the submarine horizontally. It is usually one of the largest sources of load on board and thus rapid control changes can cause power issues.

Fields:
  • MaxForce: amount of thrust produced at max power. Effect is hard to measure accurately but a higher force results in a more responsive engine.
  • MinVoltage: as described.
  • PowerConsumption: power consumption varies proportionally with usage.
Fabricator
Spoiler
The fabricator can assemble an item from its component materials. Comes with a list of functional recipes displayed on its GUI.

Fields:
  • MinVoltage: as described. Additionally progress is not lost but paused when below voltage.
  • PowerConsumption: as described.
MiniMap
Spoiler
Displays a GUI map of the submarine that shows hulls and their water content.

Fields:
  • MinVoltage: as described.
  • PowerConsumption: as described.
Navigation Terminal
Spoiler
When wired properly this console controls the engine and ballast pumps, allowing both x- and y-axis maneuvering. Has both an autopilot and a sonar component.

Fields:
  • NeutralBallastLevel: setting for the ballast pumps at a neutral control setting. Tweak this if the sub is too buoyant or not buoyant enough at neutral trim.
  • MinVoltage (x2): as described. The navigation terminal has two of these fields, one is for the autopilot and the other is for the sonar component.
  • PowerConsumption (x2): no effect. The navigation terminal does not produce load.
Nuclear Reactor
Spoiler
The only power generator in the game. Vital for every submarine. Slowly consumes fuel rods to produce heat, which is converted into power. Has an automatic setting which controls fuel rods and cooling to match temperature to load.

Fields:
  • MeltDownTemp: temperature at which reactor can explode.
  • FireTemp: temperature at which reactor causes fire.
  • PowerPerTemp: amount of electricity produced per unit of temperature. Do not change this. The reactor does not balance power to load, it balances temperature to load. If PowerPerTemp does not equal 1 then the reactor will under- or over-shoot the current load.
  • MinVoltage: no effect.
  • PowerConsumption: no effect.
Oxygen Generator
Spoiler
Vital component of any submarine. Without it the crew will eventually suffocate. Refills oxygen tanks and produces oxygen in all linked vents. Significant and constant power load.

Fields:
  • GeneratedAmount: unknown. Presumably it relates to the oxygen output of linked vents but that is extremely hard to measure. Has no effect on refilling oxygen tanks.
  • MinVoltage: as described.
  • PowerConsumption: as described.
Pump
Spoiler
An extremely versatile device, the pump can typically be found in the bilge, ballast, airlock, and many other locations. It can pump water in and out and can be directed by the navigation terminal for buoyancy control. Ballast is usually the second highest load on a submarine.

Fields:
  • MinVoltage: as described.
  • PowerConsumption: power consumption varies proportionally with usage.
Railgun
Spoiler
Projectile weapon controlled by a railgun controller. Enormous power demand requires a direct link to a supercapacitor.

Fields:
  • MinVoltage: unknown. Power requirements are far too high to link directly to the power network, a supercapacitor is needed.
  • PowerConsumption: approximately 28% of a supercapacitor.
Sonar Monitor
Spoiler
Displays surrounding terrain and ranging information when active. Very important for navigating without damaging the submarine.

Fields:
  • MinVoltage: as described.
  • PowerConsumption: as described.
Battery
Spoiler
Functionally identical to the supercapacitor but with different settings. Stores power and can discharge into the power network, smoothing spikes in demand. Output is typically somewhat lower than demand, and is further limited when under 100% charge.

At 1000kw Load:
  • 100% charge -- 660kw output
  • 50% charge -- 566kw output
  • 20% charge -- 448kw output
  • 10% charge -- 316kw output
Fields:
  • MaxOutPut: maximum possible output. Output is typically somewhat lower than demand, and is further limited at under 100% charge.
  • Capacity: maximum charge in kw/minutes. 1000kw/m means 1000kw for 1 minute, or 500kw for 2 minutes.
  • RechargeSpeed: current setting in kw of recharge speed.
  • MaxRechargeSpeed: 100% setting in kw for recharge speed. This setting cannot be changed, saving the submarine resets it to 500.
  • MinVoltage: charge rate is proportional to setting and voltage. This includes overvolting, can charge faster than rated limit when voltage is over 1.
  • PowerConsumption: power consumption varies proportionally with charge setting.
Junction Box
Spoiler
Perhaps the device most critical to a functional power network. A junction box distributes power and load to all connected devices. Most importantly, a junction box can overload. It will short out and possibly cause fires if the following conditions are met:
  • At least 200kw of power.
  • Voltage of 2, meaning that power is twice load.
  • These conditions have remained true for several seconds.
Fields:
  • MinVoltage: as described.
  • PowerConsumption: as described.
Lamp
Spoiler
Simple, low-power light emitter. Can be toggled on or off and can have various colors.

Fields:
  • Range: light intensity when fully powered.
  • LightColor: the RGBA color intensity of the light itself.
  • MinVoltage: light intensity varies proportionally with voltage. The lamp will also flicker when below rated voltage.
  • PowerConsumption: as described.
Supercapacitor
Spoiler
Functionally identical to the battery but with different settings. Best used for the massive power requirements of the railgun.

Fields:
  • MaxOutPut: maximum possible output.
  • Capacity: maximum charge in kw/minutes. 1000kw/m means 1000kw for 1 minute, or 500kw for 2 minutes.
  • RechargeSpeed: current setting in kw of recharge speed.
  • MaxRechargeSpeed: 100% setting in kw for recharge speed.
  • MinVoltage: charge rate is proportional to setting and voltage. This includes overvolting, can charge faster than rated limit when voltage is over 1.
  • PowerConsumption: power consumption varies proportionally with charge setting.

DESIGN
The editor tutorial describes how to place and wire submarine components. This section will cover what to consider when designing a submarine and solutions to common problems.

The primary purpose of a power network is to provide a stable level of voltage. Low levels cause erratic function or even no function at all, while high levels short out junction boxes and thus cause a total loss of voltage. The challenge in providing a stable voltage is that power and load change over time. Load can shift up and down very rapidly as devices turn on, off, or vary their output. Power is significantly more restricted as the reactor can only adjust so quickly. Understanding what causes voltage to change is key to designing a robust power network.

Consider the different devices on a submarine and how they are typically used. Crew do not usually coordinate power usage as there are almost always more immediately vital tasks to perform. Crew will use power according to their immediate needs and this must be accounted for. Always keep in mind the difference between static (constant) load and dynamic (changing) load: static is safe, dynamic is dangerous.

Example
Spoiler
This is a list of common devices on a submarine that have a constant or nearly constant power consumption.
  • MiniMap: 100kw. Always on.
  • Oxygen Generator: 1000kw. Always on.
  • Sonar Monitor: 100kw. Can be toggled. Usually left on.
  • Battery: up to 500kw. Can be adjusted. Usually left on max.
  • Lamp: 5kw. Can be toggled. Usually left on.
Assume a submarine with a minimap, oxygen generator, 2 sonar monitors, 2 batteries, and 10 lamps. Such a sub would have a static load of 2350kw.

This is a list of common devices on a submarine that have significantly varying power consumption.
  • Deconstructor: 500kw. On when in use. Rarely used.
  • Engine: 2000kw. Can be adjusted. Use varies significantly.
  • Fabricator: 500kw. On when in use. Rarely used.
  • Pump: 300kw. Can be adjusted. Use varies significantly.
Assume further that this submarine has an engine and 3 pumps. Ignore the deconstructor and fabricator because their power consumption is short and rare. Such a sub would have a dynamic load of 2900kw.

This is a list of common devices on a submarine that can contribute power.
  • Reactor: varies significantly. Responds slowly.
  • Battery: 1000kw. Responds immediately. In practice this tends to be somewhat lower due to how they respond to demand and charge.
This submarine also contains a reactor and 2 batteries. The reactor typically sits at 2350kw and the batteries can provide a combined 1500kw for short periods of time.
Scenario
Spoiler
Reactor spools up to 2350kw to meet the static load. Voltage 1. Crew finishes setting up the submarine and navigation begins. Load spikes and varies considerably, up to a combined maximum of 5250kw. Batteries kick in immediately, bringing power to 3850kw. Voltage 0.73. Reactor increases temperature to 3750kw to meet demand. Due to how batteries function, as the reactor supplies more power the batteries reduce their output. Given enough time the reactor will be contributing the whole 5250kw. Voltage 1. The situation changes, and the sub stops. Perhaps the bridge is flooded, or there is a rock wall ahead, or the sub needs to hold position to recover an artifact. In any case the dynamic load drops, leaving 2350kw of load to soak up 5250kw of power. Voltage 2.23. The reactor cannot reduce power fast enough and junction boxes short out. Any load trapped on the far side of a shorted box only makes the voltage problem worse. The crew now face a significant obstacle at what is probably an already difficult time.

There are three main methods to prevent this problem.
  1. Increase static load. Load is not an issue, it is proportionally how much load changes that causes the issue. If static load was 600kw higher the voltage would have been 1.98. A thin margin, but enough. Either add more devices that contribute to static load or tweak the power consumption of existing ones upwards.
  2. Decrease dynamic load. Reduce the variation in load to reduce the variation in voltage. Use less devices or tweak their consumption downwards. The Vellamo, a stock sub, produces twice as much engine force as it consumes power.
  3. Isolate the worse offenders. Use batteries to "stand off" the load from the power network. If those two batteries output directly to the engine then there would have been 2000kw less of dynamic load. But remember that batteries can run out of charge.

Re: Electricity Reference & Design

#2
Doubleumc wrote:NeutralBallastLevel: setting for the ballast pumps at a neutral control setting. Tweak this if the sub is too buoyant or not buoyant enough at neutral trim.
Can you or Regalis elaborate on this? Does it just control the initial fill or will it affect the sub's ballast fill percent for the entire round? I'm assuming it's just some initial setting, right?

Re: Electricity Reference & Design

#3
It effects the ballast fill percent for the entire round. Changing NeutralBallastLevel means that at all control settings the ballast pumps will have a higher/lower fill target.

The setting does not exactly correspond to fill fraction. The default setting of 0.5 will seek a 50% ballast level at neutral controls, but setting it to 0.0 still has about 25% ballast.

Re: Electricity Reference & Design

#4
Made a test sub which starts a fire in a room if you press a button by overloading a junction. Turned out that fire starts only in 1/6 of cases, in other 5/6 junction simply breaks. Any suggestions to make fire start reliably? I'm thinking to simply put more junctions so that probability of fire appearing would rise, but that still wouldn't make it 100% while you'd have to fix more junctions after every use. Well, that's still easier than crafting incendium grenades.

Re: Electricity Reference & Design

#5
Clueless wrote:Any suggestions to make fire start reliably?
At the moment there's a hard-coded 15% probability for a fire to start when a junction box breaks, so I don't think there's a way to start it reliably with junction boxes in the current version. I made a quick config for an item that causes a fire when it receives a signal, you can try it by adding it to one of the item config files (explosives.xml for example). It won't work in the multiplayer though, but I think we could add an item like this to the vanilla game in the future updates:

Code: Select all

<Item
	name="Ignitor"
	description="Causes a fire when a signal is received"
	category="Equipment"
	Tags="smallitem"    
	price="50"
	cargocontainername="Explosive Crate">

	<Sprite texture="Content/Items/Weapons/weapons.png"  depth="0.8" sourcerect="0,107,14,12"/>

	<Body width="14" height="12"/>

	<Holdable selectkey="Action" pickkey="Use" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
	  <requireditem name="Wrench" type="Equipped"/>
	</Holdable>

	<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
	  <requireditem name="Screwdriver,Wire" type="Equipped"/>
	  <input name="activate">
		<StatusEffect type="OnUse" target="This">
			<Fire size="100"/>
		</StatusEffect>
	  </input>
	</ConnectionPanel>
</Item>

Re: Electricity Reference & Design

#6
Regalis wrote:
Clueless wrote:Any suggestions to make fire start reliably?
At the moment there's a hard-coded 15% probability for a fire to start when a junction box breaks,
It's actually 1/6 ~ 17% because the code which starts fire is picking a random integer number between 1 and 1/0.15 = 6.6(6).
Regalis wrote: so I don't think there's a way to start it reliably with junction boxes in the current version. I made a quick config for an item that causes a fire when it receives a signal, you can try it by adding it to one of the item config files (explosives.xml for example). It won't work in the multiplayer though, but I think we could add an item like this to the vanilla game in the future updates:
That'd be too OP (if I'm understanding properly and this Ignitor thingie is reusable multiple times). You could put them in aegir corridors where captain can activate them in case of mantis intrusions, husk infestations or if he's a dick. I'd rather have some consumable like IC-4 but without explosion which breaks the hull in a huge radius, something which could kill everything in the room without breaking the ship. That'd still be really useful and reliable but it wouldn't have infinite uses like breaking junctions.