TEST_F(EnergyPlusFixture,ReverseTranslator_WindowConstruction)
{
  StrictnessLevel level(StrictnessLevel::Draft);
  IddFileType iddFileType(IddFileType::EnergyPlus);
  Workspace workspace(level,iddFileType);

  IdfObject glazing(IddObjectType::WindowMaterial_Glazing);
  IdfObject gas(IddObjectType::WindowMaterial_Gas);
  glazing.setName("Glazing Material");
  gas.setName("Gas Material");
  IdfObject construction(IddObjectType::Construction);
  ASSERT_EQ(0u,construction.numExtensibleGroups());
  EXPECT_FALSE(construction.pushExtensibleGroup(StringVector(1u,glazing.name().get())).empty());
  EXPECT_FALSE(construction.pushExtensibleGroup(StringVector(1u,gas.name().get())).empty());
  EXPECT_FALSE(construction.pushExtensibleGroup(StringVector(1u,glazing.name().get())).empty());
  IdfObjectVector objects;
  objects.push_back(glazing);
  objects.push_back(gas);
  objects.push_back(construction);
  EXPECT_EQ(3u,workspace.addObjects(objects).size());

  ReverseTranslator reverseTranslator;
  Model model = reverseTranslator.translateWorkspace(workspace);

  ASSERT_EQ(1u, model.getModelObjects<Construction>().size());
  Construction mConstruction = model.getModelObjects<Construction>()[0];
  EXPECT_EQ(3u,mConstruction.layers().size());
  EXPECT_EQ(2u, model.getModelObjects<FenestrationMaterial>().size());
}
Beispiel #2
0
std::vector<IdfObject> IdfFile::getObjectsByName(const std::string& name) const {
  IdfObjectVector result;
  BOOST_FOREACH(const IdfObject& object,m_objects) {
    OptionalString objectName = object.name();
    if (objectName && openstudio::istringEqual(name,*objectName)) {
      result.push_back(object);
    }
  }
Beispiel #3
0
std::vector<IdfObject> IdfFile::getObjectsByType(const IddObject& objectType) const {
  IdfObjectVector result;
  BOOST_FOREACH(const IdfObject& object,objects()) {
    if (object.iddObject() == objectType) {
      result.push_back(object);
    }
  }
  return result;
}
Beispiel #4
0
std::vector<IdfObject> IdfFile::getObjectsByType(IddObjectType objectType) const {
  IdfObjectVector result;
  for (IdfObjectVector::const_iterator it = m_objects.begin(),
       itEnd = m_objects.end(); it != itEnd; ++it) {
    if (it->iddObject().type() == objectType) {
      result.push_back(*it);
    }
  }
  return result;
}
TEST(ProgressBar, WorkspaceTest)
{
  ProgressBar2 pb;
  EXPECT_FALSE(pb.called());

  StrictnessLevel level(StrictnessLevel::Draft);
  IddFileType fileType(IddFileType::EnergyPlus);
  Workspace workspace(level,fileType);
  workspace.connectProgressBar(pb);

  IdfObjectVector objects;
  objects.push_back(IdfObject(IddObjectType::Zone));
  workspace.addObjects(objects);

  System::msleep(10);

  EXPECT_TRUE(pb.called());
}
Beispiel #6
0
TEST_F(ModelFixture, MeterFromModel)
{
  Model model;

  IdfObjectVector idfObjects;

  idfObjects.push_back(IdfObject(IddObjectType::OS_Meter));
  idfObjects.back().setString(OS_MeterFields::Name,"Electricity:Facility");
  idfObjects.back().setString(OS_MeterFields::ReportingFrequency,"monthly");
  idfObjects.back().setString(OS_MeterFields::MeterFileOnly,"false");

  LOG(Debug,"Meter text: " << std::endl << idfObjects.back());

  idfObjects.push_back(IdfObject(IddObjectType::OS_Meter));
  idfObjects.back().setString(OS_MeterFields::Name,"Gas:Building");
  idfObjects.back().setString(OS_MeterFields::ReportingFrequency,"hourly");

  idfObjects.push_back(IdfObject(IddObjectType::OS_Meter));
  idfObjects.back().setString(OS_MeterFields::Name,"InteriorLights:Electricity");
  idfObjects.back().setString(OS_MeterFields::ReportingFrequency,"runperiod");
  idfObjects.back().setString(OS_MeterFields::MeterFileOnly,"false");
  idfObjects.back().setString(OS_MeterFields::Cumulative,"true");

  idfObjects.push_back(IdfObject(IddObjectType::OS_Meter));
  idfObjects.back().setString(OS_MeterFields::Name,"General:InteriorLights:Electricity:Zone:North Zone");
  idfObjects.back().setString(OS_MeterFields::ReportingFrequency,"daily");
  idfObjects.back().setString(OS_MeterFields::Cumulative,"true");

  EXPECT_EQ(static_cast<unsigned>(4), idfObjects.size());

  HandleVector handles = getHandles(model.addObjects(idfObjects));
  ASSERT_EQ(static_cast<unsigned>(4), handles.size());
  EXPECT_EQ(static_cast<unsigned>(4), model.getModelObjects<Meter>().size());

  //"Output:Meter,Electricity:Facility,monthly;"
  OptionalMeter meter = model.getModelObject<Meter>(handles[0]);
  ASSERT_TRUE(meter);
  EXPECT_EQ("Electricity:Facility", meter->name());
  EXPECT_FALSE(meter->cumulative());
  EXPECT_FALSE(meter->specificEndUse());
  EXPECT_FALSE(meter->endUseType());
  ASSERT_TRUE(meter->fuelType());
  EXPECT_EQ(FuelType::Electricity, meter->fuelType().get().value());
  ASSERT_TRUE(meter->installLocationType());
  EXPECT_EQ(InstallLocationType::Facility, meter->installLocationType().get().value());
  EXPECT_FALSE(meter->specificInstallLocation());

  //"Output:Meter:MeterFileOnly,Gas:Building,hourly;"
  meter = model.getModelObject<Meter>(handles[1]);
  ASSERT_TRUE(meter);
  EXPECT_EQ("Gas:Building", meter->name());
  EXPECT_FALSE(meter->cumulative());
  EXPECT_FALSE(meter->specificEndUse());
  EXPECT_FALSE(meter->endUseType());
  ASSERT_TRUE(meter->fuelType());
  EXPECT_EQ(FuelType::Gas, meter->fuelType().get().value());
  ASSERT_TRUE(meter->installLocationType());
  EXPECT_EQ(InstallLocationType::Building, meter->installLocationType().get().value());
  EXPECT_FALSE(meter->specificInstallLocation());

  //"Output:Meter:Cumulative,InteriorLights:Electricity,runperiod;"
  meter = model.getModelObject<Meter>(handles[2]);
  ASSERT_TRUE(meter);
  EXPECT_EQ("InteriorLights:Electricity", meter->name());
  EXPECT_TRUE(meter->cumulative());
  EXPECT_FALSE(meter->specificEndUse());
  ASSERT_TRUE(meter->endUseType());
  EXPECT_EQ(EndUseType::InteriorLights, meter->endUseType().get().value());
  ASSERT_TRUE(meter->fuelType());
  EXPECT_EQ(FuelType::Electricity, meter->fuelType().get().value());
  EXPECT_FALSE(meter->installLocationType());
  EXPECT_FALSE(meter->specificInstallLocation());

  //"Output:Meter:Cumulative:MeterFileOnly,General:InteriorLights:Electricity:Zone:North Zone,daily;"
  meter = model.getModelObject<Meter>(handles[3]);
  ASSERT_TRUE(meter);
  EXPECT_EQ("General:InteriorLights:Electricity:Zone:North Zone", meter->name());
  EXPECT_TRUE(meter->cumulative());
  ASSERT_TRUE(meter->specificEndUse());
  EXPECT_EQ("General", meter->specificEndUse().get());
  ASSERT_TRUE(meter->endUseType());
  EXPECT_EQ(EndUseType::InteriorLights, meter->endUseType().get().value());
  ASSERT_TRUE(meter->fuelType());
  EXPECT_EQ(FuelType::Electricity, meter->fuelType().get().value());
  ASSERT_TRUE(meter->installLocationType());
  EXPECT_EQ(InstallLocationType::Zone, meter->installLocationType().get().value());
  ASSERT_TRUE(meter->specificInstallLocation());
  EXPECT_EQ("North Zone", meter->specificInstallLocation().get());
}