-
Notifications
You must be signed in to change notification settings - Fork 53
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
The differences in two_nodes between R and Python #143
Comments
@TwinGan and @FedericoTartarini If I interprete correctly, we can fix the difference either by making an addition to R or removing the addition in py. I am fine with both and suggest we go for the version, that is closer to the reference values. |
@TwinGan and @marcelschweiker please find below my comments. First pointThe code from Gagge is ![]() The two-node code from Mark Fountain is as follows. ![]() I have also attached both documents for your reference. Please let me know what do you think. Gagge et al_1986_A standard predictive index of human reponse to the thermal environemnt.pdf Fountain_A derivation of the Gagge 2-node model.pdf Second pointI am not sure why this is happening. It must be something related to how we initialise the simulation. One must be skipping the first run. Third pointI think there is an issue in pythermalcomfort and we need to return w with more decimals, I think I have already partially fixed this in the new version of pythermalcomfort. I should not be returning w with only one dwecimal value. Please have a look at the code in development. If the code is not there yet I will fix it as soon as I have time. |
@TwinGan, Marcel and I looked into the code and we have noticed that the code is actually the same. The difference you mentioned in point 1 is not there. However, we identified an issue caused by the iteration and this is what it is causing the error. I will fix point 2 and 3 in the new version of pythermalcomfort. |
I am closing this issue since I solved point 2 and 3 and I opened issue #147 for point 1 |
Differences caused by additional code logic unique to Python
At the end of the loop, Py package will reassign the two variables
e_skin
,m_rsw
(regsw
in R)When w > w_max, the
e_rsw
will be assign toprsw * emax
which will make m_rsw become different because the reassign logic.In the R package, there was no this logic.
The extra logic
For input:
calc2Node(ta = 45,tr = 45,vel = 1.1,rh = 20,clo = 0.2,met = 3) in R
two_nodes(tdb = 45,tr = 45,v = 1.1,rh = 20,clo = 0.2,met = 3) in Python
The R code result will lead Python's result by one loop
It 's the result of m_rsw(regsw) in the end of each loop (I have added the following extra logic to R)
You can see that the 59 loop m_rsw in R equals the 60 loop in Python.


I am sure that these two loop all start from 1
I don't understand why but this situation happened.
Expected w = 0.2 Actual w = 0.226183272947463
Expected w = 0.2 Actual w = 0.174338146533957
Expected w = 0.1 Actual w = 0.127748749502237
All three cases failed because of the tolerance value.
@FedericoTartarini and @marcelschweiker what shall I do with those differences?
The text was updated successfully, but these errors were encountered: