def 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 """ warnings.warn("This function has been deprecated. Please consider converting it to an object inheriting from \"BaseCycle\".",DeprecationWarning) for i in kwargs: warnings.warn("This function has been deprecated, your input \"{0}: {1}\" will be ignored".format(i,kwargs[i]),DeprecationWarning) from CoolProp.Plots import SimpleCompressionCycle cycle = SimpleCompressionCycle(fluid_ref=Ref, graph_type=Ts_Ph) cycle.simple_solve_dt(Te, Tc, DTsh, DTsc, eta_a, SI=True) print(cycle.COP_cooling(),cycle.COP_heating())
def 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 """ warnings.warn( "This function has been deprecated. Please consider converting it to an object inheriting from \"BaseCycle\".", DeprecationWarning) for i in kwargs: warnings.warn( "This function has been deprecated, your input \"{0}: {1}\" will be ignored" .format(i, kwargs[i]), DeprecationWarning) from CoolProp.Plots import SimpleCompressionCycle cycle = SimpleCompressionCycle(fluid_ref=Ref, graph_type=Ts_Ph) cycle.simple_solve_dt(Te, Tc, DTsh, DTsc, eta_a, SI=True) print(cycle.COP_cooling(), cycle.COP_heating())
def plot_Ts(): pp = PropertyPlot('HEOS::R134a', 'TS', unit_system='EUR', tp_limits='ACHP') pp.calc_isolines() cycle = SimpleCompressionCycle('HEOS::R134a', 'TS', unit_system='EUR', tp_limits='ACHP') cycle.simple_solve_dt(Te=T_K_sat_evaporating ,Tc=T_K_sat_condensing, dT_sh=superheat, dT_sc=subcooling, eta_com= Isentropic_Efficiency/100, SI=True) cycle.steps = 50 sc = cycle.get_state_changes() plt.close(cycle.figure) pp.draw_process(sc) pp.savefig('T-s.svg') pp.show()
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.__dir__) #%% import CoolProp from CoolProp.Plots import PropertyPlot from CoolProp.Plots import SimpleCompressionCycle pp = PropertyPlot('HEOS::R134a', 'PH', unit_system='EUR') pp.calc_isolines(CoolProp.iQ, num=11) cycle = SimpleCompressionCycle('HEOS::R134a', 'PH', unit_system='EUR') T0 = 280 pp.state.update(CoolProp.QT_INPUTS, 0.0, T0 - 10) p0 = pp.state.keyed_output(CoolProp.iP) T2 = 310 pp.state.update(CoolProp.QT_INPUTS, 1.0, T2 + 15) p2 = pp.state.keyed_output(CoolProp.iP) pp.calc_isolines(CoolProp.iT, [T0 - 273.15, T2 - 273.15], num=2) cycle.simple_solve(T0, p0, T2, p2, 0.7, SI=True) cycle.steps = 50 sc = cycle.get_state_changes() pp.draw_process(sc) import matplotlib.pyplot as plt plt.close(cycle.figure) pp.show()
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) #%% import CoolProp from CoolProp.Plots import PropertyPlot from CoolProp.Plots import SimpleCompressionCycle pp = PropertyPlot('HEOS::R134a', 'PH', unit_system='EUR') pp.calc_isolines(CoolProp.iQ, num=11) cycle = SimpleCompressionCycle('HEOS::R134a', 'PH', unit_system='EUR') T0 = 280 pp.state.update(CoolProp.QT_INPUTS, 0.0, T0 - 10) p0 = pp.state.keyed_output(CoolProp.iP) T2 = 310 pp.state.update(CoolProp.QT_INPUTS, 1.0, T2 + 15) p2 = pp.state.keyed_output(CoolProp.iP) pp.calc_isolines(CoolProp.iT, [T0 - 273.15, T2 - 273.15], num=2) cycle.simple_solve(T0, p0, T2, p2, 0.7, SI=True) cycle.steps = 50 sc = cycle.get_state_changes() pp.draw_process(sc) import matplotlib.pyplot as plt plt.close(cycle.figure) pp.show()