Fix #7225 - Add Year field in SQL for DaylightMapHourlyReports#7235
Conversation
|
@jmarrec it has been 20 days since this pull request was last updated. |
|
@jmarrec it has been 7 days since this pull request was last updated. |
1 similar comment
|
@jmarrec it has been 7 days since this pull request was last updated. |
|
@jmarrec it has been 8 days since this pull request was last updated. |
|
@jmarrec it has been 13 days since this pull request was last updated. |
|
@jmarrec it has been 7 days since this pull request was last updated. |
|
@jmarrec it has been 8 days since this pull request was last updated. |
|
@Myoldmopar could you suggest a reviewer please? |
|
@macumber do you envision this causing any issues on OS side? |
|
Don't think so, @jmarrec could check if there is :-) |
|
@Myoldmopar This actually coming from OpenStudio's side, I noticed this daylightmap table was missing the year field while adding the year field to other tables now that it was available, cf NatLabRockies/OpenStudio#3453 More specifically, I should mostly have to revert that commit to get OS to make use of this PR: NatLabRockies/OpenStudio@79ecaa3 |
|
|
||
| // We need DataGlobals::CalendarYear, and not DataEnvironment::Year because | ||
| // otherwise if you run a TMY file, you'll get for eg 1977, 1981, etc | ||
| SQYear = DataGlobals::CalendarYear; |
|
|
||
| sqlite->createSQLiteDaylightMap( | ||
| MapNum, SQMonth, SQDayOfMonth, HourOfDay, IllumMap(MapNum).Xnum, XValue, IllumMap(MapNum).Ynum, YValue, IllumValue); | ||
| MapNum, SQYear, SQMonth, SQDayOfMonth, HourOfDay, IllumMap(MapNum).Xnum, XValue, IllumMap(MapNum).Ynum, YValue, IllumValue); |
There was a problem hiding this comment.
Makes sense, adding a year so it can report.
| const std::string daylightMapHourlyReportsTableSQL = "CREATE TABLE DaylightMapHourlyReports ( " | ||
| "HourlyReportIndex INTEGER PRIMARY KEY, " | ||
| "MapNumber INTEGER, Month INTEGER, DayOfMonth INTEGER, Hour INTEGER, " | ||
| "MapNumber INTEGER, Year INTEGER, Month INTEGER, DayOfMonth INTEGER, Hour INTEGER, " |
There was a problem hiding this comment.
Of course the SQL will need a new argument
| sqliteExecuteCommand(daylightMapHourlyReportsTableSQL); | ||
|
|
||
| const std::string daylightMapHourlyTitleInsertSQL = "INSERT INTO DaylightMapHourlyReports VALUES(?,?,?,?,?);"; | ||
| const std::string daylightMapHourlyTitleInsertSQL = "INSERT INTO DaylightMapHourlyReports VALUES(?,?,?,?,?,?);"; |
| sqliteBindInteger(m_daylightMapHourlyTitleInsertStmt, 3, month); | ||
| sqliteBindInteger(m_daylightMapHourlyTitleInsertStmt, 4, dayOfMonth); | ||
| sqliteBindInteger(m_daylightMapHourlyTitleInsertStmt, 5, hourOfDay); | ||
| int b = 0; |
There was a problem hiding this comment.
Sure, it's reasonable to use a counter here instead of manually persisting the order.
|
|
||
| ASSERT_EQ(1ul, daylightMapHourlyReports.size()); | ||
| std::vector<std::string> daylightMapHourlyReport0{"1", "1", "7", "21", "5"}; | ||
| std::vector<std::string> daylightMapHourlyReport0{"1", "1", "2005", "7", "21", "5"}; |
Pull request overview
Fix #7225 - Add Year field in SQL for DaylightMapHourlyReports
I also have uploaded a supporting file to
EnergyPlusDevSupport/DefectFiles/7000s/7225if you want to look at a multiyear sql output.Work Checklist
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Review Checklist
This will not be exhaustively relevant to every PR.