First time here? Check out the Help page!
1 | initial version |
Here's how to use any of the getXXXXByName
methods:
air_loop_name = "my air loop"
# This returns an optional air loop
air_loop = model.getAirLoopByName(air_loop_name)
# If you couldn't find it
if air_loop.empty?
puts "Couldn't match an AirLoopHVAC with the name #{air_loop_name}"
# Otherwise, get it (OptionalAirLoopHVAC > AirLoopHVAC)
else
air_loop = air_loop.get
end
2 | No.2 Revision |
Here's how to use any of the getXXXXByName
methods:methods, which all return an OptionalXXXX
object that you can call empty?
(or is_initialized
) on, and once you made sure it did find it, you can .get
it:
air_loop_name = "my air loop"
# This returns an optional air loop
air_loop = model.getAirLoopByName(air_loop_name)
# If you couldn't find it
if air_loop.empty?
puts "Couldn't match an AirLoopHVAC with the name #{air_loop_name}"
# Otherwise, get it (OptionalAirLoopHVAC > AirLoopHVAC)
else
air_loop = air_loop.get
end
Similarly, air_loop.name
returns an OptionalString
, meaning you need to call either .get
or .to_s
on it in order to get a String
object.
For example, to list all the AirLoopHVAC names in your model:
model.getAirLoopHVACs.each do |loop|
puts loop.name.to_s
end
3 | No.3 Revision |
Here's how to use any of the getXXXXByName
methods, which all return an OptionalXXXX
object that you can call empty?
(or is_initialized
) on, and once you made sure it did find it, you can .get
it:
air_loop_name = "my air loop"
# This returns an optional air loop
air_loop = model.getAirLoopByName(air_loop_name)
# If you couldn't find it
if air_loop.empty?
puts "Couldn't match an AirLoopHVAC with the name #{air_loop_name}"
# Otherwise, get it (OptionalAirLoopHVAC > AirLoopHVAC)
else
air_loop = air_loop.get
// Do Stuff, eg:
puts air_loop.name.to_s
end
Similarly, air_loop.name
returns an OptionalString
, meaning you need to call either .get
or .to_s
on it in order to get a String
object.
For example, to list all the AirLoopHVAC names in your model:
model.getAirLoopHVACs.each do |loop|
puts loop.name.to_s
end