Skip to the content.

Advanced Process Logic Features

Overview

NeqSim’s process logic framework has been extended with powerful advanced features for complex process control, startup/shutdown sequences, and decision-making. This document covers the new capabilities added to the framework.

New Features Summary

Feature Purpose Key Classes Status
Startup Logic Permissive-based startup sequences StartupLogic, LogicCondition ✓ Complete
Shutdown Logic Controlled/emergency ramp-down ShutdownLogic ✓ Complete
Conditional Branching If-then-else decision making ConditionalAction ✓ Complete
Parallel Execution Simultaneous action execution ParallelActionGroup ✓ Complete
Voting Logic Redundant sensor evaluation VotingEvaluator, VotingPattern ✓ Complete
Logic Conditions Runtime condition checking PressureCondition, TemperatureCondition, TimerCondition ✓ Complete

1. Startup Logic with Permissive Checks

Purpose

Ensures all required conditions are met before starting equipment, following industry best practices for safe process startup.

Key Features

Example

StartupLogic startup = new StartupLogic("Compressor Startup");

// Add permissives (ALL must be true before starting)
startup.addPermissive(new TemperatureCondition(cooler, 50.0, "<"));  // Cooled down
startup.addPermissive(new PressureCondition(suction, 3.0, ">"));     // Min pressure
startup.addPermissive(new TimerCondition(60.0));                     // Warm-up time

// 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

// Activate and execute
startup.activate();
while (!startup.isComplete()) {
    warmupTimer.update(timeStep);
    startup.execute(timeStep);
}

Status Output

Separator Startup - WAITING FOR PERMISSIVES (2.0s / 300.0s)
  Permissives:
    ✓ Pressure > 5.0 bara: MET (current: 10.0 bara)
    ✓ Temperature < 50.0°C: MET (current: 25.0°C)
    ✗ Wait 5.0 seconds: NOT MET (current: 4.0 s)

2. Shutdown Logic with Ramp-Down

Purpose

Provides controlled, gradual equipment shutdown to prevent thermal shock, pressure surges, or process upsets.

Key Features

Example

ShutdownLogic shutdown = new ShutdownLogic("Reactor Shutdown");
shutdown.setRampDownTime(600.0);  // 10 minutes controlled

// Add ramp-down actions
shutdown.addAction(new ReduceFeedAction(feedValve, 75.0), 0.0);   // 75% immediately
shutdown.addAction(new ReduceFeedAction(feedValve, 50.0), 120.0); // 50% after 2 min
shutdown.addAction(new ReduceFeedAction(feedValve, 25.0), 300.0); // 25% after 5 min
shutdown.addAction(new StopHeaterAction(heater), 450.0);          // Stop at 7.5 min
shutdown.addAction(new CloseFeedAction(feedValve), 600.0);        // Close at 10 min

// Controlled shutdown
shutdown.activate();

// Or emergency shutdown (much faster)
shutdown.setEmergencyMode(true);
shutdown.setEmergencyShutdownTime(30.0); // Complete in 30s
shutdown.activate();

Output Comparison

CONTROLLED (10 minutes):
Time: 0.0s   → Valve: 75%   → Progress: 0%
Time: 120.0s → Valve: 50%   → Progress: 20%
Time: 600.0s → Valve: 0%    → Progress: 100%

EMERGENCY (30 seconds):
Time: 0.0s  → Valve: 0%     → Progress: 100% (all actions accelerated)

3. Conditional Branching (If-Then-Else)

Purpose

Enables dynamic decision-making within process sequences based on runtime conditions.

Key Features

Example

// If temperature > 100°C, open cooling valve; else open bypass valve
LogicCondition highTemp = new TemperatureCondition(reactor, 100.0, ">");
LogicAction openCooling = new OpenValveAction(coolingValve);
LogicAction openBypass = new OpenValveAction(bypassValve);

ConditionalAction conditional = new ConditionalAction(
    highTemp, 
    openCooling,      // If true
    openBypass,       // If false
    "Temperature Control"
);

// Add to sequence
startupLogic.addAction(conditional, 0.0);

// At runtime, evaluates temperature and opens appropriate valve
conditional.execute();

Use Cases


4. Parallel Action Execution

Purpose

Executes multiple actions simultaneously to reduce total sequence time and coordinate equipment.

Key Features

Example

// Open 3 valves simultaneously
ParallelActionGroup parallelOpen = new ParallelActionGroup("Open All Inlet Valves");
parallelOpen.addAction(new OpenValveAction(valve1));
parallelOpen.addAction(new OpenValveAction(valve2));
parallelOpen.addAction(new OpenValveAction(valve3));

// Add to sequence
startupLogic.addAction(parallelOpen, 0.0);

// Executes all valves at once (saves time vs sequential)
parallelOpen.execute();

System.out.printf("Progress: %d/%d complete (%.0f%%)\n",
    parallelOpen.getCompletedCount(),
    parallelOpen.getTotalCount(),
    parallelOpen.getCompletionPercentage());

Benefits


5. Voting Logic (Enhanced)

Purpose

Generic voting logic for redundant sensors or conditions, applicable beyond just safety systems.

Key Features

Example - Digital Voting

// 2 out of 3 pressure switches must be high
VotingEvaluator<Boolean> voting = new VotingEvaluator<>(VotingPattern.TWO_OUT_OF_THREE);
voting.addInput(pt1.isHigh(), pt1.isFaulty());
voting.addInput(pt2.isHigh(), pt2.isFaulty());
voting.addInput(pt3.isHigh(), pt3.isFaulty());

boolean alarmActive = voting.evaluateDigital();

Example - Analog Voting

// Median of 3 temperature sensors (best for safety)
VotingEvaluator<Double> tempVoting = new VotingEvaluator<>(VotingPattern.TWO_OUT_OF_THREE);
tempVoting.addInput(tt1.getValue(), tt1.isFaulty());
tempVoting.addInput(tt2.getValue(), tt2.isFaulty());
tempVoting.addInput(tt3.getValue(), tt3.isFaulty());

double temperature = tempVoting.evaluateMedian();  // Most reliable
double tempAvg = tempVoting.evaluateAverage();     // Alternative
double tempMid = tempVoting.evaluateMidValue();    // For 3 sensors

Applications


6. Logic Conditions

Purpose

Define runtime conditions that can be checked by startup logic, conditional actions, or custom logic.

Available Conditions

PressureCondition

// Check if pressure meets criteria
PressureCondition minPressure = new PressureCondition(stream, 5.0, ">");   // > 5 bara
PressureCondition stable = new PressureCondition(stream, 10.0, "==", 0.5); // ±0.5 bara

TemperatureCondition

// Check if temperature meets criteria
TemperatureCondition cooled = new TemperatureCondition(heater, 80.0, "<");  // < 80°C
TemperatureCondition ready = new TemperatureCondition(reactor, 150.0, ">="); // ≥ 150°C

TimerCondition

// Wait for specified duration
TimerCondition warmup = new TimerCondition(60.0);  // 60 seconds
warmup.start();

// In loop
warmup.update(timeStep);
if (warmup.evaluate()) {
    // Time elapsed
}

Supported Operators


Integration Examples

Complete Startup Sequence

// Compressor startup with all features
StartupLogic startup = new StartupLogic("Gas Compressor Startup");

// 1. Permissives
startup.addPermissive(new PressureCondition(suction, 3.0, ">"));
startup.addPermissive(new TemperatureCondition(oil, 40.0, ">"));
startup.addPermissive(new TimerCondition(120.0));

// 2. Parallel valve opening
ParallelActionGroup openValves = new ParallelActionGroup("Open Inlet Valves");
openValves.addAction(new OpenValveAction(suctionValve));
openValves.addAction(new OpenValveAction(recycleValve));
startup.addAction(openValves, 0.0);

// 3. Conditional lubrication
LogicCondition oilPressureLow = new PressureCondition(oilSystem, 2.0, "<");
ConditionalAction startAuxOilPump = new ConditionalAction(
    oilPressureLow,
    new StartPumpAction(auxOilPump),
    "Auxiliary Oil Pump"
);
startup.addAction(startAuxOilPump, 2.0);

// 4. Start compressor
startup.addAction(new StartCompressorAction(compressor), 10.0);

// Execute
startup.activate();

Layered Safety System

// HIPPS → Fire/Gas → ESD with voting
VotingEvaluator<Double> pressureVoting = new VotingEvaluator<>(VotingPattern.TWO_OUT_OF_THREE);
pressureVoting.addInput(pt1.getValue(), pt1.isFaulty());
pressureVoting.addInput(pt2.getValue(), pt2.isFaulty());
pressureVoting.addInput(pt3.getValue(), pt3.isFaulty());

double votedPressure = pressureVoting.evaluateMedian();

// Use voted pressure for HIPPS
if (votedPressure > hippsSetpoint) {
    hipps.activate();
}

Best Practices

Startup Logic

  1. Order permissives by criticality (most important first)
  2. Use reasonable timeouts (5 minutes default is good)
  3. Test permissives before going live
  4. Add delays between actions for stabilization

Shutdown Logic

  1. Gradual ramp-down prevents thermal shock (10-30 minutes typical)
  2. Emergency mode for critical situations only
  3. Monitor progress to verify controlled shutdown
  4. Cool down before stopping agitation/mixing

Voting Logic

  1. 2oo3 is standard for safety systems (good balance)
  2. Median is preferred over average for safety (outlier rejection)
  3. Track faulty sensors and enforce bypass limits
  4. Test voting logic with sensor failures

Conditional Logic

  1. Keep conditions simple - one comparison per condition
  2. Provide alternatives when feasible (else path)
  3. Test both paths in simulation
  4. Document decisions in descriptions

Parallel Execution

  1. Group related actions (all valves, all pumps)
  2. Check completion before proceeding
  3. Independent actions only (no dependencies)
  4. Monitor individual actions for failures

Performance Considerations

Feature Overhead Typical Use
Startup Logic Low Once per startup (minutes)
Shutdown Logic Low Once per shutdown (minutes/hours)
Conditional Action Very Low Infrequent (mode changes)
Parallel Group Very Low Startup/shutdown only
Voting Logic Very Low Every control loop (seconds)
Conditions Very Low Continuous monitoring

All features are designed for real-time performance with minimal overhead.


See Also


Summary

The advanced process logic features provide industrial-grade capabilities for:

These features follow industry best practices from standards like ISA-88 (batch), ISA-84 (SIS), and IEC 61131-3 (PLC programming) to provide robust, production-ready process control logic.