Class SafetyInstrumentedFunction
java.lang.Object
neqsim.process.logic.sis.SafetyInstrumentedFunction
- All Implemented Interfaces:
ProcessLogic
Safety Instrumented Function (SIF) implementing fire and gas detection with voting logic.
A SIF is a safety function designed to prevent or mitigate hazardous events. It consists of:
- Sensors/detectors (input elements)
- Logic solver (voting and logic)
- Final elements (valves, alarms, etc.)
This implementation follows IEC 61511 principles:
- Voting logic (1oo1, 1oo2, 2oo3, etc.)
- Bypass management (max 1 bypassed detector)
- Fault detection and alarming
- Manual override capability
- Reset permissives
Example usage:
// Create fire detection SIF with 2oo3 voting
SafetyInstrumentedFunction fireSIF =
new SafetyInstrumentedFunction("Fire Detection SIF", VotingLogic.TWO_OUT_OF_THREE);
// Add detectors
fireSIF.addDetector(new Detector("FD-101", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));
fireSIF.addDetector(new Detector("FD-102", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));
fireSIF.addDetector(new Detector("FD-103", DetectorType.FIRE, AlarmLevel.HIGH, 60.0, "°C"));
// Link to ESD logic
fireSIF.linkToLogic(esdLogic);
// In simulation loop:
fireSIF.update(temp1, temp2, temp3); // Update detector values
if (fireSIF.isTripped()) {
// SIF has activated
}
- Version:
- 1.0
- Author:
- ESOL
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate final List<ProcessLogic> private intprivate final Stringprivate LogicStateprivate longprivate final VotingLogic -
Constructor Summary
ConstructorsConstructorDescriptionSafetyInstrumentedFunction(String name, VotingLogic votingLogic) Creates a Safety Instrumented Function. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the logic sequence, starting execution.voidaddDetector(Detector detector) Adds a detector to this SIF.voidDeactivates the logic sequence, pausing or stopping execution.private voidEvaluates the voting logic and determines if SIF should trip.voidexecute(double timeStep) Executes one time step of the logic sequence.getDetector(int index) Gets a specific detector by index.Gets all detectors.getName()Gets the name of this logic sequence.getState()Gets the current state of the logic.Gets a description of the current status.Gets the list of equipment targeted by this logic.Gets the voting logic pattern.booleanisActive()Checks if the logic is currently active (running).booleanChecks if the logic sequence has completed successfully.booleanChecks if SIF is overridden.booleanChecks if SIF is tripped.voidlinkToLogic(ProcessLogic logic) Links this SIF to a process logic sequence that will be activated when SIF trips.booleanreset()Resets the SIF after trip conditions have cleared.voidsetMaxBypassedDetectors(int max) Sets the maximum number of detectors that can be bypassed simultaneously.voidsetOverride(boolean override) Manually overrides the SIF (for testing or bypass).toString()voidupdate(double... measuredValues) Updates all detectors with new measured values and evaluates voting logic.
-
Field Details
-
name
-
votingLogic
-
detectors
-
linkedLogics
-
state
-
isTripped
private boolean isTripped -
isOverridden
private boolean isOverridden -
tripTime
private long tripTime -
maxBypassedDetectors
private int maxBypassedDetectors
-
-
Constructor Details
-
SafetyInstrumentedFunction
Creates a Safety Instrumented Function.- Parameters:
name- SIF name/tagvotingLogic- voting pattern for detectors
-
-
Method Details
-
addDetector
Adds a detector to this SIF.The number of detectors added must match the voting logic total sensors requirement.
- Parameters:
detector- detector to add- Throws:
IllegalStateException- if too many detectors are added
-
linkToLogic
Links this SIF to a process logic sequence that will be activated when SIF trips.- Parameters:
logic- process logic to activate
-
update
public void update(double... measuredValues) Updates all detectors with new measured values and evaluates voting logic.- Parameters:
measuredValues- array of values corresponding to each detector- Throws:
IllegalArgumentException- if array size doesn't match detector count
-
evaluateVoting
private void evaluateVoting()Evaluates the voting logic and determines if SIF should trip. -
setOverride
public void setOverride(boolean override) Manually overrides the SIF (for testing or bypass).Override should be used with extreme caution and typically requires management approval.
- Parameters:
override- true to override (inhibit), false to restore
-
reset
public boolean reset()Resets the SIF after trip conditions have cleared.Reset requires all detectors to be in non-trip condition.
- Specified by:
resetin interfaceProcessLogic- Returns:
- true if reset successful, false if conditions not met
-
getDetector
Gets a specific detector by index.- Parameters:
index- detector index (0-based)- Returns:
- detector at index
-
getDetectors
-
isTripped
public boolean isTripped()Checks if SIF is tripped.- Returns:
- true if tripped
-
isOverridden
public boolean isOverridden()Checks if SIF is overridden.- Returns:
- true if overridden
-
getVotingLogic
-
setMaxBypassedDetectors
public void setMaxBypassedDetectors(int max) Sets the maximum number of detectors that can be bypassed simultaneously.- Parameters:
max- maximum bypass count (typically 1)
-
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
-
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
-
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
-
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
-
toString
-