Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YES! IP! Small issue though #12

Open
eloneill opened this issue Jan 2, 2020 · 1 comment
Open

YES! IP! Small issue though #12

eloneill opened this issue Jan 2, 2020 · 1 comment

Comments

@eloneill
Copy link

eloneill commented Jan 2, 2020

I'm super pumped to see that this has been ported over with IP usage. As a mechanical engineer without much debugging experience, I'm running this code and getting the following issue. Am I doing something wrong?

Thanks for the work getting this to work with IP units.

%matplotlib inline

%config InlineBackend.figure_format = 'retina'

import matplotlib.pyplot as plt

​

from psychrochart import PsychroChart, load_config

​

chart_ashrae_style = PsychroChart(use_unit_system_si=False)

ax = chart_ashrae_style.plot()

ax.get_figure()

WARNING:root:[IP units mode] ENABLED
ERROR:root:ENTHALPHY CONVERGENCE ERROR: No convergence error after 100 iterations! Last value: 101.8643583901623, ∆: 0.125. Objective: 75, iter_value: 75.18484966677528


ValueError Traceback (most recent call last)
in
5 from psychrochart import PsychroChart, load_config
6
----> 7 chart_ashrae_style = PsychroChart(use_unit_system_si=False)
8 ax = chart_ashrae_style.plot()
9 ax.get_figure()

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\chart.py in init(self, styles, zones_file, use_unit_system_si)
86 self._handlers_annotations: List = []
87
---> 88 self._make_chart_data(styles, zones_file)
89
90 def repr(self) -> str:

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\chart.py in _make_chart_data(self, styles, zones_file)
213 label_loc=self.chart_params.get("constant_v_labels_loc", 1.0),
214 family_label=self.chart_params["constant_v_label"],
--> 215 saturation_curve=self.saturation.curves[0],
216 )
217

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\chartdata.py in make_constant_specific_volume_lines(w_humidity_ratio_min, pressure, vol_values, v_label_values, style, label_loc, family_label, saturation_curve)
310 vol_values,
311 lambda *x: t_sat_interpolator(x[0]),
--> 312 lambda x: GetMoistAirVolume(
313 x, GetHumRatioFromVapPres(GetSatVapPres(x), pressure), pressure,
314 ),

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\util.py in solve_curves_with_iteration(family_name, objective_values, func_init, func_eval)
178 func_eval=func_eval,
179 initial_increment=initial_increment,
--> 180 precision=precision,
181 )
182 except AssertionError as exc: # pragma: no cover

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\util.py in _iter_solver(initial_value, objective_value, func_eval, initial_increment, num_iters_max, precision)
121 num_iter = 0
122 value_calc = initial_value.copy()
--> 123 error = objective_value - func_eval(initial_value)
124 while abs(error) > precision and num_iter < num_iters_max:
125 iteration_value = func_eval(value_calc)

~\AppData\Roaming\Python\Python37\site-packages\psychrochart\chartdata.py in (x)
311 lambda *x: t_sat_interpolator(x[0]),
312 lambda x: GetMoistAirVolume(
--> 313 x, GetHumRatioFromVapPres(GetSatVapPres(x), pressure), pressure,
314 ),
315 )

~\AppData\Roaming\Python\Python37\site-packages\psychrolib.py in GetSatVapPres(TDryBulb)
1022 if isIP():
1023 if (TDryBulb < -148 or TDryBulb > 392):
-> 1024 raise ValueError("Dry bulb temperature must be in range [-148, 392]°F")
1025
1026 T = GetTRankineFromTFahrenheit(TDryBulb)

ValueError: Dry bulb temperature must be in range [-148, 392]°F

@azogue
Copy link
Owner

azogue commented Jan 8, 2020

Hi @eloneill,

IP usage is too new, sorry :) I need to take some time to polish the plot logic so those errors get better treatment.

Anyway, I think your current problem is because you changed the unit system but the chart is working with plot limits adequate only for SI. Try to change this line:

chart_ashrae_style = PsychroChart(use_unit_system_si=False)

to

chart_ashrae_style = PsychroChart(styles="ashrae_ip", use_unit_system_si=False)

By loading another predefined style (the only one tested with IP right now, btw), the plot limits change, and it should work ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants