Class TimerCondition
java.lang.Object
neqsim.process.logic.condition.TimerCondition
- All Implemented Interfaces:
LogicCondition
Condition that becomes true after a specified time delay.
Used for:
- Minimum wait times between steps
- Equipment warm-up periods
- Stabilization delays
- Timeout detection
Example usage:
// Wait 30 seconds before starting pump
TimerCondition warmUp = new TimerCondition(30.0);
warmUp.start();
// In simulation loop
warmUp.update(timeStep);
if (warmUp.evaluate()) {
// 30 seconds elapsed
}
- Version:
- 1.0
- Author:
- ESOL
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanevaluate()Evaluates if the condition is currently met.Gets the current value being evaluated (for diagnostics).Gets a description of this condition.doubleGets the elapsed time.Gets the expected/setpoint value (for diagnostics).doubleGets the remaining time.Gets the target equipment this condition monitors (if any).voidreset()Resets the timer.voidstart()Starts the timer.voidupdate(double timeStep) Updates the timer with a time step.
-
Field Details
-
duration
private final double duration -
elapsed
private double elapsed -
started
private boolean started
-
-
Constructor Details
-
TimerCondition
public TimerCondition(double duration) Creates a timer condition.- Parameters:
duration- duration in seconds
-
-
Method Details
-
start
public void start()Starts the timer. -
reset
public void reset()Resets the timer. -
update
public void update(double timeStep) Updates the timer with a time step.- Parameters:
timeStep- time step in seconds
-
evaluate
public boolean evaluate()Description copied from interface:LogicConditionEvaluates if the condition is currently met.- Specified by:
evaluatein interfaceLogicCondition- Returns:
- true if condition is satisfied, false otherwise
-
getElapsed
public double getElapsed()Gets the elapsed time.- Returns:
- elapsed time in seconds
-
getRemaining
public double getRemaining()Gets the remaining time.- Returns:
- remaining time in seconds, or 0 if complete
-
getDescription
Description copied from interface:LogicConditionGets a description of this condition.- Specified by:
getDescriptionin interfaceLogicCondition- Returns:
- human-readable description
-
getTargetEquipment
Description copied from interface:LogicConditionGets the target equipment this condition monitors (if any).- Specified by:
getTargetEquipmentin interfaceLogicCondition- Returns:
- target equipment, or null if not equipment-specific
-
getCurrentValue
Description copied from interface:LogicConditionGets the current value being evaluated (for diagnostics).- Specified by:
getCurrentValuein interfaceLogicCondition- Returns:
- current value as string, or empty if not applicable
-
getExpectedValue
Description copied from interface:LogicConditionGets the expected/setpoint value (for diagnostics).- Specified by:
getExpectedValuein interfaceLogicCondition- Returns:
- expected value as string, or empty if not applicable
-