Class MultiStreamHeatExchanger2
java.lang.Object
neqsim.util.NamedBaseClass
neqsim.process.SimulationBaseClass
neqsim.process.equipment.ProcessEquipmentBaseClass
neqsim.process.equipment.TwoPortEquipment
neqsim.process.equipment.heatexchanger.Heater
neqsim.process.equipment.heatexchanger.MultiStreamHeatExchanger2
- All Implemented Interfaces:
Serializable, Runnable, HeaterInterface, MultiStreamHeatExchangerInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
MultiStreamHeatExchanger2 class.
- Author:
- esol
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Doubleprivate doubleprivate doubleprivate final intprivate final doubleprivate final doubleprivate List<SystemInterface> private doubleprivate List<StreamInterface> private doubleprivate double(package private) static org.apache.logging.log4j.LoggerLogger object for class.private intprivate List<StreamInterface> private static final longprivate static final StringMessage used when the Jacobian is singular.private intprivate final int(package private) SystemInterfaceprivate doubleprivate DoubleFields inherited from class Heater
coolingMediumTemperature, dT, lastDuty, lastFlowRate, lastOutPressure, lastOutTemperature, lastPressure, lastPressureDrop, lastTemperature, mechanicalDesign, pressureOut, setOutPressure, setTemperature, system, temperatureOutFields inherited from class TwoPortEquipment
inStream, outStreamFields 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 MultiStreamHeatExchanger2. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInStream(StreamInterface inStream) Adds an inlet stream to the heat exchanger.voidaddInStreamMSHE(StreamInterface inStream, String streamType, Double outletTemp) Adds an inlet stream to the multi-stream heat exchanger.doublecalcThermalEffectiveness(double NTU, double Cr) Calculates the thermal effectiveness based on the Number of Transfer Units (NTU) and the capacity ratio (Cr).private doublecalculateIntervalTemp(double loadStart, double targetLoad, double loadEnd, double tempStart, double tempEnd) doubleCalculates the overall heat transfer coefficient (UA) for the heat exchanger.Calculates the composite curve data for the heat exchanger.voiddisplayResult.doubleCalculates the energy difference between the inlet and outlet streams.private doubleenthalpyTPFlash(int index, double pressure, double temperature) Returns hot and cold composite curves.doubleRetrieves the fixed temperature difference (ΔT) used in calculations.doublegetDuty()getDuty.Retrieves the flow arrangement of the heat exchanger.doubleRetrieves the guessed outlet temperature used during initialization.doubleRetrieves the hot and cold duty balance of the heat exchanger.getInStream(int i) Retrieves the input stream at the specified index.doublegetInTemperature(int i) Gets the inlet temperature of a specific input stream.getOutStream(int i) Retrieves the output stream at the specified index.doublegetOutTemperature(int i) Gets the outlet temperature of a specific output stream.doublegetTemperatureApproach.doubleGets the thermal effectiveness of the heat exchanger.doublegetUA()getUA.doubleRetrieves the overall heat transfer coefficient times area (UA value).private doubleinitializeOutletGuess(int i) private doubleinterpolateTemperature(List<Map<String, Object>> points, double load) private doubleintervalLoad(int i, double tempStart, double tempEnd) private double[]linearSystemOneUnknown(double[][] A, double[] b) private double[]linearSystemThreeUnknowns(double[][] A, double[] b) private double[]linearSystemTwoUnknowns(double[][] A, double[] b) private double[][]numericalJacobiOneUnknown(List<Integer> unknownIndices) private double[][]numericalJacobiThreeUnknowns(List<Integer> unknownIndices) private double[][]numericalJacobiTwoUnknowns(List<Integer> unknownIndices) voidCalculates the outlet temperatures for the heat exchanger when there is one unknown.doublepinch()Calculates the minimum approach temperature for the heat exchanger.private voidresetOfExtremesAndStalls(List<Integer> unknownIndices, boolean localMin, boolean UATest) private double[]private double[]private double[]voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidRuns a condition analysis using the current heat exchanger as the reference.voidsetDeltaT(double dT) Sets the fixed temperature difference (ΔT) for calculations and enables its usage.voidsetFeedStream(int index, StreamInterface stream) Sets the feed stream at a specific index.voidsetFlowArrangement(String arrangement) Sets the flow arrangement of the heat exchanger.voidsetGuessOutTemperature(double temp) Sets the guessed outlet temperature in Kelvin.voidsetGuessOutTemperature(double temp, String unit) Sets the guessed outlet temperature with a specified unit.voidsetHotColdDutyBalance(double value) Sets the hot and cold duty balance of the heat exchanger.voidsetTemperatureApproach(double temperatureApproach) setTemperatureApproach.voidsetThermalEffectiveness(double effectiveness) Sets the thermal effectiveness of the heat exchanger.voidsetUAvalue(double UAvalue) Sets the overall heat transfer coefficient times area (UA value).voidsetUseDeltaT(boolean use) Enables or disables the use of a fixed temperature difference (ΔT) in calculations.private booleanstallDetection(List<Integer> unknownIndices) voidCalculates the outlet temperatures for the heat exchanger when there are three unknowns.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.voidCalculates the outlet temperatures for the heat exchanger when there are two unknowns.Methods inherited from class Heater
getCapacityDuty, getCapacityMax, getDuty, getEnergyInput, getEntropyProduction, getExergyChange, getMechanicalDesign, getPressureDrop, getUtilitySpecification, initMechanicalDesign, isSetEnergyInput, needRecalculation, runTransient, setdT, setDuty, setEnergyInput, setOutPressure, setOutPressure, setOutStream, setOutTemperature, setOutTemperature, setOutTP, setPressureDrop, setSetEnergyInput, setUtilityApproachTemperature, setUtilityHeatCapacityRate, setUtilityOverallHeatTransferCoefficient, setUtilityReturnTemperature, setUtilitySpecification, setUtilitySupplyTemperatureMethods inherited from class TwoPortEquipment
getInletPressure, getInletStream, getInletTemperature, getMassBalance, getOutletPressure, getOutletStream, getOutletTemperature, setInletPressure, setInletStream, setInletTemperature, setOutletPressure, setOutletStream, setOutletTemperature, validateSetupMethods inherited from class ProcessEquipmentBaseClass
copy, equals, getConditionAnalysisMessage, getController, getEnergyStream, getMassBalance, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, isActive, isActive, isSetEnergyStream, reportResults, run_step, runConditionAnalysis, setController, setEnergyStream, setEnergyStream, setFlowValveController, setMinimumFlow, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, 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 MultiStreamHeatExchangerInterface
getEntropyProduction, getMassBalance, runConditionAnalysis, setdT, setOutTemperatureMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface ProcessEquipmentInterface
equals, getCapacityDuty, getCapacityMax, getConditionAnalysisMessage, getController, getExergyChange, getExergyChange, getFluid, getMassBalance, getMechanicalDesign, getPressure, getPressure, getReport_json, getRestCapacity, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, initMechanicalDesign, needRecalculation, reportResults, setController, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, validateSetupMethods inherited from interface SimulationInterface
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, run, run_step, run_step, runTransient, runTransient, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTime, solvedMethods inherited from interface TwoPortInterface
getInStream, getOutStream
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
logger
static org.apache.logging.log4j.Logger loggerLogger object for class. -
thermoSystem
SystemInterface thermoSystem -
tolerance
private double tolerance -
maxIterations
private int maxIterations -
jacobiDelta
private double jacobiDelta -
SINGULAR_JACOBIAN_MSG
Message used when the Jacobian is singular.- See Also:
-
extremeEnergy
private final double extremeEnergy- See Also:
-
extremeUA
private final double extremeUA- See Also:
-
extremeAttempts
private final int extremeAttempts- See Also:
-
prevOutletTemps
-
stallCounter
private int stallCounter -
stallLimit
private final int stallLimit- See Also:
-
localRange
private double localRange -
damping
private double damping -
approachTemperature
-
UA
-
hotLoad
private double hotLoad -
coldLoad
private double coldLoad -
compositeCurvePoints
-
hInlet
-
fluidInlet
-
allLoad
-
hotTempAll
-
coldTempAll
-
tempDiff
-
inStreams
-
outStreams
-
streamTypes
-
inletTemps
-
outletTemps
-
unknownOutlets
-
pressures
-
massFlows
-
streamLoads
-
-
Constructor Details
-
MultiStreamHeatExchanger2
Constructor for MultiStreamHeatExchanger2.- Parameters:
name- Name of the heat exchanger
-
-
Method Details
-
addInStream
Adds an inlet stream to the heat exchanger.- Specified by:
addInStreamin interfaceMultiStreamHeatExchangerInterface- Parameters:
inStream- Input stream to be added
-
addInStreamMSHE
Adds an inlet stream to the multi-stream heat exchanger.- Parameters:
inStream- aStreamInterfaceobjectstreamType- aStringobjectoutletTemp- aDoubleobject
-
setTemperatureApproach
public void setTemperatureApproach(double temperatureApproach) setTemperatureApproach.
- Parameters:
temperatureApproach- a double
-
setUAvalue
public void setUAvalue(double UAvalue) Sets the overall heat transfer coefficient times area (UA value).- Specified by:
setUAvaluein interfaceMultiStreamHeatExchangerInterface- Parameters:
UAvalue- UA value to set
-
run
In this method all thermodynamic and unit operations will be calculated in a steady state calculation.
- Specified by:
runin interfaceSimulationInterface- Overrides:
runin classHeater- Parameters:
id- UUID
-
oneUnknown
public void oneUnknown()Calculates the outlet temperatures for the heat exchanger when there is one unknown. -
residualFunctionOneUnknown
private double[] residualFunctionOneUnknown() -
numericalJacobiOneUnknown
-
linearSystemOneUnknown
private double[] linearSystemOneUnknown(double[][] A, double[] b) -
twoUnknowns
public void twoUnknowns()Calculates the outlet temperatures for the heat exchanger when there are two unknowns. -
residualFunctionTwoUnknowns
private double[] residualFunctionTwoUnknowns() -
numericalJacobiTwoUnknowns
-
linearSystemTwoUnknowns
private double[] linearSystemTwoUnknowns(double[][] A, double[] b) -
threeUnknowns
public void threeUnknowns()Calculates the outlet temperatures for the heat exchanger when there are three unknowns. -
residualFunctionThreeUnknowns
private double[] residualFunctionThreeUnknowns() -
numericalJacobiThreeUnknowns
-
linearSystemThreeUnknowns
private double[] linearSystemThreeUnknowns(double[][] A, double[] b) -
energyDiff
public double energyDiff()Calculates the energy difference between the inlet and outlet streams.- Returns:
- a double representing the total energy difference
-
pinch
public double pinch()Calculates the minimum approach temperature for the heat exchanger.- Returns:
- a double
-
calculateUA
public double calculateUA()Calculates the overall heat transfer coefficient (UA) for the heat exchanger.- Returns:
- the overall heat transfer coefficient (UA) value in W/K
-
enthalpyTPFlash
private double enthalpyTPFlash(int index, double pressure, double temperature) -
compositeCurve
-
initializeOutletGuess
private double initializeOutletGuess(int i) -
intervalLoad
private double intervalLoad(int i, double tempStart, double tempEnd) -
calculateIntervalTemp
private double calculateIntervalTemp(double loadStart, double targetLoad, double loadEnd, double tempStart, double tempEnd) -
interpolateTemperature
-
resetOfExtremesAndStalls
-
stallDetection
-
getCompositeCurve
-
getUA
public double getUA()getUA.
- Returns:
- a double
-
getTemperatureApproach
public double getTemperatureApproach()getTemperatureApproach.
- Returns:
- a double
-
getOutStream
Retrieves the output stream at the specified index.- Specified by:
getOutStreamin interfaceMultiStreamHeatExchangerInterface- Parameters:
i- Index of the output stream- Returns:
- The output
StreamInterfaceat the given index
-
getInStream
Retrieves the input stream at the specified index.- Specified by:
getInStreamin interfaceMultiStreamHeatExchangerInterface- Parameters:
i- Index of the input stream- Returns:
- The input
StreamInterfaceat the given index
-
getInTemperature
public double getInTemperature(int i) Gets the inlet temperature of a specific input stream.- Specified by:
getInTemperaturein interfaceMultiStreamHeatExchangerInterface- Parameters:
i- Index of the input stream- Returns:
- Inlet temperature in Kelvin
-
getOutTemperature
public double getOutTemperature(int i) Gets the outlet temperature of a specific output stream.- Specified by:
getOutTemperaturein interfaceMultiStreamHeatExchangerInterface- Parameters:
i- Index of the output stream- Returns:
- Outlet temperature in Kelvin
-
getDuty
public double getDuty()getDuty.
- Specified by:
getDutyin interfaceMultiStreamHeatExchangerInterface- Overrides:
getDutyin classHeater- Returns:
- a double
-
displayResult
public void displayResult()displayResult.
- Specified by:
displayResultin interfaceProcessEquipmentInterface- Overrides:
displayResultin classHeater
-
runConditionAnalysis
public void runConditionAnalysis()Runs a condition analysis using the current heat exchanger as the reference.- Specified by:
runConditionAnalysisin interfaceMultiStreamHeatExchangerInterface
-
getGuessOutTemperature
public double getGuessOutTemperature()Retrieves the guessed outlet temperature used during initialization.- Specified by:
getGuessOutTemperaturein interfaceMultiStreamHeatExchangerInterface- Returns:
- Guessed outlet temperature
-
setGuessOutTemperature
public void setGuessOutTemperature(double temp) Sets the guessed outlet temperature in Kelvin.- Specified by:
setGuessOutTemperaturein interfaceMultiStreamHeatExchangerInterface- Parameters:
temp- Guessed outlet temperature
-
setGuessOutTemperature
Sets the guessed outlet temperature with a specified unit.- Specified by:
setGuessOutTemperaturein interfaceMultiStreamHeatExchangerInterface- Parameters:
temp- Guessed outlet temperatureunit- Unit of the temperature (e.g., "K", "C")
-
setFlowArrangement
Sets the flow arrangement of the heat exchanger.- Specified by:
setFlowArrangementin interfaceMultiStreamHeatExchangerInterface- Parameters:
arrangement- Name of the flow arrangement
-
getFlowArrangement
Retrieves the flow arrangement of the heat exchanger.- Specified by:
getFlowArrangementin interfaceMultiStreamHeatExchangerInterface- Returns:
- Flow arrangement as a String (e.g., "counterflow", "parallelflow")
-
setThermalEffectiveness
public void setThermalEffectiveness(double effectiveness) Sets the thermal effectiveness of the heat exchanger.- Specified by:
setThermalEffectivenessin interfaceMultiStreamHeatExchangerInterface- Parameters:
effectiveness- Thermal effectiveness to set
-
getThermalEffectiveness
public double getThermalEffectiveness()Gets the thermal effectiveness of the heat exchanger.- Specified by:
getThermalEffectivenessin interfaceMultiStreamHeatExchangerInterface- Returns:
- Thermal effectiveness
-
getHotColdDutyBalance
public double getHotColdDutyBalance()Retrieves the hot and cold duty balance of the heat exchanger.- Specified by:
getHotColdDutyBalancein interfaceMultiStreamHeatExchangerInterface- Returns:
- Hot and cold duty balance
-
setHotColdDutyBalance
public void setHotColdDutyBalance(double value) Sets the hot and cold duty balance of the heat exchanger.- Specified by:
setHotColdDutyBalancein interfaceMultiStreamHeatExchangerInterface- Parameters:
value- Hot and cold duty balance to set
-
calcThermalEffectiveness
public double calcThermalEffectiveness(double NTU, double Cr) Calculates the thermal effectiveness based on the Number of Transfer Units (NTU) and the capacity ratio (Cr).- Specified by:
calcThermalEffectivenessin interfaceMultiStreamHeatExchangerInterface- Parameters:
NTU- Number of Transfer UnitsCr- Capacity ratio (Cmin/Cmax)- Returns:
- Calculated thermal effectiveness
-
setUseDeltaT
public void setUseDeltaT(boolean use) Enables or disables the use of a fixed temperature difference (ΔT) in calculations.- Specified by:
setUseDeltaTin interfaceMultiStreamHeatExchangerInterface- Parameters:
use- True to use ΔT, false otherwise
-
setFeedStream
Sets the feed stream at a specific index.- Specified by:
setFeedStreamin interfaceMultiStreamHeatExchangerInterface- Parameters:
index- Index of the stream to setstream- Input stream to set at the specified index
-
setDeltaT
public void setDeltaT(double dT) Sets the fixed temperature difference (ΔT) for calculations and enables its usage.- Specified by:
setDeltaTin interfaceMultiStreamHeatExchangerInterface- Parameters:
dT- Fixed temperature difference to set
-
getDeltaT
public double getDeltaT()Retrieves the fixed temperature difference (ΔT) used in calculations.- Specified by:
getDeltaTin interfaceMultiStreamHeatExchangerInterface- Returns:
- Temperature difference ΔT
-
getUAvalue
public double getUAvalue()Retrieves the overall heat transfer coefficient times area (UA value).- Specified by:
getUAvaluein interfaceMultiStreamHeatExchangerInterface- Returns:
- UA value
-
toJson
Serializes the Process Equipment along with its state to a JSON string.
- Specified by:
toJsonin interfaceMultiStreamHeatExchangerInterface- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classHeater- Returns:
- json string.
-
toJson
Serializes the Process Equipment with configurable level of detail.- Specified by:
toJsonin interfaceMultiStreamHeatExchangerInterface- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classHeater- Parameters:
cfg- report configuration- Returns:
- json string
-