-
Notifications
You must be signed in to change notification settings - Fork 222
Fix #5371 - add FuelTypes to PlantComponentUserDefined #5372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // Convenience method to return all EnergyManagementSystemMeteredOutputVariable that refer to this Subroutine | ||
| std::vector<EnergyManagementSystemMeteredOutputVariable> energyManagementSystemMeteredOutputVariables() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience
| std::vector<EnergyManagementSystemMeteredOutputVariable> | ||
| EnergyManagementSystemSubroutine_Impl::energyManagementSystemMeteredOutputVariables() const { | ||
| return getObject<ModelObject>().getModelObjectSources<EnergyManagementSystemMeteredOutputVariable>( | ||
| EnergyManagementSystemMeteredOutputVariable::iddObjectType()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple
| // Convenience method to return all EnergyManagementSystemMeteredOutputVariable that refer to this Program | ||
| std::vector<EnergyManagementSystemMeteredOutputVariable> energyManagementSystemMeteredOutputVariables() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience for Program too
| // This is not an HVACComponent but it will help in the determination of the PlantUserDefinedComponent, so implementation is here because it's | ||
| // more logical | ||
| ComponentType componentType() const; | ||
| std::vector<FuelType> coolingFuelTypes() const; | ||
| std::vector<FuelType> heatingFuelTypes() const; | ||
| std::vector<AppGFuelType> appGHeatingFuelTypes() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New fuel type methods for EMS:MeteredOutputVariable
| // This is not an HVACComponent but it will help in the determination of the PlantUserDefinedComponent, so implementation is here because it's | ||
| // more logical | ||
| ComponentType componentType() const; | ||
| boost::optional<FuelType> fuelTypeFromResourceType() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Impl side you also have this
| std::set<AppGFuelType> result; | ||
| for (const auto& ems_metered_var : energyManagementSystemMeteredOutputVariables()) { | ||
| for (auto& ft : ems_metered_var.appGHeatingFuelTypes()) { | ||
| result.insert(ft); | ||
| } | ||
| } | ||
| return {result.begin(), result.end()}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appGHeatingFuelTypes
| TEST_F(ModelFixture, PlantComponentUserDefined_EMSProgram_emsMeteredOutputVariables) { | ||
|
|
||
| Model m; | ||
| PlantComponentUserDefined plant_comp(m); | ||
| plant_comp.setPlantLoadingMode("MeetsLoadWithNominalCapacityHiOutLimit"); | ||
| plant_comp.setPlantLoopFlowRequestMode("NeedsFlowIfLoopIsOn"); | ||
|
|
||
| EXPECT_EQ(ComponentType(ComponentType::None), plant_comp.componentType()); | ||
| testFuelTypeEquality({}, plant_comp.coolingFuelTypes()); | ||
| testFuelTypeEquality({}, plant_comp.heatingFuelTypes()); | ||
| testAppGFuelTypeEquality({}, plant_comp.appGHeatingFuelTypes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlantComponentUserDefined has CompType::None until it has EMS MeteredOutputVariables
| EXPECT_EQ(0, plant_comp.energyManagementSystemMeteredOutputVariables().size()); | ||
| auto sim_pgrm = plant_comp.plantSimulationProgram().get(); | ||
| sim_pgrm.setName("Sim_Pgrm"); | ||
| sim_pgrm.setBody("SET Elec_Htg_Cons = 0"); | ||
| EnergyManagementSystemMeteredOutputVariable meteredoutvar(m, "Plant Heating Comp Electricity Consumption"); | ||
| EXPECT_TRUE(meteredoutvar.setEMSVariableName("Elec_Htg_Cons")); | ||
| EXPECT_TRUE(meteredoutvar.setUpdateFrequency("SystemTimestep")); | ||
| EXPECT_TRUE(meteredoutvar.setEMSProgramOrSubroutineName(sim_pgrm)); | ||
| EXPECT_TRUE(meteredoutvar.setResourceType("Electricity")); | ||
| EXPECT_TRUE(meteredoutvar.setGroupType("HVAC")); | ||
| EXPECT_TRUE(meteredoutvar.setEndUseCategory("Heating")); | ||
| EXPECT_TRUE(meteredoutvar.setEndUseSubcategory("")); | ||
| EXPECT_TRUE(meteredoutvar.setUnits("J")); | ||
| EXPECT_EQ(1, plant_comp.energyManagementSystemMeteredOutputVariables().size()); | ||
| EXPECT_EQ(ComponentType(ComponentType::Heating), plant_comp.componentType()); | ||
| testFuelTypeEquality({}, plant_comp.coolingFuelTypes()); | ||
| testFuelTypeEquality({FuelType::Electricity}, plant_comp.heatingFuelTypes()); | ||
| testAppGFuelTypeEquality({AppGFuelType::Electric}, meteredoutvar.appGHeatingFuelTypes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I create an EMSMeteredOutputVar of type "Heating" and "Electricity" into the plantSimulationProgram, and check that the PlantComponentUserDefined has the right fuel types
| PlantLoop plant(m); | ||
| EXPECT_EQ(ComponentType(ComponentType::None), plant.componentType()); | ||
| testFuelTypeEquality({}, plant.coolingFuelTypes()); | ||
| testFuelTypeEquality({}, plant.heatingFuelTypes()); | ||
| testAppGFuelTypeEquality({}, plant.appGHeatingFuelTypes()); | ||
|
|
||
| EXPECT_TRUE(plant.addSupplyBranchForComponent(plant_comp)); | ||
| EXPECT_EQ(ComponentType(ComponentType::Heating), plant.componentType()); | ||
| testFuelTypeEquality({}, plant.coolingFuelTypes()); | ||
| testFuelTypeEquality({FuelType::Electricity}, plant.heatingFuelTypes()); | ||
| testAppGFuelTypeEquality({AppGFuelType::Electric}, plant.appGHeatingFuelTypes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plant inherits it correctly AFTER I assign the PlantComponentUserDefined on the supply side
| sim_pgrm.setBody("SET Elec_Htg_Cons = 0\nSET Elec_Clg_Cons = 0"); | ||
| EnergyManagementSystemMeteredOutputVariable meteredoutvar2(m, "Plant Cooling Comp Electricity Consumption"); | ||
| EXPECT_TRUE(meteredoutvar2.setEMSVariableName("Elec_Htg_Cons")); | ||
| EXPECT_TRUE(meteredoutvar2.setUpdateFrequency("SystemTimestep")); | ||
| EXPECT_TRUE(meteredoutvar2.setEMSProgramOrSubroutineName(sim_pgrm)); | ||
| EXPECT_TRUE(meteredoutvar2.setResourceType("NaturalGas")); | ||
| EXPECT_TRUE(meteredoutvar2.setGroupType("HVAC")); | ||
| EXPECT_TRUE(meteredoutvar2.setEndUseCategory("Chillers")); | ||
| EXPECT_TRUE(meteredoutvar2.setEndUseSubcategory("")); | ||
| EXPECT_TRUE(meteredoutvar2.setUnits("J")); | ||
| EXPECT_EQ(2, plant_comp.energyManagementSystemMeteredOutputVariables().size()); | ||
| EXPECT_EQ(ComponentType(ComponentType::Both), plant_comp.componentType()); | ||
| EXPECT_TRUE(testFuelTypeEquality({FuelType::Gas}, plant_comp.coolingFuelTypes())); | ||
| EXPECT_TRUE(testFuelTypeEquality({FuelType::Electricity}, plant_comp.heatingFuelTypes())); | ||
| EXPECT_TRUE(testAppGFuelTypeEquality({}, meteredoutvar2.appGHeatingFuelTypes())); | ||
|
|
||
| EXPECT_EQ(ComponentType(ComponentType::Both), plant.componentType()); | ||
| EXPECT_TRUE(testFuelTypeEquality({FuelType::Gas}, plant.coolingFuelTypes())); | ||
| EXPECT_TRUE(testFuelTypeEquality({FuelType::Electricity}, plant.heatingFuelTypes())); | ||
| EXPECT_TRUE(testAppGFuelTypeEquality({AppGFuelType::Electric}, plant.appGHeatingFuelTypes())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test with a second variable, this type "Chillers" with "Natural Gas"
…ariable MeteredOutputVar also has the OnSiteGeneration, but that maps to Cogenation and I can't add a third alias for it... Will handle manually
…mentSystemMeteredOutputVariables to find linked Metered vars
…gFuelTypes, and appGHeatingFuelTypes
…termine the componentType / fuelTypes
|
CI Results for b2461a8:
|
Pull request overview
Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp)Labels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.