First time here? Check out the Help page!
1 | initial version |
By getting, I assume you mean via the OpenStudio API (e.g., a Ruby script). A bare-bones example of one way to do it (first make sure you can access the OpenStudio Ruby gem):
require "openstudio"
# Load in memory OpenStudio Model (a "warehouse" example):
translator = OpenStudio::OSVersion::VersionTranslator.new
file = "warehouse.osm"
path = OpenStudio::Path.new(File.dirname(__FILE__) + file)
model = translator.loadModel(path)
raise "Invalid OSM" if model.empty?
model = os_model.get
At this point, you should have access to a valid OSM, which you can probe with the API. You'll find many examples here at UnmetHours like this.
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
zones = model.getThermalZones
Note the pattern between the get prefix and the class name e.g. getThermalZones. You can then retrieve objects attributes e.g.
zones.each do |zone|
puts zone.nameString
puts zone.multiplier
end
Loops are neat/safe - the object may be empty (i.e. no zones in the OSM). Otherwise, one needs to pay attention to optional attributes (such as ThermalZone volume, which may not be initialized). Again, lots of examples on how to do this at UnmetHours, within OpenStudio Measures, etc.
You can also retrieve all model objects at once, then try to convert them into specific objects like the ones above.
2 | No.2 Revision |
Rereading your question, you seem specifically interested in getting/generating a single structure/file with all OpenStudio nested classes/methods. I'm not sure if that exists in one file. Following a somewhat similar approach to what's described below, you could script your way to a solution by initializing a single instance of each upper class object, and recursively looping through each class method; then through derived classes; and so on. Some effort, but manageable e.g.
point3D = OpenStudio::Point3d.new(0, 0, 0)
puts point3D.public_methods(false)
puts point3D.instance_methods(false)
--- original answer ---
By getting, I assume you mean via the OpenStudio API (e.g., a Ruby script). A bare-bones example of one way to do it (first make sure you can access the OpenStudio Ruby gem):
require "openstudio"
# Load in memory OpenStudio Model (a "warehouse" example):
translator = OpenStudio::OSVersion::VersionTranslator.new
file = "warehouse.osm"
path = OpenStudio::Path.new(File.dirname(__FILE__) + file)
model = translator.loadModel(path)
raise "Invalid OSM" if model.empty?
model = os_model.get
At this point, you should have access to a valid OSM, which you can probe with the API. You'll find many examples here at UnmetHours like this.
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
zones = model.getThermalZones
Note the pattern between the get prefix and the class name e.g. getThermalZones. You can then retrieve objects attributes e.g.
zones.each do |zone|
puts zone.nameString
puts zone.multiplier
end
Loops are neat/safe - the object may be empty (i.e. no zones in the OSM). Otherwise, one needs to pay attention to optional attributes (such as ThermalZone volume, which may not be initialized). Again, lots of examples on how to do this at UnmetHours, within OpenStudio Measures, etc.
You can also retrieve all model objects at once, then try to convert them into specific objects like the ones above.
3 | No.3 Revision |
Rereading your question, you seem specifically interested in getting/generating a single structure/file with all OpenStudio nested classes/methods. I'm not sure if that exists in one file. Following a somewhat similar approach to what's described below, you could script your way to a solution by initializing a single instance of each upper class object, and recursively looping through each class method; method/member; then go through derived classes; and so on. Some effort, but manageable on; e.g.
point3D = OpenStudio::Point3d.new(0, 0, 0)
puts point3D.public_methods(false)
puts point3D.instance_methods(false)
Some effort (!), but manageable.
--- original answer ---
By getting, I assume you mean via the OpenStudio API (e.g., a Ruby script). A bare-bones example of one way to do it (first make sure you can access the OpenStudio Ruby gem):
require "openstudio"
# Load in memory OpenStudio Model (a "warehouse" example):
translator = OpenStudio::OSVersion::VersionTranslator.new
file = "warehouse.osm"
path = OpenStudio::Path.new(File.dirname(__FILE__) + file)
model = translator.loadModel(path)
raise "Invalid OSM" if model.empty?
model = os_model.get
At this point, you should have access to a valid OSM, which you can probe with the API. You'll find many examples here at UnmetHours like this.
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
zones = model.getThermalZones
Note the pattern between the get prefix and the class name e.g. getThermalZones. You can then retrieve objects attributes e.g.
zones.each do |zone|
puts zone.nameString
puts zone.multiplier
end
Loops are neat/safe - the object may be empty (i.e. no zones in the OSM). Otherwise, one needs to pay attention to optional attributes (such as ThermalZone volume, which may not be initialized). Again, lots of examples on how to do this at UnmetHours, within OpenStudio Measures, etc.
You can also retrieve all model objects at once, then try to convert them into specific objects like the ones above.
4 | No.4 Revision |
Rereading your question, you seem specifically interested in getting/generating a single structure/file with all OpenStudio nested classes/methods. I'm not sure if that exists in one file. Following a somewhat similar approach to what's described below, you could script your way to a solution by initializing a single instance of each upper class object, and recursively looping through each class method/member; then go through derived classes; and so on; e.g.
point3D = OpenStudio::Point3d.new(0, 0, 0)
puts point3D.public_methods(false)
or
puts point3D.instance_methods(false)
OpenStudio::Point3d.instance_methods(false)
Some effort (!), but manageable.
--- original answer ---
By getting, I assume you mean via the OpenStudio API (e.g., a Ruby script). A bare-bones example of one way to do it (first make sure you can access the OpenStudio Ruby gem):
require "openstudio"
# Load in memory OpenStudio Model (a "warehouse" example):
translator = OpenStudio::OSVersion::VersionTranslator.new
file = "warehouse.osm"
path = OpenStudio::Path.new(File.dirname(__FILE__) + file)
model = translator.loadModel(path)
raise "Invalid OSM" if model.empty?
model = os_model.get
At this point, you should have access to a valid OSM, which you can probe with the API. You'll find many examples here at UnmetHours like this.
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
zones = model.getThermalZones
Note the pattern between the get prefix and the class name e.g. getThermalZones. You can then retrieve objects attributes e.g.
zones.each do |zone|
puts zone.nameString
puts zone.multiplier
end
Loops are neat/safe - the object may be empty (i.e. no zones in the OSM). Otherwise, one needs to pay attention to optional attributes (such as ThermalZone volume, which may not be initialized). Again, lots of examples on how to do this at UnmetHours, within OpenStudio Measures, etc.
You can also retrieve all model objects at once, then try to convert them into specific objects like the ones above.
5 | No.5 Revision |
Rereading your question, you seem specifically interested in getting/generating a single structure/file with all OpenStudio nested classes/methods. I'm not sure if that exists in one file. Following a somewhat similar approach to what's described below, you could script your way to a solution by initializing a instantiating single instance instances of each upper class object, and recursively looping through each class object method/member; then go through derived classes; and so on; e.g.
point3D = OpenStudio::Point3d.new(0, 0, 0)
puts point3D.public_methods(false)
oror simply
puts OpenStudio::Point3d.instance_methods(false)
Some effort (!), but manageable.
--- original answer ---
By getting, I assume you mean via the OpenStudio API (e.g., a Ruby script). A bare-bones example of one way to do it (first make sure you can access the OpenStudio Ruby gem):
require "openstudio"
# Load in memory OpenStudio Model (a "warehouse" example):
translator = OpenStudio::OSVersion::VersionTranslator.new
file = "warehouse.osm"
path = OpenStudio::Path.new(File.dirname(__FILE__) + file)
model = translator.loadModel(path)
raise "Invalid OSM" if model.empty?
model = os_model.get
At this point, you should have access to a valid OSM, which you can probe with the API. You'll find many examples here at UnmetHours like this.
air_loops = model.getAirLoopHVACs
plant_loops = model.getPlantLoops
zones = model.getThermalZones
Note the pattern between the get prefix and the class name e.g. getThermalZones. You can then retrieve objects attributes e.g.
zones.each do |zone|
puts zone.nameString
puts zone.multiplier
end
Loops are neat/safe - the object may be empty (i.e. no zones in the OSM). Otherwise, one needs to pay attention to optional attributes (such as ThermalZone volume, which may not be initialized). Again, lots of examples on how to do this at UnmetHours, within OpenStudio Measures, etc.
You can also retrieve all model objects at once, then try to convert them into specific objects like the ones above.