This weather plugin provides compatibility between DIRSIG and the National Solar Radiation Database (NSRDB) System Advisor Model (SAM) comma-separated value (CSV) weather file.
Summary
NSRDB weather files have a number of advantages over DIRSIG’s traditional THERM weather files. The advantages of the NSRDB file are as follows:
-
Offers a full year of weather data, as opposed to the inherent 2 day duration of the THERM weather file.
-
Support for various time resolutions, as opposed to the inherent 15-minute resolution of the THERM weather file.
-
Able to be queried from an API in the required format, no conversions or hand-editing of files is needed.
There are two main components to using the NSRDB weather file integration with DIRSIG:
-
The makewth.py tool, which can be used to acquire NSRDB weather files via the NSRDB API. See the
makewth.py
documentation for more details on how to acquire these weather files. -
The NsrdbWeather plugin, described in this document, which can be used via a JSIM setup to ingest and serve the weather data to DIRSIG5.
Plugin Input
The inputs to the plugin are given via a JSON object embedded directly into the plugin list of a simulation in the JSIM file. Below is an example of the input object:
{
"name": "NsrdbWeather",
"inputs": {
"filename": "rochester2018.csv"
}
}
In the example, filename
is the name of the NSRDB CSV file that has been
acquired for use in this simulation.
Details
Our interpretation of the NSRDB SAM CSV file was derived from the specification found here.
Relevant Fields
The following fields from the NSRDB weather file are used:
NSRDB Field | DIRSIG Field | Required | Assumed Units |
---|---|---|---|
Year |
Local Date/Time |
Y |
N/A |
Month |
Local Date/Time |
Y |
Jan = 1, Dec = 12 |
Day |
Local Date/Time |
Y |
N/A |
Hour |
Local Date/Time |
Y |
24-hour time (first hour is 0) |
Minute |
Local Date/Time |
N |
N/A |
Ambient dry bulb temperature |
Air temperature |
Y |
°C |
Atmospheric pressure |
Air pressure |
Y |
mbar |
Relative humidity |
Relative humidity |
Y |
% |
Wind speed |
Wind speed |
Y |
m/s |
Dew point temperature |
Dew point |
Y |
°C |
Beam normal irradiance |
Direct Insolation |
Y |
W/m^2 |
Diffuse horizontal irradiance |
Diffuse Insolation |
Y |
W/m^2 |
Files missing any required field (any name in the specification is accepted), will result in an error from the plugin.
File Format Assumptions
The following assumptions are made about the file:
-
The file MUST cover a whole year with at least 1-hour, resolution and MUST start on January 1st at 0:00.
-
The file MUST have a constant time resolution over the whole year.
-
Sub-hour resolution is supported, but MUST be a whole factor of 60 such that each hour has the same samples.
These assumptions are not thoroughly checked by the plugin, as they are true on weather files obtained from the API, unless hand-modified. Modifying the files and violating these assumptions may cause the plugin to malfunction. |
Workarounds and Corner Cases
While NSRDB files are a great source of weather data, there are a few corner cases to consider when using them.
-
Use outside of the intended year:
-
Situations may arise where date queries fall outside of the provided year of weather data.
-
January 1st simulation may need to look to the previous year’s December 31st for thermal history.
-
The simulation reference time may also just be in a different year.
-
-
We have chosen to not have this be an error and to simply loop the year’s worth of data.
-
In the case of a leap day (February 29th) query if the source data is not from a leap year, February 28th is used.
-
-
-
Use outside the intended location time/zone:
-
We strongly encourage getting data at or near the simulation’s geodetic location.
-
The location is not checked and there is no error condition for use outside of the time zone.
-
The file is assumed to be in the local time of the simulation and the time zone from the file is discarded.
-
Demos
The WeatherPlugins1
demo gives an example of how to set up the NsrdbWeather
plugin in a JSIM simulation and includes a sample NSRDB CSV weather file.