CoolProp.Plots.SimpleCycles module

class CoolProp.Plots.SimpleCycles.BaseCycle(fluid_ref, graph_type, unit_system='EUR', **kwargs)

Bases: BasePlot

A simple thermodynamic cycle, should not be used on its own.

Initialises a simple cycle calculator

Parameters:
  • fluid_ref (str, CoolProp.AbstractState) – The fluid property provider, either a subclass of CoolProp.AbstractState or a string that can be used to generate a CoolProp.AbstractState instance via Common.process_fluid_state().

  • graph_type (string) – The graph type to be plotted, like “PH” or “TS”

  • unit_system (string, ['EUR','KSI','SI']) – Select the units used for the plotting. ‘EUR’ is bar, kJ, C; ‘KSI’ is kPa, kJ, K; ‘SI’ is Pa, J, K

  • properties (for more) –

:param see CoolProp.Plots.Common.BasePlot.:

PROPERTIES = {19: 'temperature', 20: 'pressure', 36: 'density', 37: 'specific enthalpy', 38: 'specific entropy'}
STATECHANGE = None

A list of lists of tuples that defines how the state transitions behave for the corresponding entry in BaseCycle.STATECOUNT

STATECOUNT = 0

A list of accepted numbers of states

property cycle_states
fill_states(objs=None)

Try to populate all fields in the state objects

get_state_change(index)
get_state_changes()
state_change(in1, in2, start, ty1='lin', ty2='lin')

Calculates a state change defined by the properties in1 and in2

Uses self.states[start] and self.states[start+1] (or self.states[0]) to define the process and interpolates between the values.

Parameters:
  • in1 (int) – The index of the first defined property.

  • in2 (int) – The index of the second defined property.

  • start (int) – The index of the start state.

  • ty1 (str) – The key that defines the type of state change for in1, lin or log.

  • ty2 (str) – The key that defines the type of state change for in2, lin or log.

Returns:

a list of the length of self.steps+1 that describes the process. It includes start and end state.

Return type:

scalar or array_like

property steps
property system
valid_states()

Check the formats of BaseCycle.STATECOUNT and BaseCycle.STATECHANGE

CoolProp.Plots.SimpleCycles.EconomizedCycle(Ref, Qin, Te, Tc, DTsh, DTsc, eta_oi, f_p, Ti, Ts_Ph='Ts', skipPlot=False, axis=None, **kwargs)

This function plots an economized cycle, on the current axis, or that given by the optional parameter axis

Required parameters:

  • Ref : Refrigerant [string]

  • Qin : Cooling capacity [W]

  • Te : Evap Temperature [K]

  • Tc : Condensing Temperature [K]

  • DTsh : Evaporator outlet superheat [K]

  • DTsc : Condenser outlet subcooling [K]

  • eta_oi : Adiabatic efficiency of compressor (no units) in range [0,1]

  • f_p : fraction of compressor power lost as ambient heat transfer in range [0,1]

  • Ti : Saturation temperature corresponding to intermediate pressure [K]

Optional parameters:

  • Ts_Ph : ‘Ts’ for a Temperature-Entropy plot, ‘Ph’ for a Pressure-Enthalpy

  • axis : An axis to use instead of the active axis

  • skipPlot : If True, won’t actually plot anything, just print COP

CoolProp.Plots.SimpleCycles.SimpleCycle(Ref, Te, Tc, DTsh, DTsc, eta_a, Ts_Ph='Ph', **kwargs)

This function plots a simple four-component cycle, on the current axis, or that given by the optional parameter axis

Required parameters:

  • Ref : A string for the refrigerant

  • Te : Evap Temperature in K

  • Tc : Condensing Temperature in K

  • DTsh : Evaporator outlet superheat in K

  • DTsc : Condenser outlet subcooling in K

  • eta_a : Adiabatic efficiency of compressor (no units) in range [0,1]

Optional parameters:

  • Ts_Ph : ‘Ts’ for a Temperature-Entropy plot, ‘Ph’ for a Pressure-Enthalpy

  • axis : An axis to use instead of the active axis

  • skipPlot : If True, won’t actually plot anything, just print COP

class CoolProp.Plots.SimpleCycles.StateContainer(unit_system=<CoolProp.Plots.Common.SIunits object>)

Bases: object

A collection of values for the main properties, built to mixin with CoolProp.Plots.Common.PropertyDict

Examples

This container has overloaded accessor methods. Just pick your own flavour or mix the styles as you like:

>>> from __future__ import print_function
>>> import CoolProp
>>> from CoolProp.Plots.SimpleCycles import StateContainer
>>> T0 = 300.000; p0 = 200000.000; h0 = 112745.749; s0 = 393.035
>>> cycle_states = StateContainer()
>>> cycle_states[0,'H'] = h0
>>> cycle_states[0]['S'] = s0
>>> cycle_states[0][CoolProp.iP] = p0
>>> cycle_states[0,CoolProp.iT] = T0
>>> cycle_states[1,"T"] = 300.064
>>> print(cycle_states)
Stored State Points:
state        T (K)       p (Pa)    d (kg/m3)     h (J/kg)   s (J/kg/K)
    0      300.000   200000.000            -   112745.749      393.035
    1      300.064            -            -            -            -
property D
property H
property P
property Q
property S
property T
property U
append(new)
extend(new)
get_point(index, SI=True)
property points
set_point(index, value, SI=True)
property units
class CoolProp.Plots.SimpleCycles.StatePoint

Bases: PropertyDict

A simple fixed dimension dict represented by an object with attributes

ROUND_DECIMALS = {19: 5, 20: 2, 21: 5, 36: 5, 37: 5, 38: 5, 42: 5}
CoolProp.Plots.SimpleCycles.TwoStage(Ref, Q, Te, Tc, DTsh, DTsc, eta_oi, f_p, Tsat_ic, DTsh_ic, Ts_Ph='Ph', prints=False, skipPlot=False, axis=None, **kwargs)

This function plots a two-stage cycle, on the current axis, or that given by the optional parameter axis

Required parameters:

  • Ref : Refrigerant [string]

  • Q : Cooling capacity [W]

  • Te : Evap Temperature [K]

  • Tc : Condensing Temperature [K]

  • DTsh : Evaporator outlet superheat [K]

  • DTsc : Condenser outlet subcooling [K]

  • eta_oi : Adiabatic efficiency of compressor (no units) in range [0,1]

  • f_p : fraction of compressor power lost as ambient heat transfer in range [0,1]

  • Tsat_ic : Saturation temperature corresponding to intermediate pressure [K]

  • DTsh_ic : Superheating at outlet of intermediate stage [K]

Optional parameters:

  • Ts_Ph : ‘Ts’ for a Temperature-Entropy plot, ‘Ph’ for a Pressure-Enthalpy

  • prints : True to print out some values

  • axis : An axis to use instead of the active axis

  • skipPlot : If True, won’t actually plot anything, just print COP