Package srsim.simulator

Examples of srsim.simulator.SystemTimeTimeSource


  @Test
  public void testTemperatureChangeThroughActuator()
      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();
View Full Code Here


  @Test
  public void testLightingChangeThroughActuator()
      throws SimulationContextException,
      SimulationConfigurationException, InterruptedException {
    double targetBrightness = 6000.0D;
    Simulation simulation = new Simulation(new SystemTimeTimeSource());
    simulation.setResolution(0);
    Room room = new Room();
    AbstractController controller = new LightingController();
    ISensor sensor = new LightSensor();
    IActuator[] lights = new IActuator[10];
View Full Code Here

public class RoomTest {

  @Test
  public void testAddingSensors() throws SimulationContextException {
    Room room = new Room();
    room.setContext(new SimulationContext(new SystemTimeTimeSource()));
    TemperatureSensor sensor = new TemperatureSensor();
    room.addSensor(sensor);
    List<ISensor> sensors = room.getSensors();
    Assert.assertSame(sensor, sensors.get(0));
  }
View Full Code Here

  }
 
  @Test
  public void testAddingActuators() throws SimulationContextException {
    Room room = new Room();
    room.setContext(new SimulationContext(new SystemTimeTimeSource()));
    HeatingActuator actuator = new HeatingActuator();
    room.addActuator(actuator);
    List<IActuator> actuators = room.getActuators();
    Assert.assertSame(actuator, actuators.get(0));
  }
View Full Code Here

  }
 
  @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

    controller.attachActuator(actuator);
  }
 
  @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());
View Full Code Here

    ITimeSource timeSource = null;
    if (timeSourceClass != null) {
      timeSource = (ITimeSource) Class.forName(timeSourceClass)
          .newInstance();
    } else {
      timeSource = new SystemTimeTimeSource();
    }
    Simulation simulation = new Simulation(timeSource);

    JsonNumber resolution = simulationObject.getJsonNumber("resolution");
    simulation.setResolution(resolution != null ? resolution.longValue()
View Full Code Here

TOP

Related Classes of srsim.simulator.SystemTimeTimeSource

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.