The code shown below shows what the measure does. It literally just makes a new objects swaps it out for the water heater, then removes the water heater. Approach 1 seems like the right one. I assume the measure runs fine but you simulation is failing with missing setpoint. You can edit the model in the GUI after the measure has run to add anything else that is necessary.
# create thermal storage object
new_chilled_water = OpenStudio::Model::ThermalStorageChilledWaterStratified.new(model)
placeholder = nil
# loop through plant loops and swap objects
model.getPlantLoops.each do |plant_loop|
puts "Checking #{plant_loop.name}"
plant_loop.supplyComponents.each do |component|
if component.name.to_s == wh_name
placeholder = component
puts "found #{component.name}"
# swap components
supply_inlet_node = component.to_WaterToWaterComponent.get.supplyInletModelObject.get.to_Node.get
new_chilled_water.addToNode(supply_inlet_node)
demand_inlet_node = component.to_WaterToWaterComponent.get.demandInletModelObject.get.to_Node.get
new_chilled_water.addToNode(demand_inlet_node)
end
end
end
# remove unused water heater from the model
if not placeholder.nil?
puts "Removing water heater"
placeholder.remove
end
Are you sure that component is supposed to be connected to two loops? From the I/O the object input only takes one inlet and one outlet node connection. In the 5ZoneDetailedIceStorage.idf example file, the ThermalStorage:Ice:Detailed object is only connected to the chilled water loop.
Hi Eric, Because I saw this post : https://unmethours.com/question/18395...
Then I guess the question is which object you're trying to use: ThermalStorage:Ice:Detailed or ThermalStorage:ChilledWater:Stratified. The answer you linked to is using the latter, which does take connections to multiple loops. Your screenshot is ambiguous, but based on the color of the icon you're trying to use ThermalStorage:Ice:Detailed, which does not connect to a recharge loop.
It also looks like you're using a version of OpenStudio that might not support ThermalStorage:ChilledWater:Stratified.
My current version is 1.12. I tried chilled water storage, can't find it.