package AccelerationSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class AccelerationSensors {
private int deviceNumbers
private List accelerationSensors
this.deviceNumbers = deviceNumbers
this.accelerationSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.acceleration = "inactive"
+ this.accelerationLatestValue = "inactive"
+ } else {
+ this.acceleration = "active"
+ this.accelerationLatestValue = "active"
+ }
accelerationSensors.add(new AccelerationSensor(id, label, displayName, this.acceleration, this.accelerationLatestValue))
}
package Alarm
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Alarms {
int deviceNumbers
List alarms
this.deviceNumbers = deviceNumbers
this.alarms = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.alarm = "off"
+ this.currentAlarm = "off"
+ this.alarmLatestValue = "off"
+ } else {
+ this.alarm = "on"
+ this.currentAlarm = "on"
+ this.alarmLatestValue = "on"
+ }
alarms.add(new Alarm(sendEvent, id, label, displayName, this.alarm, this.currentAlarm, this.alarmLatestValue))
}
package Battery
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Batteries {
private int deviceNumbers
private List batteries
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.batteries = []
+
+ def init = Verify.getIntFromList(30, 50, 70)
+ this.battery = init
batteries.add(new Battery(id, label, displayName, this.battery))
}
package BeaconSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class BeaconSensors {
private int deviceNumbers
private List beaconSensors
this.deviceNumbers = deviceNumbers
this.beaconSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.presence = "not present"
+ this.presenceLatestValue = "not present"
+ } else {
+ this.presence = "present"
+ this.presenceLatestValue = "present"
+ }
beaconSensors.add(new BeaconSensor(id, label, displayName, this.presence, this.presenceLatestValue))
}
package CarbonMonoxideDetector
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class CarbonMonoxideDetectors {
private int deviceNumbers
private List carbonMonoxideDetectors
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.carbonMonoxideDetectors = []
-
- carbonMonoxideDetectors.add(new CarbonMonoxideDetector(id, label, displayName, this.currentCarbonMonoxideValue, this.carbonMonoxideLatestValue))
+
+ def init = Verify.getInt(0,2)
+ if (init == 0) {
+ this.carbonMonoxide = "clear"
+ this.carbonMonoxideLatestValue = "clear"
+ } else if (init == 1) {
+ this.carbonMonoxide = "detected"
+ this.carbonMonoxideLatestValue = "detected"
+ } else {
+ this.carbonMonoxide = "tested"
+ this.carbonMonoxideLatestValue = "tested"
+ }
+ carbonMonoxideDetectors.add(new CarbonMonoxideDetector(id, label, displayName, this.carbonMonoxide, this.carbonMonoxideLatestValue))
}
//By Model Checker
package ColorControl
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
public class ColorControls {
private int deviceNumbers
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.colorControls = []
+
+ def initHue = Verify.getIntFromList(30, 50, 70)
+ this.hue = initHue
+ def initSat = Verify.getIntFromList(40, 50, 60)
+ this.saturation = initSat
+ def init = Verify.getInt(0,2)
+ if (init == 0) {
+ this.color = "red"
+ } else if (init == 1) {
+ this.color = "green"
+ } else {
+ this.color = "blue"
+ }
colorControls.add(new ColorControl(id, label, displayName, this.color, this.hue, this.saturation))
}
package ContactSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class ContactSensors {
private int deviceNumbers
private List contacts
this.deviceNumbers = deviceNumbers
this.contacts = []
+ def initSensor = Verify.getBoolean()
+ if (initSensor) {
+ this.contactState = "closed"
+ this.currentContact = "closed"
+ this.latestValue = "closed"
+ } else {
+ this.contactState = "open"
+ this.currentContact = "open"
+ this.latestValue = "open"
+ }
+
+ def initAlarm = Verify.getBoolean()
+ if (initAlarm) {
+ this.alarmState = "armed"
+ } else {
+ this.alarmState = "not armed"
+ }
contacts.add(new ContactSensor(id, label, displayName, this.contactState, this.currentContact, this.alarmState, this.latestValue))
}
package DoorControl
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class DoorControls {
int deviceNumbers
List doorControls
this.timers = new SimulatedTimer()
this.deviceNumbers = deviceNumbers
this.doorControls = []
-
+
+ def init = Verify.getBoolean()
+ if (init) {
+ this.doorState = "closed"
+ this.doorLatestValue = "closed"
+ } else {
+ this.doorState = "open"
+ this.doorLatestValue = "open"
+ }
doorControls.add(new DoorControl(sendEvent, id, label, displayName, this.doorState, this.doorLatestValue))
}
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.energyMeters = []
-
+
+ def init = Verify.getIntFromList(30, 50, 70)
+ this.energy = init
+
energyMeters.add(new EnergyMeter(id, label, displayName, this.energy))
}
this.deviceNumbers = deviceNumbers
this.imageCaptureSensors = []
+ def initAlarm = Verify.getBoolean()
+ if (initAlarm) {
+ this.alarmState = "armed"
+ } else {
+ this.alarmState = "not armed"
+ }
imageCaptureSensors.add(new ImageCapture(id, label, displayName, this.image, this.alarmState))
}
package Lock
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Locks{
int deviceNumbers
List locks
this.deviceNumbers = deviceNumbers
this.locks = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.lockState = "locked"
+ this.lockLatestValue = "locked"
+ } else {
+ this.lockState = "unlocked"
+ this.lockLatestValue = "unlocked"
+ }
locks.add(new Lock(sendEvent,id, label, displayName, this.lockState, this.lockLatestValue))
}
package MotionSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class MotionSensors {
private int deviceNumbers
private List motionSensors
this.deviceNumbers = deviceNumbers
this.motionSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.motion = "inactive"
+ this.motionLatestValue = "inactive"
+ } else {
+ this.motion = "active"
+ this.motionLatestValue = "active"
+ }
motionSensors.add(new MotionSensor(id, label, displayName, this.motion, this.motionLatestValue))
}
package MusicPlayer
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
public class MusicPlayers {
private int deviceNumbers
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.musicPlayers = []
+
+ def initLevel = Verify.getIntFromList(10, 20, 30)
+ this.level = initLevel
+ def initTrack = Verify.getIntFromList(1, 2, 3)
+ this.trackNumber = initTrack
+ def initMute = Verify.getBoolean()
+ if (initMute) {
+ this.mute = "unmuted"
+ } else {
+ this.mute = "mute"
+ }
+ def initStatus = Verify.getBoolean()
+ if (initStatus) {
+ this.status = "pause"
+ } else {
+ this.status = "play"
+ }
+ def initTrackData = Verify.getBoolean()
+ if (initTrackData) {
+ this.trackData = "someTrack"
+ } else {
+ this.trackData = "someOtherTrack"
+ }
+ def initTrackDesc = Verify.getBoolean()
+ if (initTrackDesc) {
+ this.trackDescription = "someDescriptions"
+ } else {
+ this.trackDescription = "someOtherDescriptions"
+ }
musicPlayers.add(new MusicPlayer(id, label, displayName, this.level, this.mute, this.status, this.trackNumber, this.trackData, this.trackDescription))
}
package PresenceSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class PresenceSensors {
private int deviceNumbers
private List presenceSensors
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.presenceSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.presence = "not present"
+ this.presenceLatestValue = "not present"
+ } else {
+ this.presence = "present"
+ this.presenceLatestValue = "present"
+ }
presenceSensors.add(new PresenceSensor(id, label, displayName, this.presence, this.presenceLatestValue))
}
package SmokeDetector
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class SmokeDetectors {
private int deviceNumbers
private List smokeDetectors
this.deviceNumbers = deviceNumbers
this.smokeDetectors = []
+ def init = Verify.getInt(0,2)
+ if (init == 0) {
+ this.currentSmokeValue = "clear"
+ this.smokeLatestValue = "clear"
+ } else if (init == 1) {
+ this.currentSmokeValue = "detected"
+ this.smokeLatestValue = "detected"
+ } else {
+ this.currentSmokeValue = "tested"
+ this.smokeLatestValue = "tested"
+ }
smokeDetectors.add(new SmokeDetector(id, label, displayName, this.currentSmokeValue, this.smokeLatestValue))
}
package SpeechSynthesis
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class SpeechSynthesises {
private int deviceNumbers
private List speechSynthesises
this.deviceNumbers = deviceNumbers
this.speechSynthesises = []
+ def init = Verify.getIntFromList(30, 50, 70)
+ this.level = init
+
speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
}
package Switch
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Switches {
int deviceNumbers
List switches
this.timers = new SimulatedTimer()
this.deviceNumbers = deviceNumbers
this.switches = []
+
+ def initLevel = Verify.getIntFromList(30, 50, 70)
+ this.currentLevel = initLevel
+ def init = Verify.getBoolean()
+ if (init) {
+ this.switchState = "off"
+ this.currentSwitch = "off"
+ this.switchLatestValue = "off"
+ } else {
+ this.switchState = "on"
+ this.currentSwitch = "on"
+ this.switchLatestValue = "on"
+ }
switches.add(new Switch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.currentLevel, this.switchLatestValue))
}
package Thermostat
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Thermostats{
int deviceNumbers
List thermostats
this.deviceNumbers = deviceNumbers
this.thermostats = []
+ def initTemperature = Verify.getIntFromList(60, 66, 70)
+ this.temperature = initTemperature
+
+ def initCoolingSetpoint = Verify.getIntFromList(70, 80, 90)
+ this.currentCoolingSetpoint = initCoolingSetpoint
+ this.coolingSetpoint = initCoolingSetpoint
+
+ def initHeatingSetpoint = Verify.getIntFromList(20, 35, 50)
+ this.currentHeatingSetpoint = initHeatingSetpoint
+ this.heatingSetpoint = initHeatingSetpoint
+
+ def initThermostatSetpoint = Verify.getIntFromList(50, 60, 70)
+ this.currentHeatingSetpoint = initThermostatSetpoint
+
+ def initFanMode = Verify.getInt(0,4)
+ if (initFanMode == 0) {
+ this.thermostatFanMode = "auto"
+ } else if (initFanMode == 1) {
+ this.thermostatFanMode = "fanCirculate"
+ } else if (initFanMode == 2) {
+ this.thermostatFanMode = "circulate"
+ } else if (initFanMode == 3) {
+ this.thermostatFanMode = "fanOn"
+ } else {
+ this.thermostatFanMode = "on"
+ }
+
+ def initMode = Verify.getInt(0,4)
+ if (initMode == 0) {
+ this.thermostatMode = "auto"
+ this.currentThermostatMode = "auto"
+ } else if (initMode == 1) {
+ this.thermostatMode = "cool"
+ this.currentThermostatMode = "cool"
+ } else if (initMode == 2) {
+ this.thermostatMode = "emergencyHeat"
+ this.currentThermostatMode = "emergencyHeat"
+ } else if (initMode == 3) {
+ this.thermostatMode = "heat"
+ this.currentThermostatMode = "heat"
+ } else {
+ this.thermostatMode = "off"
+ this.currentThermostatMode = "off"
+ }
+
thermostats.add(new Thermostat(sendEvent, id, label, displayName, this.temperature, this.currentCoolingSetpoint,
this.currentHeatingSetpoint, this.coolingSetpoint, this.thermostatSetpoint, this.heatingSetpoint, this.coolingSetpointRange,
this.thermostatSetpointRange, this.heatingSetpointRange, this.supportedThermostatFanModes, this.supportedThermostatModes,