Class StartupLogic
java.lang.Object
neqsim.process.logic.startup.StartupLogic
- All Implemented Interfaces:
ProcessLogic
Startup logic with permissive checks and sequential action execution.
Startup sequences verify that required conditions (permissives) are met before proceeding with equipment startup. This follows industry best practices for safe process startup.
Key features:
- Permissive checks (temperature, pressure, level, etc.)
- Sequential action execution with timing
- Automatic abort if permissives lost during startup
- Configurable timeout for permissive waiting
- Detailed status reporting
Example usage:
StartupLogic startup = new StartupLogic("Compressor Startup");
// Add permissives (must all be true before starting)
startup.addPermissive(new TemperatureCondition(cooler, 50.0, "<")); // Cooled
startup.addPermissive(new PressureCondition(suction, 3.0, ">")); // Min pressure
startup.addPermissive(new TimerCondition(60.0)); // Min 60s warm-up
// Add startup actions
startup.addAction(new OpenValveAction(suctionValve), 0.0); // Immediate
startup.addAction(new StartPumpAction(lubePump), 2.0); // After 2s
startup.addAction(new StartCompressorAction(compressor), 10.0); // After 10s
// In control loop
startup.activate();
while (!startup.isComplete()) {
startup.execute(timeStep);
}
- Version:
- 1.0
- Author:
- ESOL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInternal class to store an action with its delay. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Stringprivate final List<StartupLogic.ActionWithDelay> private intprivate doubleprivate doubleprivate doubleprivate final Stringprivate final List<LogicCondition> private doubleprivate LogicState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the logic sequence, starting execution.voidaddAction(LogicAction action, double delay) Adds an action to the startup sequence.voidaddPermissive(LogicCondition permissive) Adds a permissive condition that must be met before startup can proceed.voidDeactivates the logic sequence, pausing or stopping execution.voidexecute(double timeStep) Executes one time step of the logic sequence.private voidexecuteActions(double timeStep) private voidexecutePermissiveWait(double timeStep) Gets the reason for abort.intGets the number of actions in the sequence.getName()Gets the name of this logic sequence.Gets all permissive conditions.doubleGets the time spent waiting for permissives.getState()Gets the current state of the logic.Gets a description of the current status.Gets the list of equipment targeted by this logic.booleanChecks if startup was aborted.booleanisActive()Checks if the logic is currently active (running).booleanChecks if the logic sequence has completed successfully.booleanreset()Resets the logic sequence to its initial state.voidsetPermissiveTimeout(double timeout) Sets the maximum time to wait for permissives to be met.
-
Field Details
-
name
-
permissives
-
actions
-
state
-
currentActionIndex
private int currentActionIndex -
elapsedTime
private double elapsedTime -
currentDelay
private double currentDelay -
permissiveWaitTime
private double permissiveWaitTime -
maxPermissiveWaitTime
private double maxPermissiveWaitTime -
aborted
private boolean aborted -
abortReason
-
-
Constructor Details
-
StartupLogic
Creates a startup logic sequence.- Parameters:
name- name of the startup sequence
-
-
Method Details
-
addPermissive
Adds a permissive condition that must be met before startup can proceed.All permissives must be true simultaneously before the first action executes.
- Parameters:
permissive- condition to check
-
addAction
Adds an action to the startup sequence.- Parameters:
action- action to executedelay- delay in seconds before executing (relative to previous action completion)
-
setPermissiveTimeout
public void setPermissiveTimeout(double timeout) Sets the maximum time to wait for permissives to be met.- Parameters:
timeout- timeout in seconds (default 300s)
-
activate
public void activate()Description copied from interface:ProcessLogicActivates the logic sequence, starting execution.If the logic is already active, this may restart it or have no effect depending on implementation.
- Specified by:
activatein interfaceProcessLogic
-
deactivate
public void deactivate()Description copied from interface:ProcessLogicDeactivates the logic sequence, pausing or stopping execution.The logic remains in its current state and can be reactivated later.
- Specified by:
deactivatein interfaceProcessLogic
-
reset
public boolean reset()Description copied from interface:ProcessLogicResets the logic sequence to its initial state.This prepares the logic for a fresh execution. Reset may require certain permissive conditions to be met.
- Specified by:
resetin interfaceProcessLogic- Returns:
- true if reset was successful, false if permissives not met
-
execute
public void execute(double timeStep) Description copied from interface:ProcessLogicExecutes one time step of the logic sequence.This method should be called repeatedly in transient simulations to advance the logic through its steps.
- Specified by:
executein interfaceProcessLogic- Parameters:
timeStep- time increment in seconds
-
executePermissiveWait
private void executePermissiveWait(double timeStep) -
executeActions
private void executeActions(double timeStep) -
isAborted
public boolean isAborted()Checks if startup was aborted.- Returns:
- true if aborted
-
getAbortReason
Gets the reason for abort.- Returns:
- abort reason, or empty string if not aborted
-
getPermissiveWaitTime
public double getPermissiveWaitTime()Gets the time spent waiting for permissives.- Returns:
- wait time in seconds
-
getName
Description copied from interface:ProcessLogicGets the name of this logic sequence.- Specified by:
getNamein interfaceProcessLogic- Returns:
- logic name
-
getState
Description copied from interface:ProcessLogicGets the current state of the logic.- Specified by:
getStatein interfaceProcessLogic- Returns:
- current logic state
-
isActive
public boolean isActive()Description copied from interface:ProcessLogicChecks if the logic is currently active (running).- Specified by:
isActivein interfaceProcessLogic- Returns:
- true if logic is active
-
isComplete
public boolean isComplete()Description copied from interface:ProcessLogicChecks if the logic sequence has completed successfully.- Specified by:
isCompletein interfaceProcessLogic- Returns:
- true if logic has completed all steps
-
getTargetEquipment
Description copied from interface:ProcessLogicGets the list of equipment targeted by this logic.- Specified by:
getTargetEquipmentin interfaceProcessLogic- Returns:
- list of target equipment
-
getStatusDescription
Description copied from interface:ProcessLogicGets a description of the current status.- Specified by:
getStatusDescriptionin interfaceProcessLogic- Returns:
- status description
-
getPermissives
Gets all permissive conditions.- Returns:
- list of permissives
-
getActionCount
public int getActionCount()Gets the number of actions in the sequence.- Returns:
- action count
-