MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / TEST_F

Function TEST_F

src/energyplus/Test/PythonPluginOutputVariable_GTest.cpp:30–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28using namespace openstudio;
29
30TEST_F(EnergyPlusFixture, ForwardTranslator_PythonPluginOutputVariable) {
31
32 ForwardTranslator ft;
33
34 // Create a model
35 Model m;
36
37 PythonPluginVariable pyVar(m);
38 pyVar.setName("PythonPluginVariable1");
39
40 PythonPluginOutputVariable pyOutVar(pyVar);
41 pyOutVar.setName("Chiller Electricity Consumption");
42 EXPECT_TRUE(pyOutVar.setTypeofDatainVariable("Metered"));
43 EXPECT_TRUE(pyOutVar.setUpdateFrequency("SystemTimestep"));
44 EXPECT_TRUE(pyOutVar.setUnits("J"));
45 EXPECT_TRUE(pyOutVar.setResourceType("Electricity"));
46 EXPECT_TRUE(pyOutVar.setGroupType("HVAC"));
47 EXPECT_TRUE(pyOutVar.setEndUseCategory("Cooling"));
48 EXPECT_TRUE(pyOutVar.setEndUseSubcategory("Custom air cooled chiller"));
49
50 Workspace w = ft.translateModel(m);
51 EXPECT_EQ(1, w.getObjectsByType(IddObjectType::PythonPlugin_Variables).size());
52 WorkspaceObjectVector idfObjs = w.getObjectsByType(IddObjectType::PythonPlugin_OutputVariable);
53 ASSERT_EQ(1u, idfObjs.size());
54 auto idfObj = idfObjs.front();
55
56 EXPECT_EQ(pyOutVar.nameString(), idfObj.nameString());
57
58 EXPECT_EQ("PythonPluginVariable1", idfObj.getString(PythonPlugin_OutputVariableFields::PythonPluginVariableName).get());
59 EXPECT_EQ("Metered", idfObj.getString(PythonPlugin_OutputVariableFields::TypeofDatainVariable).get());
60 EXPECT_EQ("SystemTimestep", idfObj.getString(PythonPlugin_OutputVariableFields::UpdateFrequency).get());
61 EXPECT_EQ("J", idfObj.getString(PythonPlugin_OutputVariableFields::Units).get());
62 EXPECT_EQ("Electricity", idfObj.getString(PythonPlugin_OutputVariableFields::ResourceType).get());
63 EXPECT_EQ("HVAC", idfObj.getString(PythonPlugin_OutputVariableFields::GroupType).get());
64 EXPECT_EQ("Cooling", idfObj.getString(PythonPlugin_OutputVariableFields::EndUseCategory).get());
65 EXPECT_EQ("Custom air cooled chiller", idfObj.getString(PythonPlugin_OutputVariableFields::EndUseSubcategory).get());
66}

Callers

nothing calls this directly

Calls 14

nameStringMethod · 0.80
setNameMethod · 0.45
setUpdateFrequencyMethod · 0.45
setUnitsMethod · 0.45
setResourceTypeMethod · 0.45
setGroupTypeMethod · 0.45
setEndUseCategoryMethod · 0.45
setEndUseSubcategoryMethod · 0.45
translateModelMethod · 0.45
sizeMethod · 0.45
getObjectsByTypeMethod · 0.45

Tested by

no test coverage detected