Package srsim.controller

Examples of srsim.controller.HeatingController


 
  @Test
  public void testAddingControllers() throws SimulationContextException {
    Room room = new Room();
    room.setContext(new SimulationContext(new SystemTimeTimeSource()));
    HeatingController controller = new HeatingController();
    room.addController(controller);
    List<IController> controllers = room.getControllers();
    Assert.assertSame(controller, controllers.get(0));
  }
View Full Code Here


    SmartRoomSimulator simulator = new SmartRoomSimulator();
    Room room = new Room();
    simulator.addRoom(room);
    HeatingActuator heatingActuator = new HeatingActuator();
    TemperatureSensor temperatureSensor = new TemperatureSensor();
    HeatingController heatingController = new HeatingController();
    heatingController.attachActuator(heatingActuator);
    heatingController.attachSensor(temperatureSensor);
    room.addActuator(heatingActuator);
    room.addSensor(temperatureSensor);
    room.addController(heatingController);
    simulator.startSimulation();
  }
View Full Code Here

public class ControllerTest {

  @Test
  public void testAttachingSensors() throws SimulationConfigurationException {
    IController controller = new HeatingController();
    ISensor sensor = new TemperatureSensor();
    IActuator actuator = new HeatingActuator();
    controller.attachSensor(sensor);
    controller.attachActuator(actuator);
  }
View Full Code Here

 
  @Test
  public void testInitiatingActuatorChangeFromSensorUpdate() throws SimulationContextException {
    Simulation simulation = new Simulation(new SystemTimeTimeSource());
    Room room = new Room();
    HeatingController controller = new HeatingController();
    ISensor sensor = new TemperatureSensor();
    IActuator actuator = new HeatingActuator();
    room.setContext(simulation.getContext());
    simulation.getContext().setTemperature(0.0D);
    simulation.getContext().setPreference("targetTemperature","21.5D");
    controller.attachSensor(sensor);
    controller.attachActuator(actuator);
    Assert.assertTrue(actuator.getState() == IActuator.IDLE);
    room.addSensor(sensor);
    room.addController(controller);
    room.addActuator(actuator);
    controller.step();
    Assert.assertTrue(actuator.getState() == IActuator.ACTIVE);
  }
View Full Code Here

      throws SimulationContextException, InterruptedException {
    double targetTemperature = 21.5D;
    Simulation simulation = new Simulation(new SystemTimeTimeSource());
    simulation.setResolution(0);
    Room room = new Room();
    HeatingController controller = new HeatingController();
    ISensor sensor = new TemperatureSensor();
    IActuator actuator = new HeatingActuator();
    simulation.addRoom(room);
    room.getLocalContext().setTemperature(20.0D);
    room.getLocalContext().setPreference("targetTemperature", "21.5D");
    controller.attachSensor(sensor);
    controller.attachActuator(actuator);
    room.addActuator(actuator);
    room.addController(controller);
    room.addSensor(sensor);
    double temperature = room.getLocalContext().getTemperature();
    double previousTemperature = temperature;
View Full Code Here

TOP

Related Classes of srsim.controller.HeatingController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.