Package srsim.domain

Examples of srsim.domain.IActuator


    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);
View Full Code Here


  @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

  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

    }
    JsonArray actuators = roomDescription.getJsonArray("actuators");
    if (actuators != null) {
      for (JsonObject actuatorDescription : actuators
          .getValuesAs(JsonObject.class)) {
        IActuator actuator = (IActuator) Class.forName(
            actuatorDescription.getString("class")).newInstance();
        actuator.setId(actuatorDescription.getJsonNumber("id")
            .longValue());
        room.addActuator(actuator);
        actuatorMap.put(actuatorDescription.getInt("id"), actuator);
      }
    }
View Full Code Here

TOP

Related Classes of srsim.domain.IActuator

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.