User:Zamujasa/Mechanics

From Space Station 13 Wiki
Jump to navigation Jump to search

Mostly based off the 2016 release since I'm not a coder.


Power

SMES units

Maximum capacity of 100,000,000 W (100 MW). Maximum input and output rates of 200,000 W (200 KW).

Charging

  • Charges using the terminal-side interface only.
  • Won't charge at all if input > available.
  • Won't use extra power if availableinput.

Discharging

  • Discharges using the cable-side interface only.
  • Will output exactly how much power is specified in output, even if not needed.
  • Attempts to reclaim unused power after discharging.
    • Basically, if it outputs 100,000 W but only 60,000 W is used, will try to remove 40,000 W and add it back to its storage.
    • Some notes on the wiki here suggest that this is kinda fucked up and can result in power dissipating into the void???
    • "Order" of SMES units is vaguely important. If two are outputting 100 KW (200 KW total) but only 150 KW is being used, only one of the SMES units will 'reclaim' that power.
  • The amount of power being actively used is shown as the "load". You can intentionally lower the output to spread the load across multiple units.

If you can figure out the priority of the SMES units, you can set them up like this, assuming a 70 KW average load with occasional telescience nerds:

  • Unit 1: Output 40,000 W
  • Unit 2: Output 40,000 W
  • Unit 3: Output 200,000 W

Assuming that all three SMES units are charging at 200 KW and the priority is right, unit 3 will stay fully charged most of the time but will handle excess load, while the former two stay fully powered indefinitely.

Not much of a reason to do this unless you like micromanaging things or ensuring that a loss of power doesn't cripple things.

APCs

Those little squares that regulate power for a room.

For automatic settings:

  • Equipment: Turns off at < 15% power (probably). Usually stuff like doors, computers.
  • Lighting: Turns off at < 30% power (probably). It's the lights.
  • Environment: Turns off when there's no power at all. Not a lot of things use this, though.
    • Fire alarms
    • Pipes
    • Power gloves (possibly)

Power gloves are weird because the code seems to check if you're on a powered/connected wire (as expected) but then chooses to use 50,000 W Environmental from the local APC and disregards the power in the wire completely. This may have been changed since the 2016 release since otherwise it makes hotwiring the engine kinda pointless.

The powernet keeps track of how many APCs are attached to it as numapc, and how much power is available to each (avail ÷ numapc = perapc).

When an APC draws or gives power to a cell, the amount (W) is multiplied by CELLRATE (0.002). The 2016 comments suggest this is supposed to be 2%, but 0.002 is 0.2%.)

Operation

APC operation is a little complex:

  1. If we have no cell at all, turn everything off and stop. Otherwise...
  2. Calculate power usage ((Equipment + Lighting + Environment) W) as usage.
  3. Draw usage from the cell.
  4. If there is excess power in the powernet, or perapc > usage ...
    • Restore perapc to the cell.
    • Add perapc to the powernet load.
  5. Otherwise, if (cell charge + perapcusage) ...
    • Restore perapc to the cell.
    • Add perapc to the powernet load.
  6. Otherwise, turn everything off.
  7. Auto-set options based on cell charge level.

Or in layman's terms:

  1. Remove usage from the APC's cell.
  2. Is the per-APC power allocation (perapc) higher than what we're using (usage)?
    • Yes: Draw that amount from the pnet and restore the perapc to the cell. (Basically: Cell doesn't discharge.)
    • No: Draw (usage - perapc) from the cell, and remove perapc from the powernet.

After determining if the area is powered, check if the cell should charge:

  1. If the cell is charging...
    • If there's excess in the powernet...
      1. Find whichever is lowest of the remaining capacity of the cell, perapc, or the cell's max capacity × CHARGELEVEL (0.001). The 2016 code comments suggest that 0.001 here is supposed to be 1%, but 0.001 = 0.1%. ?????
      2. Draw that amount from the pnet.
      3. Add that amount to the cell.
    • Otherwise, stop charging.
  2. Otherwise, if the cell is full, stop charging.
  3. Otherwise...
    • If the excess power > (the cell's max capacity × CHARGELEVEL), start the charge counter.
    • Otherwise, reset the counter.
    • If the charge counter is at 10, start charging and reset the counter.

In layman's terms:

  • If there's enough power to charge the cell...
    • If we're already charging, charge the cell more.
    • Otherwise, wait 10 ticks, and then start charging.
  • Otherwise, stop charging.

Power cells

Come in a few varieties:

  • 2,500: Standard APC cells.
  • 4,000: AI shell cells.
  • 7,500: Higher-capacity cells. Round-start Cyborgs and the AI start with these.
  • 15,000: Standard regular power cells, found all over the station. Comes in two special flavors:
    • Cerenkite: Recharges 2 per tick.
    • Erebite: Violently explodes if you look at it funny. Otherwise, charges 10 per tick.
  • Artifact cells can be anywhere from (15 ≤ x ≤ 1000) × 100, i.e. 1500 to 100,000. They always charge 50 per tick.


As noted above in the APC section, for the purposes of charging and discharging in APCs, the capacity is effectively divided by CELLRATE, 0.002 (i.e. multiplied by 500):

  • 2,500: 1,250,000 W capacity
  • 4,000: 2,000,000 W capacity
  • 7,500: 3,750,000 W capacity
  • 15,000: 7,500,000 W capacity
  • Artifact cells can range from 750,000 W to 50,000,000 W (!) and recharge 25,000 W per tick.
    • Putting one of these in an APC will power pretty much everything indefinitely except for the Telescience portal.


Given that an SMES unit stores 100,000,000 W, these little batteries aren't too shabby.

Power usage across the station

Eventually, the amount of power used by various components will be here.

Fun facts about power sinks, based on the 2016 code:

  • Can drain 200,000,000 W before exploding; basically, two full SMES units.
  • Drains up to 400,000 W from powernet per tick.
  • If powernet has < 400,000 W, starts draining up to 50 charge from APCs per tick until it reaches the limit.
    • This seems to be in cell units, not funny-watts like above.
    • A side effect of this is that the power sink will eat 25,000 W from a cell, but consider it as having eaten only 50.
    • It also considers any drain from an APC cell to be 50 units, even if the APC cell had less, though this doesn't matter as much since the effect APCs have on the limit is minimal.
  • At 190,000,000 W (95%), the power sink will start making some horrible noises. If you hear those, you should probably run.

If you're dealing with a power sink, dump an additional 400 KW into the grid above what you normally would, and the power sink should stop draining APCs — you'll lose a lot less power this way due to the above!

I should ask a coder if any of this has changed since, welp


Lights

Power usage

Power usage of a light: light.brightness × LIGHTING_POWER_FACTOR (40)

Type Brightness Power Use
Light tube 1.6 64 W
Light bulb 1.2 48 W
Emergency light 1.0 40 W
"Exit sign" (unused?) 1.3 52 W
Runway Lights 0.5 20 W
Tripod Light 1.5 60 W
Desk and lava lamp 1.0 40 W

Colors

General manufacturers can make replacement light tubes and bulbs in varying colors. Some pre-made light fixtures have different, unique lights, generally darker and crappier for ambience.

All replacement lights look the same and are only differentiated by their name, except for blacklights, which have a unique name. Maybe someone could patch making lights actually look like the color they generate! Maybe you!

Light tubes
Type Color
Regular
Red
Yellow
Green
Cyan
Blue
Purple
Blacklight1
Blacklight2
Light bulbs
Type Color
Regular
Red
Yellow
Green
Cyan
Blue
Purple
Blacklight1
Blacklight2
Emergency
Other
Type Color
Big bulbs

Notes:

  1. Due to a bug, this is what happens in the 2016 code. Specifically, due to a typo, color_r is assigned to twice, and color_b is left default.
  2. This is assumedly what it should be if the second color_r is changed to color_b.

This chart might actually be a little misleading, as the way light usually works in this game is that colors are subtracted from full-brightness, so e.g. a white light wouldn't remove any, while a red light would remove all blue and green coloring, rather than adding red everywhere.