Go to file
2024-08-27 23:21:49 -04:00
.devcontainer added python to devcontainer and recommendations 2023-04-21 18:56:32 +00:00
.github updated main's manifest workflow 2024-07-06 00:55:03 -04:00
.vscode #342 added element focusing feature to graphics library 2023-09-16 21:08:28 -04:00
build cleanup 2024-06-30 12:33:52 -04:00
coordinator WIP rearchitecting process command orchestration 2024-08-27 23:05:46 -04:00
graphics allow right alignment for numeric inputs 2024-08-26 20:31:36 -04:00
lockbox #338 resolved diagnostic warnings 2023-09-03 17:54:39 -04:00
pocket adjusted guide section heights and moved process init to have facility access 2024-08-27 23:21:49 -04:00
reactor-plc added INF tab to supervisor to provide helpful info and removed some redundant alignment specifiers 2024-08-25 22:45:41 -04:00
rtu added INF tab to supervisor to provide helpful info and removed some redundant alignment specifiers 2024-08-25 22:45:41 -04:00
scada-common incremented common version 2024-08-25 21:29:20 -04:00
supervisor refactoring and removed unused set_waste_ack 2024-08-26 20:30:30 -04:00
test luacheck fix and cleanup 2024-04-28 13:08:16 -04:00
.gitignore #465 first pass at minifier 2024-04-24 21:11:41 +00:00
ccmsi.lua #517 ccmsi print wrapping and other adjustments for pocket environment 2024-08-11 22:11:57 -04:00
configure.lua #408 increment bootloader version for pocket configurator, minification 2024-02-19 14:27:02 -05:00
initenv.lua #377 switched to using ... for vararg 2023-11-27 19:32:52 -05:00
LICENSE remove UTF-8 copyright symbol 2024-06-30 00:01:00 -04:00
README.md readme updates 2024-04-15 10:20:48 -04:00
startup.lua cleanup of bootloader 2024-06-29 15:11:16 -04:00

cc-mek-scada

Configurable ComputerCraft SCADA system for multi-reactor control of Mekanism fission reactors with a GUI, automatic safety features, waste processing control, and more!

GitHub GitHub release (latest by date including pre-releases) GitHub Workflow Status (with branch) GitHub Workflow Status (with branch)

Join the Discord!

Discord

Released Component Versions

Installer

Bootloader Comms Comms Graphics Lockbox

Reactor PLC RTU Supervisor Coordinator Pocket

Requirements

Mod Requirements:

  • CC: Tweaked
  • Mekanism v10.1+

Mod Recommendations:

  • Advanced Peripherals (adds the capability to detect environmental radiation levels)
  • Immersive Engineering (provides bundled redstone, though any mod containing bundled redstone will do)

v10.1+ is required due to the complete support of CC:Tweaked added in Mekanism v10.1

Installation

You can install this on a ComputerCraft computer using either:

  • wget https://raw.githubusercontent.com/MikaylaFischler/cc-mek-scada/main/ccmsi.lua
  • pastebin get sqUN6VUb ccmsi.lua

Contributing

Please reach out to me via Discord or email (or GitHub in some way) if you are thinking of making any contributions at this time. I started this project as a challenge for myself and have been enjoying having something I can work on in my own way.

Once this is out of beta I will be more open to contributions, but for now I am hoping to keep them to a minimum as the remaining challenges are ones I am looking forward to solving.

SCADA

Supervisory control and data acquisition (SCADA) is a control system architecture comprising computers, networked data communications and graphical user interfaces for high-level supervision of machines and processes. It also covers sensors and other devices, such as programmable logic controllers, which interface with process plant or machinery.

This project implements concepts of a SCADA system in ComputerCraft (because why not? ..okay don't answer that). I recommend reviewing that linked wikipedia page on SCADA if you want to understand the concepts used here.

Architecture

SCADA and industrial automation terminology is used throughout the project, such as:

  • Supervisory Computer: Gathers data and controls the process
  • Coordinating Computer: Used as the HMI component, user requests high-level processing operations
  • RTU: Remote Terminal Unit
  • PLC: Programmable Logic Controller

ComputerCraft Architecture

Coordinator Server

There can only be one of these. This server acts as a hybrid of levels 3 & 4 in the SCADA diagram above. In addition to viewing status and controlling processes with advanced monitors, it can host access for one or more Pocket computers.

Supervisory Computers

There should be one of these per facility system. Currently, that means only one. In the future, multiple supervisors would provide the capability of coordinating between multiple facilities (like a fission facility, fusion facility, etc).

RTUs

RTUs are effectively basic connections between a device and the SCADA system with no internal logic providing the system with I/O capabilities. A single Advanced Computer can represent multiple RTUs as instead I am modeling an RTU as the wired modems connected to that computer rather than the computer itself. Each RTU is referenced separately with an identifier in the modbus communications (see Communications section), so a single computer can distribute instructions to multiple devices. This should save on having a pile of computers everywhere (but if you want to have that, no one's stopping you).

The RTU control code is relatively unique, as instead of having instructions be decoded simply, due to using modbus, I implemented a generalized RTU interface. To fulfill this, each type of I/O operation is linked to a function rather than implementing the logic itself. For example, to connect an input register to a turbine getFlowRate() call, the function reference itself is passed to the connect_input_reg() function. A call to read_input_reg() on that register address will call the turbine.getFlowRate() function and return the result.

PLCs

PLCs are advanced devices that allow for both reporting and control to/from the SCADA system in addition to programed behaviors independent of the SCADA system. Currently there is only one type of PLC, and that is the reactor PLC. This is responsible for reporting on and controlling the reactor as a part of the SCADA system, and independently regulating the safety of the reactor. It checks the status for multiple hazard scenarios and shuts down the reactor if any condition is met.

There can and should only be one of these per reactor. A single Advanced Computer will act as the PLC, with either a direct connection (physical contact) or a wired modem connection to the reactor logic port.

Communications

A vaguely-modbus modbus communication protocol is used for communication with RTUs. Useful terminology for you to know:

  • Discrete Inputs: Single Bit Read-Only (digital inputs)
  • Coils: Single Bit Read/Write (digital I/O)
  • Input Registers: Multi-Byte Read-Only (analog inputs)
  • Holding Registers: Multi-Byte Read/Write (analog I/O)

Security

HMAC message authentication is available as a configuration option to prevent replay attacks and generally prevent control or false data reporting within a system's network. This is done utilizing the lua-lockbox project.

The other, simpler security feature is to enforce a maximum authorized transmission range, which is also a configurable feature on each device.