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

How to create measure for replacing Occupancy Schedule with CSV file?

asked 2019-01-07 06:28:10 -0600

kapils16's avatar

updated 2019-01-07 11:43:52 -0600

I am modeling Airport building for my project. Each zone in building has different occupancy schedule. This occupancy schedule is created with pedestrian simulation software. The pedestrian occupancy software gives occupancy data in a csv format for every zone. I want to create a measure to replace the Occupancy schedule with the CSV input file. The occupancy Schedule is Day schedule.

edit retag flag offensive close merge delete

Comments

1

@kapils16 Just out of interest. I typically think of pedestrian simulations for emergency egress analysis vs. 8760 simulation, but I guess for transportation hubs, stadiums, theaters, or anywhere where queue management is important you may run simulation full time series for at least specific event days. Is historical data (or future flight growth projections) being used for the changes in flow patterns for different days of the week and times of year? Just wondering about the source of the data, and outside of EnergyAnalysis/SystemSizing, what the full year occupancy simulation is used for.

David Goldwasser's avatar David Goldwasser  ( 2019-01-07 13:02:00 -0600 )edit
1

Since I am considering the Airport terminal which characterized by fluctuating occupancy. I am simulating the pedestrian movement across various zone such as Check in Halls, Hold-rooms, security checks etc. according to the service time. This would give me occupancy variation throughout the day. For this I am using AnyLogic Software.

kapils16's avatar kapils16  ( 2019-01-07 23:41:15 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2019-01-07 12:46:16 -0600

updated 2019-01-09 10:57:51 -0600

@kapils16 it is great to see cross simulation data being used in this way. Prior to OpenStudio 2.7.0 you would have to write this as an EnergyPlus measure to use it with OpenStudio, but scheduleFile is now part of the OpenStudio SDK. Your code would look something like this

Note: Code updated to correctly use externalFile object instead of string with scheduleFile. externalFile copies the referenced file into the models "files" directory making the file easier to find at run time and more transportable. If the CSV is not found this will fail. This function works in OpenStudio 2.7.0, but there were fixes in 2.7.1 related to its use in Apply Measures Now in the OpenStudio application. If you are using it in that way, please update to 2.7.1.

ext_file = OpenStudio::Model::ExternalFile::getExternalFile(model,"/Users/myusername/Documents/temp.csv")
if ext_file.is_initialized
  ext_file = ext_file.get
else
  puts "Warning, could not find file"
  runner.registerError("File could not be found and can not be assigned to ScheduleFile objects")
  return false
end
model.getSpaces.each do |space|
  space.people.each do |people|
    # arguments are file, column, rows to skip
    schedule_file_new = OpenStudio::Model::ScheduleFile.new(ext_file,25,1)
    people.setNumberofPeopleSchedule(schedule_file_new)
  end
end

The code above assumes you have a fractional schedule associated with the design level of people for each space in the OpenStudio model. If your CSV file contains actual number of people, then you are still fine, you just need to add more code before you loop through people. Use standard ruby methods to create a new copy of the ped_sim_raw.csvfile. Set the first row to the maximum number of people found in the column. Next convert all raw entries to a fractional value based on the maximum value. You could create a unique people object for each space, but a cleaner approach would be to create a people definition that represents a single person. If your pedestrian simulation supports it you can have different people types with different activity levels. When you loop through the people objects in each space you can set the multiplier based on the maximum value from for that column from the raw data, or saved in the top of fractional csv. Code to change multiplier would look like this.

people.setMultiplier(max_num_people_for_room_from_ped_sim)

Here is a link to the OpenStudio API documentation for scheduleFile. The fields should be similar to what is in the EnergyPlus ScheudleFile object.

edit flag offensive delete link more

Comments

1

If you want to go for tighter integration, if you pedestrian simulation software has a command line interface, you could have it directly update and run the OpenStudio models. Conversely if the pedestrian simulation can be run from a command line, then OpenStudio could run the pedestrian simulation to make sure CSV is of most current data. Neither of these are necessary, just running pedestrian simulation then OpenStudio simulation is already pretty clean, but it would be cool to have changes to inputs on pedestrian simulation provide feedback on annual energy consumption and peak load.

David Goldwasser's avatar David Goldwasser  ( 2019-01-07 13:14:08 -0600 )edit

Thank you very much for your prompt and comprehensive response. Will surely get back to you about the progress. Thank you.

kapils16's avatar kapils16  ( 2019-01-07 23:34:02 -0600 )edit

@David Goldwasser, I am new to custom measure writing in openstudio. On the basis of my initial learnings I have developed a script for the same task. There is some problem in my code. Could you be able to see.

kapils16's avatar kapils16  ( 2019-01-08 10:34:19 -0600 )edit

@kapils16 if you add the relevant code to your question and the ruby error or simulation issue you are seeing, I can take a look.

David Goldwasser's avatar David Goldwasser  ( 2019-01-08 11:31:28 -0600 )edit

For assigning the Schedule I am using this codes in runner

model.getSpaces.each do |space|
  # arguments are file, column, rows to skip
  if space.name.get.match("CheckIn")
    space.people.each do |people|
      schedule_file_new = OpenStudio::Model::ScheduleFile.new("occ_filename",25,1)
      people.setNumberofPeopleSchedule(schedule_file_new)
    end
  end
end
kapils16's avatar kapils16  ( 2019-01-08 22:50:48 -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

3 followers

Stats

Asked: 2019-01-07 06:28:10 -0600

Seen: 705 times

Last updated: Jan 09 '19