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-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",
|
|
|
|
boiler = "boiler",
|
2022-05-04 15:23:45 +00:00
|
|
|
boiler_valve = "boiler_valve",
|
2022-05-03 14:44:18 +00:00
|
|
|
turbine = "turbine",
|
2022-05-04 15:23:45 +00:00
|
|
|
turbine_valve = "turbine_valve",
|
2022-05-03 14:44:18 +00:00
|
|
|
energy_machine = "emachine",
|
2022-05-04 15:23:45 +00:00
|
|
|
induction_matrix = "induction_matrix"
|
2022-05-03 14:44:18 +00:00
|
|
|
}
|
|
|
|
|
2022-05-10 21:06:27 +00:00
|
|
|
---@alias rps_status_t string
|
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",
|
|
|
|
manual = "manual"
|
2022-05-03 14:44:18 +00:00
|
|
|
}
|
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
|