SetpointManagerScheduled_Impl::SetpointManagerScheduled_Impl(
     const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : SetpointManager_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == SetpointManagerScheduled::iddObjectType());
 }
Esempio n. 2
0
 OtherEquipment_Impl::OtherEquipment_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : SpaceLoadInstance_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == OtherEquipment::iddObjectType());
 }
 SetpointManagerFollowOutdoorAirTemperature_Impl::SetpointManagerFollowOutdoorAirTemperature_Impl(
     const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : HVACComponent_Impl(idfObject, model, keepHandle)
 {
   BOOST_ASSERT(idfObject.iddObject().type() == SetpointManagerFollowOutdoorAirTemperature::iddObjectType());
 }
Esempio n. 4
0
 WindowDataFile_Impl::WindowDataFile_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ConstructionBase_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == WindowDataFile::iddObjectType());
 }
Esempio n. 5
0
 CurveQuadraticLinear_Impl::CurveQuadraticLinear_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : Curve_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == CurveQuadraticLinear::iddObjectType());
 }
Esempio n. 6
0
 WeatherFileDays_Impl::WeatherFileDays_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : SizingPeriod_Impl(idfObject, model, keepHandle)
 {
   BOOST_ASSERT(idfObject.iddObject().type() == WeatherFileDays::iddObjectType());
 }
TEST_F(IdfFixture, WorkspaceObject_FieldSettingWithHiddenPushes) {
  Workspace scratch(StrictnessLevel::None,IddFileType::EnergyPlus); // Strictness level None

  std::stringstream text;
  text << "ZoneHVAC:HighTemperatureRadiant," << std::endl
       << "  MyRadiantSystem," << std::endl
       << "  MyHVACSchedule," << std::endl
       << "  MyCoreZone," << std::endl
       << "  HeatingDesignCapacity," << std::endl
       << "  Autosize," << std::endl
       << "  ," << std::endl
       << "  ," << std::endl
       << "  Electricity;";
  OptionalIdfObject oObj = IdfObject::load(text.str());
  ASSERT_TRUE(oObj);
  IdfObject idfObject = *oObj;
  OptionalWorkspaceObject w1 = scratch.addObject(idfObject);
  ASSERT_TRUE(w1);
  OptionalWorkspaceObject tObject = scratch.getObject(w1->handle ());
  ASSERT_TRUE(tObject);
  WorkspaceObject object = *tObject;
  EXPECT_EQ(static_cast<unsigned>(8),object.numFields());

  // create schedule object to point to from non-extensible field
  text.str("");
  text << "Schedule:Compact," << std::endl
       << "  AlwaysOn," << std::endl
       << "  ," << std::endl
       << "  For: AllOtherDays," << std::endl
       << "  Until: 24:00," << std::endl
       << "  1.0;";
  oObj = IdfObject::load(text.str());
  ASSERT_TRUE(oObj);
  idfObject = *oObj;
  ASSERT_TRUE(idfObject.iddObject().type() == IddObjectType::Schedule_Compact);
  OptionalWorkspaceObject w2 = scratch.addObject(idfObject);
  ASSERT_TRUE(w2);
  EXPECT_TRUE(object.setPointer(14,w2->handle ()));
  EXPECT_EQ(15u,object.numFields());
  tObject = object.getTarget(14);
  ASSERT_TRUE(tObject);
  EXPECT_TRUE(tObject->handle() == w2->handle());

  // hidden pushing for setting extensible string pointer
  EXPECT_TRUE(object.setString(16,*(tObject->name()))); // should only work at strictness none
  tObject = object.getTarget(16);
  ASSERT_TRUE(tObject);
  EXPECT_TRUE(tObject->handle() == w2->handle());
  EXPECT_EQ(18u,object.numFields());

  // hidden pushing for setting extensible double
  EXPECT_TRUE(object.setDouble(19,0.5));
  EXPECT_EQ(20u,object.numFields());
  OptionalDouble dValue = object.getDouble(19);
  ASSERT_TRUE(dValue);
  EXPECT_NEAR(0.5,*dValue,tol);
  
  // SHOULD NOT BE VALID
  scratch = Workspace(StrictnessLevel::Draft, IddFileType::EnergyPlus); // Non-null data must be valid
  text.str("");
  text << "ZoneHVAC:HighTemperatureRadiant," << std::endl
       << "  MyRadiantSystem," << std::endl
       << "  MyHVACSchedule," << std::endl
       << "  MyCoreZone," << std::endl
       << "  HeatingDesignCapacity," << std::endl
       << "  Autosize," << std::endl
       << "  ," << std::endl
       << "  ," << std::endl
       << "  Electricity;";
  oObj = IdfObject::load(text.str());
  ASSERT_TRUE(oObj);
  idfObject = *oObj;
  w2 = scratch.addObject(idfObject);
  ASSERT_TRUE(w2);
  tObject = scratch.getObject(w2->handle());
  ASSERT_TRUE(tObject);
  object = *tObject;

  // hidden pushing for setting nonextensible double
  EXPECT_FALSE(object.setDouble(9,1.5));
  EXPECT_EQ(8u,object.numFields());
  EXPECT_TRUE(object.setDouble(9,0.6));
  EXPECT_EQ(10u,object.numFields());

  // hidden pushing for setting nonextensible string
  EXPECT_FALSE(object.setString(12,"bad key"));
  EXPECT_EQ(10u,object.numFields());
  EXPECT_TRUE(object.setString(12,"MeanAirTemperature"));
  EXPECT_EQ(13u,object.numFields());

  // hidden pushing for setting nonextensible pointer
  EXPECT_TRUE(object.setString(14,""));
  EXPECT_EQ(15u,object.numFields());

  // hidden pushing for setting extensible string pointer
  EXPECT_FALSE(object.setString(16,"MySurface"));
  EXPECT_EQ(15u,object.numFields());
  EXPECT_TRUE(object.setString(16,""));
  EXPECT_EQ(18u,object.numFields());

  // hidden pushing for setting extensible double
  EXPECT_FALSE(object.setDouble(21,-1.5));
  EXPECT_EQ(18u,object.numFields());
  EXPECT_TRUE(object.setDouble(19,0.5));
  EXPECT_EQ(20u,object.numFields());
}
 CurveRectangularHyperbola2_Impl::CurveRectangularHyperbola2_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : Curve_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == CurveRectangularHyperbola2::iddObjectType());
 }
 LightingSimulationControl_Impl::LightingSimulationControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ModelObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == LightingSimulationControl::iddObjectType());
 }
Esempio n. 10
0
 ClimateZones_Impl::ClimateZones_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ModelObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == ClimateZones::iddObjectType());
 }
Esempio n. 11
0
TEST_F(IdfFixture, IdfObject_DefaultFieldComments) {
  // OBJECT WITH NO FIELD COMMENTS
  std::stringstream text;
  text << "  Schedule:Day:Interval," << std::endl
       << "    A Schedule," << std::endl
       << "    Any Number," << std::endl
       << "    ," << std::endl
       << "    09:00," << std::endl
       << "    0," << std::endl
       << "    22:00," << std::endl
       << "    1," << std::endl
       << "    24:00," << std::endl
       << "    0;";
  OptionalIdfObject oObj = IdfObject::load(text.str());
  ASSERT_TRUE(oObj);
  IdfObject object = *oObj;
  // non-extensible fields
  OptionalString fc = object.fieldComment(0,true);
  OptionalIddField iddField = object.iddObject().getField(0);
  ASSERT_TRUE(fc); ASSERT_TRUE(iddField);
  EXPECT_EQ(makeIdfEditorComment(iddField->name()),*fc);
  fc = object.fieldComment(0);
  ASSERT_TRUE(fc); EXPECT_TRUE(fc->empty());

  fc = object.fieldComment(2,true);
  iddField = object.iddObject().getField(2);
  ASSERT_TRUE(fc); ASSERT_TRUE(iddField);
  EXPECT_EQ(makeIdfEditorComment(iddField->name()),*fc);
  fc = object.fieldComment(2);
  ASSERT_TRUE(fc); EXPECT_TRUE(fc->empty());

  // extensible fields
  fc = object.fieldComment(6,true);
  iddField = object.iddObject().getField(6);
  ASSERT_TRUE(fc); ASSERT_TRUE(iddField);
  EXPECT_EQ(makeIdfEditorComment(iddField->name()) + " 2",*fc);
  fc = object.fieldComment(6);
  ASSERT_TRUE(fc); EXPECT_TRUE(fc->empty());

  // non-existant fields
  fc = object.fieldComment(14,true);
  EXPECT_FALSE(fc);

  // OBJECT WITH SOME FIELD COMMENTS
  text.str("");
  text << "  Schedule:Day:Interval," << std::endl
       << "    A Schedule," << std::endl
       << "    Any Number," << std::endl
       << "    ," << std::endl
       << "    09:00, ! opening time" << std::endl
       << "    0," << std::endl
       << "    22:00, ! closing time" << std::endl
       << "    1," << std::endl
       << "    24:00," << std::endl
       << "    0;";
  oObj = IdfObject::load(text.str());
  ASSERT_TRUE(oObj);
  object = *oObj;
  // returns set values
  fc = object.fieldComment(3,true);
  ASSERT_TRUE(fc);
  EXPECT_EQ("! opening time",*fc);
  fc = object.fieldComment(5,true);
  ASSERT_TRUE(fc);
  EXPECT_EQ("! closing time",*fc);

  // returns default for fields behind fields with set values
  fc = object.fieldComment(4,true);
  iddField = object.iddObject().getField(4);
  ASSERT_TRUE(fc); ASSERT_TRUE(iddField);
  EXPECT_EQ(makeIdfEditorComment(iddField->name()) + " 1",*fc);
  fc = object.fieldComment(6);
  ASSERT_TRUE(fc); EXPECT_TRUE(fc->empty());

  // returns default for fields past fields with set values
  fc = object.fieldComment(6,true);
  iddField = object.iddObject().getField(6);
  ASSERT_TRUE(fc); ASSERT_TRUE(iddField);
  EXPECT_EQ(makeIdfEditorComment(iddField->name()) + " 2",*fc);
  fc = object.fieldComment(6);
  ASSERT_TRUE(fc); EXPECT_TRUE(fc->empty());

}
 HotWaterEquipmentDefinition_Impl::HotWaterEquipmentDefinition_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : SpaceLoadDefinition_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == HotWaterEquipmentDefinition::iddObjectType());
 }
Esempio n. 13
0
 InternalMass_Impl::InternalMass_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : SpaceLoadInstance_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == InternalMass::iddObjectType());
 }
Esempio n. 14
0
 ScheduleWeek_Impl::ScheduleWeek_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ResourceObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == ScheduleWeek::iddObjectType());
 }
 FFactorGroundFloorConstruction_Impl::FFactorGroundFloorConstruction_Impl(
     const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ConstructionBase_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == FFactorGroundFloorConstruction::iddObjectType());
 }
LifeCycleCostUsePriceEscalation_Impl::LifeCycleCostUsePriceEscalation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
  : ParentObject_Impl(idfObject, model, keepHandle)
{
  OS_ASSERT(idfObject.iddObject().type() == LifeCycleCostUsePriceEscalation::iddObjectType());
}
Esempio n. 17
0
 Timestep_Impl::Timestep_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ModelObject_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == Timestep::iddObjectType());
 }
Esempio n. 18
0
 BoilerHotWater_Impl::BoilerHotWater_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : StraightComponent_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == BoilerHotWater::iddObjectType());
 }
 DefaultSurfaceConstructions_Impl::DefaultSurfaceConstructions_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ResourceObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == DefaultSurfaceConstructions::iddObjectType());
 }
Esempio n. 20
0
 CurveSigmoid_Impl::CurveSigmoid_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : Curve_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == CurveSigmoid::iddObjectType());
 }
 ScheduleFixedInterval_Impl::ScheduleFixedInterval_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ScheduleInterval_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == ScheduleFixedInterval::iddObjectType());
 }
SiteWaterMainsTemperature_Impl::SiteWaterMainsTemperature_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
    : ModelObject_Impl(idfObject,model,keepHandle)
{
    OS_ASSERT(idfObject.iddObject().type() == SiteWaterMainsTemperature::iddObjectType());
}
 ExteriorLightsDefinition_Impl::ExteriorLightsDefinition_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ResourceObject_Impl(idfObject,model,keepHandle)
 {
   BOOST_ASSERT(idfObject.iddObject().type() == ExteriorLightsDefinition::iddObjectType());
 }
Esempio n. 24
0
 ConvergenceLimits_Impl::ConvergenceLimits_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ModelObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == ConvergenceLimits::iddObjectType());
 }
 CurveDoubleExponentialDecay_Impl::CurveDoubleExponentialDecay_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : Curve_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == CurveDoubleExponentialDecay::iddObjectType());
 }
Esempio n. 26
0
 BuildingStory_Impl::BuildingStory_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : ModelObject_Impl(idfObject,model,keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == BuildingStory::iddObjectType());
 }
boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXSingleSpeed( CoilCoolingDXSingleSpeed& modelObject )
{
  IdfObject coilSystemCoolingDXIdf(IddObjectType::CoilSystem_Cooling_DX);
    
  m_idfObjects.push_back(coilSystemCoolingDXIdf);

  boost::optional<IdfObject> oIdfObject = translateCoilCoolingDXSingleSpeedWithoutUnitary(modelObject);

  if( ! oIdfObject ) { return boost::none; }

  IdfObject idfObject = oIdfObject.get();

  OptionalString s;

  s = modelObject.name();
  if( s )
  {
    coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::CoolingCoilObjectType,idfObject.iddObject().name());

    coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::CoolingCoilName,*s);

    coilSystemCoolingDXIdf.setName(*s + " CoilSystem");
  }

  Schedule sched = modelObject.getAvailabilitySchedule();
  translateAndMapModelObject(sched);

  coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::AvailabilityScheduleName,sched.name().get());

  OptionalModelObject omo = modelObject.inletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemInletNodeName,*s);
    }
  }

  omo= modelObject.outletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemOutletNodeName,*s);

      coilSystemCoolingDXIdf.setString(CoilSystem_Cooling_DXFields::DXCoolingCoilSystemSensorNodeName,*s);
    }
  }

  return coilSystemCoolingDXIdf;
}
 ConstructionWithInternalSource_Impl::ConstructionWithInternalSource_Impl(
     const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : LayeredConstruction_Impl(idfObject, model, keepHandle)
 {
   OS_ASSERT(idfObject.iddObject().type() == ConstructionWithInternalSource::iddObjectType());
 }
UtilityCost_Computation_Impl::UtilityCost_Computation_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
  : ParentObject_Impl(idfObject, model, keepHandle)
{
  OS_ASSERT(idfObject.iddObject().type() == UtilityCost_Computation::iddObjectType());
}
Esempio n. 30
0
 AirLoopHVACZoneMixer_Impl::AirLoopHVACZoneMixer_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
   : Mixer_Impl(idfObject, model, keepHandle)
 {
   BOOST_ASSERT(idfObject.iddObject().type() == AirLoopHVACZoneMixer::iddObjectType());
 }