######################################################################## ### FILE: tbcinit.mod ### PURPOSE: Initialize Thermal Block Controller ######################################################################## ######################################################################## ### Initialize TBC DEFine INITialize ZoneINIT SensorINIT DriverINIT ######################################################################## ### Initialize TBC zones DEFINT ZoneINIT #RATe cover 0.3 0.049 ######################################################################## ### Initialize TBC sensors DEFINT SensorINIT REPeat -counter=idx -start=1 $(SensorCount?) LVAR Type $(Sensor${idx}:TYPe?) TRY LVAR Group $(CONF? tbcspecs SensorTypes ${Type}) REGisterGroup+ -append ${Group}? Sensor${idx}:READing? PASS ######################################################################## ### Initialize TBC drivers DEFINT DriverINIT REPeat -counter=idx -start=1 $(DriverCount?) LVAR Type $(Driver${idx}:TYPe?) LVAR TypeDesc $(CONF? -ignoreMissing tbcspecs DriverTypes ${Type}) IF ${#TypeDesc:-} REGisterGroup+ -append ${TypeDesc} Driver${idx}:CONTrol REGisterGroup+ -append ${TypeDesc} Driver${idx}:OUTput ######################################################################## ### Support for reading TBC Error Log DEFine ReadERRors? $count$=50 SET Count $[ min($count$) ] REPeat -start=$(TBC:ErrorCount?) ######################################################################## ### MACRO: VERSion? ### PURPOSE: Return readable version DEFine VERSion? LVAR vers $(FirmwareVersion?) RETurn -product=$[ ${vers} >> 8 ] -build=$[ ${vers} & 0x00FF ] ######################################################################## ### MACRO: PROPerties? ### PURPOSE: Return properties of this TBC ######################################################################## DEFine PROPerties? LVAR BlockID $(BlockID?) LVAR Description $(CONF? -ignoreMissing blocks "BlockType ${BlockID}" description) LVAR MinVol $(CONF? -ignoreMissing blocks "BlockType ${BlockID}" minvol) LVAR MaxVol $(CONF? -ignoreMissing blocks "BlockType ${BlockID}" maxvol) LVAR RunModes $(CONF? -ignoreMissing blocks "BlockType ${BlockID}" runmodes) LVAR vers $(FirmwareVersion?) LVAR prod $[ ${vers} >> 8 ] LVAR build $[ ${vers} & 0xFF ] RETurn -firmwareID=${prod} \ -firmwareVersion=${build} \ -bootcodeVersion=$(BootVersion?) \ -zones=${ControlZones} \ -blockID=${BlockID} \ -blockSerial=$(SerialNumber?) \ -blockDescription=\"${Description:-[Unknown block type]}\" \ -minSampleVolume=${MinVol:-[Unknown]} \ -maxSampleVolume=${MaxVol:-[Unknown]} \ -hardwareVersion=$(HardwareVersion?) \ -lifeCycleCount=$(LifeCycleCount?) \ -lifeDegreesClimbed=$(LifeDegreesClimbed?) \ -runModes=${RunModes:-Unknown} DEScribe PROPerties? Return properties for this TBC