I don't think "Unit Type" is at fault here for Number of People Schedule, as long as you use either empty, dimensionless
, availability
or controlmode
, you're fine.
Since this can be confusing to track down for anyone who's first digging in the source code, these kind of rules are defined in ScheduleTypeRegistry.cpp. Here's an extract circa L273:
// className, scheduleDisplayName, scheduleRelationshipName, isContinuous, unitType, lowerLimitValue, upperLimitValue;
{"People","Number of People","numberofPeopleSchedule",true,"",0.0,1.0},
{"People","Activity Level","activityLevelSchedule",true,"ActivityLevel",0.0,OptionalDouble()},
{"People","Work Efficiency","workEfficiencySchedule",true,"",0.0,1.0},
{"People","Clothing Insulation","clothingInsulationSchedule",true,"ClothingInsulation",0.0,OptionalDouble()},
So here, you might get that you need a number of people schedule that is Continuous, no Unit Type, and between 0 and 1. Not that simple!
Then it gets a bit trickier, and I'll give you the semi-short story. ScheduleTypeRegistry > isCompatible will:
- Ignore the Numeric Type (
Discrete
or Continuous
) - Check the unit type which in turns calls ScheduleTypeLimits::units, esp L310, which is where you'll see that here really since the
ScheduleTypeRegistry
is expecting empty
for unit type, you could use Dimensionless
, availability
or controlmode
as well. If you use say "Temperature", it won't work. - Check the lower and upper limit values, that must be included in the
[0;1]
interval ([0.3;0.7]
will work). They MUST be set!
Here's some code to play with and to demonstrate what I'm saying:
# Initialize an empty model with a people object
model = OpenStudio::Model::Model.new
people_def = OpenStudio::Model::PeopleDefinition.new(model)
people = OpenStudio::Model::People.new(people_def)
# Create a sch type limits
sch_limit = OpenStudio::Model::ScheduleTypeLimits.new(model)
# THE LIMITS MUST BE SET.
# Above 0.0 included
sch_limit.setLowerLimitValue(0.3)
# Less than 1.0 included
sch_limit.setUpperLimitValue(0.9)
# Whether you include the following two statements or not, it doesn't care
# If you put "Temperature", it'll fail
sch_limit.setUnitType("Dimensionless")
# It should be Continuous but it is ignored...
sch_limit.setNumericType("Discrete")
# Create a schedule and set the schedule type limit
sch = OpenStudio::Model::ScheduleRuleset.new(model)
sch.setScheduleTypeLimits(sch_limit)
# Assign the schedule, and check what the result is:
people.setNumberofPeopleSchedule(sch)
=> true