cz.zcu.fav.kiv.jsimcasestudies.watersystem.model
Class WaterConsumptionProcess

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--cz.zcu.fav.kiv.jsim.JSimProcess
              |
              +--cz.zcu.fav.kiv.jsimcasestudies.watersystem.model.WaterConsumptionProcess
All Implemented Interfaces:
java.lang.Comparable, cz.zcu.fav.kiv.jsim.gui.JSimDisplayable, java.lang.Runnable

class WaterConsumptionProcess
extends cz.zcu.fav.kiv.jsim.JSimProcess

Dynamic model of water consumption. This process is responsible for periodic adjustments of the output flow from the main tank caused by people's consumption. It only updates the Output Flow register and decrements the water volume in the main tank.

Version:
1.2 from 2004-03-24
Author:
Cesar ALLAIN, Jarda KACER

Field Summary
private static double BASE_PERIOD_MULTIPLIER
          Multiplier of the model's base period.
private  double basePeriod
          The model's base period of updates.
private  StationHardwareData hw
          Information produced by hardware sensors.
private  Station station
          The station that this process manages.
 
Fields inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
INT_REQUESTS_TO_IGNORE, myParent, semaphoreIAmCurrentlyBlockedOn, STATE_ACTIVE, STATE_BLOCKEDONMESSAGERECEIVE, STATE_BLOCKEDONMESSAGESEND, STATE_BLOCKEDONSEMAPHORE, STATE_NEW, STATE_PASSIVE, STATE_SCHEDULED, STATE_TERMINATED
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected WaterConsumptionProcess(cz.zcu.fav.kiv.jsim.JSimSimulation simulation, StationHardwareData hw, Station station, double basePeriod)
          Constructs a new process simulating changes of the output flow from the main tank.
 
Method Summary
protected  void life()
          Simulates output flow changes in the pipe leading from the main tank.
private  double randomOutputFlowChange(double time)
          Computes a change of the output flow.
 
Methods inherited from class cz.zcu.fav.kiv.jsim.JSimProcess
activate, blockOnSemaphore, cancel, compareTo, copyToMessageClipboard, createDetailedInfoWindow, equals, error, getDetailedInformationArray, getMessageBox, getNumber, getObjectListItemDescription, getParent, getPrivateLock, getSenderIAmWaitingFor, getScheduleTime, getState, getStateAsString, getStateAsString, hasBeenStarted, hasEmptyMessageClipboard, hashCode, hold, isIdle, message, messageNoNL, passivate, reactivate, readFromClipboard, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, receiveMessageWithoutBlocking, run, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, sendMessageWithoutBlocking, start, toString, unblockFromSemaphore, wait
 
Methods inherited from class java.lang.Thread
activeCount, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, checkAccess, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BASE_PERIOD_MULTIPLIER

private static final double BASE_PERIOD_MULTIPLIER
Multiplier of the model's base period. The product of this multiplier and the model's base period will be used as a parameter to the hold() method.

See Also:
Constant Field Values

basePeriod

private final double basePeriod
The model's base period of updates.


hw

private StationHardwareData hw
Information produced by hardware sensors.


station

private Station station
The station that this process manages.

Constructor Detail

WaterConsumptionProcess

protected WaterConsumptionProcess(cz.zcu.fav.kiv.jsim.JSimSimulation simulation,
                                  StationHardwareData hw,
                                  Station station,
                                  double basePeriod)
                           throws cz.zcu.fav.kiv.jsim.JSimSimulationAlreadyTerminatedException,
                                  cz.zcu.fav.kiv.jsim.JSimInvalidParametersException,
                                  cz.zcu.fav.kiv.jsim.JSimTooManyProcessesException
Constructs a new process simulating changes of the output flow from the main tank. These changes are caused by varying people's water consumption.

Parameters:
simulation - The overall simulation.
hw - Hardware data periodically changed by the tank's flow sensor.
station - The station to be managed.
basePeriod - The model's base period.
Method Detail

life

protected void life()
Simulates output flow changes in the pipe leading from the main tank. Reads and sets the Output Flow register in the station's hardware data.

Overrides:
life in class cz.zcu.fav.kiv.jsim.JSimProcess

randomOutputFlowChange

private double randomOutputFlowChange(double time)
Computes a change of the output flow. A random number with uniform distribution limited by -MAX_OUTPUT_FLOW_CHANGE_PER_SECOND from the left and +MAX_OUTPUT_FLOW_CHANGE_PER_SECOND from the right is multiplied by the time interval between two consecutive updates of model values.

Parameters:
time - The time period during which the change happened.
Returns:
A change of the output flow which has a uniform distribution.


Copyright © 2000-2004 University of West Bohemia, FAV-KIV. All Rights Reserved. Build date 20040510