Class Adjuster

All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, SimulationInterface, NamedInterface

public class Adjuster extends ProcessEquipmentBaseClass

Adjuster class.

Version:
$Id: $Id
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

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

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • adjustedEquipment

      ProcessEquipmentInterface adjustedEquipment
    • targetEquipment

      ProcessEquipmentInterface targetEquipment
    • adjustedVariable

      String adjustedVariable
    • adjustedVariableUnit

      String adjustedVariableUnit
    • maxAdjustedValue

      double maxAdjustedValue
    • minAdjustedValue

      double minAdjustedValue
    • targetVariable

      String targetVariable
    • targetPhase

      String targetPhase
    • targetComponent

      String targetComponent
    • targetValue

      double targetValue
    • targetUnit

      String targetUnit
    • tolerance

      private double tolerance
    • inputValue

      double inputValue
    • oldInputValue

      double oldInputValue
    • error

      private double error
    • oldError

      private double oldError
    • iterations

      int iterations
    • activateWhenLess

      private boolean activateWhenLess
    • targetValueCalculator

      private Function<ProcessEquipmentInterface, Double> targetValueCalculator
    • adjustedValueGetter

      private Function<ProcessEquipmentInterface, Double> adjustedValueGetter
    • adjustedValueSetter

      private BiConsumer<ProcessEquipmentInterface, Double> adjustedValueSetter
  • Constructor Details

    • Adjuster

      public Adjuster(String name)

      Constructor for Adjuster.

      Parameters:
      name - a String object
  • Method Details

    • getStreamFromEquipment

      private StreamInterface getStreamFromEquipment(ProcessEquipmentInterface equipment)
      Helper method to get a StreamInterface from equipment. If the equipment is a StreamInterface, returns it directly. Otherwise, tries to get the outlet stream from TwoPortInterface or MixerInterface.
      Parameters:
      equipment - the equipment to get stream from
      Returns:
      StreamInterface or null if not available
    • setAdjustedVariable

      public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable, String unit)

      setAdjustedVariable.

      Parameters:
      adjustedEquipment - a ProcessEquipmentInterface object
      adjstedVariable - a String object
      unit - a string
    • setAdjustedVariable

      public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable)

      setAdjustedVariable.

      Parameters:
      adjustedEquipment - a ProcessEquipmentInterface object
      adjstedVariable - a String object
    • setAdjustedVariable

      public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment)

      setAdjustedVariable.

      Parameters:
      adjustedEquipment - a ProcessEquipmentInterface object
    • setTargetVariable

      public void setTargetVariable(ProcessEquipmentInterface targetEquipment)

      Setter for the field targetVariable.

      Parameters:
      targetEquipment - a ProcessEquipmentInterface object
    • setTargetVariable

      public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit)

      Setter for the field targetVariable.

      Parameters:
      targetEquipment - a ProcessEquipmentInterface object
      targetVariable - a String object
      targetValue - a double
      targetUnit - a String object
    • setTargetVariable

      public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase)

      Setter for the field targetVariable.

      Parameters:
      targetEquipment - a ProcessEquipmentInterface object
      targetVariable - a String object
      targetValue - a double
      targetUnit - a String object
      targetPhase - a String object
    • setTargetVariable

      public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase, String targetComponent)

      Setter for the field targetVariable.

      Parameters:
      targetEquipment - a ProcessEquipmentInterface object
      targetVariable - a String object
      targetValue - a double
      targetUnit - a String object
      targetPhase - a String object
      targetComponent - a String object
    • setTargetValue

      public void setTargetValue(double targetValue)

      Setter for the field targetValue.

      Parameters:
      targetValue - a double
    • setAdjustedEquipment

      public void setAdjustedEquipment(ProcessEquipmentInterface adjustedEquipment)

      Setter for the field adjustedEquipment.

      Parameters:
      adjustedEquipment - a ProcessEquipmentInterface object
    • setTargetEquipment

      public void setTargetEquipment(ProcessEquipmentInterface targetEquipment)

      Setter for the field targetEquipment.

      Parameters:
      targetEquipment - a ProcessEquipmentInterface object
    • run

      public void run(UUID id)

      In this method all thermodynamic and unit operations will be calculated in a steady state calculation.

      Parameters:
      id - UUID
    • solved

      public boolean solved()

      Returns whether or not the module has been solved.

      Specified by:
      solved in interface SimulationInterface
      Overrides:
      solved in class ProcessEquipmentBaseClass
      Returns:
      a boolean
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
      Overrides:
      displayResult in class ProcessEquipmentBaseClass
    • getTolerance

      public double getTolerance()

      Getter for the field tolerance.

      Returns:
      a double
    • setTolerance

      public void setTolerance(double tolerance)

      Setter for the field tolerance.

      Parameters:
      tolerance - the tolerance to set
    • getError

      public double getError()

      Getter for the field error.

      Returns:
      the error
    • setError

      public void setError(double error)

      Setter for the field error.

      Parameters:
      error - the error to set
    • main

      public static void main(String[] args)

      main.

      Parameters:
      args - an array of String objects
    • isActivateWhenLess

      public boolean isActivateWhenLess()

      isActivateWhenLess.

      Returns:
      a boolean
    • setActivateWhenLess

      public void setActivateWhenLess(boolean activateWhenLess)

      Setter for the field activateWhenLess.

      Parameters:
      activateWhenLess - a boolean
    • setMaxAdjustedValue

      public void setMaxAdjustedValue(double maxVal)

      Setter for the field maxAdjustedValue.

      Parameters:
      maxVal - a double
    • setMinAdjustedValue

      public void setMinAdjustedValue(double minVal)

      Setter for the field minAdjustedValue.

      Parameters:
      minVal - a double
    • getMaxAdjustedValue

      public double getMaxAdjustedValue()

      Getter for the field maxAdjustedValue.

      Returns:
      a double
    • getMinAdjustedValue

      public double getMinAdjustedValue()

      Getter for the field minAdjustedValue.

      Returns:
      a double
    • setTargetValueCalculator

      public void setTargetValueCalculator(Function<ProcessEquipmentInterface, Double> targetValueCalculator)

      Setter for the field targetValueCalculator.

      Parameters:
      targetValueCalculator - a Function object
    • setTargetValueCalculator

      public void setTargetValueCalculator(Supplier<Double> targetValueCalculator)

      Setter for the field targetValueCalculator.

      Parameters:
      targetValueCalculator - a Supplier object
    • setAdjustedValueGetter

      public void setAdjustedValueGetter(Function<ProcessEquipmentInterface, Double> adjustedValueGetter)

      Setter for the field adjustedValueGetter.

      Parameters:
      adjustedValueGetter - a Function object
    • setAdjustedValueGetter

      public void setAdjustedValueGetter(Supplier<Double> adjustedValueGetter)

      Setter for the field adjustedValueGetter.

      Parameters:
      adjustedValueGetter - a Supplier object
    • setAdjustedValueSetter

      public void setAdjustedValueSetter(BiConsumer<ProcessEquipmentInterface, Double> adjustedValueSetter)

      Setter for the field adjustedValueSetter.

      Parameters:
      adjustedValueSetter - a BiConsumer object
    • setAdjustedValueSetter

      public void setAdjustedValueSetter(Consumer<Double> adjustedValueSetter)

      Setter for the field adjustedValueSetter.

      Parameters:
      adjustedValueSetter - a Consumer object
    • validateSetup

      public ValidationResult validateSetup()
      Validate the process equipment before execution.

      Checks for common setup errors:

      • Equipment has a valid name
      • Input streams connected
      • Operating parameters in valid ranges

      Validates the adjuster setup before execution. Checks that:

      • Equipment has a valid name
      • Adjusted equipment is set
      • Target equipment or value is set
      • Tolerance is positive
      Returns:
      validation result with errors and warnings