#125 moved environmental loss on boilers from build to state category
This commit is contained in:
parent
7c39e8c72b
commit
6fcd18e17a
@ -28,10 +28,10 @@ function boilerv_rtu.new(boiler)
|
|||||||
unit.connect_input_reg(boiler.getCooledCoolantCapacity)
|
unit.connect_input_reg(boiler.getCooledCoolantCapacity)
|
||||||
unit.connect_input_reg(boiler.getSuperheaters)
|
unit.connect_input_reg(boiler.getSuperheaters)
|
||||||
unit.connect_input_reg(boiler.getMaxBoilRate)
|
unit.connect_input_reg(boiler.getMaxBoilRate)
|
||||||
unit.connect_input_reg(boiler.getEnvironmentalLoss)
|
|
||||||
-- current state
|
-- current state
|
||||||
unit.connect_input_reg(boiler.getTemperature)
|
unit.connect_input_reg(boiler.getTemperature)
|
||||||
unit.connect_input_reg(boiler.getBoilRate)
|
unit.connect_input_reg(boiler.getBoilRate)
|
||||||
|
unit.connect_input_reg(boiler.getEnvironmentalLoss)
|
||||||
-- tanks
|
-- tanks
|
||||||
unit.connect_input_reg(boiler.getSteam)
|
unit.connect_input_reg(boiler.getSteam)
|
||||||
unit.connect_input_reg(boiler.getSteamNeeded)
|
unit.connect_input_reg(boiler.getSteamNeeded)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ local sna_rtu = require("rtu.dev.sna_rtu")
|
|||||||
local sps_rtu = require("rtu.dev.sps_rtu")
|
local sps_rtu = require("rtu.dev.sps_rtu")
|
||||||
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
local turbinev_rtu = require("rtu.dev.turbinev_rtu")
|
||||||
|
|
||||||
local RTU_VERSION = "beta-v0.9.4"
|
local RTU_VERSION = "beta-v0.9.5"
|
||||||
|
|
||||||
local rtu_t = types.rtu_t
|
local rtu_t = types.rtu_t
|
||||||
|
|
||||||
|
|||||||
@ -71,12 +71,12 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
|||||||
ccoolant_cap = 0,
|
ccoolant_cap = 0,
|
||||||
superheaters = 0,
|
superheaters = 0,
|
||||||
max_boil_rate = 0.0,
|
max_boil_rate = 0.0,
|
||||||
env_loss = 0.0
|
|
||||||
},
|
},
|
||||||
state = {
|
state = {
|
||||||
last_update = 0,
|
last_update = 0,
|
||||||
temperature = 0.0,
|
temperature = 0.0,
|
||||||
boil_rate = 0.0
|
boil_rate = 0.0,
|
||||||
|
env_loss = 0.0
|
||||||
},
|
},
|
||||||
tanks = {
|
tanks = {
|
||||||
last_update = 0,
|
last_update = 0,
|
||||||
@ -108,14 +108,14 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
|||||||
|
|
||||||
-- query the build of the device
|
-- query the build of the device
|
||||||
local function _request_build()
|
local function _request_build()
|
||||||
-- read input registers 1 through 13 (start = 1, count = 13)
|
-- read input registers 1 through 12 (start = 1, count = 12)
|
||||||
self.session.send_request(TXN_TYPES.BUILD, MODBUS_FCODE.READ_INPUT_REGS, { 1, 13 })
|
self.session.send_request(TXN_TYPES.BUILD, MODBUS_FCODE.READ_INPUT_REGS, { 1, 12 })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- query the state of the device
|
-- query the state of the device
|
||||||
local function _request_state()
|
local function _request_state()
|
||||||
-- read input registers 14 through 15 (start = 14, count = 2)
|
-- read input registers 13 through 15 (start = 13, count = 3)
|
||||||
self.session.send_request(TXN_TYPES.STATE, MODBUS_FCODE.READ_INPUT_REGS, { 14, 2 })
|
self.session.send_request(TXN_TYPES.STATE, MODBUS_FCODE.READ_INPUT_REGS, { 13, 3 })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- query the tanks of the device
|
-- query the tanks of the device
|
||||||
@ -143,7 +143,7 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
|||||||
elseif txn_type == TXN_TYPES.BUILD then
|
elseif txn_type == TXN_TYPES.BUILD then
|
||||||
-- build response
|
-- build response
|
||||||
-- load in data if correct length
|
-- load in data if correct length
|
||||||
if m_pkt.length == 13 then
|
if m_pkt.length == 12 then
|
||||||
self.db.build.last_update = util.time_ms()
|
self.db.build.last_update = util.time_ms()
|
||||||
self.db.build.length = m_pkt.data[1]
|
self.db.build.length = m_pkt.data[1]
|
||||||
self.db.build.width = m_pkt.data[2]
|
self.db.build.width = m_pkt.data[2]
|
||||||
@ -157,7 +157,6 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
|||||||
self.db.build.ccoolant_cap = m_pkt.data[10]
|
self.db.build.ccoolant_cap = m_pkt.data[10]
|
||||||
self.db.build.superheaters = m_pkt.data[11]
|
self.db.build.superheaters = m_pkt.data[11]
|
||||||
self.db.build.max_boil_rate = m_pkt.data[12]
|
self.db.build.max_boil_rate = m_pkt.data[12]
|
||||||
self.db.build.env_loss = m_pkt.data[13]
|
|
||||||
self.has_build = true
|
self.has_build = true
|
||||||
|
|
||||||
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
out_queue.push_command(unit_session.RTU_US_CMDS.BUILD_CHANGED)
|
||||||
@ -167,10 +166,11 @@ function boilerv.new(session_id, unit_id, advert, out_queue)
|
|||||||
elseif txn_type == TXN_TYPES.STATE then
|
elseif txn_type == TXN_TYPES.STATE then
|
||||||
-- state response
|
-- state response
|
||||||
-- load in data if correct length
|
-- load in data if correct length
|
||||||
if m_pkt.length == 2 then
|
if m_pkt.length == 3 then
|
||||||
self.db.state.last_update = util.time_ms()
|
self.db.state.last_update = util.time_ms()
|
||||||
self.db.state.temperature = m_pkt.data[1]
|
self.db.state.temperature = m_pkt.data[1]
|
||||||
self.db.state.boil_rate = m_pkt.data[2]
|
self.db.state.boil_rate = m_pkt.data[2]
|
||||||
|
self.db.state.env_loss = m_pkt.data[3]
|
||||||
else
|
else
|
||||||
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
log.debug(log_tag .. "MODBUS transaction reply length mismatch (" .. TXN_TAGS[txn_type] .. ")")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -14,7 +14,7 @@ local svsessions = require("supervisor.session.svsessions")
|
|||||||
local config = require("supervisor.config")
|
local config = require("supervisor.config")
|
||||||
local supervisor = require("supervisor.supervisor")
|
local supervisor = require("supervisor.supervisor")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "beta-v0.7.7"
|
local SUPERVISOR_VERSION = "beta-v0.7.8"
|
||||||
|
|
||||||
local print = util.print
|
local print = util.print
|
||||||
local println = util.println
|
local println = util.println
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user