Skip to content

RTU Gateway Legacy Config

Mikayla edited this page May 4, 2024 · 3 revisions

Warning

ARCHIVED PAGE: The RTU gatway no longer uses a config.lua file. Please see the page on the RTU Gateway Configurator.

For details on common fields, see this page. RTU gateway specific fields are identified below.

These are the most complicated configuration files.

local rsio = require("scada-common.rsio")

local config = {}

-- supervisor comms channel
config.SVR_CHANNEL = 16240
-- RTU/MODBUS comms channel
config.RTU_CHANNEL = 16242
-- max trusted modem message distance (0 to disable check)
config.TRUSTED_RANGE = 0
-- time in seconds (>= 2) before assuming a remote device is no longer active
config.COMMS_TIMEOUT = 5
-- facility authentication key (do NOT use one of your passwords)
-- this enables verifying that messages are authentic
-- all devices on the same network must use the same key
-- config.AUTH_KEY = "SCADAfacility123"

-- log path
config.LOG_PATH = "/log.txt"
-- log mode
--  0 = APPEND (adds to existing file on start)
--  1 = NEW (replaces existing file on start)
config.LOG_MODE = 0
-- true to log verbose debug messages
config.LOG_DEBUG = false

-- RTU peripheral devices (named: side/network device name)
config.RTU_DEVICES = {
    {
        name = "boilerValve_0",
        index = 1,
        for_reactor = 1
    },
    {
        name = "turbineValve_0",
        index = 1,
        for_reactor = 1
    },
    {
        name = "bottom",
        index = 1,
        for_reactor = 1
    }
}
-- RTU redstone interface definitions
config.RTU_REDSTONE = {
    {
        for_reactor = 1,
        io = {
            {
                port = rsio.IO.WASTE_PO,
                side = "top",
                bundled_color = colors.red
            },
            {
                port = rsio.IO.WASTE_PU,
                side = "top",
                bundled_color = colors.orange
            },
            {
                port = rsio.IO.WASTE_POPL,
                side = "top",
                bundled_color = colors.yellow
            },
            {
                port = rsio.IO.WASTE_AM,
                side = "top",
                bundled_color = colors.lime
            }
        }
    }
}

return config

The most important part of an RTU config file is the RTU_DEVICES and RTU_REDSTONE tables. In the above example, the RTU_DEVICES lists a boiler connected via wired modem (which why it has a network name not a side), a turbine connected via a wired modem, and an environment detector at the bottom of the computer. Note that you can use the computercraft peripherals command in the computer terminal to see the list of peripheral names on a wired network. On boot, the PPM info messages in the logs will list the peripherals in the format of type (interface) where type is the reported peripheral type and the interface would be either the side if its in direct contact or the network name if its on a wired network.

The index field defines which number device this is. If you have two turbines for one reactor, then one would be index = 1 and the other would be index = 2. This would be used to identify it on the annunciator or define its vertical ordering shown on the coordinator unit overview.

The RTU_REDSTONE definition above allows full waste routing using the four waste valves. The outer block contains the two fields for_reactor and io which declare the io table is for a particular reactor (or the facility). The io table lists the redstone port, the side of the redstone output, and optionally the color. The color is used for bundled redstone, which requires additional mods (such as Immersive Engineering). This makes wiring for valve controls much easier, so it or another mod with bundled redstone is encouraged.

All of these shown in the above example are for unit #1 (for_reactor = 1). Devices can also be configured for the facility in general (not unit specific), like for an induction matrix or facility radiation detector.

Facility Devices

Devices and redstone entries for the facility (not a specific reactor) use a for_reactor option of '0' as shown below for the facility induction matrix and the facility SCRAM.

config.RTU_DEVICES = {
    {
        name = "back",
        index = 1,
        for_reactor = 0
    }
}

config.RTU_REDSTONE = {
    {
        for_reactor = 0,
        io = {
            {
                port = rsio.IO.F_SCRAM,
                side = "left"
            }
        }
    }
}
Clone this wiki locally