How to add a controller to a hot water loop
From the SDK documentation, if use addDemandBranchForComponent method, it will create a new ControllerWaterCoil if hvacComponent is a CoilCoolingWater or a CoilHeatingWater.
So from OpenStudio, should be like this:

however, when I add heating water coils to loop by this ruby script:
coils = model.getCoilHeatingWaters
plant = model.getPlantLoopByName('Hot Water Loop')
coils.each do |coil|
plant.addDemandBranchForComponent(coil)
end
there is no controller in OpenStudio:

So any suggestions?
Comments
one more interesting finding is that for the osm file shown in first picture, no any controller objects in its idf file. and when I locate the controller in ruby binding, there is no actuatorNode and sensorNode for them:
coil = model.getCoilHeatingWaters[0].controllerWaterCoil.get
coil.sensorNode.get
RuntimeError: Optional not initialized