boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACReturnPath( AirLoopHVAC & airLoopHVAC )
{
  IdfObject returnPathIdf(openstudio::IddObjectType::AirLoopHVAC_ReturnPath);
  m_idfObjects.push_back(returnPathIdf);

  returnPathIdf.setName(airLoopHVAC.name().get() + " Return Path");

  Node node = airLoopHVAC.demandOutletNode();
  returnPathIdf.setString(openstudio::AirLoopHVAC_ReturnPathFields::ReturnAirPathOutletNodeName,node.name().get());

  std::vector<ModelObject> returnPlenums = airLoopHVAC.demandComponents(AirLoopHVACReturnPlenum::iddObjectType());
  for( auto & returnPlenum : returnPlenums )
  {
    IdfExtensibleGroup eg = returnPathIdf.pushExtensibleGroup();
    boost::optional<IdfObject> _returnPlenum = translateAndMapModelObject(returnPlenum);
    OS_ASSERT(_returnPlenum);
    eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentObjectType,_returnPlenum->iddObject().name());
    eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentName,_returnPlenum->name().get());
  }

  AirLoopHVACZoneMixer zoneMixer = airLoopHVAC.zoneMixer();
  boost::optional<IdfObject> _zoneMixer = translateAndMapModelObject(zoneMixer);
  OS_ASSERT(_zoneMixer);
  IdfExtensibleGroup eg = returnPathIdf.pushExtensibleGroup();
  eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentObjectType,_zoneMixer->iddObject().name());
  eg.setString(AirLoopHVAC_ReturnPathExtensibleFields::ComponentName,_zoneMixer->name().get());

  return boost::optional<IdfObject>(returnPathIdf);
}
boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACSupplyPath( AirLoopHVAC & airLoopHVAC )
{
  std::string s;

  IdfObject supplyPathIdf(openstudio::IddObjectType::AirLoopHVAC_SupplyPath);
  m_idfObjects.push_back(supplyPathIdf);

  supplyPathIdf.setName(airLoopHVAC.name().get() + " Supply Path");

  model::Node node = airLoopHVAC.demandInletNode();
  supplyPathIdf.setString(openstudio::AirLoopHVAC_SupplyPathFields::SupplyAirPathInletNodeName,node.name().get());

  model::AirLoopHVACZoneSplitter zoneSplitter = airLoopHVAC.zoneSplitter();

  boost::optional<IdfObject> _zoneSplitter = translateAndMapModelObject(zoneSplitter);
  OS_ASSERT(_zoneSplitter);
  IdfExtensibleGroup eg = supplyPathIdf.pushExtensibleGroup();
  eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_zoneSplitter->iddObject().name());
  eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_zoneSplitter->name().get());

  std::vector<ModelObject> supplyPlenums = airLoopHVAC.demandComponents(AirLoopHVACSupplyPlenum::iddObjectType());
  for( std::vector<ModelObject>::iterator it = supplyPlenums.begin();
       it != supplyPlenums.end();
       it++ )
  {
    eg = supplyPathIdf.pushExtensibleGroup();
    boost::optional<IdfObject> _supplyPlenum = translateAndMapModelObject(*it);
    OS_ASSERT(_supplyPlenum);
    eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentObjectType,_supplyPlenum->iddObject().name());
    eg.setString(AirLoopHVAC_SupplyPathExtensibleFields::ComponentName,_supplyPlenum->name().get());
  }

  return boost::optional<IdfObject>(supplyPathIdf);
}
boost::optional<IdfObject> ForwardTranslator::createAirLoopHVACSupplyPath( AirLoopHVAC & airLoopHVAC )
{
  std::string s;

  IdfObject supplyPathIdf(openstudio::IddObjectType::AirLoopHVAC_SupplyPath);

  m_idfObjects.push_back(supplyPathIdf);

  supplyPathIdf.createName();

  s = airLoopHVAC.demandInletNodes().front().name().get();
  supplyPathIdf.setString(openstudio::AirLoopHVAC_SupplyPathFields::SupplyAirPathInletNodeName,s);

  ModelObjectVector modelObjects;
  modelObjects = airLoopHVAC.demandComponents( airLoopHVAC.demandInletNodes().front(),
                                               airLoopHVAC.demandOutletNode(),
                                               openstudio::IddObjectType::OS_AirLoopHVAC_ZoneSplitter );
  if( modelObjects.size() == 1 )
  {
    ModelObject modelObject = modelObjects.front();
    OptionalAirLoopHVACZoneSplitter zoneSplitter = modelObject.optionalCast<AirLoopHVACZoneSplitter>();
    translateAndMapModelObject(*zoneSplitter);

    s = stripOS2(zoneSplitter->iddObject().name());
    supplyPathIdf.setString(2,s);

    s = zoneSplitter->name().get();
    supplyPathIdf.setString(3,s);
  }

  return boost::optional<IdfObject>(supplyPathIdf);
}