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

Revision history [back]

When I try to run your measure, I get the following error message: .../user_script.rb:111:in 'run': undefined method 'inletModelObject' for # (NoMethodError) which tells me that at line 111 when you try to 'get the nodes before and after the SetpointManager on the loop', something is wrong. As it turns out, a SetpointManager does not exist as an object between two nodes on a loop, it is rather assigned to a particular node. Looking at the documentation for the SetpointManagerScheduled class, you'll see a method called setpointNode, which "returns the node referred to by the SetpointNodeName field", i.e. the node the SPM is assigned to.

So that makes it easy to finish out your measure. If you replace lines 111-116 with the following, it should work:

# get the node the selected spm is assigned to
node = selected_setpoint_manager.setpointNode.get
# remove selected, so you don't double up spm's on the node
selected_setpoint_manager.remove
# apply the new spm
new_setpoint_manager.addToNode(node)

When I try to run your measure, I get the following error message: .../user_script.rb:111:in 'run': undefined method 'inletModelObject' for # (NoMethodError) which tells me that at line 111 when you try to 'get the nodes before and after the SetpointManager on the loop', something is wrong. As it turns out, a SetpointManager does not exist as an object between two nodes on a loop, it is rather assigned to a particular node. Looking at the documentation for the SetpointManagerScheduled class, you'll see first if you look click the box at the top to 'List all members' you won't find the inletModelObject method, which explains the error - the method you're calling doesn't exist for that class. However, there is a method for that class called setpointNode, which "returns the node referred to by the SetpointNodeName field", i.e. the node the SPM is assigned to.

So that makes it easy to finish out your measure. If you replace lines 111-116 with the following, it should work:

# get the node the selected spm is assigned to
node = selected_setpoint_manager.setpointNode.get
# remove selected, so you don't double up spm's on the node
selected_setpoint_manager.remove
# apply the new spm
new_setpoint_manager.addToNode(node)

When I try to run your measure, I get the following error message: .../user_script.rb:111:in 'run': undefined method 'inletModelObject' for # (NoMethodError) which tells me that at line 111 when you try to 'get the nodes before and after the SetpointManager on the loop', something is wrong. As it turns out, a SetpointManager does not exist as an object between two nodes on a loop, it is rather assigned to a particular node. Looking at the documentation for the SetpointManagerScheduled class, first if you look click the box at the top to 'List all members' you won't find the inletModelObject method, method listed, which explains the error - error: the method you're calling doesn't exist for that class. However, there is a method for that class called setpointNode, which "returns the node referred to by the SetpointNodeName field", i.e. the node the SPM is assigned to.

So that makes it easy to finish out your measure. If you replace lines 111-116 with the following, it should work:

# get the node the selected spm is assigned to
node = selected_setpoint_manager.setpointNode.get
# remove selected, so you don't double up spm's on the node
selected_setpoint_manager.remove
# apply the new spm
new_setpoint_manager.addToNode(node)

When I try to run your measure, I get the following error message: .../user_script.rb:111:in 'run': undefined method 'inletModelObject' for # (NoMethodError) which tells me that at line 111 when you try to 'get the nodes before and after the SetpointManager on the loop', something is wrong. As it turns out, a SetpointManager does not exist as an object between two nodes on a loop, it is rather assigned to a particular node. Looking at the documentation for the SetpointManagerScheduled class, if you click the box at the top to 'List all members' you won't find the inletModelObject method listed, which explains the error: the method you're calling doesn't exist for that class. However, there is a method for that class called setpointNode, which "returns the node referred to by the SetpointNodeName field", i.e. the node the SPM is assigned to.

So that makes it easy to finish out your measure. If you replace lines 111-116 with the following, it should work:

# get the node the selected spm is assigned to
node = selected_setpoint_manager.setpointNode.get
# remove selected, so you don't double up spm's on the node
selected_setpoint_manager.remove
# apply the new spm
new_setpoint_manager.addToNode(node)

PS: nice job on the measure otherwise! The only other thing I'd note is that on line 34 instead of getting all modelObjects and then filtering with to_SetpointManagerSchedule.empty?, you should just be able to do model.getSetpointManagerSchedules to only get those objects from the model. This should work for any modelObjects, e.g. getThermalZones, getSpaces, getAirLoopHVACs, etc.