Wrap ZoneMRTCalculation - #232
Conversation
…51014f9c0) [x86_64-linux], Rubocop 1.50.0)
|
|
||
| definition2 = OpenStudio::Model::PeopleDefinition.new(model) | ||
| definition2.setNumberofPeople(1.0) | ||
| definition2.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') # SurfaceWeighted, AngleFactor not supported? |
There was a problem hiding this comment.
See https://github.com/NatLabRockies/OpenStudio/blob/develop/src/energyplus/ForwardTranslator/ForwardTranslatePeople.cpp#L109 -- we'll want to wrap that.
| # make a 1 story, 100m X 50m, 5 zone core/perimeter building | ||
| model.add_geometry({ 'length' => 100, | ||
| 'width' => 50, | ||
| 'num_floors' => 1, | ||
| 'floor_to_floor_height' => 4, | ||
| 'plenum_height' => 1, | ||
| 'perimeter_zone_depth' => 3 }) |
There was a problem hiding this comment.
I think you only need one zone here.
There was a problem hiding this comment.
I recan't what I just said. For demo purposes, I think we'd actually like two spaces (if you use 5 that's fine), but assign them to the same thermal zone.
There was a problem hiding this comment.
So here we'd do.
# Get spaces, ordered by name to ensure consistency
spaces = model.getSpaces.sort_by { |s| s.name.to_s }
# collapse all spaces into one thermal zone
thermalZone = nil
spaces.each do |space|
if thermalZone
temp = space.thermalZone.get
space.setThermalZone(thermalZone)
temp.remove
else
thermalZone = space.thermalZone.get
end
end
thermalZone.setName("5 spaces zone")
and we'd add a comment explaining the preconditions you need: people must be unique per space, etc.
| # get all spaces in the zone | ||
| spaces = thermal_zone.spaces.sort_by { |s| s.name.to_s } |
There was a problem hiding this comment.
There's only one space per zone by design.
| # add ASHRAE System type 01, PTAC, Residential | ||
| model.add_hvac({ 'ashrae_sys_num' => '01' }) | ||
|
|
||
| # add thermostats | ||
| model.add_thermostats({ 'heating_setpoint' => 24, | ||
| 'cooling_setpoint' => 28 }) |
There was a problem hiding this comment.
Don't think you need HVAC for your test?
| # mrt weighting factors for people | ||
| peoples = peoples.uniq.sort_by { |p| p.name.to_s } | ||
| peoples.each do |people| | ||
| zonemrtcalc.addMRTWeightingFactor(people, 1.0 / peoples.size) | ||
| end |
There was a problem hiding this comment.
Explain that the sum can't exceed 1.
And probably do a proper demo of the the extensible methods, for example
OpenStudio-resources/model/simulationtests/output_tables.rb
Lines 64 to 99 in a247998
| def test_zonemrtcalculation_rb | ||
| result = sim_test('zonemrtcalculation.rb') | ||
| end |
There was a problem hiding this comment.
Once the ruby one is good, you'll need a py equivalent.
…(caught a few problems while doing so)
|
|
||
| definition2 = openstudio.model.PeopleDefinition(model) | ||
| definition2.setNumberofPeople(1.0) | ||
| definition2.setMeanRadiantTemperatureCalculationType("EnclosureAveraged") # SurfaceWeighted, AngleFactor not supported? |
There was a problem hiding this comment.
Supporting SurfaceWeighted and AngleFactor in NatLabRockies/OpenStudio#5650
| definition1 = OpenStudio::Model::PeopleDefinition.new(model) | ||
| definition1.setNumberofPeople(1.0) | ||
| definition1.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') | ||
| definition1.setThermalComfortModelType(0, 'Fanger') | ||
|
|
||
| people1 = OpenStudio::Model::People.new(definition1) | ||
| people1.setWorkEfficiencySchedule(workeffsch) | ||
| people1.setClothingInsulationSchedule(cloinssch) | ||
| people1.setAirVelocitySchedule(airvelsch) | ||
| people1.setSpace(space) | ||
| peoples << people1 | ||
|
|
||
| definition2 = OpenStudio::Model::PeopleDefinition.new(model) | ||
| definition2.setNumberofPeople(1.0) | ||
| definition2.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') # SurfaceWeighted, AngleFactor not supported? | ||
| definition2.setThermalComfortModelType(0, 'Pierce') | ||
|
|
||
| people2 = OpenStudio::Model::People.new(definition2) | ||
| people2.setWorkEfficiencySchedule(workeffsch) | ||
| people2.setClothingInsulationSchedule(cloinssch) | ||
| people2.setAirVelocitySchedule(airvelsch) | ||
| people2.setSpace(space) | ||
| peoples << people2 |
There was a problem hiding this comment.
Using NatLabRockies/OpenStudio#5650, test all mean radiant temperature calculation types:
| definition1 = OpenStudio::Model::PeopleDefinition.new(model) | |
| definition1.setNumberofPeople(1.0) | |
| definition1.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') | |
| definition1.setThermalComfortModelType(0, 'Fanger') | |
| people1 = OpenStudio::Model::People.new(definition1) | |
| people1.setWorkEfficiencySchedule(workeffsch) | |
| people1.setClothingInsulationSchedule(cloinssch) | |
| people1.setAirVelocitySchedule(airvelsch) | |
| people1.setSpace(space) | |
| peoples << people1 | |
| definition2 = OpenStudio::Model::PeopleDefinition.new(model) | |
| definition2.setNumberofPeople(1.0) | |
| definition2.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') # SurfaceWeighted, AngleFactor not supported? | |
| definition2.setThermalComfortModelType(0, 'Pierce') | |
| people2 = OpenStudio::Model::People.new(definition2) | |
| people2.setWorkEfficiencySchedule(workeffsch) | |
| people2.setClothingInsulationSchedule(cloinssch) | |
| people2.setAirVelocitySchedule(airvelsch) | |
| people2.setSpace(space) | |
| peoples << people2 | |
| surfaces = space.surfaces.sort_by { |s| s.name.to_s } | |
| comfortview = OpenStudio::Model::ComfortViewFactorAngles.new(model) | |
| surfaces.each do |surface| | |
| comfortview.addAngleFactor(surface, 1.0 / surfaces.size) | |
| end | |
| definition1 = OpenStudio::Model::PeopleDefinition.new(model) | |
| definition1.setNumberofPeople(1.0) | |
| definition1.setMeanRadiantTemperatureCalculationType('EnclosureAveraged') | |
| definition1.setThermalComfortModelType(0, 'Fanger') | |
| people1 = OpenStudio::Model::People.new(definition1) | |
| people1.setWorkEfficiencySchedule(workeffsch) | |
| people1.setClothingInsulationSchedule(cloinssch) | |
| people1.setAirVelocitySchedule(airvelsch) | |
| people1.setSpace(space) | |
| peoples << people1 | |
| definition2 = OpenStudio::Model::PeopleDefinition.new(model) | |
| definition2.setNumberofPeople(1.0) | |
| definition2.setMeanRadiantTemperatureCalculationType('SurfaceWeighted') | |
| definition2.setSurfaceNameAngleFactorListName(surfaces[0]) | |
| definition2.setThermalComfortModelType(0, 'Pierce') | |
| people2 = OpenStudio::Model::People.new(definition2) | |
| people2.setWorkEfficiencySchedule(workeffsch) | |
| people2.setClothingInsulationSchedule(cloinssch) | |
| people2.setAirVelocitySchedule(airvelsch) | |
| people2.setSpace(space) | |
| peoples << people2 | |
| definition3 = OpenStudio::Model::PeopleDefinition.new(model) | |
| definition3.setNumberofPeople(1.0) | |
| definition3.setMeanRadiantTemperatureCalculationType('AngleFactor') | |
| definition3.setSurfaceNameAngleFactorListName(comfortview) | |
| definition3.setThermalComfortModelType(0, 'KSU') | |
| people3 = OpenStudio::Model::People.new(definition3) | |
| people3.setWorkEfficiencySchedule(workeffsch) | |
| people3.setClothingInsulationSchedule(cloinssch) | |
| people3.setAirVelocitySchedule(airvelsch) | |
| people3.setSpace(space) | |
| peoples << people3 |
71824d8 to
3363ef3
Compare
|
@joseph-robertson I'm going to merge this one without your last commit, which I extracted to another branch: ComfortViewFactorAngles |
Pull request overview
Companion PR:
Link to relevant GitHub Issue(s) if appropriate:
Link to the Ubuntu 24.04 .deb installer to use for CI Testing. If not set, it will default to latest official release.
[OpenStudio Installer]: http://
This Pull Request is concerning:
NewTest: a new test for a new model API class,TestFix: a fix for an existing test. The GitHub issue should be referenced in the PR descriptionNewTestForExisting: a new test for an already-existing model API classOther: Something else, like maintenance of the repo, or just committing test results with a new OpenStudio version.Depending on your answer, please fill out the required section below, and delete the three others.
Leave the review checklist in place.
Case 1: New test for a new model API class
Please include which class(es) you are adding a test to specifically test for.
Include a link to the OpenStudio Pull Request in which you are adding the new classes, or the class itself if already on develop.
Work Checklist
The following has been checked to ensure compliance with the guidelines:
Tests pass either:
with official OpenStudio release (include version):
AddedOSMhas been added to this PRout.oswhave been committedwith current develop (incude SHA):
PendingOSMhas been added to this PRmodel_tests.rbhas a TODO.out.oswhave been committed as they need to be run with an official OpenStudio versionRuby test is stable: when run multiple times on the same machine, it produces the same total site kBTU.
Please paste the heatmap png generated after running the following commands:
model.getThermalZones.sort_by{|z| z.name.to_s}.each do ...so I am sure I put the same ZoneHVAC systems to the same zones regardless of their order)process_results.py(seepython process_results.py --helpfor usage).Please paste the text output or heatmap png generated after running the following commands:
Object has been added to
autosize_hvac.rbto ensure the autosizedXXX values methods do workCase 2: Fix for an existing test
Please include a link to the specific test you are modifying, and a description of the changes you have made and why they are required.
Work Checklist
The change:
If it affects total site kBTU:
out.oswhave been committed for official OpenStudio versions onlyEither way:
Ruby test is still stable: when run multiple times on the same machine, it produces the same total site kBTU.
model.getThermalZones.sort_by{|z| z.name.to_s}.each do ...so I am sure I put the same ZoneHVAC systems to the same zones regardless of their order)process_results.py(seepython process_results.py --helpfor usage).Please paste the text output or heatmap png generated after running the following commands:
If relevant, new fields that can be autosized have been added to
autosize_hvac.rbto ensure the autosizedXXX values methods do workCase 3: New test for an already-existing model API class
Please include which class(es) you are adding a test to specifically test for as it was currently not being tested for.
Include a link to the OpenStudio model classes themselves.
Work Checklist
The following has been checked to ensure compliance with the guidelines:
Test has been run backwards (see Instructions for Running Docker) for all OpenStudio versions
A Matching OSM test has been added with the output of the ruby test for the oldest OpenStudio release where it passes (include OpenStudio Version)
Ruby test is stable in the last OpenStudio version: when run multiple times on the same machine, it produces the same total site kBTU.
model.getThermalZones.sort_by{|z| z.name.to_s}.each do ...so I am sure I put the same ZoneHVAC systems to the same zones regardless of their order)process_results.py(seepython process_results.py --helpfor usage).Please paste the text output or heatmap png generated after running the following commands:
Object has been added to
autosize_hvac.rbto ensure the autosizedXXX values methods do workCase 4: Other
Please be as explicit as possible about the changes you have made, and why they are warranted.
Review Checklist
# TODOadded tomodel_tests.rbout.oswhave been committedautosize_hvacas appropriateNewTest,TestFix,NewTestForExisting,OtherNewTest: addPendingOSMorAddedOSM