First time here? Check out the Help page!
1 | initial version |
I'll let someone else address the best approach in EnergyPlus for this, but I wanted to give some advice when for when you write the measure. Basically start simple, with the measure being littler more than a block of hard coded IDF text that gets dropped in. It will pretty quick and will work for what you need. To make it useful for future models, parametric studies, and to share start to expose some variables as user arguments and and in looping and conditional logic as needed. In my example Simple PV E+ measure which was also based on example files I exposed a user argument for shading surface type and then loop through shading surfaces of the correct type.
The one things that makes yours more complex is the connection to the building water system. The simple PV is pretty isolated other than a reference to a surface in the model. It is also more work to do building integrated, but should be possible. I did some initial testing with integrated PV with cavity, but never made a measure with it.
I create an array of strings, and then at the end of the measure make a workspace object out of them. Below is part of the code to show what it looks like
# array to hold new IDF objects needed for PV
string_objects = []
# add PhotovoltaicPerformance:Simple object
string_objects << "
PhotovoltaicPerformance:Simple,
pvPerformanceObject, !- Name
#{fraction_surfacearea_with_pv}, !- Fraction of Surface Area with Active Solar Cells {dimensionless}
Fixed, !- Conversion Efficiency Input Mode
#{value_for_cell_efficiency}; !- Value for Cell Efficiency if Fixed
"
generator_list = []
pv_shading_surfaces.each do |shading_surface|
#set the fields to the values you want
surface_name = shading_surface.getString(0).to_s
gen_name = "gen #{surface_name}".to_s
# add name to generator list array
generator_list << gen_name
# make Generator:Photovoltaic object
string_objects << "
Generator:Photovoltaic,
#{gen_name}, !- Name
#{surface_name}, !- Surface Name ** change to match your surface
PhotovoltaicPerformance:Simple, !- Photovoltaic Performance Object Type
pvPerformanceObject, !- Module Performance Name
Decoupled, !- Heat Transfer Integration Mode
1.0, !- Number of Modules in Parallel {dimensionless}
1.0; !- Number of Modules in Series {dimensionless}
"
end #end of shading surfaces each do
# some more stuff
# add all of the strings to workspace
string_objects.each do |string_object|
idfObject = OpenStudio::IdfObject::load(string_object)
object = idfObject.get
wsObject = workspace.addObject(object)
end
2 | No.2 Revision |
I'll let someone else address the best approach in EnergyPlus for this, but I wanted to give some advice when for when you write the measure. Basically start simple, with the measure being littler little more than a block of hard coded IDF text that gets dropped in. It will pretty quick and will work for what you need. To make it useful for future models, parametric studies, and to share start to expose some variables as user arguments and and in looping and conditional logic as needed. In my example Simple PV E+ measure which was also based on example files I exposed a user argument for shading surface type and then loop through shading surfaces of the correct type.
The one things that makes yours more complex is the connection to the building water system. The simple PV is pretty isolated other than a reference to a surface in the model. It is also more work to do building integrated, but should be possible. I did some initial testing with integrated PV with cavity, but never made a measure with it.
I create an array of strings, and then at the end of the measure make a workspace object out of them. Below is part of the code to show what it looks like
# array to hold new IDF objects needed for PV
string_objects = []
# add PhotovoltaicPerformance:Simple object
string_objects << "
PhotovoltaicPerformance:Simple,
pvPerformanceObject, !- Name
#{fraction_surfacearea_with_pv}, !- Fraction of Surface Area with Active Solar Cells {dimensionless}
Fixed, !- Conversion Efficiency Input Mode
#{value_for_cell_efficiency}; !- Value for Cell Efficiency if Fixed
"
generator_list = []
pv_shading_surfaces.each do |shading_surface|
#set the fields to the values you want
surface_name = shading_surface.getString(0).to_s
gen_name = "gen #{surface_name}".to_s
# add name to generator list array
generator_list << gen_name
# make Generator:Photovoltaic object
string_objects << "
Generator:Photovoltaic,
#{gen_name}, !- Name
#{surface_name}, !- Surface Name ** change to match your surface
PhotovoltaicPerformance:Simple, !- Photovoltaic Performance Object Type
pvPerformanceObject, !- Module Performance Name
Decoupled, !- Heat Transfer Integration Mode
1.0, !- Number of Modules in Parallel {dimensionless}
1.0; !- Number of Modules in Series {dimensionless}
"
end #end of shading surfaces each do
# some more stuff
# add all of the strings to workspace
string_objects.each do |string_object|
idfObject = OpenStudio::IdfObject::load(string_object)
object = idfObject.get
wsObject = workspace.addObject(object)
end
3 | No.3 Revision |
I'll let someone else address the best approach in EnergyPlus for this, but I wanted to give some advice when for when you write the measure. Basically start simple, with the measure being little more than a block of hard coded IDF text that gets dropped in. It will pretty quick and will work for what you need. To make it useful for future models, parametric studies, and to share start to expose some variables as user arguments and and add in looping and conditional logic as needed. In my example Simple PV E+ measure which was also based on example files I exposed a user argument for shading surface type and then loop through shading surfaces of the correct type.
The one things that makes yours more complex is the connection to the building water system. The simple PV is pretty isolated other than a reference to a surface in the model. It is also more work to do building integrated, but should be possible. I did some initial testing with integrated PV with cavity, but never made a measure with it.
I create an array of strings, and then at the end of the measure make a workspace object out of them. Below is part of the code to show what it looks like
# array to hold new IDF objects needed for PV
string_objects = []
# add PhotovoltaicPerformance:Simple object
string_objects << "
PhotovoltaicPerformance:Simple,
pvPerformanceObject, !- Name
#{fraction_surfacearea_with_pv}, !- Fraction of Surface Area with Active Solar Cells {dimensionless}
Fixed, !- Conversion Efficiency Input Mode
#{value_for_cell_efficiency}; !- Value for Cell Efficiency if Fixed
"
generator_list = []
pv_shading_surfaces.each do |shading_surface|
#set the fields to the values you want
surface_name = shading_surface.getString(0).to_s
gen_name = "gen #{surface_name}".to_s
# add name to generator list array
generator_list << gen_name
# make Generator:Photovoltaic object
string_objects << "
Generator:Photovoltaic,
#{gen_name}, !- Name
#{surface_name}, !- Surface Name ** change to match your surface
PhotovoltaicPerformance:Simple, !- Photovoltaic Performance Object Type
pvPerformanceObject, !- Module Performance Name
Decoupled, !- Heat Transfer Integration Mode
1.0, !- Number of Modules in Parallel {dimensionless}
1.0; !- Number of Modules in Series {dimensionless}
"
end #end of shading surfaces each do
# some more stuff
# add all of the strings to workspace
string_objects.each do |string_object|
idfObject = OpenStudio::IdfObject::load(string_object)
object = idfObject.get
wsObject = workspace.addObject(object)
end