-
Notifications
You must be signed in to change notification settings - Fork 34
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
Weather data reader #12
Comments
@tbeu made a lot of changes and a new release of ncDataReader2 that makes it much easier to https://github.com/tbeu/netCDF-DataReader If you want to keep it as the file reader solution in the BuildingSystems library, one of us has to |
There also exists one more HDF5 (or a special sub-dialect?) reading library: |
Why should it be not possible to simply depend on a Modelica library that already can handle external files? We have several platform-generic, tool-independent, license-friendly FLOSS libraries available, that are also well maintained.
Otherwise it's rather strange to me that every Building library implements its own weatherdata reader for that specific part. |
The libraries started out separately and every library implemented everything themselves. The idea of Annex60 is exactly to reduce this duplication. Every part that is needed by all libraries could be moved from the extending libraries to the Annex60 core library. That is what happened with the weather data reader: It was copied from the Buildings library to the Annex60 library, and then during the next integration, it was copied from Annex60 to all extending libraries. This is why we now have two weather data readers, and this is why I filed this issue. |
I am also not a weather data expert but checking the files you have, the spec and the Java conversion utility it does not look complicated. If I understand it correctly, currently the EPW files are converted to TXT files (which you call MOS) that the CombiTimeTable of the MSL can understand and which handles then the interpolation and/or periodic extrapolation. One real improvement of the ModelicaStandardTables would be to decouple the file I/O from the core table business of interplation/extrapolation. Currently only MAT files and TXT files are supported. You ask for netCDF or HDF5 files. Many more formats are possible, e.g. in Modelica ticket #1153 Excel sheets were asked for. The idea is to have an replaceable package that holds the ctor and dtor of the external file object and one mandatory function to read the data. The goal of course is to have all external data only at the external side with no need to have it passed to the Modelica environment. Sorry if I hijacked your issue for a ModelicaStandardTables issue. But since there is not much going on in Modelica ticket #1153 this "plugin concept" really looks like a valuable generalization. Tell me what you think. And let's see what the experts @mwetter and @MartinOtter think about it. |
@tbeu Your understanding about converting EPW files is correct; we simply change the syntax in order to use the CombiTable1Ds from the MSL. Decoupling file I/O from interpolation and extrapolation is desirable in my view: In other words, if simply the file format changes from txt to mat (or hdf5), the output of the table reader should be identical. Hence, interpolation/extrapolation functions should ideally be reused. I personally had not yet had a use case that requires hdf5, but @thorade or his co-workers may had. If hdf5 has indeed higher performance (compilation and simulation time) for very large tables, I think this could be of interest for example if annual measured data in intervals of seconds are available for a building. |
The fork of @tbeu has a lot of advantages for Modelica users, it should
be preferred over my old code.
The ncDataReader2 was developed for one-dimensional data sets (that
depend on one variable like typical weather files) and is very efficient
for smooth interpolation of large data sets and network operations, but
it is not a general purpose file reader. At the moment I don't have any
plans to improve or extend the code.
netCDF 4 can use HDF5 as the storage engine, but it reads and writes its
own structure and metadata in HDF5 files. As a result, only special HDF5
files can be read by netCDF and ncDataReader2. To implement a general
HDF5 reader, the HDF5 API has to be used and not the netCDF API (like
ncDataReader2 does).
…--
Dipl.-Ing. Jörg Rädler
CAD_LAB | Institut für Architektur und Städtebau | Fakultät Gestaltung
Universität der Künste Berlin | +49 30 3185 2927 | [email protected]
|
As referenced by @thorade we are planning to add a model into the AixLib that makes use of the NcDataReader2 library and its functions. Just a few words regarding the story behind that: @mwetter: Since NcDataReader2 will be used in 2 of 4 libraries, is there any interest in integrating it into the annex60 library? @tbeu: What is your opinion about that, especially because @jraedler doesn't have any plans to continue development of NcDataReader2. |
|
@tbeu: I can provide the total model. But since it contains partially confidential models, which I cannot easily substitute by others to share the whole model here, I would suggest that you contact me via e-mail (see my profile). addition: I tested it with MSL 3.2.2 build3 (2016-04-03) |
@tbeu @PMehrfeld |
@mwetter We had this discussion at a previous MAP-Lib web meeting that it is not the aim of the MA to include anymore third-party C code dependencies in the MSL. There were some objections regarding maintenance effort and platform independence. Well, I am not sure how fixed this statement is, but at least it holds for now. I compared the performance of TXT-file, MAT-file and netCDF-file based reading in modelica/ModelicaStandardLibrary#1682 (comment). Test tables were a 112156x2 matrix which are also attached there. For me, performance is not a real issue. |
@PMehrfeld Please try to minimize the model as much as possible and describe the expected vs. the observed behaviour. |
FYI: It turned out that @PMehrfeld's observation with the CombiTimeTable is the same as reported in modelica/ModelicaStandardLibrary#2080. |
I recently started some effort with the Modelica Table Additions - a drop-in extension of the Modelica Standard Tables but with additional support of external formats (currently CSV and JSON). It would then be possible to directly support EPW files without the need of the pre-processing step using ConvertWeatherData.jar. |
@tbeu : If the data reading is similarly efficient than the current approach which puts the table into the C code, then this would be interesting, i.e., if the overhead for parsing the epw file during run time is not significant. Note however that since a few days or weeks, many epw files are now also available as mos files, see for example https://energyplus.net/weather-location/north_and_central_america_wmo_region_4/USA/AK/USA_AK_Adak.NAS.704540_TMY |
Yes, this is the case.
Would be interesting why the mos files are displayed such prominently there. If you are interested in a native epw support available in Modelica interpolation blocks (by library Modelica Tables Additions) we could add it there. |
@tbeu : We would need to be able to conduct interpolation on some of the time series, please see Note however some items to consider in
So, if a file starts at
is the same as
because the minute field However, if the entries are sub hourly, then they seem to be
To be sure, one would need to double check if subhourly data, say at 30 min time stamps, start at Also, because the first entry is for 1:00, and no entry is provided for 0:00, when we convert .epw to .mos, we duplicate the first entry and assign it for t=0. This then makes the file periodic, otherwise it misses one time stamp. |
EPW read support is now available in ModelicaTableAdditions v2.2.0 for MSL v4.0.0. I took ConvertWeatherData.java as inspiration and reimplemented in C. I also noticed that the last data line of the EPW file is not conidered at all. I will tag new version of ModelicaTableAdditions after some feedback. |
ModelicaTableAdditions v2.2.0 is available now. It also considers leap year settings and data. |
Thank you Thomas for this work, and for posting it. Modelon recently ran into a related issue and will give your table implementation a try! |
Hi Matthis, thanks for letting me know. I believe the native EPW support is the real benefit here. Let me also know how your evaluation turned out. In case you like it, I would appreciate if you supported the development through (temporary) sponsorship by https://github.com/sponsors/tbeu. Thanks a lot. |
As a result of
ibpsa/modelica-ibpsa#82 (comment)
we do now have two Weather Data Readers.
The version from Buildings has been added to Annex60 and is therefore now included in BuildingSystems. This Reader reads TMY3 files, converts them to CombiTimeTable format and uses a Bus to distribute the info to components.
BuildingSystems has the netCDF reader from @jraedler , but an old version.
There exists a newer version by @jraedler
https://bitbucket.org/jraedler/ncdatareader2
and there also exists a fork by @tbeu that has been restructured a lot.
https://github.com/tbeu/netCDF-DataReader
The newer netCDF reader can also read HDF5, I believe.
http://www.hdfgroup.org/projects/netCDF-4/
Should the two readers be combined? What is the better weather format, TMY3 or HDF5? Can we support both, if possible with the identical interface to the end user?
The text was updated successfully, but these errors were encountered: