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

Revision history [back]

To build upon @mdahlausen's answer, here's what I've been doing:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. You have several lines that have the same "model_space_name"
  • Use Roo to parse the Excel spreadsheet. You could also just export your spreadsheet to CSV and use the built-in CSV module.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows, use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
  • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times (new_value = old_value * daily_h * 365 / eflh.to_f)

To build upon @mdahlausen's answer, here's what I've been doing:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. You can have several lines that have the same "model_space_name""model_space_name", the space will then get multiple Lights objects.
  • Use Roo to parse the Excel spreadsheet. You could also just export your spreadsheet to CSV and use the built-in CSV module.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows, rows (from Excel), use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
  • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times (new_value = old_value * daily_h * 365 / eflh.to_f)).
  • I renamed the cloned schedule like #{light_sch.name} - #{hours}, so that in the loop I can test whether I already created it or not to avoid duplicating it many times unecessarily.

To build upon @mdahlausen's answer, here's what I've been doing:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. You can have several lines that have the same "model_space_name", the space will then get multiple Lights objects.
  • Use Roo to parse the Excel spreadsheet. You could also just export your spreadsheet to CSV and use the built-in CSV module.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows (from Excel), use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
  • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times (new_value = old_value * daily_h * 365 / eflh.to_f).
  • I renamed the cloned schedule like #{light_sch.name} - #{hours}#{daily_h} hrs/day, so that in the loop I can test whether I already created it or not to avoid duplicating it many times unecessarily.unnecessarily.

To build upon @mdahlausen's @mdahlhausen's answer, here's what I've been doing:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. You can have several lines that have the same "model_space_name", the space will then get multiple Lights objects.
  • Use Roo to parse the Excel spreadsheet. You could also just export your spreadsheet to CSV and use the built-in CSV module.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows (from Excel), use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
  • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times (new_value = old_value * daily_h * 365 / eflh.to_f).
  • I renamed the cloned schedule like #{light_sch.name} - #{daily_h} hrs/day, so that in the loop I can test whether I already created it or not to avoid duplicating it many times unnecessarily.

To build upon @mdahlhausen's answer, here's what I've been doing:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. You can have several lines that have the same "model_space_name", the space will then get multiple Lights objects.
  • Use Roo to parse the Excel spreadsheet. You could also just export your spreadsheet to CSV and use the built-in CSV module.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows (from Excel), use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
  • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times day_sch.times.with_index (new_value = old_value * daily_h * 365 / eflh.to_f).
  • I renamed Neat trick: I rename the cloned schedule like #{light_sch.name} - #{daily_h} hrs/day, so that in the loop I can test whether I already created it or not to avoid duplicating it many times unnecessarily.

To build upon @mdahlhausen's answer, answer in more specific terms, here's what I've been doing:doing to automate this stuff:

  • Create a spreadsheet with columns ["model_space_name", "watt", "hours"]. "hours"].
    • You can have several lines that have the same "model_space_name", the space will then get multiple Lights objects.objects.
    • You could also include your multiplier here if you wanted to... In my spreadsheet I actually have more columns, for eg Fixture (eg 'Fluorescent Linear T8 590mm, 2-18 Watt, electronic ballast'), Count, W/fixture and I calculate "watt" by doing Count times W/fixture
  • Use Roo to parse the Excel spreadsheet. spreadsheet
    • I find this convenient exactly because I have multiple columns and formulas and I don't need to export a CSV each time I change it.
    • You could also just export your spreadsheet to CSV and use the built-in CSV module.module if you find this easier.
  • Define a ScheduleRuset in my model to use as a default profile. That would be SecondarySchool Bldg Light in your example, let's call it light_sch going forward
  • Loop on parsed rows (from Excel),
    • use model.getSpaceByName(row["model_space_name"]).get to get the corresponding space, and create a new lighting object (you need to create a OpenStudio::Model::LightsDefinition and a OpenStudio::Model::Lights that references it).
    • The real key point here is to scale to the SecondarySchool Bldg Light to get the correct number of hours while maintaining the same profile. For this, I leverage openstudio-standards' ScheduleRuleset.annual_equivalent_full_load_hrs. I store the initial eflh = light_sch.annual_equivalent_full_load_hrs. For the lighting objects, I clone this schedule, get the ScheduleDay attached to it (it helps if there's only one...) and scale each value entered accordingly by looping on day_sch.times.with_index (new_value = old_value * daily_h * 365 / eflh.to_f).
    • Neat trick: I rename the cloned schedule like #{light_sch.name} - #{daily_h} hrs/day, so that in the loop I can test whether I already created it or not to avoid duplicating it many times unnecessarily.