Tutorial 3: power for the mine

Goal: a 48 V plant that feeds your machines day and night.

What you need

From Market (about 6 600 MT: if your loan money is spent, sell ore first): 1 power_station_m, 3 solar_panel, 1 charge_controller, 2 bus_bar, 1 battery_48v, 1 fuse_250, 1 breaker_100, and cable_25 (9 for the loop, plus some for your machines).

Steps

  1. Place the station facing north with its top left at (X, Y). It covers 2×2.
  2. Place the panels facing east (structure_place with item: "solar_panel", direction: "east") and the cables like this. P> panel, C cable, S station, O output face:
row Y-3   C  P> P> P> C
row Y-2   C  .  .  .  C
row Y-1   C  C  C  C  C
row Y     S  S
row Y+1   S  S
row Y+2   O  O
          X
  1. Open the station page. Under Tables, use Put in for each part (station_edit, action: "part_put", slot, item, pole):
slot in the tool name in terminals part pole
1 s0 charge_controller
2 s1 bus_bar +
3 s2 bus_bar -
4 s3 battery_48v
5 s4 fuse_250 +
6 s5 breaker_100 +
  1. Link these, gauge 120 (action: "link", from, to, gauge):
pv+        s0.in+
pv-        s0.in-
s0.out+    s1.1
s0.out-    s2.1
s3.bat+    s4.a
s4.b       s1.3
s3.bat-    s2.3
s1.2       s5.a
s5.b       out+
s2.2       out-
  1. Read the findings, then Commit: switch on (action: "arm").
  2. Run cable_25 from the output face to your machines.

The station already runs this script, which sheds load when the battery is low:

LOW_PERMILLE = 300
HIGH_PERMILLE = 500

def charge(readings):
    total = 0
    count = 0
    for battery in readings["batteries"]:
        if not battery["open"]:
            total += battery["soc_permille"]
            count += 1
    if count == 0:
        return None
    return total // count

def tick():
    readings = power_controller.readings()
    level = charge(readings)
    if level == None:
        return
    mine = memory.get("shed", [])
    if level >= HIGH_PERMILLE:
        for shed_id in mine:
            power_controller.restore(shed_id)
        if len(mine) > 0:
            memory.set("shed", [])
        return
    if level >= LOW_PERMILLE:
        return
    loads = [one for one in readings["loads"] if one["status"] != "shed"]
    if len(loads) < 2:
        return
    # Highest priority number first: those are shed first.
    ordered = sorted(loads, key=lambda one: -one["priority"])
    for one in ordered[:len(loads) // 2]:
        power_controller.shed(one["id"])
        mine = mine + [one["id"]]
    memory.set("shed", mine)

What you should see

On the station page, a bus voltage and a charging battery by day. Energy shows loads as served. station_get returns findings and bus_mv.

Three common mistakes

  1. Off-by-one slots. The tool and the editor count from 1; terminal names count from 0.
  2. Half a loop. Both panel faces must reach the station by cable, or you get panel_pole_open.
  3. Forgetting to re-commit. Any edit switches the station off. Forcing past an error can end in an explosion that does not care whose machines it hits.

A robot is not powered by touching a cable. Park it just outside the station's dock side (east when it faces north).

Next

Tutorial 4: from ore to raw metal