References
Contents
Index
Carnot.DirectOptParametersCarnot.HeatPumpCarnot.HeatPumpRecuperatorCarnot.ORCCarnot.ORCEconomizerCarnot.OptHeatPumpCarnot.SolutionStateCarnot.ThermoCycleParametersCarnot.TranscriticalORCCarnot.COPCarnot.FCarnot.FCarnot.FCarnot.FCarnot.IHEX_QCarnot.VHCCarnot.convert_solutionCarnot.generate_box_solve_boundsCarnot.generate_box_solve_boundsCarnot.generate_box_solve_boundsCarnot.generate_box_solve_boundsCarnot.generate_box_solve_boundsCarnot.generate_initial_pointCarnot.generate_initial_pointCarnot.generate_initial_pointCarnot.generate_initial_pointCarnot.generate_initial_pointCarnot.get_temperature_profilesCarnot.isentropic_compressorCarnot.isentropic_expanderCarnot.isentropic_pumpCarnot.off_design_compressor_relationCarnot.off_design_expander_relationCarnot.power_ratingsCarnot.power_ratingsCarnot.power_ratingsCarnot.show_parametersCarnot.ηCarnot.ηCommonSolve.solveCommonSolve.solve
Carnot.DirectOptParameters Method
DirectOptParameters(; N::Int, ΔT_sh_min, ΔT_sc_min)
Parameters controlling the discretisation and minimum temperature differences used in the direct heat-pump optimisation.
# Arguments
- `N::Int`: Number of discretisation points used in the direct optimisation. Must be greater than 1.
- `ΔT_sh_min`: Minimum allowable superheat temperature difference. Must be non-negative.
- `ΔT_sc_min`: Minimum allowable subcooling temperature difference. Must be non-negative.
# Returns A `DirectOptParameters` instance containing the specified optimisation parameters.
# Throws - `AssertionError`: If `N ≤ 1`.
- `AssertionError`: If `ΔT_sh_min < 0`.
- `AssertionError`: If `ΔT_sc_min < 0`.Carnot.HeatPump Type
HeatPump{T<:Real} <: AbstractHeatPumpA mutable structure representing a vapour-compression heat pump thermodynamic problem.
Fields
fluid::EoSModel: The equation of state (EoS) model defining the working fluid thermodynamic properties. For now it has to be Cubic EoS.z::AbstractVector{T}: The composition vector of the working fluid (for mixtures; typically[1.0]for pure fluids).T_evap_in::T: Inlet temperature to the evaporator [K].T_evap_out::T: Outlet temperature from the evaporator [K].ΔT_sh::T: Degree of superheating at the evaporator outlet [K].T_cond_in::T: Inlet temperature to the condenser [K].T_cond_out::T: Outlet temperature from the condenser [K].ΔT_sc::T: Degree of subcooling at the condenser outlet [K].η_comp::T: Isentropic efficiency of the compressor [-].pp_evap::T: Pinch point temperature difference for evaporator [K].pp_cond::T: Pinch point temperature difference for condensor [K].
Optional arguments
check_subcritical= true: checks if the input conditions (inlet temperature minus pinch point) are actually below the mixture critical point.
Carnot.HeatPumpRecuperator Type
HeatPumpRecuperator{HP<:HeatPump,T<:Real} <: AbstractHeatPumpA mutable structure representing a heat pump cycle with an internal recuperator (economiser or heat exchanger) between the discharge and suction sides.
Fields
hp::HP: The base heat pump configuration, containing fluid properties and cycle parameters.ϵ::T: Effectiveness of the recuperator (dimensionless, typically between 0 and 1).
Carnot.ORC Type
ORC{T<:Real} <: AbstractORC
Defines an Organic Rankine Cycle (ORC) problem with thermodynamic and design parameters specified in Kelvin and dimensionless efficiencies.
Fields
fluid::CubicModel: Equation of State (EoS) model representing the working fluid. For now it has to be Cubic EoS.z::AbstractVector{T}: Mole fraction composition vector of the working fluid.T_evap_in::T: Inlet temperature of the evaporator [K].T_evap_out::T: Outlet temperature of the evaporator [K].ΔT_sh::T: Degree of superheating at the expander inlet [K].T_cond_in::T: Inlet temperature of the condenser [K].T_cond_out::T: Outlet temperature of the condenser [K].ΔT_sc::T: Degree of subcooling at the pump inlet [K].η_pump::T: Isentropic efficiency of the pump [-].η_expander::T: Isentropic efficiency of the expander [-].pp_evap::T: Minimum temperature difference (pinch point) at the evaporator [K].pp_cond::T: Minimum temperature difference (pinch point) at the condenser [K].
Carnot.ORCEconomizer Type
ORCEconomizer{T<:Real} <: AbstractORCDefines an Organic Rankine Cycle (ORC) configuration with an economiser (regenerative heat exchanger), extending the base ORC problem with a specified effectiveness.
Fields
orc::ORC{T}: Base ORC system definition containing the thermodynamic parameters.ϵ::T: Effectiveness of the economiser (regenerator) [-].
Carnot.OptHeatPump Type
OptHeatPump{E<:EoSModel,T<:Real,Z<:AbstractVector{T}} <: ThermoCycleProblem
Thermodynamic optimisation problem for a heat pump.
# Fields
- `fluid::E`: Equation-of-state model describing the working fluid.
- `z::Z`: Composition vector of the working fluid.
- `T_evap_in::T`: Inlet temperature of the evaporator.
- `T_evap_out::T`: Outlet temperature of the evaporator.
- `T_cond_in::T`: Inlet temperature of the condenser.
- `T_cond_out::T`: Outlet temperature of the condenser.
- `η_comp::T`: Isentropic efficiency of the compressor.
- `pp_evap::T`: Minimum pinch-point temperature difference in the evaporator.
- `pp_cond::T`: Minimum pinch-point temperature difference in the condenser.
- `crit::NTuple{3,T}`: Critical properties of the working fluid, typically `(T_crit, p_crit, ρ_crit)`.
# Type Parameters
- `E`: Type of the equation-of-state model.
- `T`: Numeric type used for temperatures and other scalar parameters.
- `Z`: Type of the composition vector.Carnot.SolutionState Type
SolutionState - A struct to hold the solution state of the nonlinear solver.
x::Vector{T}: The solution vector.f_calls::I: The number of function calls made during the solving process.iterations::I: The number of iterations taken to converge.residuals::Vector{T}: The residuals at the solution.lb::Vector{T}: The lower bounds used in the solver.ub::Vector{T}: The upper bounds used in the solver.autodiff::Bool: A flag indicating whether automatic differentiation was used.fd_order::I: The order of finite difference used if autodiff is false.lenx::T: The final change in the solution vector.lenf::T: The final change in the residuals.soltype::Symbol: A symbol indicating the type of cycle (:unknown,:subcritical,:transcritical). This will be updated with the cycle type after solving.
Carnot.ThermoCycleParameters Type
ThermoCycleParameters - A struct to hold the solver parameters of the nonlinear solver.
N::Int: Heat Exchanger discretization.max_iters::Int: Maximum number of iterationsautodiff::Bool: A flag indicating whether automatic differentiation was used.fd_order::Int: The order of finite difference used if autodiff is false.xtol::Float64: convergece criteria onx.ftol::Float64: convergece criteria onf.restart_TOL::Float64: Restrat strategy with tolerace.internal_pinch::Bool: Check for interal pinch for mixtures
Carnot.TranscriticalORC Type
TranscriticalORC{E<:EoSModel,T<:Real} <: ThermoCycleProblemThermodynamic problem definition for a transcritical Organic Rankine Cycle (ORC).
Fields
fluid::E: Equation-of-state model describing the ORC working fluid.T_evap_in::T: Inlet temperature of the secondary fluid to the evaporator.T_evap_out::T: Outlet temperature of the secondary fluid from the evaporator.ΔT_sh_min::T: Minimum degree of superheating required at the evaporator outlet.T_cond_in::T: Inlet temperature of the secondary fluid to the condenser.T_cond_out::T: Outlet temperature of the secondary fluid from the condenser.ΔT_sc_min::T: Minimum degree of subcooling required at the condenser outlet.η_pump::T: Isentropic efficiency of the pump.η_expander::T: Isentropic efficiency of the expander.pp_evap::T: Minimum pinch-point temperature difference in the evaporator.pp_cond::T: Minimum pinch-point temperature difference in the condenser.
Carnot.COP Method
COP(prob::Carnot.AbstractHeatPump, sol::SolutionState) -> Float64Computes the coefficient of performance (COP) of a thermodynamic cycle given the problem definition and its corresponding solution state.
Arguments
prob::Carnot.AbstractHeatPump: The thermodynamic cycle problem containing fluid models, boundary conditions, and component parameters.sol::SolutionState: The solution state object containing the converged state variables (x), residuals, and convergence information.
Carnot.F Method
F(prob::TranscriticalORC, x::AbstractVector; N::Int)Evaluate the evaporator and condenser pinch-point constraints and the thermal efficiency of a transcritical Organic Rankine Cycle (ORC).
The cycle pressures and the minimum degrees of superheating and subcooling are specified through the decision vector x. The heat exchangers are discretised using the working-fluid enthalpy as the spatial coordinate.
Arguments
prob::TranscriticalORC: Transcritical ORC problem definition containing the working-fluid model, secondary-fluid temperatures, pinch-point constraints, and component efficiencies.x::AbstractVector: Decision vector containing:x[1]: Evaporation pressure as a fraction of the critical pressure,p_evap / p_crit.x[2]: Condensation pressure as a fraction of atmospheric pressure,p_cond / 101325.x[3]: Degree of superheating at the evaporator outlet,ΔT_sh.x[4]: Degree of subcooling at the condenser outlet,ΔT_sc.
N::Int: Number of discretisation points used for the evaporator enthalpy-based discretisation.
Returns
A tuple (Δevap, Δcond), η_orc, where:
Δevap: Minimum evaporator pinch-point temperature difference relative toprob.pp_evap.Δcond: Minimum condenser pinch-point temperature difference relative toprob.pp_cond.η_orc: ORC thermal efficiency, calculated as the net specific work produced by the expander and pump divided by the specific enthalpy supplied in the evaporator.
Positive values of Δevap and Δcond indicate that the corresponding minimum pinch-point temperature difference is satisfied.
Notes
The evaporator is discretised between the pump outlet and evaporator outlet enthalpies. The condenser is evaluated at the expander outlet, saturated vapour, saturated liquid, and condenser outlet states.
The evaporator outlet temperature is defined relative to the critical temperature of the working fluid, while the condenser outlet temperature is defined relative to the saturation temperature at the condensation pressure.
sourceCarnot.F Method
F(prob::HeatPumpRecuperator, x::AbstractVector{T}; N::Int) function call to HeatPump
Carnot.F Method
F(prob::OptHeatPump, x::AbstractVector{T}; N::Int) where {T<:Real}
Evaluate the heat-pump optimisation problem for a given set of decision variables.
The decision vector `x` contains the evaporating pressure, condensing pressure, superheat, and subcooling.
For mixtures, the function evaluates the evaporator and condenser pinch-point constraints using a discretised heat-exchanger model.
For pure fluids, the calculation is delegated to [`F_pure`](@ref).
# Arguments
- `prob::OptHeatPump`: Heat-pump optimisation problem.
- `x::AbstractVector{T}`: Decision vector of length 4:
- `x[1]`: Evaporating pressure, normalised by 1 atm.
- `x[2]`: Condensing pressure, normalised by 1 atm.
- `x[3]`: Superheat temperature difference.
- `x[4]`: Subcooling temperature difference.
- `N::Int`: Number of discretisation points used to evaluate the evaporator and condenser pinch points.
# Returns A tuple `(constraints, cop)` where:
- `constraints`: Two-element vector containing the evaporator and condenser pinch-point constraint residuals, `[ΔTpp_evap, ΔTpp_cond]`. A non-negative value indicates that the corresponding minimum pinch-point temperature difference constraint is satisfied.
- `cop`: Coefficient of performance of the heat pump, calculated as `(h_cond_out - h_comp_out) / (h_comp_out - h_evap_out)`.
# Notes For mixtures, the heat-exchanger temperature profiles are discretised using linear enthalpy spacing. The minimum temperature difference between the working-fluid and secondary-fluid profiles is used to evaluate each pinch-point constraint. The pressures in `x` are expressed relative to atmospheric pressure: `p = x[i] * 101325`.Carnot.IHEX_Q Method
Computes the heat transfer in the recuperator. Assumes fluid entering from the left to be higher in temperature. Based over ϵ - effictiveness of heat exchanger.
sourceCarnot.VHC Method
VHC(prob::HeatPump,sol::SolutionState)
Returns the volumetric heating capacity [kJ/m³].
sourceCarnot.convert_solution Method
convert_solution(prob::OptHeatPump, sol::SolutionState)
Convert an optimised `OptHeatPump` solution into a `HeatPump` problem and solve the resulting thermodynamic cycle.
The pressure-related decision variables from the optimisation solution are used by the `HeatPump` solver,
while the superheat and subcooling values are passed explicitly to the `HeatPump` constructor.
# Arguments
- `prob::OptHeatPump`: Heat-pump optimisation problem.
- `sol::SolutionState`: Optimisation solution containing the four decision variables `[p_evap, p_cond, ΔT_sh, ΔT_sc]`.
# Returns A tuple `(hp, sol)` where:
- `hp`: Constructed `HeatPump` problem corresponding to the optimised solution.
- `sol`: Solution obtained by solving the constructed `HeatPump` problem.
# Throws - `AssertionError`: If `sol.x` does not contain exactly four decision variables.
# Notes
The returned `SolutionState` is the result of re-solving the `HeatPump` problem using `ThermoCycleParameters(N = 20, autodiff = false, max_iters = 10)`.Carnot.generate_box_solve_bounds Method
generate_box_solve_bounds(prob::HeatPumpRecuperator) -> lb, ub Generates lower and upper bounds for the heat pump problem based on its parameters.
Carnot.generate_box_solve_bounds Method
generate_box_solve_bounds(prob::HeatPumpVarEff) -> lb, ub Generates lower and upper bounds for the heat pump problem based on its parameters.
Carnot.generate_box_solve_bounds Method
generate_box_solve_bounds(prob::HeatPump) -> lb, ub Generates lower and upper bounds for the heat pump problem based on its parameters.
Carnot.generate_box_solve_bounds Method
generate_box_solve_bounds(prob::ORCEconomizer) -> lb, ub Generates lower and upper bounds for the heat pump problem based on its parameters.
Carnot.generate_box_solve_bounds Method
generate_box_solve_bounds(prob::ORC) -> lb, ub Generates lower and upper bounds for the heat pump problem based on its parameters.
Carnot.generate_initial_point Method
generate_initial_point(prob::HeatPump,lb::AbstractVector{T},ub::AbstractVector{T}) Generates initial point for solving the system.
Carnot.generate_initial_point Method
generate_initial_point(prob::HeatPumpRecuperator,lb::AbstractVector{T},ub::AbstractVector{T}) Generates initial point for solving the system.
Carnot.generate_initial_point Method
generate_initial_point(prob::HeatPumpVarEff,lb::AbstractVector{T},ub::AbstractVector{T}) Generates initial point for solving the system.
Carnot.generate_initial_point Method
generate_initial_point(prob::ORC,lb::AbstractVector{T},ub::AbstractVector{T}) Generates initial point for solving the system.
Carnot.generate_initial_point Method
generate_initial_point(prob::ORCEconomizer,lb::AbstractVector{T},ub::AbstractVector{T}) Generates initial point for solving the system.
Carnot.get_temperature_profiles Function
get_temperature_profiles(prob::HeatPump,sol::SolutionState,N::Int = 20)
Returns the temperature profile over the heat exchangers for HeatPump problem and given SolutionState.
Carnot.isentropic_compressor Method
Returns the outlet enthalpy in vapour phase for constant isentropic efficiency. Use in compression of gas.
sourceCarnot.isentropic_expander Method
Returns the outlet enthalpy in vapour phase for constant isentropic efficiency for turbine application.
sourceCarnot.isentropic_pump Method
Returns the outlet enthalpy in liquid phase for constant isentropic efficiency. Use in pump of ORC.
sourceCarnot.off_design_expander_relation Method
Similar to off_design_compressor_relation for modelling of expander
Carnot.power_ratings Method
Function that gives specific power ratings for HP by fixing outlet power of compressor to equal 1.
sourceCarnot.power_ratings Method
Function that gives specific power ratings for HP by fixing outlet power of compressor to equal 1.
sourceCarnot.power_ratings Method
Function that gives specific power ratings for ORC by fixing outlet power of expander to equal 1.
sourceCarnot.η Method
η(prob::Carnot.AbstractORC, sol::SolutionState) -> Float64Computes the thermal efficiency of a thermodynamic cycle given a problem definition and its corresponding solution state.
Arguments
prob::Carnot.AbstractORC: The thermodynamic cycle problem containing fluid properties, boundary conditions, and component parameters.sol::SolutionState: The solution state object containing the converged state variables (x), residuals, and convergence information.
Returns
Float64: The computed cycle efficiency, defined as the ratio of net work output to heat input.
Notes
This method acts as a wrapper that extracts the solution vector x from sol and calls the lower-level η(prob, x) implementation.
CommonSolve.solve Method
Solves for pressure values in HP and ORC cycles for the given glide and problem parameters. Define those problems in the respective structs. For now the default box-nonlinear solver is newton-raphson, but this can be changed to other solvers in the future.
sourceCommonSolve.solve Method
Solves for pressure values in HP and ORC cycles for the given glide and problem parameters. Define those problems in the respective structs. For now the default box-nonlinear solver is newton-raphson, but this can be changed to other solvers in the future.
source