Class Tank
- All Implemented Interfaces:
Serializable, Runnable, AutoSizeable, CapacityConstrainedEquipment, ProcessEquipmentInterface, SimulationInterface, NamedInterface
Tank class.
- Version:
- $Id: $Id
- Author:
- Even Solbraa
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether tank has been auto-sized.private doubleDesign liquid level (fraction).private doubleDesign liquid residence time (seconds).private doubleDesign volume (m3).private doubleprivate double(package private) Stream(package private) SystemInterface(package private) double(package private) double(package private) Mixerprivate doubleprivate double(package private) Stream(package private) SystemInterface(package private) double(package private) static org.apache.logging.log4j.LoggerLogger object for class.private doubleMaximum liquid level allowed (fraction).private TankMechanicalDesignMechanical design for the tank.private doubleMinimum liquid level allowed (fraction).private doubleMinimum residence time allowed (seconds).private int(package private) double(package private) doubleprivate static final longSerialization version UID.(package private) double(package private) double(package private) double(package private) doubleprivate booleanWhether capacity analysis is enabled.private Map<String, CapacityConstraint> Tank capacity constraints map.(package private) SystemInterface(package private) SystemInterfaceprivate double(package private) SystemInterfaceFields inherited from class ProcessEquipmentBaseClass
conditionAnalysisMessage, energyStream, hasController, isSolved, properties, reportFields inherited from class SimulationBaseClass
calcIdentifier, calculateSteadyState, timeFields inherited from class NamedBaseClass
name -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for Tank.Tank(String name, StreamInterface inletStream) Constructor for Tank. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCapacityConstraint(CapacityConstraint constraint) Adds a new capacity constraint to this equipment.voidaddStream(StreamInterface newStream) addStream.voidautoSize()Automatically size using default safety factor (1.2 = 20% margin).voidautoSize(double safetyFactor) Automatically size the equipment based on connected stream conditions.voidAutomatically size using company-specific design standards.voidClears all capacity constraints from this equipment.voiddisplayResult.Gets the constraint with the highest utilization (the bottleneck).Gets all capacity constraints defined for this equipment.doubleGets the design liquid level.doubleGets the design residence time.doubleGetter for the fieldefficiency.getGas()getGas.doubleGetter for the fieldgasCarryunderFraction.Getter for the fieldgasOutStream.getLiquid.doubleGetter for the fieldliquidCarryoverFraction.doubleGetter for the fieldliquidLevel.Getter for the fieldliquidOutStream.doublegetMassBalance(String unit) getMassBalance.doubleGets the maximum liquid level.doubleGets the maximum utilization across all constraints.Get amechanicalDesignfor the equipment.doubleGets the minimum liquid level.doubleGets the minimum residence time.Get a detailed sizing report after auto-sizing.Get sizing report as JSON for programmatic access.doubleGetter for the fieldvolume.private voidInitialize tank capacity constraints.voidInitialize ainitMechanicalDesignfor the equipment.booleanCheck if equipment has been auto-sized.booleanChecks if capacity analysis is enabled for this equipment.booleanChecks if any capacity constraint is violated (exceeds 100% utilization).booleanChecks if any HARD constraint limit is exceeded.booleanremoveCapacityConstraint(String constraintName) Removes a capacity constraint by name.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidrunTransient(double dt, UUID id) runTransientvoidsetCapacityAnalysisEnabled(boolean enabled) Enables or disables capacity analysis for this equipment.voidsetDesignLiquidLevel(double level) Sets the design liquid level.voidsetDesignResidenceTime(double time) Sets the design residence time.voidsetEfficiency(double efficiency) Setter for the fieldefficiency.voidsetGasCarryunderFraction(double gasCarryunderFraction) Setter for the fieldgasCarryunderFraction.voidsetInletStream(StreamInterface inletStream) setInletStream.voidsetLiquidCarryoverFraction(double liquidCarryoverFraction) Setter for the fieldliquidCarryoverFraction.voidsetMaxLiquidLevel(double level) Sets the maximum liquid level.voidsetMinLiquidLevel(double level) Sets the minimum liquid level.voidsetMinResidenceTime(double time) Sets the minimum residence time.voidsetOutComposition(SystemInterface thermoSystem) setOutComposition.voidsetTempPres(double temp, double pres) setTempPres.voidsetVolume(double volume) Setter for the fieldvolume.toJson()Serializes the Process Equipment along with its state to a JSON string.toJson(ReportConfig cfg) Serializes the Process Equipment with configurable level of detail.Validate the process equipment before execution.Methods inherited from class ProcessEquipmentBaseClass
copy, equals, getConditionAnalysisMessage, getController, getEffectiveCapacityFactor, getEnergyStream, getEntropyProduction, getExergyChange, getFailureMode, getMassBalance, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, isActive, isActive, isFailed, isSetEnergyStream, reportResults, restoreFromFailure, run_step, runConditionAnalysis, setController, setEnergyStream, setEnergyStream, setFailureMode, setFlowValveController, setMinimumFlow, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, simulateDegradedOperation, simulateTrip, solvedMethods 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 CapacityConstrainedEquipment
disableAllConstraints, enableAllConstraints, getAvailableMargin, getAvailableMarginPercent, getMaxUtilizationPercent, getUtilizationSummary, isNearCapacityLimitMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface ProcessEquipmentInterface
getCapacityDuty, getCapacityMax, getExergyChange, getFluid, getOperatingEnvelopeViolation, getRestCapacity, getSimulationValidationErrors, isSimulationValid, isWithinOperatingEnvelope, needRecalculationMethods inherited from interface SimulationInterface
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, run, run_step, 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. -
mechanicalDesign
Mechanical design for the tank. -
autoSized
private boolean autoSizedWhether tank has been auto-sized. -
designLiquidLevel
private double designLiquidLevelDesign liquid level (fraction). -
designResidenceTime
private double designResidenceTimeDesign liquid residence time (seconds). -
designVolume
private double designVolumeDesign volume (m3). -
minResidenceTime
private double minResidenceTimeMinimum residence time allowed (seconds). -
maxLiquidLevel
private double maxLiquidLevelMaximum liquid level allowed (fraction). -
minLiquidLevel
private double minLiquidLevelMinimum liquid level allowed (fraction). -
tankCapacityConstraints
Tank capacity constraints map. -
tankCapacityAnalysisEnabled
private boolean tankCapacityAnalysisEnabledWhether capacity analysis is enabled. -
thermoSystem
SystemInterface thermoSystem -
gasSystem
SystemInterface gasSystem -
waterSystem
SystemInterface waterSystem -
liquidSystem
SystemInterface liquidSystem -
thermoSystemCloned
SystemInterface thermoSystemCloned -
gasOutStream
Stream gasOutStream -
liquidOutStream
Stream liquidOutStream -
numberOfInputStreams
private int numberOfInputStreams -
inletStreamMixer
Mixer inletStreamMixer -
efficiency
private double efficiency -
liquidCarryoverFraction
private double liquidCarryoverFraction -
gasCarryunderFraction
private double gasCarryunderFraction -
volume
private double volume -
steelWallTemperature
double steelWallTemperature -
steelWallMass
double steelWallMass -
steelWallArea
double steelWallArea -
heatTransferNumber
double heatTransferNumber -
steelCp
double steelCp -
separatorLength
double separatorLength -
separatorDiameter
double separatorDiameter -
liquidVolume
double liquidVolume -
gasVolume
double gasVolume -
liquidLevel
private double liquidLevel
-
-
Constructor Details
-
Tank
-
Tank
Constructor for Tank.
- Parameters:
name- aStringobjectinletStream- aStreamInterfaceobject
-
-
Method Details
-
getMechanicalDesign
Get a
mechanicalDesignfor the equipment.- Specified by:
getMechanicalDesignin interfaceProcessEquipmentInterface- Overrides:
getMechanicalDesignin classProcessEquipmentBaseClass- Returns:
- a
MechanicalDesignobject
-
initMechanicalDesign
public void initMechanicalDesign()Initialize a
initMechanicalDesignfor the equipment.- Specified by:
initMechanicalDesignin interfaceProcessEquipmentInterface- Overrides:
initMechanicalDesignin classProcessEquipmentBaseClass
-
setInletStream
setInletStream.
- Parameters:
inletStream- aStreamInterfaceobject
-
addStream
addStream.
- Parameters:
newStream- aStreamInterfaceobject
-
getLiquidOutStream
Getter for the field
liquidOutStream.- Returns:
- a
Streamobject
-
getGasOutStream
Getter for the field
gasOutStream.- Returns:
- a
Streamobject
-
getGas
-
getLiquid
-
run
In this method all thermodynamic and unit operations will be calculated in a steady state calculation.
Calculates the following properties:
- steelWallTemperature
- gasOutStream
- liquidOutStream
thermoSystemincluding properties- liquidLevel
- liquidVolume
- gasVolume
- Specified by:
runin interfaceSimulationInterface- Parameters:
id- UUID
-
displayResult
public void displayResult()displayResult.
- Specified by:
displayResultin interfaceProcessEquipmentInterface- Overrides:
displayResultin classProcessEquipmentBaseClass
-
runTransient
runTransient
This method calculates thermodynamic and unit operations using difference equations if available and calculateSteadyState is true. Use setCalculateSteadyState to set the parameter. Sets calc identifier UUID.- Specified by:
runTransientin interfaceSimulationInterface- Parameters:
dt- Delta time [s]id- Calculation identifier
-
setOutComposition
setOutComposition.
- Parameters:
thermoSystem- aSystemInterfaceobject
-
setTempPres
public void setTempPres(double temp, double pres) setTempPres.
- Parameters:
temp- a doublepres- a double
-
getEfficiency
public double getEfficiency()Getter for the field
efficiency.- Returns:
- a double
-
setEfficiency
public void setEfficiency(double efficiency) Setter for the field
efficiency.- Parameters:
efficiency- a double
-
getLiquidCarryoverFraction
public double getLiquidCarryoverFraction()Getter for the field
liquidCarryoverFraction.- Returns:
- a double
-
setLiquidCarryoverFraction
public void setLiquidCarryoverFraction(double liquidCarryoverFraction) Setter for the field
liquidCarryoverFraction.- Parameters:
liquidCarryoverFraction- a double
-
getGasCarryunderFraction
public double getGasCarryunderFraction()Getter for the field
gasCarryunderFraction.- Returns:
- a double
-
setGasCarryunderFraction
public void setGasCarryunderFraction(double gasCarryunderFraction) Setter for the field
gasCarryunderFraction.- Parameters:
gasCarryunderFraction- a double
-
getLiquidLevel
public double getLiquidLevel()Getter for the field
liquidLevel.- Returns:
- a double
-
getVolume
public double getVolume()Getter for the field
volume.- Returns:
- a double
-
setVolume
public void setVolume(double volume) Setter for the field
volume.- Parameters:
volume- a double
-
getMassBalance
getMassBalance.
- Specified by:
getMassBalancein interfaceProcessEquipmentInterface- Overrides:
getMassBalancein classProcessEquipmentBaseClass- Parameters:
unit- aStringobject- Returns:
- a double
-
toJson
Serializes the Process Equipment along with its state to a JSON string.
- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classProcessEquipmentBaseClass- Returns:
- json string.
-
toJson
Serializes the Process Equipment with configurable level of detail.- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classProcessEquipmentBaseClass- Parameters:
cfg- report configuration- Returns:
- json string
-
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 tank setup before execution. Checks that:
- Equipment has a valid name
- At least one inlet stream is connected
- Tank volume is positive
- Liquid level is within valid range
- Specified by:
validateSetupin interfaceProcessEquipmentInterface- Returns:
- validation result with errors and warnings
-
autoSize
public void autoSize(double safetyFactor) Automatically size the equipment based on connected stream conditions.This method calculates dimensions and design parameters using the inlet stream properties and applies the specified safety factor. The equipment must have a valid inlet stream connected before calling this method.
- Specified by:
autoSizein interfaceAutoSizeable- Parameters:
safetyFactor- multiplier for design capacity, typically 1.1-1.3 (10-30% over design)
-
autoSize
public void autoSize()Automatically size using default safety factor (1.2 = 20% margin).- Specified by:
autoSizein interfaceAutoSizeable
-
autoSize
Automatically size using company-specific design standards.This method applies design rules from the specified company's technical requirements (TR) documents. The standards are loaded from the NeqSim design database.
- Specified by:
autoSizein interfaceAutoSizeable- Parameters:
companyStandard- company name (e.g., "Equinor", "Shell", "TotalEnergies")trDocument- TR document reference (e.g., "TR2000", "DEP-31.38.01.11")
-
isAutoSized
public boolean isAutoSized()Check if equipment has been auto-sized.- Specified by:
isAutoSizedin interfaceAutoSizeable- Returns:
- true if autoSize() has been called successfully
-
getSizingReport
Get a detailed sizing report after auto-sizing.The report includes:
- Design basis (flow rates, pressures, temperatures)
- Calculated dimensions
- Design parameters (K-factor, Cv, velocity, etc.)
- Safety margins
- Specified by:
getSizingReportin interfaceAutoSizeable- Returns:
- formatted sizing report string
-
getSizingReportJson
Get sizing report as JSON for programmatic access.- Specified by:
getSizingReportJsonin interfaceAutoSizeable- Returns:
- JSON string with sizing data
-
initializeTankCapacityConstraints
private void initializeTankCapacityConstraints()Initialize tank capacity constraints. -
setDesignLiquidLevel
public void setDesignLiquidLevel(double level) Sets the design liquid level.- Parameters:
level- design liquid level (0-1 fraction)
-
getDesignLiquidLevel
public double getDesignLiquidLevel()Gets the design liquid level.- Returns:
- design liquid level (0-1 fraction)
-
setDesignResidenceTime
public void setDesignResidenceTime(double time) Sets the design residence time.- Parameters:
time- design residence time in seconds
-
getDesignResidenceTime
public double getDesignResidenceTime()Gets the design residence time.- Returns:
- design residence time in seconds
-
setMinResidenceTime
public void setMinResidenceTime(double time) Sets the minimum residence time.- Parameters:
time- minimum residence time in seconds
-
getMinResidenceTime
public double getMinResidenceTime()Gets the minimum residence time.- Returns:
- minimum residence time in seconds
-
setMaxLiquidLevel
public void setMaxLiquidLevel(double level) Sets the maximum liquid level.- Parameters:
level- maximum liquid level (0-1 fraction)
-
getMaxLiquidLevel
public double getMaxLiquidLevel()Gets the maximum liquid level.- Returns:
- maximum liquid level (0-1 fraction)
-
setMinLiquidLevel
public void setMinLiquidLevel(double level) Sets the minimum liquid level.- Parameters:
level- minimum liquid level (0-1 fraction)
-
getMinLiquidLevel
public double getMinLiquidLevel()Gets the minimum liquid level.- Returns:
- minimum liquid level (0-1 fraction)
-
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.
- Specified by:
isCapacityAnalysisEnabledin interfaceCapacityConstrainedEquipment- Overrides:
isCapacityAnalysisEnabledin classProcessEquipmentBaseClass- 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.
- Specified by:
setCapacityAnalysisEnabledin interfaceCapacityConstrainedEquipment- Overrides:
setCapacityAnalysisEnabledin classProcessEquipmentBaseClass- Parameters:
enabled- true to include in capacity analysis, false to exclude
- System bottleneck detection (
-
getCapacityConstraints
Gets all capacity constraints defined for this equipment.The map keys are constraint names (e.g., "speed", "gasLoadFactor") and values are the corresponding CapacityConstraint objects containing design values, current values, and utilization calculations.
- Specified by:
getCapacityConstraintsin interfaceCapacityConstrainedEquipment- Returns:
- unmodifiable map of constraint name to CapacityConstraint
-
getBottleneckConstraint
Gets the constraint with the highest utilization (the bottleneck).This method identifies which constraint is closest to or exceeding its design limit. Use this to determine what is limiting equipment capacity.
- Specified by:
getBottleneckConstraintin interfaceCapacityConstrainedEquipment- Returns:
- the bottleneck constraint, or null if no constraints are defined
-
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:
isCapacityExceededin interfaceCapacityConstrainedEquipment- Returns:
- true if any 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:
isHardLimitExceededin interfaceCapacityConstrainedEquipment- Returns:
- true if any HARD constraint's max value is exceeded
-
getMaxUtilization
public double getMaxUtilization()Gets the maximum utilization across all constraints.This gives a single number representing how close the equipment is to its limiting constraint. Values above 1.0 indicate the equipment is over capacity.
- Specified by:
getMaxUtilizationin interfaceCapacityConstrainedEquipment- Returns:
- maximum utilization as fraction (1.0 = 100% of design capacity)
-
addCapacityConstraint
Adds a new capacity constraint to this equipment.This allows dynamic addition of constraints at runtime. Constraints can be added during equipment configuration or based on operating conditions.
- Specified by:
addCapacityConstraintin interfaceCapacityConstrainedEquipment- Parameters:
constraint- the constraint to add
-
removeCapacityConstraint
Removes a capacity constraint by name.- Specified by:
removeCapacityConstraintin interfaceCapacityConstrainedEquipment- Parameters:
constraintName- the name of the constraint to remove- Returns:
- true if the constraint was found and removed
-
clearCapacityConstraints
public void clearCapacityConstraints()Clears all capacity constraints from this equipment.- Specified by:
clearCapacityConstraintsin interfaceCapacityConstrainedEquipment
-