Skip to content

Commit

Permalink
Merge pull request #4 from WimPessemier/master
Browse files Browse the repository at this point in the history
Wests commissioned
  • Loading branch information
WimPessemier authored Feb 10, 2017
2 parents 4be8537 + 994be40 commit 3fdb4e2
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 42 deletions.
22 changes: 12 additions & 10 deletions coffee/models/mtcs/common/software.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1984,54 +1984,56 @@ MTCS_MAKE_CONFIG THISLIB, "InstrumentConfig",
MTCS_MAKE_PROCESS THISLIB, "ModbusRTUBusReadCoilProcess",
extends: THISLIB.BaseProcess
arguments:
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
address : { type: t_uint16 , comment: "Modbus data address"}
variables:
value : { type: t_bool, comment: "Value of the coil" }
errorId : { type: t_uint16, comment: "Error Id. Modbus error code" }
errorId : { type: t_int16, comment: "Error Id. Modbus error code" }

########################################################################################################################
# ModbusRTUBusWriteCoilProcess
########################################################################################################################
MTCS_MAKE_PROCESS THISLIB, "ModbusRTUBusWriteCoilProcess",
extends: THISLIB.BaseProcess
arguments:
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
address : { type: t_uint16 , comment: "Modbus data address"}
value : { type: t_bool, comment: "Value to write on the coil" }
value : { type: t_bool , comment: "Value to write on the coil" }
variables:
errorId : { type: t_uint8, comment: "Error Id. Modbus error code" }
errorId : { type: t_int16 , comment: "Error Id. Modbus error code" }

########################################################################################################################
# ModbusRTUBusReadRegisterProcess
########################################################################################################################
MTCS_MAKE_PROCESS THISLIB, "ModbusRTUBusReadRegisterProcess",
extends: THISLIB.BaseProcess
arguments:
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
address : { type: t_uint16 , comment: "Modbus data address"}
variables:
value : { type: t_int16, comment: "Value of the register" }
errorId : { type: t_uint8, comment: "Error Id. Modbus error code" }
errorId : { type: t_int16, comment: "Error Id. Modbus error code" }

########################################################################################################################
# ModbusRTUBusWriteRegisterProcess
########################################################################################################################
MTCS_MAKE_PROCESS THISLIB, "ModbusRTUBusWriteRegisterProcess",
extends: THISLIB.BaseProcess
arguments:
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
unitID : { type: t_uint8 , comment: "Modbus station address (1..247)"}
address : { type: t_uint16 , comment: "Modbus data address"}
value : { type: t_int16, comment: "Value to write on the register" }
value : { type: t_int16 , comment: "Value to write on the register" }
variables:
errorId : { type: t_uint8, comment: "Error Id. Modbus error code" }
errorId : { type: t_int16, comment: "Error Id. Modbus error code" }

########################################################################################################################
# ModbusRTUBus
########################################################################################################################
MTCS_MAKE_STATEMACHINE THISLIB, "ModbusRTUBus",
variables_hidden:
isEnabled : { type: t_bool , comment: "Is control enabled?" }
variables:
retries : { type: t_int16 , initial: int(3), comment: "Number of retries for a succesfull process" }
processes:
readCoil : { type: THISLIB.ModbusRTUBusReadCoilProcess, comment: "Read coil" }
writeCoil : { type: THISLIB.ModbusRTUBusWriteCoilProcess, comment: "Write coil" }
Expand Down
3 changes: 3 additions & 0 deletions coffee/models/mtcs/dome/software.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,15 @@ MTCS_MAKE_STATEMACHINE THISLIB, "DomeShutter",
isEnabled : -> self.operatorStatus.tech
# statuses
lowerApertureStatus:
superState : -> NOT(OR(self.wirelessTimeout,self.wirelessError))
isOpen : -> self.lowerOpenSignal
isClosed : -> self.lowerClosedSignal
upperApertureStatus:
superState : -> NOT(OR(self.wirelessTimeout,self.wirelessError))
isOpen : -> self.upperOpenSignal
isClosed : -> self.upperClosedSignal
apertureStatus:
superState : -> NOT(OR(self.wirelessTimeout,self.wirelessError))
isOpen : -> AND(self.statuses.lowerApertureStatus.open , self.statuses.upperApertureStatus.open )
isClosed : -> AND(self.statuses.lowerApertureStatus.closed , self.statuses.upperApertureStatus.closed )
healthStatus:
Expand Down
174 changes: 152 additions & 22 deletions coffee/models/mtcs/services/software.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,61 @@ MTCS_MAKE_CONFIG THISLIB, "ServicesMeteoConfig",
comment: "Config for the 3.5 V reference voltage"
expand: false




########################################################################################################################
# ServicesWestTemperatureTimeConfig
########################################################################################################################

MTCS_MAKE_CONFIG THISLIB, "ServicesWestTemperatureTimeConfig",
items:
enable:
type: t_bool
comment: "Enable this time (TRUE) or not (FALSE)"
hour:
type: t_double
comment: "The time to change the setpoint, as decimal hour (e.g. 9.5 = 9:30 am)"
offset:
type: t_double
comment: "Setpoint = air temperature of meteo station + this offset (in degrees celsius)"


########################################################################################################################
# ServicesWestTemperatureUpdateConfig
########################################################################################################################

MTCS_MAKE_CONFIG THISLIB, "ServicesWestTemperatureUpdateConfig",
items:
time0: { type: THISLIB.ServicesWestTemperatureTimeConfig, comment: "Time config 0" }
time1: { type: THISLIB.ServicesWestTemperatureTimeConfig, comment: "Time config 1" }
time2: { type: THISLIB.ServicesWestTemperatureTimeConfig, comment: "Time config 2" }
time3: { type: THISLIB.ServicesWestTemperatureTimeConfig, comment: "Time config 3" }
time4: { type: THISLIB.ServicesWestTemperatureTimeConfig, comment: "Time config 4" }


########################################################################################################################
# ServicesWestControllerConfig
########################################################################################################################

MTCS_MAKE_CONFIG THISLIB, "ServicesWestControllerConfig",
items:
address:
type: t_uint8
comment: "The address of the controller"
measurement:
type: COMMONLIB.MeasurementConfig
comment: "The measurement config"
update:
type: t_bool
comment: "True to automatically update the setpoint"
updateMinimumSetpoint:
type: t_double
comment: "Minimum setpoint when the PLC updates the value"
warningMessage:
type: t_string
comment: "A warning message (empty = not shown)"

########################################################################################################################
# ServicesWestConfig
########################################################################################################################
Expand All @@ -171,7 +226,22 @@ MTCS_MAKE_CONFIG THISLIB, "ServicesWestConfig",
items:
pollingInterval :
type: t_double
comment: "Time between West reads in seconds"
comment: "Time between bus reads in seconds"
domeTemperature:
type: THISLIB.ServicesWestControllerConfig
comment: "The address of the Dome temperature controller"
firstFloorTemperature:
type: THISLIB.ServicesWestControllerConfig
comment: "The address of the first floor temperature controller"
pumpsRoomTemperature:
type: THISLIB.ServicesWestControllerConfig
comment: "The address of the pumps room temperature controller"
oilHeatExchangerTemperature:
type: THISLIB.ServicesWestControllerConfig
comment: "The address of the oil heat exchanger temperature controller"
temperatureUpdate:
type: THISLIB.ServicesWestTemperatureUpdateConfig
comment: "The config for the temperature setpoint"



Expand Down Expand Up @@ -203,6 +273,7 @@ MTCS_MAKE_STATEMACHINE THISLIB, "Services",
editableConfig : { type: THISLIB.ServicesConfig , comment: "Editable configuration of the Services subsystem", expand: false }
references:
operatorStatus : { type: COMMONLIB.OperatorStatus , comment: "Shared operator status" }
domeApertureStatus : { type: COMMONLIB.ApertureStatus , comment: "Is the dome open or closed?", expand: false }
variables_read_only:
config : { type: THISLIB.ServicesConfig , comment: "Active configuration of the Services subsystem" }
parts:
Expand All @@ -220,14 +291,17 @@ MTCS_MAKE_STATEMACHINE THISLIB, "Services",
arguments:
config : {}
attributes:
airTemperature : {}
statuses:
attributes:
healthStatus : { type: COMMONLIB.HealthStatus }
west:
comment : "West service"
arguments:
operatorStatus : {}
config : {}
config : {}
airTemperature : {}
domeApertureStatus : {}
attributes:
statuses:
attributes:
Expand Down Expand Up @@ -285,6 +359,8 @@ MTCS_MAKE_STATEMACHINE THISLIB, "Services",
west:
operatorStatus : -> self.operatorStatus
config : -> self.config.west
airTemperature : -> self.parts.meteo.airTemperature
domeApertureStatus : -> self.domeApertureStatus


########################################################################################################################
Expand Down Expand Up @@ -609,14 +685,46 @@ MTCS_MAKE_STATEMACHINE THISLIB, "ServicesMeteo",
self.referenceVoltage
)




########################################################################################################################
# ServicesWestController
########################################################################################################################
#MTCS_MAKE_STATEMACHINE THISLIB, "ServicesWestController",
# references:
# config: { type: THISLIB.ServicesWestControllerConfig, comment: "A small config only for a single WEST controller" }
# variables:
# isPolling : {}
MTCS_MAKE_STATEMACHINE THISLIB, "ServicesWestController",
variables:
isEnabled : { type: t_bool, comment: "Are the processes enabled?" }
unit : { type: COMMONLIB.Units }
variables_read_only:
invalidData : { type: t_bool , comment: "True if there is invalid data"}
processValue : { type: COMMONLIB.QuantityValue, comment: "The process value" }
outputPower : { type: COMMONLIB.QuantityValue, comment: "The output power" }
setpoint : { type: COMMONLIB.QuantityValue, comment: "The setpoint" }
references:
config : { type: THISLIB.ServicesWestControllerConfig, comment: "A small config only for a single WEST controller" }
bus : { type: COMMONLIB.ModbusRTUBus , comment: "The shared Modbus RTU bus" }
processes:
update : { type: COMMONLIB.Process, comment: "Read the process value"}
writeSetpoint : { type: COMMONLIB.ChangeSetpointProcess, comment: "Write the setpoint"}
statuses:
healthStatus : { type: COMMONLIB.HealthStatus , comment: "Is the data valid and within range?" }
alarmStatus : { type: COMMONLIB.HiHiLoLoAlarmStatus , comment: "Alarm status"}
calls:
alarmStatus:
superState : -> self.config.measurement.enabled
config : -> self.config.measurement.alarms
value : -> self.processValue.value
healthStatus:
superState : -> self.config.measurement.enabled
isGood : -> NOT( OR(self.invalidData,
self.statuses.alarmStatus.hiHi,
self.statuses.alarmStatus.loLo))
hasWarning : -> OR( self.statuses.alarmStatus.hi,
self.statuses.alarmStatus.lo )
update:
isEnabled: -> self.isEnabled
writeSetpoint:
isEnabled: -> self.isEnabled



Expand All @@ -629,17 +737,19 @@ MTCS_MAKE_STATEMACHINE THISLIB, "ServicesWest",
variables:
{}
references:
operatorStatus : { type: COMMONLIB.OperatorStatus , comment: "Shared operator status" }
config : { type: THISLIB.ServicesWestConfig , comment: "The config" }
operatorStatus : { type: COMMONLIB.OperatorStatus , comment: "Shared operator status" }
config : { type: THISLIB.ServicesWestConfig , comment: "The config" }
airTemperature : { type: THISLIB.ServicesMeteoMeasurement , comment: "Air temperature" }
domeApertureStatus : { type: COMMONLIB.ApertureStatus , comment: "Is the dome open or closed?", expand: false }
statuses:
healthStatus : { type: COMMONLIB.HealthStatus , comment: "Are the WESTs in healthy state (good) or not (bad)" }
operatingStatus : { type: COMMONLIB.OperatingStatus , comment: "Are the WESTs being polled (auto) or not (manual)?" }
parts:
bus : { type: COMMONLIB.ModbusRTUBus , comment: "The shared Modbus RTU bus" }
# domeTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the dome to control the temperature " }
# firstFloorTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the first floor to control the temperature" }
# pumpsRoomTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the pumps room to control the temperature" }
# oilHeatExchangerTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the heat exchanger to control the oil temperature" }
bus : { type: COMMONLIB.ModbusRTUBus , comment: "The shared Modbus RTU bus" }
domeTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the dome to control the temperature " }
firstFloorTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the first floor to control the temperature" }
pumpsRoomTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the pumps room to control the temperature" }
oilHeatExchangerTemperature : { type: THISLIB.ServicesWestController , comment: "The West controller at the heat exchanger to control the oil temperature" }
processes:
changeOperatingState : { type: COMMONLIB.ChangeOperatingStateProcess , comment: "Change the operating state (e.g. AUTO, MANUAL, ...)" }
calls:
Expand All @@ -648,16 +758,36 @@ MTCS_MAKE_STATEMACHINE THISLIB, "ServicesWest",
changeOperatingState:
isEnabled : -> self.operatorStatus.tech
healthStatus:
isGood : -> TRUE # MTCS_SUMMARIZE_GOOD(self.parts.domeTemperature,
# self.parts.firstFloorTemperature,
# self.parts.pumpsRoomTemperature,
# self.parts.oilHeatExchangerTemperature)
hasWarning : -> FALSE # MTCS_SUMMARIZE_WARN(self.parts.domeTemperature,
# self.parts.firstFloorTemperature,
# self.parts.pumpsRoomTemperature,
# self.parts.oilHeatExchangerTemperature)
isGood : -> MTCS_SUMMARIZE_GOOD(self.parts.domeTemperature,
self.parts.firstFloorTemperature,
self.parts.pumpsRoomTemperature,
self.parts.oilHeatExchangerTemperature)
hasWarning : -> MTCS_SUMMARIZE_WARN(self.parts.domeTemperature,
self.parts.firstFloorTemperature,
self.parts.pumpsRoomTemperature,
self.parts.oilHeatExchangerTemperature)
bus:
isEnabled : -> AND(self.operatorStatus.tech, self.statuses.operatingStatus.manual)
domeTemperature:
isEnabled : -> self.parts.bus.isEnabled
unit : -> COMMONLIB.Units.DEGREES_CELSIUS
config : -> self.config.domeTemperature
bus : -> self.parts.bus
firstFloorTemperature:
isEnabled : -> self.parts.bus.isEnabled
unit : -> COMMONLIB.Units.DEGREES_CELSIUS
config : -> self.config.firstFloorTemperature
bus : -> self.parts.bus
pumpsRoomTemperature:
isEnabled : -> self.parts.bus.isEnabled
unit : -> COMMONLIB.Units.DEGREES_CELSIUS
config : -> self.config.pumpsRoomTemperature
bus : -> self.parts.bus
oilHeatExchangerTemperature:
isEnabled : -> self.parts.bus.isEnabled
unit : -> COMMONLIB.Units.DEGREES_CELSIUS
config : -> self.config.oilHeatExchangerTemperature
bus : -> self.parts.bus


########################################################################################################################
Expand Down
Loading

0 comments on commit 3fdb4e2

Please sign in to comment.