Package srsim.actuators

Examples of srsim.actuators.LightingActuator


    simulation.getContext().setBrightness(5999.0D);
    room.getLocalContext().setPreference("targetBrightness",
        String.valueOf(targetBrightness));
    controller.attachSensor(sensor);
    for (int i = 0; i < 10; i++) {
      lights[i] = new LightingActuator();
      controller.attachActuator(lights[i]);
      room.addActuator(lights[i]);
    }
    room.addController(controller);
    room.addSensor(sensor);
View Full Code Here


   * @throws SimulationContextException
   */
  private void disableLights() throws SimulationContextException {
    Iterator<IActuator> lights = this.lights.iterator();
    while (lights.hasNext()) {
      LightingActuator light = (LightingActuator) lights.next();
      if (light.getState() == IActuator.ACTIVE) {
        light.disable();
        notifyListeners("light " + light.getId() + " disabled");
      }
    }
  }
View Full Code Here

   */
  private void decreaseBrightness(final double targetBrightness)
      throws SimulationContextException {
    Iterator<IActuator> lights = this.lights.iterator();
    while (lights.hasNext() && context.getBrightness() > targetBrightness) {
      LightingActuator light = (LightingActuator) lights.next();
      if (light.getState() == IActuator.ACTIVE
          && light.getBrightness() > light.getMinimumBrightness()) {
        light.turnDown();
        notifyListeners("light " + light.getId() + " turned down");
      } else if (light.getState() == IActuator.ACTIVE) {
        light.disable();
        notifyListeners("light " + light.getId() + " disabled");
      }
    }
  }
View Full Code Here

   */
  private void increaseBrightness(final double targetBrightness)
      throws SimulationContextException {
    Iterator<IActuator> lights = this.lights.iterator();
    while (lights.hasNext() && context.getBrightness() < targetBrightness) {
      LightingActuator light = (LightingActuator) lights.next();
      if (light.getState() == IActuator.ACTIVE
          && light.getBrightness() < light.getMaxBrightness()) {
        light.turnUp();
        notifyListeners("light " + light.getId() + " turned up");
      } else if (light.getState() == IActuator.IDLE) {
        light.enable();
        notifyListeners("light " + light.getId() + " enabled");
      }
    }
  }
View Full Code Here

TOP

Related Classes of srsim.actuators.LightingActuator

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.