Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

90.1 PRM: Redundant SpaceType Lights schedule created for each Space in SpaceType #1527

Closed
eringold opened this issue Jun 7, 2023 · 1 comment
Labels
AppendixG Methods to enable the Appendix G model workflow

Comments

@eringold
Copy link
Collaborator

eringold commented Jun 7, 2023

@dmaddoxwhite @lymereJ @weilixu

I'm getting multiple redundant lighting schedules created in the stable PRM baseline model, it looks like one per instance of Space in each SpaceType:
image

I think this is due to the logic in ashrae_90_1_prm.SpaceType space_type_light_sch_change. For each space, the SpaceType lights schedule is retrieved, then the name changed, then it checks whether the new name is in schedule_hash, and if not the schedule is copied and assigned again to the Lights, and the new name added to schedule_hash. Because the name is changed before it's checked, the else branch will run and a new copy will always happen for each space:

def space_type_light_sch_change(model)
# set schedule for lighting
schedule_hash = {}
model.getSpaces.each do |space|
space_type = space.spaceType.get
if space_type.hasAdditionalProperties && space_type.additionalProperties.hasFeature('regulated_lights_name')
lights_name = space_type.additionalProperties.getFeatureAsString('regulated_lights_name').to_s
ltg = space_type.model.getLightsByName(lights_name).get
if ltg.schedule.is_initialized
ltg_schedule = ltg.schedule.get
ltg_schedule_name = ltg_schedule.name
occupancy_sensor_credit = space.additionalProperties.getFeatureAsDouble('occ_control_credit')
new_ltg_schedule_name = format("#{ltg_schedule_name}_%.4f", occupancy_sensor_credit)
if schedule_hash.key?(new_ltg_schedule_name)
# In this case, there is a schedule created, can retrieve the schedule object and reset in this space type
schedule_rule = schedule_hash[new_ltg_schedule_name]
ltg.setSchedule(schedule_rule)
else
# In this case, create a new schedule
# 1. Clone the existing schedule
new_rule_set_schedule = deep_copy_schedule(new_ltg_schedule_name, ltg_schedule, occupancy_sensor_credit, model)
if ltg.setSchedule(new_rule_set_schedule)
schedule_hash[new_ltg_schedule_name] = new_rule_set_schedule
end
end
end
end
end
end

Basically I think

should be

if schedule_hash.key?(ltg_schedule_name)
@eringold eringold changed the title 90.1 PRM: New Lights schedule created for each Space in SpaceType 90.1 PRM: Redundant SpaceType Lights schedule created for each Space in SpaceType Jun 7, 2023
@lymereJ lymereJ added the AppendixG Methods to enable the Appendix G model workflow label Jun 7, 2023
@weilixu
Copy link
Collaborator

weilixu commented Aug 31, 2023

@eringold thanks for reporting. This issue will be addressed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AppendixG Methods to enable the Appendix G model workflow
Projects
None yet
Development

No branches or pull requests

3 participants