Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
1

Can OpenStudio generate ZoneControl:Thermostat?

asked 2015-08-28 00:14:43 -0600

zhengangzhu's avatar

updated 2015-11-08 11:13:44 -0600

I need to create a thermostat dualsetpoint But when I set ScheduleWeek for the ScheduleYear using C# code it's failed. After reading the source code, the problem is it will check the assumedYear. "if (yd.assumedYear() != untilDate.assumedBaseYear()){ LOG(Error, ..."

First question: Do I need to check the function return value each time? Open Studio does not throw exceptions? If throw where can I know what exceptions may be thrown for each function? How can I get the Open Studio log for debugging like the log in this example?

Second question: I know the assumedyear of the date is 2009. Then I set the yeardescription's assumedyear to 2009 too. The scheduleweek set successfully. Then two scheduleyears set for the OS:ThermostatSetpoint:DualSetpoint. But still no dualsetpoint and zonecontrol:thermostat in the IDF

Third question: What does assumedyear mean? Why do we check this?

edit retag flag offensive close merge delete

Comments

I'm a little confused at your code. The first line looks like ruby, the other lines look like part of a thermal zone object from an osm file?

Make sure that "thermostatDualSetpoint" has valid heating and cooling temperature schedules. If not it is possible that it wouldn't translate as you expect.

David Goldwasser's avatar David Goldwasser  ( 2015-08-28 10:36:28 -0600 )edit

I use the following code to add the schedules. "res1" and "res2" return false while "res3" and "res4" return true. I guess something wrong with the schedules. Open Studio doesn't tell users any message in this case which is not good. Date untilDate = new Date(new MonthOfYear(12), 31); bool res1 = coolScheduleYear.addScheduleWeek(untilDate, coolScheduleWeek); bool res2 = heatScheduleYear.addScheduleWeek(untilDate, heatScheduleWeek); bool res3 = dualSetpoint.setCoolingSetpointTemperatureSchedule(coolScheduleYear); bool res4 = dualSetpoint.setHeatingSetpointTemperatureSchedule(heatScheduleYear)

zhengangzhu's avatar zhengangzhu  ( 2015-08-30 20:50:59 -0600 )edit

Do I need to check the function return value each time? Will Open Studio throw any exceptions?No document or comment explain what exceptions will be thrown

zhengangzhu's avatar zhengangzhu  ( 2015-08-30 21:06:10 -0600 )edit

Add a scheduleweek to a scheduleyear sometimes success sometimes fail. I don't know why. Any restrictions for the scheduleday/scheduleweek?

zhengangzhu's avatar zhengangzhu  ( 2015-08-30 22:40:19 -0600 )edit

Is it because of "if (yd.assumedYear() != untilDate.assumedBaseYear()){ LOG(Error, "Assumed base year " << untilDate.assumedBaseYear() << " of untilDate does not match this model's assumed base year of " << yd.assumedYear()); return false; }"

But I can't get the assumedyear of YearDescription from C#. I know assumedyear of untilDate is 2009. How can I get the Open Studio log?

zhengangzhu's avatar zhengangzhu  ( 2015-08-31 02:16:56 -0600 )edit

I manually set the CalenderYear of YearDescription as 2009. All ScheduleYear setting return true. But there is still no ZoneControl:Thermostat in IDF

zhengangzhu's avatar zhengangzhu  ( 2015-08-31 02:26:37 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-08-31 15:10:20 -0600

For setter methods that return a bool (like addScheduleWeek) the convention is that this will return false if the set fails. Exceptions are typically only thrown in constructors if an object cannot be created correctly.

You can get access to the error and warning messages logged, this unit test shows how to work with the logger.

Finally, the assumed year is an OpenStudio only concept, it does not exist in EnergyPlus. The purpose of this is to ensure that all dates have a year that can be accessed. If you construct a date with only month and day, OpenStudio will assume a year for you using this algorithm. When you are working with dates in your code you just need to be careful to construct all your Date objects in the same way.

edit flag offensive delete link more

Comments

Thanks. But the key issue is not resolved. Dualsetpoint and Zonecontrol:thermostat are not generated while the schedules are generated. At least all the set functions return true

zhengangzhu's avatar zhengangzhu  ( 2015-08-31 19:44:15 -0600 )edit

Hi Macumber, is it possible that all the ScheduleYear/ScheduleWeek/ScheduleDay setting functions return true but the dualsetpoint and zonecontrol:thermostat not translated to IDF? It's difficult to debug what's the root cause? It's just not generated in IDF. I'm using the C# interface. Do you know how to debug it for these cases?

zhengangzhu's avatar zhengangzhu  ( 2015-09-01 20:16:54 -0600 )edit

All schedules in the OSM are translated to IDF. However, thermostats and humidistats are only translated if they are referred to by a ThermalZone:

https://github.com/NREL/OpenStudio/bl...

Did you assign your thermostat to a ThermalZone by calling ThermalZone::setThermostat?

macumber's avatar macumber  ( 2015-09-01 21:25:39 -0600 )edit

Yes. I create a OS:ThermostatSetpoint:DualSetpoint and I can see from the OSM file its been set to the thermozone.

zhengangzhu's avatar zhengangzhu  ( 2015-09-01 21:44:38 -0600 )edit

If the thermostat is assigned to the ThermalZone then I think it should be translated. Are you sharing thermostats between ThermalZones? That is discouraged, instead you should create one thermostat for each ThermalZone. @Kyle Benne you want to add anything?

macumber's avatar macumber  ( 2015-09-01 21:53:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

Stats

Asked: 2015-08-28 00:14:43 -0600

Seen: 406 times

Last updated: Aug 31 '15