-
Notifications
You must be signed in to change notification settings - Fork 84
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
ReaderTMY3 does not work for data going over into the next year #842
Comments
The ReaderTMY3.mo file is simply reading a .mos file. The 2nd line of this file has the number of columns. Maybe you made a mistake in this entry? |
@mwetter thank you for your suggestion. Unfortunatelly it was not that. The description of the table in the second line is correct, otherwise the simulation wouldn't start. |
@AnaConstantin : You are right, the issue is caused by the
|
Thank your for your answer @mwetter. I'd be happy to give it a try and implement your suggestion. |
@AnaConstantin : It would be nice if you can make an implementation and issue a pull request against the |
@AnaConstantin have you started to work on this? Otherwise I could do it today or tomorrow. |
@thorade I haven't started yet: vacation, a lot of work in the office and a bit of a dilemma regarding the solution. While points 2 & 3 from what @mwetter suggested are easy to implement, regarding point 1 I wanted to look into the C-Functions from ModelicaStandardTables.c to see if something cannot be reused, before writting new functions. But I woun't get around to it until next week so feel free to implement your solution. |
@AnaConstantin If you have an idea how to fix it and have time next week, then I believe you should do it. I would just do it so it gets fixed. |
Ok, I give myself a deadline by next wednesday. |
Hi everybody. So I did the modifications, however I do not have permission to push anything in the issue branch. Should I do a work around with a fork and a pull request? (not a big fan, especially since the Wiki recommends the workflow over branches directly).
|
Yes, you should fork the IBPSA repository, push to the branch in your fork, and submit a pull request from your issue branch to the issue branch with the same name here in the IBPSA repo. |
@AnaConstantin : I merged your code to the branch // Evaluate time span of weather data
if ((timeSpan[1] >= 0.0) and (timeSpan[2] <= 31536000.0)) then // Data spans one year or less and ends no later than 31.12 24:00
connect(conTim1.calTim, datRea1.u) annotation (Line(
points={{-89,190},{-58,190}},
color={0,0,127},
pattern=LinePattern.Dot));
connect(conTim.calTim, datRea.u) annotation (Line(
points={{-99,-30},{-68,-30}},
color={0,0,127},
pattern=LinePattern.Dot));
else
connect(add.y, datRea1.u) annotation (Line(
points={{-119,190},{-120,190},{-120,152},{-58,152},{-58,190}},
color={0,0,127},
pattern=LinePattern.Dot));
connect(modTim.y, datRea.u) annotation (Line(
points={{-159,0},{-150,0},{-150,-68},{-68,-68},{-68,-30}},
color={0,0,127},
pattern=LinePattern.Dot));
end if; require a translator to generate C code, run the C code to get the values for the |
@mwetter, thank you for your comments. I'm on maternity leave right now so I'm somewhat slower to answer or implement anything.
|
@AnaConstantin : I am glad to hear about your paternity leave. A negative time stamp happens if a user simulates for example from t0=-86400 to t=86400. We should be rigorous in the implementation as otherwise, it won't work for some users, and not only cause problems for the user, but also takes us more time if we need to fix the code later again. Regarding the discontinuity in the weather data between Dec. and Jan., I think this should be corrected by correcting the weather data file. In the model, we don't know what the final time is, and hence I don't think it would be possible to fix this without affecting the results that one would have if exactly a year (from Jan. 1 to Dec. 31) is simulated. As the discontinuity is at midnight, I don't think there are bad implications on the simulation. |
@mwetter sorry for taking so long to come back to working on this issue. While on maternity leave taking care of small children is for me more fun than Modelica. But after receiving a friendly reminder I want to get the issue sorted out in the next couple of days. |
@AnaConstantin Thanks for the update. I deleted #858 |
To-Do on branch https://github.com/ibpsa/modelica-ibpsa/tree/issue842_multiyear:
|
@mlauster @mwetter the current implementation has initial equation
tStart = integer(modTim/year)*year;
equation
calTim = modTim - tStart; such that the input of the I guess we have to agree first on the intended functionality of the weather data reader. For me this is:
I wouldn't add 2) since this parameter is too hard to interpret for the average user and for 3) I would add both options using an Also, I think we should clearly document somewhere what 'time' means: does this relate to the position of the sun, or does it relate to the calendar time (which is different in different positions on the globe). I always forget.. @mwetter @mlauster @AnaConstantin do you agree if I modify the code such that we have the options described in 3) and if I modify the code such that the shift is removed such that we get 1)? |
@Mathadon, I think @mwetter and @AnaConstantin opinions are of higher importance than mine. So lets wait for their feedback. I will in the meantime start to add tests and check the code. |
Hello everyone, I'll be quick since it took a long time for me yesterday to go through everything which was done and said on this issue (and additional pull requests) already: |
@Mathadon : I agree partially with using your option 1 "Read weather data from file using the Modelica built-in variable time as an index for the first column of the file." This is OK for all data except those read by I agree that It would be nice if we could use timeScaled = time/timeScale;
when {time >= pre(nextTimeEvent),initial()} then which for the solar radiation data should be timeScaled = (time+1800)/timeScale;
when {(time+1800) >= pre(nextTimeEvent),initial()} then Maybe easiest would be to copy parameter Modelica.SIunits.Time timeOffset
"Time offset, causing data to be read at time+timeOffset"; and delete @AnaConstantin : The scripts Note that I merged the master into this development branch as we had 660 commits since then. |
@mwetter I assume you mean the scripts for the unit tests. As discussed previously I was unable to get access to the software configuratuion needed for generating unit tests. Neither at the institute nor at home where I'm working from at the moment. I'm very sorry for this, but I could not do anything about it. Let me know if I can help in any other way. |
@mlauster : Can you please write and add such scripts that can be used to test variables of interest. |
@mwetter, that's fine, I will take overt this work. But give me some time, we are in the reporting season and I still need to take care of my BS Paper. :-) |
@AnaConstantin : I merged your pull request but need some more time for testing. The old implementation did not work if the start time of the simulation is negative, which I corrected in b788c32 Can you please also run some tests to make sure the model works for startTime being negative, zero and strictly positive. |
Ok, I'm officially back to work tomorrow so I'll start with this. |
Hello everyone,
I have my own weather data, which I have adapted to a TMY3 format, in order to use the ReaderTMY3. The data covers the period of June 2016 to October 2017. The time stamp I used in the TMY3 format sets 1.01.2016 00:00 to 0s. However I get an error at 01.01.2017 00:00 and the simulation stops. Is there a way around this, as depending on my application, I might have data stretching over more than a year anyway? Or am not setting some parameter correctly?
Otherwise I'm happy to assist in extending the ReaderTMY3 to deal with such a situation.
The text was updated successfully, but these errors were encountered: