Skip to content

Conversation

@jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Mar 18, 2025

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. component - Standards labels Mar 18, 2025
@jmarrec jmarrec self-assigned this Mar 18, 2025
Comment on lines +70 to +71
// Convenience method to return all EnergyManagementSystemMeteredOutputVariable that refer to this Subroutine
std::vector<EnergyManagementSystemMeteredOutputVariable> energyManagementSystemMeteredOutputVariables() const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convenience

Comment on lines +343 to +347
std::vector<EnergyManagementSystemMeteredOutputVariable>
EnergyManagementSystemSubroutine_Impl::energyManagementSystemMeteredOutputVariables() const {
return getObject<ModelObject>().getModelObjectSources<EnergyManagementSystemMeteredOutputVariable>(
EnergyManagementSystemMeteredOutputVariable::iddObjectType());
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple

Comment on lines +70 to +71
// Convenience method to return all EnergyManagementSystemMeteredOutputVariable that refer to this Program
std::vector<EnergyManagementSystemMeteredOutputVariable> energyManagementSystemMeteredOutputVariables() const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convenience for Program too

Comment on lines +154 to +159
// 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;
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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

Comment on lines +562 to +568
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()};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appGHeatingFuelTypes

Comment on lines 216 to 226
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());
Copy link
Collaborator Author

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

Comment on lines 228 to 245
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());
Copy link
Collaborator Author

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

Comment on lines 247 to 257
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());
Copy link
Collaborator Author

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

Comment on lines 259 to 295
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()));
Copy link
Collaborator Author

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"

jmarrec added 7 commits March 19, 2025 10:58
…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
@jmarrec jmarrec merged commit d9e51bd into develop Mar 31, 2025
5 of 6 checks passed
@jmarrec jmarrec deleted the handle-ashp branch March 31, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - Model component - Standards Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PlantComponentUserDefined missing fuelTypes

4 participants