Class Adjuster
- All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, SimulationInterface, NamedInterface
Adjuster class.
- Version:
- $Id: $Id
- Author:
- Even Solbraa
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean(package private) ProcessEquipmentInterfaceprivate Function<ProcessEquipmentInterface, Double> private BiConsumer<ProcessEquipmentInterface, Double> (package private) String(package private) Stringprivate double(package private) double(package private) int(package private) static org.apache.logging.log4j.LoggerLogger object for class.(package private) double(package private) doubleprivate double(package private) doubleprivate static final longSerialization version UID.(package private) String(package private) ProcessEquipmentInterface(package private) String(package private) String(package private) doubleprivate Function<ProcessEquipmentInterface, Double> (package private) Stringprivate doubleFields inherited from class ProcessEquipmentBaseClass
conditionAnalysisMessage, energyStream, hasController, isSolved, properties, reportFields inherited from class SimulationBaseClass
calcIdentifier, calculateSteadyState, timeFields inherited from class NamedBaseClass
name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisplayResult.doublegetError()Getter for the fielderror.doubleGetter for the fieldmaxAdjustedValue.doubleGetter for the fieldminAdjustedValue.private StreamInterfacegetStreamFromEquipment(ProcessEquipmentInterface equipment) Helper method to get a StreamInterface from equipment.doubleGetter for the fieldtolerance.booleanisActivateWhenLess.static voidmain.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidsetActivateWhenLess(boolean activateWhenLess) Setter for the fieldactivateWhenLess.voidsetAdjustedEquipment(ProcessEquipmentInterface adjustedEquipment) Setter for the fieldadjustedEquipment.voidsetAdjustedValueGetter(Function<ProcessEquipmentInterface, Double> adjustedValueGetter) Setter for the fieldadjustedValueGetter.voidsetAdjustedValueGetter(Supplier<Double> adjustedValueGetter) Setter for the fieldadjustedValueGetter.voidsetAdjustedValueSetter(BiConsumer<ProcessEquipmentInterface, Double> adjustedValueSetter) Setter for the fieldadjustedValueSetter.voidsetAdjustedValueSetter(Consumer<Double> adjustedValueSetter) Setter for the fieldadjustedValueSetter.voidsetAdjustedVariable(ProcessEquipmentInterface adjustedEquipment) setAdjustedVariable.voidsetAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable) setAdjustedVariable.voidsetAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable, String unit) setAdjustedVariable.voidsetError(double error) Setter for the fielderror.voidsetMaxAdjustedValue(double maxVal) Setter for the fieldmaxAdjustedValue.voidsetMinAdjustedValue(double minVal) Setter for the fieldminAdjustedValue.voidsetTargetEquipment(ProcessEquipmentInterface targetEquipment) Setter for the fieldtargetEquipment.voidsetTargetValue(double targetValue) Setter for the fieldtargetValue.voidsetTargetValueCalculator(Function<ProcessEquipmentInterface, Double> targetValueCalculator) Setter for the fieldtargetValueCalculator.voidsetTargetValueCalculator(Supplier<Double> targetValueCalculator) Setter for the fieldtargetValueCalculator.voidsetTargetVariable(ProcessEquipmentInterface targetEquipment) Setter for the fieldtargetVariable.voidsetTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit) Setter for the fieldtargetVariable.voidsetTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase) Setter for the fieldtargetVariable.voidsetTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase, String targetComponent) Setter for the fieldtargetVariable.voidsetTolerance(double tolerance) Setter for the fieldtolerance.booleansolved()Returns whether or not the module has been solved.Validate the process equipment before execution.Methods inherited from class ProcessEquipmentBaseClass
copy, equals, getConditionAnalysisMessage, getController, getEnergyStream, getEntropyProduction, getExergyChange, getMassBalance, getMassBalance, getMechanicalDesign, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, initMechanicalDesign, isActive, isActive, isSetEnergyStream, reportResults, run_step, runConditionAnalysis, setController, setEnergyStream, setEnergyStream, setFlowValveController, setMinimumFlow, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, toJson, toJsonMethods inherited from class SimulationBaseClass
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTimeMethods inherited from class NamedBaseClass
getName, getTagName, setName, setTagNameMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface ProcessEquipmentInterface
getCapacityDuty, getCapacityMax, getExergyChange, getFluid, getRestCapacity, needRecalculationMethods inherited from interface SimulationInterface
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, run, run_step, runTransient, runTransient, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTime
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
static org.apache.logging.log4j.Logger loggerLogger 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
-
adjustedValueGetter
-
adjustedValueSetter
-
-
Constructor Details
-
Adjuster
-
-
Method Details
-
getStreamFromEquipment
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- aProcessEquipmentInterfaceobjectadjstedVariable- aStringobjectunit- a string
-
setAdjustedVariable
public void setAdjustedVariable(ProcessEquipmentInterface adjustedEquipment, String adjstedVariable) setAdjustedVariable.
- Parameters:
adjustedEquipment- aProcessEquipmentInterfaceobjectadjstedVariable- aStringobject
-
setAdjustedVariable
setAdjustedVariable.
- Parameters:
adjustedEquipment- aProcessEquipmentInterfaceobject
-
setTargetVariable
Setter for the field
targetVariable.- Parameters:
targetEquipment- aProcessEquipmentInterfaceobject
-
setTargetVariable
public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit) Setter for the field
targetVariable.- Parameters:
targetEquipment- aProcessEquipmentInterfaceobjecttargetVariable- aStringobjecttargetValue- a doubletargetUnit- aStringobject
-
setTargetVariable
public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase) Setter for the field
targetVariable.- Parameters:
targetEquipment- aProcessEquipmentInterfaceobjecttargetVariable- aStringobjecttargetValue- a doubletargetUnit- aStringobjecttargetPhase- aStringobject
-
setTargetVariable
public void setTargetVariable(ProcessEquipmentInterface targetEquipment, String targetVariable, double targetValue, String targetUnit, String targetPhase, String targetComponent) Setter for the field
targetVariable.- Parameters:
targetEquipment- aProcessEquipmentInterfaceobjecttargetVariable- aStringobjecttargetValue- a doubletargetUnit- aStringobjecttargetPhase- aStringobjecttargetComponent- aStringobject
-
setTargetValue
public void setTargetValue(double targetValue) Setter for the field
targetValue.- Parameters:
targetValue- a double
-
setAdjustedEquipment
Setter for the field
adjustedEquipment.- Parameters:
adjustedEquipment- aProcessEquipmentInterfaceobject
-
setTargetEquipment
Setter for the field
targetEquipment.- Parameters:
targetEquipment- aProcessEquipmentInterfaceobject
-
run
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:
solvedin interfaceSimulationInterface- Overrides:
solvedin classProcessEquipmentBaseClass- Returns:
- a boolean
-
displayResult
public void displayResult()displayResult.
- Specified by:
displayResultin interfaceProcessEquipmentInterface- Overrides:
displayResultin classProcessEquipmentBaseClass
-
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
-
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- aFunctionobject
-
setTargetValueCalculator
-
setAdjustedValueGetter
Setter for the field
adjustedValueGetter.- Parameters:
adjustedValueGetter- aFunctionobject
-
setAdjustedValueGetter
-
setAdjustedValueSetter
public void setAdjustedValueSetter(BiConsumer<ProcessEquipmentInterface, Double> adjustedValueSetter) Setter for the field
adjustedValueSetter.- Parameters:
adjustedValueSetter- aBiConsumerobject
-
setAdjustedValueSetter
-
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
-