当前位置: 首页>>代码示例>>C++>>正文


C++ ForwardTranslator类代码示例

本文整理汇总了C++中ForwardTranslator的典型用法代码示例。如果您正苦于以下问题:C++ ForwardTranslator类的具体用法?C++ ForwardTranslator怎么用?C++ ForwardTranslator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ForwardTranslator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslatorTest_TranslateConstruction) {
  openstudio::model::Model model;

  openstudio::model::StandardOpaqueMaterial mat1(model);
  mat1.setName("test layer0");
  mat1.setRoughness("MediumRough");
  mat1.setThickness(0.02);
  mat1.setThermalConductivity(1.5);
  mat1.setDensity(20.0);
  mat1.setSpecificHeat(2.0);

  openstudio::model::StandardOpaqueMaterial mat2(model);
  mat2.setName("test layer1");
  mat2.setRoughness("MediumSmooth");
  mat2.setThickness(0.005);
  mat2.setThermalConductivity(0.3);
  mat2.setDensity(3.0);
  mat2.setSpecificHeat(0.3);

  openstudio::model::Construction construction(model);
  construction.setName("test construction");
  construction.insertLayer(0, mat1);
  construction.insertLayer(1, mat2);

  ForwardTranslator trans;
  Workspace workspace = trans.translateModelObject(construction);
  ASSERT_EQ(1u, workspace.numObjectsOfType(IddObjectType::Construction));

  IdfObject constructionIdf = workspace.getObjectsByType(IddObjectType::Construction)[0];

  EXPECT_EQ(unsigned(3), constructionIdf.numFields());
  EXPECT_EQ("test construction", *(constructionIdf.name()) );
  EXPECT_EQ("test layer0", *(constructionIdf.getString(1)) );
  EXPECT_EQ("test layer1", *(constructionIdf.getString(2)) );
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:35,代码来源:ForwardTranslator_GTest.cpp

示例2: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_ShadingSurface_Space)
{
  Model model;
  
  ThermalZone thermalZone(model);

  Point3dVector points;
  points.push_back(Point3d(0,1,0));
  points.push_back(Point3d(1,1,0));
  points.push_back(Point3d(1,0,0));
  points.push_back(Point3d(0,0,0));

  boost::optional<Space> space = Space::fromFloorPrint(points, 1, model);
  ASSERT_TRUE(space);
  space->setThermalZone(thermalZone);

  ShadingSurfaceGroup shadingSurfaceGroup(model);
  EXPECT_TRUE(shadingSurfaceGroup.setSpace(*space));

  ShadingSurface shadingSurface(points, model);
  EXPECT_TRUE(shadingSurface.setShadingSurfaceGroup(shadingSurfaceGroup));

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  
  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed).size());

  WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
  WorkspaceObject shadingSurfaceObject = workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed)[0];

  EXPECT_TRUE(shadingSurfaceObject.getTarget(Shading_Zone_DetailedFields::BaseSurfaceName));
}
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:33,代码来源:ShadingSurface_GTest.cpp

示例3: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_ThermalZone_OneZone_OneSpace_Building)
{
  Model model;

  Point3dVector points;
  points.push_back(Point3d(0, 0, 0));
  points.push_back(Point3d(0, 1, 0));
  points.push_back(Point3d(1, 1, 0));
  points.push_back(Point3d(1, 0, 0));

  SpaceType spaceType(model);
  spaceType.setLightingPowerPerFloorArea(1);

  Building building = model.getUniqueModelObject<Building>();
  building.setSpaceType(spaceType);

  ThermalZone zone(model);

  Space space(model);
  space.setThermalZone(zone);

  Surface surface(points, model);
  surface.setSpace(space);

  EXPECT_EQ(1, space.floorArea());
  EXPECT_EQ(1, space.lightingPowerPerFloorArea());

  ForwardTranslator trans;
  Workspace workspace = trans.translateModel(model);

  EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
  EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::ZoneList).size());
  EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Lights).size());
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:34,代码来源:ThermalZone_GTest.cpp

示例4: TEST_F

TEST_F(EnergyPlusFixture, ForwardTranslator_ExternalInterfaceFunctionalMockupUnitImportToSchedule) {

  Model model;

  ExternalInterfaceFunctionalMockupUnitImport eifmui(model, "test name");

  ExternalInterfaceFunctionalMockupUnitImportToSchedule schedule(model, eifmui, "FMU", "FMU name", 10);

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  EXPECT_EQ(0u, forwardTranslator.errors().size());
  EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::ExternalInterface_FunctionalMockupUnitImport_To_Schedule).size());
  //EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::ScheduleTypeLimits).size());

  WorkspaceObject object = workspace.getObjectsByType(IddObjectType::ExternalInterface_FunctionalMockupUnitImport_To_Schedule)[0];
  //WorkspaceObject object2 = workspace.getObjectsByType(IddObjectType::ScheduleTypeLimits)[0];

  ASSERT_TRUE(object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::Name, false));
  EXPECT_EQ("External Interface Functional Mockup Unit Import To Schedule 1", object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::Name, false).get());
  ASSERT_TRUE(object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::ScheduleTypeLimitsNames, false));
  //EXPECT_EQ(object2.nameString(), object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::ScheduleTypeLimitsNames, false).get());
  ASSERT_TRUE(object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUFileName, false));
  EXPECT_EQ(eifmui.fMUFileName(), object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUFileName, false).get());
  ASSERT_TRUE(object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUInstanceName, false));
  EXPECT_EQ("FMU", object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUInstanceName, false).get());
  ASSERT_TRUE(object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUVariableName, false));
  EXPECT_EQ("FMU name", object.getString(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::FMUVariableName, false).get());
  ASSERT_TRUE(object.getDouble(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::InitialValue, false));
  EXPECT_EQ(10.0, object.getDouble(ExternalInterface_FunctionalMockupUnitImport_To_ScheduleFields::InitialValue, false).get());

  model.save(toPath("./ExternalInterfaceFunctionalMockupUnitImportToSchedule.osm"), true);
  workspace.save(toPath("./ExternalInterfaceFunctionalMockupUnitImportToSchedule.idf"), true);
}
开发者ID:NREL,项目名称:OpenStudio,代码行数:33,代码来源:ExternalInterfaceFT_GTest.cpp

示例5: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_Building2)
{
  Model model;
  Building building = model.getUniqueModelObject<Building>();
  building.setName("Building");
  Site site = model.getUniqueModelObject<Site>();
  SimulationControl simulationControl = model.getUniqueModelObject<SimulationControl>();

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);

  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Building).size());
  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Site_Location).size());
  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::SimulationControl).size());

  WorkspaceObject object = workspace.getObjectsByType(IddObjectType::Building)[0];
  ASSERT_TRUE(object.getString(BuildingFields::Name));
  EXPECT_EQ("Building", object.getString(BuildingFields::Name).get());
  EXPECT_TRUE(object.isEmpty(BuildingFields::NorthAxis));
  EXPECT_TRUE(object.isEmpty(BuildingFields::Terrain));
  EXPECT_TRUE(object.isEmpty(BuildingFields::LoadsConvergenceToleranceValue));
  EXPECT_TRUE(object.isEmpty(BuildingFields::TemperatureConvergenceToleranceValue));
  EXPECT_TRUE(object.isEmpty(BuildingFields::SolarDistribution));
  EXPECT_TRUE(object.isEmpty(BuildingFields::MaximumNumberofWarmupDays));
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:25,代码来源:Building_GTest.cpp

示例6: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_SpaceInfiltrationDesignFlowRate)
{
  Model model;

  ThermalZone zone(model);

  Space space(model);
  space.setThermalZone(zone);

  SpaceInfiltrationDesignFlowRate infiltration(model);
  infiltration.setSpace(space);
  infiltration.setFlowperExteriorWallArea(1.0);

  ForwardTranslator ft;
  Workspace workspace = ft.translateModel(model);

  std::vector<WorkspaceObject> objects = workspace.getObjectsByType(IddObjectType::ZoneInfiltration_DesignFlowRate);
  ASSERT_EQ(1u, objects.size());

  ASSERT_TRUE(objects[0].getString(ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod));
  EXPECT_EQ("Flow/ExteriorWallArea", objects[0].getString(ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod).get());
  EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::DesignFlowRate));
  EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::FlowperZoneFloorArea));
  ASSERT_TRUE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::FlowperExteriorSurfaceArea));
  EXPECT_EQ(1.0, objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::FlowperExteriorSurfaceArea).get());
  EXPECT_FALSE(objects[0].getDouble(ZoneInfiltration_DesignFlowRateFields::AirChangesperHour));

}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:28,代码来源:SpaceInfiltrationDesignFlowRate_GTest.cpp

示例7: TEST_F

TEST_F(EnergyPlusFixture, ForwardTranslator_AvailabilityManagerScheduledOff) {

  Model m;

  AvailabilityManagerScheduledOff avm(m);

  // Test Schedule
  ScheduleConstant sch(m);
  sch.setValue(50);
  EXPECT_TRUE(avm.setSchedule(sch));

  // Assign it to a plant loop
  PlantLoop p(m);
  p.addAvailabilityManager(avm);

  // ForwardTranslate
  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(m);

  WorkspaceObjectVector idfObjs(workspace.getObjectsByType(IddObjectType::AvailabilityManager_ScheduledOff));
  EXPECT_EQ(1u, idfObjs.size());
  WorkspaceObject idf_avm(idfObjs[0]);

  // Schedule Name
  ASSERT_EQ(sch.name().get(), idf_avm.getString(AvailabilityManager_ScheduledOffFields::ScheduleName).get());

}
开发者ID:NREL,项目名称:OpenStudio,代码行数:27,代码来源:AvailabilityManagerScheduledOff_GTest.cpp

示例8: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_Zone)
{
  Model model;

  ThermalZone thermalZone(model);

  Space space(model);
  space.setThermalZone(thermalZone);
  
  Point3dVector points;
  points.push_back(Point3d(0, 1, 0));
  points.push_back(Point3d(0, 0, 0));
  points.push_back(Point3d(1, 0, 0));
  points.push_back(Point3d(1, 1, 0));
  Surface surface(points, model);
  surface.setSpace(space);

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  EXPECT_EQ(0u, forwardTranslator.errors().size());
  EXPECT_EQ(0u, forwardTranslator.warnings().size());

  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
  ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());

  WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
  WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];

  ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName));
  EXPECT_EQ(zoneObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName)->handle());
}
开发者ID:CheyenneBerlin,项目名称:OpenStudio,代码行数:31,代码来源:Surface_GTest.cpp

示例9: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_SpaceInfiltrationEffectiveLeakageArea)
{
  Model model;
  SpaceInfiltrationEffectiveLeakageArea infiltration(model);

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  EXPECT_EQ(0u, forwardTranslator.errors().size());
  EXPECT_EQ(0u, forwardTranslator.warnings().size());
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:10,代码来源:SpaceInfiltrationEffectiveLeakageArea_GTest.cpp

示例10: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_ScheduleRuleset_Simple)
{
  Model model;
  ScheduleRuleset scheduleRuleset(model);

  // annual weekday rule
  ScheduleRule rule2(scheduleRuleset);
  rule2.setApplySunday(false);
  rule2.setApplyMonday(true);
  rule2.setApplyTuesday(true);
  rule2.setApplyWednesday(true);
  rule2.setApplyThursday(true);
  rule2.setApplyFriday(true);
  rule2.setApplySaturday(false);

  // annual weekend rule
  ScheduleRule rule1(scheduleRuleset);
  rule1.setApplySunday(true);
  rule1.setApplyMonday(false);
  rule1.setApplyTuesday(false);
  rule1.setApplyWednesday(false);
  rule1.setApplyThursday(false);
  rule1.setApplyFriday(false);
  rule1.setApplySaturday(true);

  ForwardTranslator ft;
  Workspace workspace = ft.translateModel(model);

  std::vector<WorkspaceObject> scheduleYears = workspace.getObjectsByType(IddObjectType::Schedule_Year);
  ASSERT_EQ(1u, scheduleYears.size());
  std::vector<IdfExtensibleGroup> extensibleGroups = scheduleYears[0].extensibleGroups();
  ASSERT_EQ(2u, extensibleGroups.size());

  // based on 2009 assumed year

  // 1/1-1/3
  ASSERT_TRUE(extensibleGroups[0].getInt(Schedule_YearExtensibleFields::StartMonth));
  EXPECT_EQ(1, extensibleGroups[0].getInt(Schedule_YearExtensibleFields::StartMonth).get());
  ASSERT_TRUE(extensibleGroups[0].getInt(Schedule_YearExtensibleFields::StartDay));
  EXPECT_EQ(1, extensibleGroups[0].getInt(Schedule_YearExtensibleFields::StartDay).get());
  ASSERT_TRUE(extensibleGroups[0].getInt(Schedule_YearExtensibleFields::EndMonth));
  EXPECT_EQ(1, extensibleGroups[0].getInt(Schedule_YearExtensibleFields::EndMonth).get());
  ASSERT_TRUE(extensibleGroups[0].getInt(Schedule_YearExtensibleFields::EndDay));
  EXPECT_EQ(3, extensibleGroups[0].getInt(Schedule_YearExtensibleFields::EndDay).get());

  // 1/4-12/31
  ASSERT_TRUE(extensibleGroups[1].getInt(Schedule_YearExtensibleFields::StartMonth));
  EXPECT_EQ(1, extensibleGroups[1].getInt(Schedule_YearExtensibleFields::StartMonth).get());
  ASSERT_TRUE(extensibleGroups[1].getInt(Schedule_YearExtensibleFields::StartDay));
  EXPECT_EQ(4, extensibleGroups[1].getInt(Schedule_YearExtensibleFields::StartDay).get());
  ASSERT_TRUE(extensibleGroups[1].getInt(Schedule_YearExtensibleFields::EndMonth));
  EXPECT_EQ(12, extensibleGroups[1].getInt(Schedule_YearExtensibleFields::EndMonth).get());
  ASSERT_TRUE(extensibleGroups[1].getInt(Schedule_YearExtensibleFields::EndDay));
  EXPECT_EQ(31, extensibleGroups[1].getInt(Schedule_YearExtensibleFields::EndDay).get());
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:55,代码来源:ScheduleRuleset_GTest.cpp

示例11: TEST_F

TEST_F(EnergyPlusFixture, ForwardTranslatorFuelCell4) {
  //TEST orphaned FC

  Model model;

  Building building = model.getUniqueModelObject<Building>();

  GeneratorFuelCellAirSupply airSupply(model);
  GeneratorFuelCellAuxiliaryHeater auxHeater(model);
  GeneratorFuelCellElectricalStorage elecStorage(model);
  GeneratorFuelCellExhaustGasToWaterHeatExchanger exhaustHX(model);
  GeneratorFuelCellInverter inverter(model);
  GeneratorFuelCellPowerModule powerModule(model);
  //GeneratorFuelCellStackCooler stackCooler(model);
  GeneratorFuelCellWaterSupply waterSupply(model);
  GeneratorFuelSupply fuelSupply(model);
  // create default fuelcell
  GeneratorFuelCell fuelcell(model, powerModule, airSupply, waterSupply, auxHeater, exhaustHX, elecStorage, inverter, fuelSupply);

  // remove the ELCD
  boost::optional<ElectricLoadCenterDistribution> elcd = fuelcell.electricLoadCenterDistribution();
  elcd.get().remove();
  EXPECT_FALSE(fuelcell.electricLoadCenterDistribution());

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  EXPECT_EQ(0u, forwardTranslator.errors().size());
  EXPECT_EQ(1u, forwardTranslator.warnings().size());

  //NO FC components should FT now since it is orphaned
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::ElectricLoadCenter_Generators).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::ElectricLoadCenter_Distribution).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_AirSupply).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_AuxiliaryHeater).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_ElectricalStorage).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_ExhaustGasToWaterHeatExchanger).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_Inverter).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_PowerModule).size());
  //expect stack cooler
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_StackCooler).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelCell_WaterSupply).size());
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Generator_FuelSupply).size());
  //no water mains expected
  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Site_WaterMainsTemperature).size());


  model.save(toPath("./fuelcell4.osm"), true);
  workspace.save(toPath("./fuelcell4.idf"), true);
}
开发者ID:NREL,项目名称:OpenStudio,代码行数:50,代码来源:FuelCell_GTest.cpp

示例12: TEST_F

TEST_F(EnergyPlusFixture,ReverseTranslator_DaylightingOffice)
{
  openstudio::path idfPath = resourcesPath() / toPath("energyplus/Daylighting_Office/in.idf");
  OptionalIdfFile idfFile = IdfFile::load(idfPath, IddFileType::EnergyPlus);
  ASSERT_TRUE(idfFile);
  Workspace inWorkspace(*idfFile);
  ReverseTranslator reverseTranslator;
  Model model = reverseTranslator.translateWorkspace(inWorkspace);
  model.save( resourcesPath() / toPath("energyplus/Daylighting_Office/in.osm"), true);

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);
  workspace.save( resourcesPath() / toPath("energyplus/Daylighting_Office/in2.idf"), true);
}
开发者ID:chlimit,项目名称:OpenStudio,代码行数:14,代码来源:ReverseTranslator_GTest.cpp

示例13: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_IlluminanceMap_NoZone)
{
  Model model;
  ThermalZone thermalZone(model);
  Space space(model);
  space.setThermalZone(thermalZone);
  IlluminanceMap illuminanceMap(model);
  illuminanceMap.setSpace(space);

  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);

  EXPECT_EQ(0u, workspace.getObjectsByType(IddObjectType::Output_IlluminanceMap).size());
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:14,代码来源:IlluminanceMap_GTest.cpp

示例14: TEST_F

//test orphaning the generator before FT
TEST_F(EnergyPlusFixture, ForwardTranslatorGeneratorMicroTurbine_ELCD_Orphan)
{
  // Create a model, a mchp, a mchpHR, a plantLoop and an electricalLoadCenter
  Model model;

  GeneratorMicroTurbine mchp = GeneratorMicroTurbine(model);
  GeneratorMicroTurbineHeatRecovery mchpHR = GeneratorMicroTurbineHeatRecovery(model, mchp);
  ASSERT_EQ(mchpHR, mchp.generatorMicroTurbineHeatRecovery().get());

  PlantLoop plantLoop(model);
  // Add a supply branch for the mchpHR
  ASSERT_TRUE(plantLoop.addSupplyBranchForComponent(mchpHR));

  // Create a WaterHeater:Mixed
  WaterHeaterMixed waterHeater(model);
  // Add it on the same branch as the chpHR, right after it
  Node mchpHROutletNode = mchpHR.outletModelObject()->cast<Node>();
  ASSERT_TRUE(waterHeater.addToNode(mchpHROutletNode));

  // Create a plantEquipmentOperationHeatingLoad
  PlantEquipmentOperationHeatingLoad operation(model);
  operation.setName(plantLoop.name().get() + " PlantEquipmentOperationHeatingLoad");
  ASSERT_TRUE(plantLoop.setPlantEquipmentOperationHeatingLoad(operation));
  ASSERT_TRUE(operation.addEquipment(mchpHR));
  ASSERT_TRUE(operation.addEquipment(waterHeater));

  // Create an ELCD
  ElectricLoadCenterDistribution elcd = ElectricLoadCenterDistribution(model);
  elcd.setName("Capstone C65 ELCD");
  elcd.setElectricalBussType("AlternatingCurrent");
  elcd.addGenerator(mchp);

  // orphan the generator from the ELCD
  boost::optional<ElectricLoadCenterDistribution> elcd2 = mchp.electricLoadCenterDistribution();
  elcd2.get().remove();
  EXPECT_FALSE(mchp.electricLoadCenterDistribution());

  // Forward Translates
  ForwardTranslator forwardTranslator;
  Workspace workspace = forwardTranslator.translateModel(model);

  EXPECT_EQ(0u, forwardTranslator.errors().size());
  //ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::WaterHeater_Mixed).size());
  ASSERT_EQ(0u, workspace.getObjectsByType(IddObjectType::ElectricLoadCenter_Distribution).size());

  //model.save(toPath("./ForwardTranslatorGeneratorMicroTurbine_ELCD_orhpan.osm"), true);
  //workspace.save(toPath("./ForwardTranslatorGeneratorMicroTurbine_ELCD_orphan.idf"), true);

}
开发者ID:NREL,项目名称:OpenStudio,代码行数:50,代码来源:GeneratorMicroTurbine_GTest.cpp

示例15: TEST_F

TEST_F(EnergyPlusFixture,ForwardTranslator_People_NoSpace)
{
  Model model;

  PeopleDefinition def(model);

  People people(def);
  
  ForwardTranslator ft;
  Workspace workspace = ft.translateModel(model);

  std::vector<WorkspaceObject> peopleObjects = workspace.getObjectsByType(IddObjectType::People);
  //ASSERT_EQ(0u, peopleObjects.size()); // for now we will let the object come through, this will cause an error in E+
  ASSERT_EQ(1u, peopleObjects.size());
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:15,代码来源:People_GTest.cpp


注:本文中的ForwardTranslator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。