2022-05-04 17:37:01 +00:00
|
|
|
--
|
2022-05-03 14:44:18 +00:00
|
|
|
-- Global Types
|
2022-05-04 17:37:01 +00:00
|
|
|
--
|
2022-05-03 14:44:18 +00:00
|
|
|
|
2022-05-10 21:06:27 +00:00
|
|
|
---@class types
|
2022-05-04 17:37:01 +00:00
|
|
|
local types = {}
|
|
|
|
|
2022-05-13 13:38:32 +00:00
|
|
|
-- CLASSES --
|
|
|
|
|
2022-05-12 19:37:42 +00:00
|
|
|
---@class tank_fluid
|
2022-05-13 13:38:32 +00:00
|
|
|
---@field name string
|
|
|
|
---@field amount integer
|
2022-05-12 19:37:42 +00:00
|
|
|
|
|
|
|
---@class coordinate
|
2022-05-13 13:38:32 +00:00
|
|
|
---@field x integer
|
|
|
|
---@field y integer
|
|
|
|
---@field z integer
|
|
|
|
|
|
|
|
---@class rtu_advertisement
|
|
|
|
---@field type integer
|
|
|
|
---@field index integer
|
|
|
|
---@field reactor integer
|
|
|
|
---@field rsio table|nil
|
|
|
|
|
2022-06-06 03:24:18 +00:00
|
|
|
-- ALIASES --
|
|
|
|
|
|
|
|
---@alias color integer
|
|
|
|
|
2022-05-21 16:24:43 +00:00
|
|
|
-- ENUMERATION TYPES --
|
|
|
|
|
|
|
|
---@alias TRI_FAIL integer
|
|
|
|
types.TRI_FAIL = {
|
|
|
|
OK = 0,
|
|
|
|
PARTIAL = 1,
|
|
|
|
FULL = 2
|
|
|
|
}
|
|
|
|
|
2023-01-26 23:26:26 +00:00
|
|
|
---@alias PROCESS integer
|
|
|
|
types.PROCESS = {
|
|
|
|
INACTIVE = 0,
|
2023-02-10 03:52:10 +00:00
|
|
|
MAX_BURN = 1,
|
2023-01-26 23:26:26 +00:00
|
|
|
BURN_RATE = 2,
|
|
|
|
CHARGE = 3,
|
2023-02-10 03:52:10 +00:00
|
|
|
GEN_RATE = 4,
|
|
|
|
MATRIX_FAULT_IDLE = 5,
|
|
|
|
UNIT_ALARM_IDLE = 6
|
2023-01-26 23:26:26 +00:00
|
|
|
}
|
|
|
|
|
2022-12-01 04:31:14 +00:00
|
|
|
---@alias WASTE_MODE integer
|
|
|
|
types.WASTE_MODE = {
|
|
|
|
AUTO = 1,
|
|
|
|
PLUTONIUM = 2,
|
|
|
|
POLONIUM = 3,
|
|
|
|
ANTI_MATTER = 4
|
|
|
|
}
|
|
|
|
|
2022-11-26 21:18:31 +00:00
|
|
|
---@alias ALARM integer
|
|
|
|
types.ALARM = {
|
|
|
|
ContainmentBreach = 1,
|
|
|
|
ContainmentRadiation = 2,
|
|
|
|
ReactorLost = 3,
|
|
|
|
CriticalDamage = 4,
|
|
|
|
ReactorDamage = 5,
|
|
|
|
ReactorOverTemp = 6,
|
|
|
|
ReactorHighTemp = 7,
|
|
|
|
ReactorWasteLeak = 8,
|
|
|
|
ReactorHighWaste = 9,
|
|
|
|
RPSTransient = 10,
|
|
|
|
RCSTransient = 11,
|
|
|
|
TurbineTrip = 12
|
|
|
|
}
|
|
|
|
|
|
|
|
types.alarm_string = {
|
|
|
|
"ContainmentBreach",
|
|
|
|
"ContainmentRadiation",
|
|
|
|
"ReactorLost",
|
|
|
|
"CriticalDamage",
|
|
|
|
"ReactorDamage",
|
|
|
|
"ReactorOverTemp",
|
|
|
|
"ReactorHighTemp",
|
|
|
|
"ReactorWasteLeak",
|
|
|
|
"ReactorHighWaste",
|
|
|
|
"RPSTransient",
|
|
|
|
"RCSTransient",
|
|
|
|
"TurbineTrip"
|
|
|
|
}
|
|
|
|
|
|
|
|
---@alias ALARM_PRIORITY integer
|
|
|
|
types.ALARM_PRIORITY = {
|
|
|
|
CRITICAL = 0,
|
|
|
|
EMERGENCY = 1,
|
|
|
|
URGENT = 2,
|
|
|
|
TIMELY = 3
|
|
|
|
}
|
|
|
|
|
|
|
|
types.alarm_prio_string = {
|
|
|
|
"CRITICAL",
|
|
|
|
"EMERGENCY",
|
|
|
|
"URGENT",
|
|
|
|
"TIMELY"
|
|
|
|
}
|
|
|
|
|
|
|
|
-- map alarms to alarm priority
|
|
|
|
types.ALARM_PRIO_MAP = {
|
|
|
|
types.ALARM_PRIORITY.CRITICAL,
|
|
|
|
types.ALARM_PRIORITY.CRITICAL,
|
|
|
|
types.ALARM_PRIORITY.URGENT,
|
|
|
|
types.ALARM_PRIORITY.CRITICAL,
|
|
|
|
types.ALARM_PRIORITY.EMERGENCY,
|
2022-12-04 18:59:10 +00:00
|
|
|
types.ALARM_PRIORITY.EMERGENCY,
|
2022-11-26 21:18:31 +00:00
|
|
|
types.ALARM_PRIORITY.TIMELY,
|
|
|
|
types.ALARM_PRIORITY.EMERGENCY,
|
|
|
|
types.ALARM_PRIORITY.TIMELY,
|
|
|
|
types.ALARM_PRIORITY.URGENT,
|
|
|
|
types.ALARM_PRIORITY.TIMELY,
|
|
|
|
types.ALARM_PRIORITY.URGENT
|
|
|
|
}
|
|
|
|
|
|
|
|
---@alias ALARM_STATE integer
|
|
|
|
types.ALARM_STATE = {
|
|
|
|
INACTIVE = 0,
|
|
|
|
TRIPPED = 1,
|
|
|
|
ACKED = 2,
|
|
|
|
RING_BACK = 3
|
|
|
|
}
|
|
|
|
|
2022-05-13 13:38:32 +00:00
|
|
|
-- STRING TYPES --
|
2022-05-12 19:37:42 +00:00
|
|
|
|
2022-07-19 19:18:11 +00:00
|
|
|
---@alias os_event
|
|
|
|
---| "alarm"
|
|
|
|
---| "char"
|
|
|
|
---| "computer_command"
|
|
|
|
---| "disk"
|
|
|
|
---| "disk_eject"
|
|
|
|
---| "http_check"
|
|
|
|
---| "http_failure"
|
|
|
|
---| "http_success"
|
|
|
|
---| "key"
|
|
|
|
---| "key_up"
|
|
|
|
---| "modem_message"
|
|
|
|
---| "monitor_resize"
|
|
|
|
---| "monitor_touch"
|
|
|
|
---| "mouse_click"
|
|
|
|
---| "mouse_drag"
|
|
|
|
---| "mouse_scroll"
|
|
|
|
---| "mouse_up"
|
|
|
|
---| "paste"
|
|
|
|
---| "peripheral"
|
|
|
|
---| "peripheral_detach"
|
|
|
|
---| "rednet_message"
|
|
|
|
---| "redstone"
|
|
|
|
---| "speaker_audio_empty"
|
|
|
|
---| "task_complete"
|
|
|
|
---| "term_resize"
|
|
|
|
---| "terminate"
|
|
|
|
---| "timer"
|
|
|
|
---| "turtle_inventory"
|
|
|
|
---| "websocket_closed"
|
|
|
|
---| "websocket_failure"
|
|
|
|
---| "websocket_message"
|
|
|
|
---| "websocket_success"
|
|
|
|
|
2022-09-03 17:10:09 +00:00
|
|
|
---@alias rps_trip_cause
|
|
|
|
---| "ok"
|
|
|
|
---| "dmg_crit"
|
|
|
|
---| "high_temp"
|
|
|
|
---| "no_coolant"
|
|
|
|
---| "full_waste"
|
|
|
|
---| "heated_coolant_backup"
|
|
|
|
---| "no_fuel"
|
|
|
|
---| "fault"
|
|
|
|
---| "timeout"
|
|
|
|
---| "manual"
|
2022-11-11 20:45:46 +00:00
|
|
|
---| "automatic"
|
|
|
|
---| "sys_fail"
|
|
|
|
---| "force_disabled"
|
2022-09-03 17:10:09 +00:00
|
|
|
|
2022-05-10 21:06:27 +00:00
|
|
|
---@alias rtu_t string
|
2022-05-04 17:37:01 +00:00
|
|
|
types.rtu_t = {
|
2022-05-03 14:44:18 +00:00
|
|
|
redstone = "redstone",
|
2022-05-04 15:23:45 +00:00
|
|
|
boiler_valve = "boiler_valve",
|
|
|
|
turbine_valve = "turbine_valve",
|
2022-06-04 14:49:36 +00:00
|
|
|
induction_matrix = "induction_matrix",
|
|
|
|
sps = "sps",
|
|
|
|
sna = "sna",
|
|
|
|
env_detector = "environment_detector"
|
2022-05-03 14:44:18 +00:00
|
|
|
}
|
|
|
|
|
2022-12-07 04:39:35 +00:00
|
|
|
---@alias rps_status_t rps_trip_cause
|
2022-05-05 15:55:04 +00:00
|
|
|
types.rps_status_t = {
|
2022-05-03 14:44:18 +00:00
|
|
|
ok = "ok",
|
|
|
|
dmg_crit = "dmg_crit",
|
|
|
|
high_temp = "high_temp",
|
|
|
|
no_coolant = "no_coolant",
|
2022-05-05 17:14:14 +00:00
|
|
|
ex_waste = "full_waste",
|
|
|
|
ex_hcoolant = "heated_coolant_backup",
|
|
|
|
no_fuel = "no_fuel",
|
|
|
|
fault = "fault",
|
|
|
|
timeout = "timeout",
|
2022-10-26 03:40:36 +00:00
|
|
|
manual = "manual",
|
2022-11-11 20:45:46 +00:00
|
|
|
automatic = "automatic",
|
|
|
|
sys_fail = "sys_fail",
|
|
|
|
force_disabled = "force_disabled"
|
2022-05-03 14:44:18 +00:00
|
|
|
}
|
2022-05-03 15:27:40 +00:00
|
|
|
|
2022-05-13 13:38:32 +00:00
|
|
|
-- turbine steam dumping modes
|
|
|
|
---@alias DUMPING_MODE string
|
|
|
|
types.DUMPING_MODE = {
|
|
|
|
IDLE = "IDLE",
|
|
|
|
DUMPING = "DUMPING",
|
|
|
|
DUMPING_EXCESS = "DUMPING_EXCESS"
|
|
|
|
}
|
|
|
|
|
2022-05-03 15:27:40 +00:00
|
|
|
-- MODBUS
|
|
|
|
|
|
|
|
-- modbus function codes
|
2022-05-10 21:06:27 +00:00
|
|
|
---@alias MODBUS_FCODE integer
|
2022-05-04 17:37:01 +00:00
|
|
|
types.MODBUS_FCODE = {
|
2022-05-03 15:27:40 +00:00
|
|
|
READ_COILS = 0x01,
|
|
|
|
READ_DISCRETE_INPUTS = 0x02,
|
|
|
|
READ_MUL_HOLD_REGS = 0x03,
|
|
|
|
READ_INPUT_REGS = 0x04,
|
|
|
|
WRITE_SINGLE_COIL = 0x05,
|
|
|
|
WRITE_SINGLE_HOLD_REG = 0x06,
|
|
|
|
WRITE_MUL_COILS = 0x0F,
|
|
|
|
WRITE_MUL_HOLD_REGS = 0x10,
|
|
|
|
ERROR_FLAG = 0x80
|
|
|
|
}
|
|
|
|
|
|
|
|
-- modbus exception codes
|
2022-05-10 21:06:27 +00:00
|
|
|
---@alias MODBUS_EXCODE integer
|
2022-05-04 17:37:01 +00:00
|
|
|
types.MODBUS_EXCODE = {
|
2022-05-03 15:27:40 +00:00
|
|
|
ILLEGAL_FUNCTION = 0x01,
|
|
|
|
ILLEGAL_DATA_ADDR = 0x02,
|
|
|
|
ILLEGAL_DATA_VALUE = 0x03,
|
|
|
|
SERVER_DEVICE_FAIL = 0x04,
|
|
|
|
ACKNOWLEDGE = 0x05,
|
|
|
|
SERVER_DEVICE_BUSY = 0x06,
|
|
|
|
NEG_ACKNOWLEDGE = 0x07,
|
|
|
|
MEMORY_PARITY_ERROR = 0x08,
|
|
|
|
GATEWAY_PATH_UNAVAILABLE = 0x0A,
|
|
|
|
GATEWAY_TARGET_TIMEOUT = 0x0B
|
|
|
|
}
|
2022-05-04 17:37:01 +00:00
|
|
|
|
|
|
|
return types
|