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

Revision history [back]

click to hide/show revision 1
initial version

I am currently trying to do the exact same thing, and am encountering the exact same issue. If you have any insight into this, happy to discuss.

I am currently trying to do the exact same thing, used the following code to generate the defrost schedule for the air chiller object. For refrigerated warehouse a more frequent defrost schedule than typical may be required.

note: generative A.I. was used to inform this code.

#create a defrost_schedule using ScheduleRuleset
defrost_schedule = OpenStudio::Model::ScheduleRuleset.new(model)
defrost_schedule.setName("Frequent Defrost Schedule")
default_day = defrost_schedule.defaultDaySchedule
default_day.setName("Default Day Schedule")

# Define hourly values for the default day with six defrost cycles per day # Each cycle lasts for 30 minutes and am encountering the exact same issue. If you have any insight into this, happy to discuss.occurs every 4 hours default_day.addValue(OpenStudio::Time.new(0, 0, 0, 0), 0.0) # Start with no defrost default_day.addValue(OpenStudio::Time.new(0, 0, 30, 0), 1.0) # Defrost from 12:00 AM to 12:30 AM default_day.addValue(OpenStudio::Time.new(0, 4, 0, 0), 0.0) # No defrost from 12:30 AM to 4:00 AM default_day.addValue(OpenStudio::Time.new(0, 4, 30, 0), 1.0) # Defrost from 4:00 AM to 4:30 AM default_day.addValue(OpenStudio::Time.new(0, 8, 0, 0), 0.0) # No defrost from 4:30 AM to 8:00 AM default_day.addValue(OpenStudio::Time.new(0, 8, 30, 0), 1.0) # Defrost from 8:00 AM to 8:30 AM default_day.addValue(OpenStudio::Time.new(0, 12, 0, 0), 0.0) # No defrost from 8:30 AM to 12:00 PM default_day.addValue(OpenStudio::Time.new(0, 12, 30, 0), 1.0) # Defrost from 12:00 PM to 12:30 PM default_day.addValue(OpenStudio::Time.new(0, 16, 0, 0), 0.0) # No defrost from 12:30 PM to 4:00 PM default_day.addValue(OpenStudio::Time.new(0, 16, 30, 0), 1.0) # Defrost from 4:00 PM to 4:30 PM default_day.addValue(OpenStudio::Time.new(0, 20, 0, 0), 0.0) # No defrost from 4:30 PM to 8:00 PM default_day.addValue(OpenStudio::Time.new(0, 20, 30, 0), 1.0) # Defrost from 8:00 PM to 8:30 PM default_day.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0.0) # No defrost from 8:30 PM to 12:00 AM

I used the following code to generate the defrost schedule for the air chiller object. For refrigerated warehouse a more frequent defrost schedule than typical may be required.

note: generative A.I. was used to inform this code.

#create a defrost_schedule using ScheduleRuleset
defrost_schedule = OpenStudio::Model::ScheduleRuleset.new(model)
defrost_schedule.setName("Frequent Defrost Schedule")
default_day = defrost_schedule.defaultDaySchedule
default_day.setName("Default Day Schedule")

# Define hourly values for the default day with six defrost cycles per day # Each cycle lasts for 30 minutes and occurs every 4 hours default_day.addValue(OpenStudio::Time.new(0, 0, 0, 0), 0.0) # Start with no defrost default_day.addValue(OpenStudio::Time.new(0, 0, 30, 0), 1.0) # Defrost from 12:00 AM to 12:30 AM default_day.addValue(OpenStudio::Time.new(0, 4, 0, 0), 0.0) # No defrost from 12:30 AM to 4:00 AM default_day.addValue(OpenStudio::Time.new(0, 4, 30, 0), 1.0) # Defrost from 4:00 AM to 4:30 AM default_day.addValue(OpenStudio::Time.new(0, 8, 0, 0), 0.0) # No defrost from 4:30 AM to 8:00 AM default_day.addValue(OpenStudio::Time.new(0, 8, 30, 0), 1.0) # Defrost from 8:00 AM to 8:30 AM default_day.addValue(OpenStudio::Time.new(0, 12, 0, 0), 0.0) # No defrost from 8:30 AM to 12:00 PM default_day.addValue(OpenStudio::Time.new(0, 12, 30, 0), 1.0) # Defrost from 12:00 PM to 12:30 PM default_day.addValue(OpenStudio::Time.new(0, 16, 0, 0), 0.0) # No defrost from 12:30 PM to 4:00 PM default_day.addValue(OpenStudio::Time.new(0, 16, 30, 0), 1.0) # Defrost from 4:00 PM to 4:30 PM default_day.addValue(OpenStudio::Time.new(0, 20, 0, 0), 0.0) # No defrost from 4:30 PM to 8:00 PM default_day.addValue(OpenStudio::Time.new(0, 20, 30, 0), 1.0) # Defrost from 8:00 PM to 8:30 PM default_day.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0.0) # No defrost from 8:30 PM to 12:00 AM

I used the following code to generate the defrost schedule for the air chiller object. For refrigerated warehouse a more frequent defrost schedule than typical may be required.

note: generative A.I. was used to inform this code.

#create # Create a defrost_schedule new defrost schedule using ScheduleRuleset
ScheduleCompact
defrost_schedule = OpenStudio::Model::ScheduleRuleset.new(model)
defrost_schedule.setName("Frequent OpenStudio::Model::ScheduleCompact.new(model)
defrost_schedule.setName("RefrigeratedWarehouse.idf Defrost Schedule")
default_day 
# Set schedule type limits
discrete_type_limits = defrost_schedule.defaultDaySchedule
default_day.setName("Default Day Schedule")
OpenStudio::Model::ScheduleTypeLimits.new(model)
discrete_type_limits.setName("ON/OFF")
discrete_type_limits.setLowerLimitValue(0)
discrete_type_limits.setUpperLimitValue(1)
discrete_type_limits.setNumericType("Discrete")
defrost_type_limits = discrete_type_limits
defrost_schedule.setScheduleTypeLimits(defrost_type_limits)

# Define the schedule values using Schedule:Compact format
# Defrost schedule matches AirChillerDefrostSched1 in RefrigeratedWarehouse.idf
defrost_schedule.addValue("Through: 12/31")
defrost_schedule.addValue("For: AllDays")
defrost_schedule.addValue("Until: 05:00", 0) 
defrost_schedule.addValue("Until: 05:20", 1)
defrost_schedule.addValue("Until: 22:00", 0)
defrost_schedule.addValue("Until: 22:40", 1)
defrost_schedule.addValue("Until: 24:00", 0)

# Create an air chiller using defrost_schedule above
air_chiller = OpenStudio::Model::RefrigerationAirChiller.new(model, defrost_schedule)

# Define hourly values for the default day with six defrost cycles per day # Each cycle lasts for 30 minutes and occurs every 4 hours default_day.addValue(OpenStudio::Time.new(0, 0, 0, 0), 0.0) # Start with no defrost default_day.addValue(OpenStudio::Time.new(0, 0, 30, 0), 1.0) # Defrost from 12:00 AM to 12:30 AM default_day.addValue(OpenStudio::Time.new(0, 4, 0, 0), 0.0) # No defrost from 12:30 AM to 4:00 AM default_day.addValue(OpenStudio::Time.new(0, 4, 30, 0), 1.0) # Defrost from 4:00 AM to 4:30 AM default_day.addValue(OpenStudio::Time.new(0, 8, 0, 0), 0.0) # No defrost from 4:30 AM to 8:00 AM default_day.addValue(OpenStudio::Time.new(0, 8, 30, 0), 1.0) # Defrost from 8:00 AM to 8:30 AM default_day.addValue(OpenStudio::Time.new(0, 12, 0, 0), 0.0) # No defrost from 8:30 AM to 12:00 PM default_day.addValue(OpenStudio::Time.new(0, 12, 30, 0), 1.0) # Defrost from 12:00 PM to 12:30 PM default_day.addValue(OpenStudio::Time.new(0, 16, 0, 0), 0.0) # No defrost from 12:30 PM to 4:00 PM default_day.addValue(OpenStudio::Time.new(0, 16, 30, 0), 1.0) # Defrost from 4:00 PM to 4:30 PM default_day.addValue(OpenStudio::Time.new(0, 20, 0, 0), 0.0) # No defrost from 4:30 PM to 8:00 PM default_day.addValue(OpenStudio::Time.new(0, 20, 30, 0), 1.0) # Defrost from 8:00 PM to 8:30 PM default_day.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0.0) # No defrost from 8:30 PM to 12:00 AM