Class ProcessEquipmentBaseClass

java.lang.Object
neqsim.util.NamedBaseClass
neqsim.process.SimulationBaseClass
neqsim.process.equipment.ProcessEquipmentBaseClass
All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, ProcessElementInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
Adjuster, AnnularLeakagePath, BatteryStorage, BiogasUpgrader, BiomassGasifier, BlackOilSeparator, Calculator, CementDegradationModel, CO2Electrolyzer, ComponentSplitter, Crystallizer, DexpiProcessUnit, DexpiProcessUnit, DistillationColumn, Dryer, Ejector, Electrolyzer, FlareStack, FloatingSubstructure, FuelGasSystem, FurnaceBurner, InjectionConformanceMonitor, LiquidLiquidExtractor, LNGAgeingScenario, LoopedPipeNetwork, Manifold, MembraneSeparator, Mixer, MooringSystem, MultiCompartmentReservoir, MultiEffectEvaporator, MultiPortEquipment, MultiVariableAdjuster, OffshoreEnergySystem, PipeFlowNetwork, PLEM, ProducedWaterTreatmentTrain, PyrolysisReactor, RateBasedPackedColumn, Recycle, ReservoirCVDsim, ReservoirDiffLibsim, ReservoirTPsim, Separator, SetPoint, Setter, ShortcutDistillationColumn, SimpleAdsorber, SimpleReservoir, SolarPanel, SolidsSeparator, Splitter, SpreadsheetBlock, Stream, SubseaManifold, SubseaPowerCable, Tank, TwoPortEquipment, Umbilical, UnisimCalculator, UtilityAirSystem, VesselDepressurization, VirtualStream, WellFlowlineNetwork, WellSystem, WindFarm, WindTurbine

public abstract class ProcessEquipmentBaseClass extends SimulationBaseClass implements ProcessEquipmentInterface

Abstract ProcessEquipmentBaseClass class.

Version:
$Id: $Id
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • controller

      private ControllerDeviceInterface controller
    • flowValveController

      ControllerDeviceInterface flowValveController
    • hasController

      public boolean hasController
    • controllerMap

      private final Map<String, ControllerDeviceInterface> controllerMap
      Map of controller tag name to controller device. Supports multiple controllers per equipment.
    • specification

      private String specification
    • report

      public String[][] report
    • properties

      public HashMap<String,String> properties
    • energyStream

      public EnergyStream energyStream
    • isSetEnergyStream

      private boolean isSetEnergyStream
    • isSolved

      protected boolean isSolved
    • isActive

      private boolean isActive
    • minimumFlow

      private double minimumFlow
    • capacityAnalysisEnabled

      private boolean capacityAnalysisEnabled
      Flag to enable/disable capacity analysis for this equipment. When disabled, this equipment is excluded from bottleneck detection, capacity utilization summaries, and optimization routines.
    • failureMode

      private EquipmentFailureMode failureMode
      Current failure mode of the equipment. Null means equipment is operating normally.
    • isFailed

      private boolean isFailed
      Flag indicating if the equipment is in a failed state.
    • referenceDesignation

      private ReferenceDesignation referenceDesignation
      IEC 81346 reference designation for this equipment. Contains the function, product, and location aspects per IEC 81346 standard.
    • capacityConstraints

      private transient Map<String, CapacityConstraint> capacityConstraints
      Capacity constraints for this equipment, keyed by constraint name. Marked transient because CapacityConstraint instances may hold non-serializable lambda value suppliers. After deserialization, subclasses should call initializeDefaultConstraints() to rebuild.
    • conditionAnalysisMessage

      public String conditionAnalysisMessage
  • Constructor Details

    • ProcessEquipmentBaseClass

      public ProcessEquipmentBaseClass(String name)

      Constructor for ProcessEquipmentBaseClass.

      Parameters:
      name - a String object
  • Method Details

    • getThermoSystem

      public SystemInterface getThermoSystem()

      getThermoSystem.

      Specified by:
      getThermoSystem in interface ProcessEquipmentInterface
      Returns:
      a SystemInterface object
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
    • copy

      Create deep copy.
      Returns:
      a deep copy of the unit operation/process equipment
    • getProperty

      public Object getProperty(String propertyName)

      getProperty.

      Parameters:
      propertyName - a String object
      Returns:
      a Object object
    • setRegulatorOutSignal

      public void setRegulatorOutSignal(double signal)

      setRegulatorOutSignal.

      Specified by:
      setRegulatorOutSignal in interface ProcessEquipmentInterface
      Parameters:
      signal - a double
    • setController

      public void setController(ControllerDeviceInterface controller)

      setController.

      Specified by:
      setController in interface ProcessEquipmentInterface
      Parameters:
      controller - a ControllerDeviceInterface object
    • setFlowValveController

      public void setFlowValveController(ControllerDeviceInterface controller)

      Setter for the field flowValveController.

      Parameters:
      controller - a ControllerDeviceInterface object
    • getController

      public ControllerDeviceInterface getController()

      getController.

      Specified by:
      getController in interface ProcessEquipmentInterface
      Returns:
      a ControllerDeviceInterface object
    • addController

      public void addController(String tag, ControllerDeviceInterface controller)
      Adds a controller to this equipment with the given tag name.
      Specified by:
      addController in interface ProcessEquipmentInterface
      Parameters:
      tag - a unique tag identifying the controller (e.g. "PC-101", "LC-101")
      controller - a ControllerDeviceInterface object
    • getController

      public ControllerDeviceInterface getController(String tag)
      Gets a controller by tag name.
      Specified by:
      getController in interface ProcessEquipmentInterface
      Parameters:
      tag - the controller tag name
      Returns:
      the controller, or null if not found
    • getControllers

      public Collection<ControllerDeviceInterface> getControllers()
      Gets all controllers attached to this equipment.
      Specified by:
      getControllers in interface ProcessEquipmentInterface
      Returns:
      unmodifiable collection of controllers
    • getMechanicalDesign

      public MechanicalDesign getMechanicalDesign()

      Get a mechanicalDesign for the equipment.

      Specified by:
      getMechanicalDesign in interface ProcessEquipmentInterface
      Returns:
      a MechanicalDesign object
    • initMechanicalDesign

      public void initMechanicalDesign()

      Initialize a initMechanicalDesign for the equipment.

      Specified by:
      initMechanicalDesign in interface ProcessEquipmentInterface
    • initElectricalDesign

      public void initElectricalDesign()

      Initialize an electricalDesign for the equipment.

      Specified by:
      initElectricalDesign in interface ProcessEquipmentInterface
    • initInstrumentDesign

      public void initInstrumentDesign()
      Initialize an instrumentDesign for the equipment.
      Specified by:
      initInstrumentDesign in interface ProcessEquipmentInterface
    • getSpecification

      public String getSpecification()

      getSpecification.

      Specified by:
      getSpecification in interface ProcessEquipmentInterface
      Returns:
      a String object
    • setSpecification

      public void setSpecification(String specification)

      setSpecification.

      Specified by:
      setSpecification in interface ProcessEquipmentInterface
      Parameters:
      specification - a String object
    • reportResults

      public String[][] reportResults()

      reportResults.

      Specified by:
      reportResults in interface ProcessEquipmentInterface
      Returns:
      an array of String objects
    • solved

      public boolean solved()

      Returns whether or not the module has been solved.

      Specified by:
      solved in interface SimulationInterface
      Returns:
      a boolean
    • getEnergyStream

      public EnergyStream getEnergyStream()

      Getter for the field energyStream.

      Returns:
      a EnergyStream object
    • setEnergyStream

      public void setEnergyStream(EnergyStream energyStream)

      Setter for the field energyStream.

      Parameters:
      energyStream - a EnergyStream object
    • setEnergyStream

      public void setEnergyStream(boolean isSetEnergyStream)

      Setter for the field energyStream.

      Parameters:
      isSetEnergyStream - a boolean
    • isSetEnergyStream

      public boolean isSetEnergyStream()

      isSetEnergyStream.

      Returns:
      a boolean
    • getPressure

      public double getPressure()

      Getter for the field pressure.

      Specified by:
      getPressure in interface ProcessEquipmentInterface
      Returns:
      Pressure in bara
    • getPressure

      public double getPressure(String unit)

      Getter for the field pressure converted to specified unit.

      Specified by:
      getPressure in interface ProcessEquipmentInterface
      Parameters:
      unit - a String object
      Returns:
      a double
    • setPressure

      public void setPressure(double pressure)

      Setter for the field pressure.

      Specified by:
      setPressure in interface ProcessEquipmentInterface
      Parameters:
      pressure - a double
    • getTemperature

      public double getTemperature()

      Getter for the field temperature.

      Specified by:
      getTemperature in interface ProcessEquipmentInterface
      Returns:
      a double
    • getTemperature

      public double getTemperature(String unit)

      Getter for the field temperature converted to specified unit.

      Specified by:
      getTemperature in interface ProcessEquipmentInterface
      Parameters:
      unit - a String object
      Returns:
      a double
    • setTemperature

      public void setTemperature(double temperature)

      Setter for the field temperature.

      Specified by:
      setTemperature in interface ProcessEquipmentInterface
      Parameters:
      temperature - Temperature in Kelvin
    • getEntropyProduction

      public double getEntropyProduction(String unit)

      getEntropyProduction.

      Specified by:
      getEntropyProduction in interface ProcessEquipmentInterface
      Parameters:
      unit - a String object
      Returns:
      a double
    • getMassBalance

      public double getMassBalance(String unit)

      getMassBalance.

      Specified by:
      getMassBalance in interface ProcessEquipmentInterface
      Parameters:
      unit - a String object
      Returns:
      a double
    • getMassBalance

      public double getMassBalance()

      getMassBalance in kg/sec.

      Specified by:
      getMassBalance in interface ProcessEquipmentInterface
      Returns:
      The mass balance of the process equipment in kg/sec.
    • getExergyChange

      public double getExergyChange(String unit, double surroundingTemperature)
      Get exergy change production of the process equipment.
      Specified by:
      getExergyChange in interface ProcessEquipmentInterface
      Parameters:
      unit - Supported units are J and kJ
      surroundingTemperature - The surrounding temperature in Kelvin
      Returns:
      change in exergy in specified unit
    • runConditionAnalysis

      public void runConditionAnalysis(ProcessEquipmentInterface refExchanger)

      runConditionAnalysis.

      Specified by:
      runConditionAnalysis in interface ProcessEquipmentInterface
      Parameters:
      refExchanger - a ProcessEquipmentInterface object
    • getConditionAnalysisMessage

      public String getConditionAnalysisMessage()

      getConditionAnalysisMessage.

      Specified by:
      getConditionAnalysisMessage in interface ProcessEquipmentInterface
      Returns:
      a String object
    • getResultTable

      public String[][] getResultTable()

      getResultTable.

      Specified by:
      getResultTable in interface ProcessEquipmentInterface
      Returns:
      an array of String objects
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface ProcessEquipmentInterface
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface ProcessEquipmentInterface
      Overrides:
      equals in class Object
    • toJson

      public String toJson()

      Serializes the Process Equipment along with its state to a JSON string.

      Specified by:
      toJson in interface ProcessEquipmentInterface
      Returns:
      json string.
    • toJson

      public String toJson(ReportConfig cfg)
      Serializes the Process Equipment with configurable level of detail.
      Specified by:
      toJson in interface ProcessEquipmentInterface
      Parameters:
      cfg - report configuration
      Returns:
      json string
    • getReport_json

      public String getReport_json()

      getReport_json.

      Return results of simulation in json format
      Specified by:
      getReport_json in interface ProcessEquipmentInterface
      Specified by:
      getReport_json in interface SimulationInterface
      Returns:
      a String
    • run_step

      public void run_step(UUID id)

      run_step

      In this method all thermodynamic and unit operations will be calculated in a steady state calculation. Sets calc identifier UUID. It does not solve recycles - only calculates one step
      Specified by:
      run_step in interface SimulationInterface
      Parameters:
      id - Calc identifier UUID to set.
    • getMinimumFlow

      public double getMinimumFlow()

      Getter for the field minimumFlow, e.g., the minimum flow rate for the pump.

      Returns:
      a double
    • setMinimumFlow

      public void setMinimumFlow(double minimumFlow)

      Setter for the field minimumFlow, e.g., the minimum flow rate for the pump.

      Parameters:
      minimumFlow - a double
    • isActive

      public boolean isActive()

      Getter for the field isActive.

      Returns:
      a boolean
    • isActive

      public void isActive(boolean isActive)

      Setter for the field isActive.

      Parameters:
      isActive - a boolean
    • isCapacityAnalysisEnabled

      public boolean isCapacityAnalysisEnabled()
      Checks if capacity analysis is enabled for this equipment.

      When disabled, this equipment is excluded from bottleneck detection, capacity utilization summaries, and optimization routines. The equipment still tracks its constraints but doesn't contribute to system-level analysis.

      Returns:
      true if capacity analysis is enabled (default is true)
    • setCapacityAnalysisEnabled

      public void setCapacityAnalysisEnabled(boolean enabled)
      Enables or disables capacity analysis for this equipment.

      When disabled, this equipment is excluded from:

      • System bottleneck detection (ProcessSystem.findBottleneck())
      • Capacity utilization summaries (ProcessSystem.getCapacityUtilizationSummary())
      • Equipment near capacity lists (ProcessSystem.getEquipmentNearCapacityLimit())
      • Optimization constraint checking

      The equipment still calculates and tracks its constraints internally.

      Parameters:
      enabled - true to include in capacity analysis, false to exclude
    • getFailureMode

      public EquipmentFailureMode getFailureMode()
      Gets the current failure mode of the equipment.
      Returns:
      the failure mode, or null if equipment is operating normally
    • setFailureMode

      public void setFailureMode(EquipmentFailureMode failureMode)
      Sets a failure mode on the equipment.

      When a failure mode is set, the equipment is marked as failed and its behavior changes according to the failure mode characteristics (capacity factor, etc.). Setting null clears the failure.

      Parameters:
      failureMode - the failure mode to apply, or null to clear failure
    • isFailed

      public boolean isFailed()
      Checks if the equipment is in a failed state.
      Returns:
      true if the equipment has a failure mode set
    • simulateTrip

      public void simulateTrip()
      Simulates a trip (complete failure) on the equipment.

      Convenience method that applies a standard trip failure mode. The equipment becomes inactive and is excluded from capacity analysis.

    • simulateDegradedOperation

      public void simulateDegradedOperation(double capacityPercent)
      Simulates degraded operation at a specified capacity.
      Parameters:
      capacityPercent - remaining capacity percentage (0-100)
    • restoreFromFailure

      public void restoreFromFailure()
      Restores the equipment from a failed state.

      Clears any failure mode and restores the equipment to normal operation.

    • getReferenceDesignation

      public ReferenceDesignation getReferenceDesignation()
      Returns the IEC 81346 reference designation for this equipment.

      The reference designation encodes three aspects per IEC 81346: function (what the system does), product (what the equipment is), and location (where it is installed).

      Specified by:
      getReferenceDesignation in interface ProcessEquipmentInterface
      Returns:
      the reference designation object, never null
    • setReferenceDesignation

      public void setReferenceDesignation(ReferenceDesignation referenceDesignation)
      Sets the IEC 81346 reference designation for this equipment.
      Specified by:
      setReferenceDesignation in interface ProcessEquipmentInterface
      Parameters:
      referenceDesignation - the reference designation to set
    • getEffectiveCapacityFactor

      public double getEffectiveCapacityFactor()
      Gets the effective capacity factor considering any failure mode.
      Returns:
      capacity factor (0.0 to 1.0), where 1.0 is full capacity
    • ensureCapacityConstraintsInitialized

      private void ensureCapacityConstraintsInitialized()
      Ensures the capacity constraints map is initialized.

      The map is transient (not serialized) so it may be null after deserialization. This method lazily initializes it and calls initializeDefaultConstraints() to let subclasses re-attach their lambda value suppliers.

    • initializeDefaultConstraints

      protected void initializeDefaultConstraints()
      Hook for subclasses to set up default capacity constraints.

      Called lazily when constraints are first accessed, and after deserialization. Subclasses should override this to add equipment-specific constraints using addCapacityConstraint(CapacityConstraint). The default implementation does nothing.

    • getCapacityConstraints

      public Map<String, CapacityConstraint> getCapacityConstraints()
      Gets all capacity constraints defined for this equipment.

      Returns an unmodifiable map of constraint name to constraint object. Constraints are used by the optimization framework to detect bottlenecks, enforce limits, and guide production allocation. Equipment subclasses populate this map via ProcessEquipmentInterface.addCapacityConstraint(CapacityConstraint).

      Specified by:
      getCapacityConstraints in interface ProcessEquipmentInterface
      Returns:
      unmodifiable map of constraint name to constraint, empty if none defined
    • addCapacityConstraint

      public void addCapacityConstraint(CapacityConstraint constraint)
      Adds a capacity constraint to this equipment.

      Constraints can be added at any time. If a constraint with the same name already exists, it is replaced. Use the fluent builder API on CapacityConstraint to configure the constraint before adding.

      Specified by:
      addCapacityConstraint in interface ProcessEquipmentInterface
      Parameters:
      constraint - the capacity constraint to add (ignored if null)
    • getBottleneckConstraint

      public CapacityConstraint getBottleneckConstraint()
      Gets the bottleneck (most limiting) constraint for this equipment.

      Returns the enabled constraint with the highest utilization ratio. If no constraints are defined or enabled, returns null.

      Specified by:
      getBottleneckConstraint in interface ProcessEquipmentInterface
      Returns:
      the most limiting constraint, or null if none
    • isCapacityExceeded

      public boolean isCapacityExceeded()
      Checks if any capacity constraint is violated (exceeds 100% utilization).

      A violated constraint means the equipment is operating beyond its design capacity. For HARD constraints, this may indicate equipment trip or failure. For SOFT constraints, this indicates reduced efficiency or accelerated wear.

      Specified by:
      isCapacityExceeded in interface ProcessEquipmentInterface
      Returns:
      true if any enabled constraint utilization exceeds 1.0 (100%)
    • isHardLimitExceeded

      public boolean isHardLimitExceeded()
      Checks if any HARD constraint limit is exceeded.

      HARD limits represent absolute equipment limits (e.g., maximum speed) that cannot be exceeded without equipment trip or damage. This is more severe than general capacity exceedance.

      Specified by:
      isHardLimitExceeded in interface ProcessEquipmentInterface
      Returns:
      true if any enabled HARD constraint's max value is exceeded
    • getMaxUtilization

      public double getMaxUtilization()
      Gets the maximum utilization across all enabled constraints.

      Returns the highest utilization ratio across all enabled constraints. Values above 1.0 indicate the equipment is over capacity. Returns 0.0 if no constraints are defined or enabled.

      Specified by:
      getMaxUtilization in interface ProcessEquipmentInterface
      Returns:
      maximum utilization as fraction (1.0 = 100% of design capacity)
    • getMaxUtilizationPercent

      public double getMaxUtilizationPercent()
      Gets the maximum utilization as a percentage.
      Specified by:
      getMaxUtilizationPercent in interface ProcessEquipmentInterface
      Returns:
      maximum utilization as percentage (100.0 = 100% of design capacity)
    • getAvailableMargin

      public double getAvailableMargin()
      Gets the available margin (headroom) on the most limiting constraint.

      Returns the remaining capacity before the bottleneck constraint reaches 100%. Negative values indicate the equipment is already over capacity.

      Specified by:
      getAvailableMargin in interface ProcessEquipmentInterface
      Returns:
      available margin as fraction (0.2 = 20% headroom remaining)
    • getAvailableMarginPercent

      public double getAvailableMarginPercent()
      Gets the available margin as a percentage.
      Specified by:
      getAvailableMarginPercent in interface ProcessEquipmentInterface
      Returns:
      available margin as percentage
    • isNearCapacityLimit

      public boolean isNearCapacityLimit()
      Checks if any enabled constraint is near its limit (above warning threshold).

      The warning threshold is typically set at 90% of design capacity to provide early warning before constraints are violated.

      Specified by:
      isNearCapacityLimit in interface ProcessEquipmentInterface
      Returns:
      true if any enabled constraint is above its warning threshold
    • getUtilizationSummary

      public Map<String,Double> getUtilizationSummary()
      Gets a summary of all enabled constraint utilizations.

      Returns a map of constraint names to their current utilization percentages. Useful for reporting and visualization.

      Specified by:
      getUtilizationSummary in interface ProcessEquipmentInterface
      Returns:
      map of constraint name to utilization percentage
    • getConstraintEvaluationReport

      public String getConstraintEvaluationReport()
      Evaluates all capacity constraints and returns a summary string.

      Useful for logging and diagnostics. Each enabled constraint is evaluated and its utilization is reported. Constraints that are violated or near their limit are flagged.

      Returns:
      multi-line summary of constraint status