EMS with Openstudio debugging

asked 2022-09-29 11:09:47 -0600

HoussemYounes's avatar

Hi, I have the following line in my measure.rb file

ets_heating_energy = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "EtsHeatingEnergy")

I get the following error

[openstudio.model.EnergyManagementSystemGlobalVariable] Unable to set Object of type 'OS:EnergyManagementSystem:GlobalVariable' and named 'EtsHeatingEnergy_1''s Name to EtsHeatingEnergy.

What am I doing wrong ?

edit retag flag offensive close merge delete

Comments

Is it possible that this code gets called multiple times and is trying to create multiple global variables with the same name?

shorowit's avatar shorowit  ( 2022-09-29 11:37:08 -0600 )edit

Not in this case, the error is strange, I have many global variables defined just before this particular line that are read with no problems

HoussemYounes's avatar HoussemYounes  ( 2022-09-29 11:45:16 -0600 )edit

The fact that the error message says "EtsHeatingEnergy_1", as if it renamed it from "EtsHeatingEnergy" to avoid a conflict, suggests to me that there might already be an object with the same name. But I could be totally off base.

shorowit's avatar shorowit  ( 2022-09-29 11:53:48 -0600 )edit

@shorowit I think you're right - I get the same error when I try to call the same global variable constructor twice.

ericringold's avatar ericringold  ( 2022-09-29 12:35:20 -0600 )edit

I think you're right too although it wasn't that obvious in my case. I was using the global variable to program a PlantComponent:UserDefined ( PCUD) object. I had a first successful run of the measure, but when tried to run again after an edit, I got the error, I think because the same global variable already existed within the program of the previously added PCUD object. When I reload the osm file or delete the PCUD object and then re-add my edited measure, it works.

HoussemYounes's avatar HoussemYounes  ( 2022-09-29 14:26:53 -0600 )edit