Closed lymereJ closed 1 year ago
Should use getSpaceLoadParent
? https://github.com/NREL/OpenStudio/blob/1f8353e48d5bbb441b5d1b96ac8b3d877f5df457/src/energyplus/ForwardTranslator.cpp#L228
This was tricky back in the day because OS didnt use ZoneLists, but E+ did, etc. The constructors were built with the following
I would look at the constructor first to make sure the assumptions are still valid, given the space changes in E+, etc
@lymereJ Note that in your "Steps to Reproduce" section above, the light
variable is unused. Should it be passed into the first position of EnergyManagementSystemActuator.new(...)
?
yeah, i think the light object goes first, and the TZ or space goes last. https://github.com/NREL/OpenStudio/blob/develop/src/model/test/EnergyManagementSystemActuator_GTest.cpp#L215 https://github.com/NREL/OpenStudio/blob/develop/src/model/test/EnergyManagementSystemActuator_GTest.cpp#L258
@joseph-robertson - You're correct, may bad. The code that I have in "Steps to Reproduce" generates the following actuator (incorrect as well), not the one that's in "Current Behavior". Not sure why I put space1
instead of light
.
EnergyManagementSystem:Actuator,
Energy_Management_System_Actuator_1, !- Name
Space 1, !- Actuated Component Unique Name
Lights, !- Actuated Component Type
Electricity Rate; !- Actuated Component Control Type
I'll correct that line in "Step to Reproduce". Thanks!
@lymereJ is an option for you now to just disable the space feature when forward translating?
This was tricky back in the day because OS didnt use ZoneLists, but E+ did, etc. The constructors were built with the following
Shouldn't these take in a SpaceLoadInstance instead of a ModelObject given the comment? I could see it going really wrong...
@lymereJ is an option for you now to just disable the space feature when forward translating?
@jmarrec, I believe that we don't want to do that, this is for OpenStudio-Standards. I'll let @mdahlhausen confirm.
@lymereJ is an option for you now to just disable the space feature when forward translating?
@jmarrec, I believe that we don't want to do that, this is for OpenStudio-Standards. I'll let @mdahlhausen confirm.
yeah, that's not a workable solution. People are build models using openstudio-standards, often in third-party software. I don't want to require third-party developers to have to disable the space feature when forward translating. Especially for end-users who might not know how to disable it.
OK. I'm asking because this is marked as blocker, we're close to release date, and we have the existing API to retain. I'll try to figure something out in the next couple of days that aims to support this without breaking api, I'll likely ask for thoughts/decisions as I dig down.
not sure if this helps with the debugging, but here is a measure that reproduces the EMS Demand Management example#9 and uses the Actuator on the lights object. https://github.com/NREL/OpenStudio-EMS-Measures/blob/master/Measures/m_9_example_9_demand_management/measure.rb#L301
I'm going to try to see if there is a workaround in openstudio-standards.
i just checked and this does work in OS <=3.2 but not in OS 3.5.1
require 'openstudio' model = OpenStudio::Model.exampleModel() spaceType1 = model.getSpaceTypes()[0] space1 = model.getSpaces()[0] tz1 = model.getThermalZones()[0]
light = space1.spaceType.get.lights[0] actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(light, 'Lights', 'Electricity Rate', space1)
ft = OpenStudio::EnergyPlus::ForwardTranslator.new w = ft.translateModel(model)
my bet it has something to do with no more ZoneLists or the new spaces
looks like the actuators changed to use Spaces instead of Thermal Zones according to the .EDD
my guess is to use the space.name https://github.com/NREL/OpenStudio/blob/develop/src/energyplus/ForwardTranslator/ForwardTranslateEnergyManagementSystemActuator.cpp#L124 instead of the thermal zone name
and something similiar here https://github.com/NREL/OpenStudio/blob/develop/src/energyplus/ForwardTranslator/ForwardTranslateEnergyManagementSystemActuator.cpp#L105 for getting the space name from the spacetype.
Some more context: Running test_small_office.rb for 90.1-2016 and ASHRAE 169-2013-5A
In OS 3.2.1:
OS:EnergyManagementSystem:Sensor,
{9d59be4e-d960-47c1-aa96-6783eb166770}, !- Handle
Core_ZNZN_LSr, !- Name
Core_ZN ZN, !- Output Variable or Output Meter Index Key Name
Zone Lights Electricity Rate; !- Output Variable or Output Meter Name
OS:EnergyManagementSystem:InternalVariable,
{496b4e8d-6dbc-49c2-8fd6-f0a0292d0d74}, !- Handle
Core_ZNZN_Area, !- Name
Core_ZN ZN, !- Internal Data Index Key Name
Zone Floor Area; !- Internal Data Type
OS:EnergyManagementSystem:Actuator,
{4936ef85-4857-41ae-b64f-5308c174d49f}, !- Handle
Core_ZNZN_Light1_Actuator, !- Name
{a5e82b87-ce0f-4588-9715-85b90f56135a}, !- Actuated Component Name
Lights, !- Actuated Component Type
Electricity Rate; !- Actuated Component Control Type
OS:EnergyManagementSystem:Actuator,
{69231cf4-fc89-48f6-a304-29cadfe9f63c}, !- Handle
Perimeter_ZN_1ZN_Light1_Actuator, !- Name
{a5e82b87-ce0f-4588-9715-85b90f56135a}, !- Actuated Component Name
Lights, !- Actuated Component Type
Electricity Rate; !- Actuated Component Control Type
actuated component is:
OS:Lights,
{a5e82b87-ce0f-4588-9715-85b90f56135a}, !- Handle
Office WholeBuilding - Sm Office Lights, !- Name
{72e4e8c6-2310-41ff-856b-20a2cebb0674}, !- Lights Definition Name
{629a271e-7460-4c51-87d3-d2d3125cfac1}, !- Space or SpaceType Name
, !- Schedule Name
1, !- Fraction Replaceable
, !- Multiplier
General; !- End-Use Subcategory
which is used by this space type object:
OS:SpaceType,
{629a271e-7460-4c51-87d3-d2d3125cfac1}, !- Handle
Office WholeBuilding - Sm Office, !- Name
, !- Default Construction Set Name
{09f83373-2543-4efe-ad90-7facebecbcbb}, !- Default Schedule Set Name
{c9f3a3a1-7407-4eab-bb64-27cdfc8e7a35}, !- Group Rendering Name
{58b7ecf6-9d4d-4d56-95e8-b61a0fed9557}, !- Design Specification Outdoor Air Object Name
, !- Standards Template
Office, !- Standards Building Type
WholeBuilding - Sm Office; !- Standards Space Type
The test passes but generates this warning from the forward translator:
[openstudio.energyplus.ForwardTranslator] <0> Actuator 'Core_ZNZN_Light1_Actuator' references a SpaceLoad 'Office WholeBuilding - Sm Office Lights' attached to SpaceType 'Office WholeBuilding - Sm Office', with multiple spaces. Check your EMS programs to make sure your actuators are correct.
What appears in the .idf:
EnergyManagementSystem:Actuator,
Core_ZNZN_Light1_Actuator, !- Name
Core_ZN ZN Office WholeBuilding - Sm Office Lights, !- Actuated Component Unique Name
Lights, !- Actuated Component Type
Electricity Rate; !- Actuated Component Control Type
EnergyManagementSystem:Actuator,
Perimeter_ZN_1ZN_Light1_Actuator, !- Name
Core_ZN ZN Office WholeBuilding - Sm Office Lights, !- Actuated Component Unique Name
Lights, !- Actuated Component Type
Electricity Rate; !- Actuated Component Control Type
All of the actuators point to the same shared lights object. That's a bug.
And it errors out now in OS 3.5.1:
** Severe ** Invalid Actuated Component Unique Name =CORE_ZN ZN OFFICE WHOLEBUILDING - SM OFFICE LIGHTS
** ~~~ ** Entered in EnergyManagementSystem:Actuator=CORE_ZNZN_LIGHT1_ACTUATOR
It seems there are two issues here: 1) There is a bug in openstudio-standards; the lights object needs to be broken out by zone or space before applying EMS code 2) The forward translator simply can't handle shared space/zone lights objects required by EMS. Ideally, it would take a shared space type resource like the lights object and make zone individually for each space if shared by EMS. Or we can say you can't use shared space type resources with EMS.
I think I can fix openstudio-standards by creating individual space light objects in OS 3.5.1, which means this issue is no longer a blocker. @lymereJ correct me here if you don't think that's possible.
@lymereJ @jmarrec Update: I've got a decent workaround implemented in openstudio-standards. I clone the space type lights object to each individual space. Works with both OSv3.2.1 and OSv3.5.1.
Given the workaround, this issue is no longer an OpenStudio blocker for openstudio-standards.
Issue overview
The actuated component unique name of EMS:Actuator objects in EnergyPlus is determined by OS during the forward translation process. The name appears to be based on the zone name and load object (Lights in the example below) name, even for spaces. However, when spaces are used in a model, EnergyPlus expected the name of the actuator to refer to the space name, not the zone name
Current Behavior
The code snippet below creates the following actuator ....
Expected Behavior
... but it should be:
Steps to Reproduce
Possible Solution
Do not use the thermal zone name by default here.
Environment
Some additional details about your environment for this issue (if relevant):
Context
Affects https://github.com/NREL/openstudio-standards/issues/1395.