boost::optional<IdfObject> ForwardTranslator::translateRefrigerationSecondarySystem( RefrigerationSecondarySystem & modelObject )
{
  OptionalModelObject temp;
  boost::optional<std::string> s;
  boost::optional<double> d;
  boost::optional<int> i;
  std::string name;

// Name
  IdfObject refrigerationSecondarySystem = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_SecondarySystem,
                                                          modelObject);

//RefrigeratedCaseorWalkinorCaseAndWalkInListName
  std::vector<RefrigerationCase> cases = modelObject.cases();
  std::vector<RefrigerationWalkIn> walkins = modelObject.walkins();
  std::vector<RefrigerationAirChiller> airChillers = modelObject.airChillers();

  if( !cases.empty() || !walkins.empty() || !airChillers.empty() )
  {
    // Name
    name = " Case and Walkin List";
    refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::RefrigeratedCaseorWalkinorCaseAndWalkInListName, refrigerationSecondarySystem.name().get() + name);

    IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);

    m_idfObjects.push_back(_caseAndWalkinList);

    _caseAndWalkinList.setName(refrigerationSecondarySystem.name().get() + name);

    for( auto & elem : cases )
    {
      boost::optional<IdfObject> _case = translateAndMapModelObject(elem);

      if( _case )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get()); 
      }
    }

    for( auto & elem : walkins )
    {
      boost::optional<IdfObject> _walkin = translateAndMapModelObject(elem);

      if( _walkin )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get()); 
      }
    }

    for( auto & elem : airChillers )
    {
      boost::optional<IdfObject> _airChiller = translateAndMapModelObject(elem);

      if( _airChiller )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_airChiller->name().get()); 
      }
    }
  }

//CirculatingFluidType
//CirculatingFluidName
  s = modelObject.circulatingFluidName();
  if (s) {
    i = modelObject.glycolConcentration();
    boost::optional<IdfObject> fluidProperties;
    if ( i && (istringEqual(s.get(), "PropyleneGlycol") || istringEqual(s.get(), "EthyleneGlycol")) ) {
      fluidProperties = createFluidProperties(s.get(), i.get());
      refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidType,"FluidAlwaysLiquid");
    } else {
      fluidProperties = createFluidProperties(s.get());
      refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidType,"FluidPhaseChange");
    }
    if( fluidProperties ) {
      boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName,true);
      if( value ) {
        refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::CirculatingFluidName,value.get());
      }
    }
  }

//EvaporatorCapacity
  d = modelObject.evaporatorCapacity();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorCapacity,d.get());
  }

//EvaporatorFlowRateforSecondaryFluid
  d = modelObject.evaporatorFlowRateforSecondaryFluid();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorFlowRateforSecondaryFluid,d.get());
  }

//EvaporatorEvaporatingTemperature
  d = modelObject.evaporatorEvaporatingTemperature();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorEvaporatingTemperature,d.get());
  }

//EvaporatorApproachTemperatureDifference
  d = modelObject.evaporatorApproachTemperatureDifference();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorApproachTemperatureDifference,d.get());
  }

//EvaporatorRangeTemperatureDifference
  d = modelObject.evaporatorRangeTemperatureDifference();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorRangeTemperatureDifference,d.get());
  }

//NumberofPumpsinLoop
  i = modelObject.numberofPumpsinLoop();
  if (i) {
    refrigerationSecondarySystem.setInt(Refrigeration_SecondarySystemFields::NumberofPumpsinLoop,d.get());
  }

//TotalPumpFlowRate
  d = modelObject.totalPumpFlowRate();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpFlowRate,d.get());
  }

//TotalPumpPower
  d = modelObject.totalPumpPower();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpPower,d.get());
  }

//TotalPumpHead
  d = modelObject.totalPumpHead();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::TotalPumpHead,d.get());
  }

//PhaseChangeCirculatingRate
  d = modelObject.phaseChangeCirculatingRate();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::PhaseChangeCirculatingRate,d.get());
  }

//PumpDriveType
  s = modelObject.pumpDriveType();
  if (s) {
    refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::PumpDriveType,s.get());
  }

//VariableSpeedPumpCubicCurveName
  boost::optional<CurveCubic> variableSpeedPumpCubicCurve = modelObject.variableSpeedPumpCubicCurve();

  if( variableSpeedPumpCubicCurve )
  {
    boost::optional<IdfObject> _variableSpeedPumpCubicCurve = translateAndMapModelObject(variableSpeedPumpCubicCurve.get());

    if( _variableSpeedPumpCubicCurve && _variableSpeedPumpCubicCurve->name() )
    {
      refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::VariableSpeedPumpCubicCurveName,_variableSpeedPumpCubicCurve->name().get());
    }
  }

//PumpMotorHeattoFluid
  d = modelObject.pumpMotorHeattoFluid();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::PumpMotorHeattoFluid,d.get());
  }

//SumUADistributionPiping
  d = modelObject.sumUADistributionPiping();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::SumUADistributionPiping,d.get());
  }

//DistributionPipingZoneName
  boost::optional<ThermalZone> distributionPipingZone = modelObject.distributionPipingZone();

  if( distributionPipingZone )
  {
    boost::optional<IdfObject> _distributionPipingZone = translateAndMapModelObject(distributionPipingZone.get());

    if( _distributionPipingZone && _distributionPipingZone->name() )
    {
      refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::DistributionPipingZoneName,_distributionPipingZone->name().get());
    }
  }

//SumUAReceiver_SeparatorShell
  d = modelObject.sumUAReceiverSeparatorShell();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::SumUAReceiver_SeparatorShell,d.get());
  }

//Receiver_SeparatorZoneName
  boost::optional<ThermalZone> receiverSeparatorZone = modelObject.receiverSeparatorZone();

  if( receiverSeparatorZone )
  {
    boost::optional<IdfObject> _receiverSeparatorZone = translateAndMapModelObject(receiverSeparatorZone.get());

    if( _receiverSeparatorZone && _receiverSeparatorZone->name() )
    {
      refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::Receiver_SeparatorZoneName,_receiverSeparatorZone->name().get());
    }
  }

//EvaporatorRefrigerantInventory
  d = modelObject.evaporatorRefrigerantInventory();
  if (d) {
    refrigerationSecondarySystem.setDouble(Refrigeration_SecondarySystemFields::EvaporatorRefrigerantInventory,d.get());
  }

//EndUseSubcategory
  s = modelObject.endUseSubcategory();
  if (s) {
    refrigerationSecondarySystem.setString(Refrigeration_SecondarySystemFields::EndUseSubcategory,s.get());
  }

  return refrigerationSecondarySystem;

}
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationTranscriticalSystem( RefrigerationTranscriticalSystem & modelObject )
{
  OptionalModelObject temp;
  boost::optional<std::string> s;
  boost::optional<double> d;
  std::string name;

// Name
  IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_TranscriticalSystem, modelObject);

//MediumTemperatureRefrigeratedCaseAndWalkInListName
  std::vector<RefrigerationCase> mediumTemperatureCases = modelObject.mediumTemperatureCases();
  std::vector<RefrigerationWalkIn> mediumTemperatureWalkins = modelObject.mediumTemperatureWalkins();

  if( !mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty() )
  {
    // Name
    name = " Medium Temperature Case and Walkin List";
    idfObject.setString(Refrigeration_TranscriticalSystemFields::MediumTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, idfObject.name().get() + name);

    IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);

    m_idfObjects.push_back(_caseAndWalkinList);

    _caseAndWalkinList.setName(idfObject.name().get() + name);

    for( auto & mediumTemperatureCase : mediumTemperatureCases )
    {
      boost::optional<IdfObject> _case = translateAndMapModelObject(mediumTemperatureCase);

      if( _case )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get()); 
      }
    }

    for( auto & mediumTemperatureWalkin : mediumTemperatureWalkins )
    {
      boost::optional<IdfObject> _walkin = translateAndMapModelObject(mediumTemperatureWalkin);

      if( _walkin )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get()); 
      }
    }
  }

//LowTemperatureRefrigeratedCaseAndWalkInListName
  std::vector<RefrigerationCase> lowTemperatureCases = modelObject.lowTemperatureCases();
  std::vector<RefrigerationWalkIn> lowTemperatureWalkins = modelObject.lowTemperatureWalkins();

  if( !lowTemperatureCases.empty() || !lowTemperatureWalkins.empty() )
  {
    // Name
    name = " Low Temperature Case and Walkin List";
    idfObject.setString(Refrigeration_TranscriticalSystemFields::LowTemperatureRefrigeratedCaseorWalkinorCaseAndWalkInListName, idfObject.name().get() + name);

    IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);

    m_idfObjects.push_back(_caseAndWalkinList);

    _caseAndWalkinList.setName(idfObject.name().get() + name);

    for( auto & lowTemperatureCase : lowTemperatureCases )
    {
      boost::optional<IdfObject> _case = translateAndMapModelObject(lowTemperatureCase);

      if( _case )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get()); 
      }
    }

    for( auto & lowTemperatureWalkin : lowTemperatureWalkins )
    {
      boost::optional<IdfObject> _walkin = translateAndMapModelObject(lowTemperatureWalkin);

      if( _walkin )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get()); 
      }
    }
  }

// SystemType
  if ( (!mediumTemperatureCases.empty() || !mediumTemperatureWalkins.empty()) &&
       (!lowTemperatureCases.empty() || !lowTemperatureWalkins.empty()) ) {
    idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType,"TwoStage");
  }
  else {
    idfObject.setString(Refrigeration_TranscriticalSystemFields::SystemType,"SingleStage");
  }

// RefrigerationGasCoolerName
  if( boost::optional<RefrigerationGasCoolerAirCooled> refrigerationGasCooler = modelObject.refrigerationGasCooler() )
  {
    boost::optional<IdfObject> _refrigerationGasCooler = translateAndMapModelObject(refrigerationGasCooler.get());

    if( _refrigerationGasCooler && _refrigerationGasCooler->name() )
    {
      idfObject.setString(Refrigeration_TranscriticalSystemFields::RefrigerationGasCoolerName,_refrigerationGasCooler->name().get());
    }
  }

//HighPressureCompressorListName
  std::vector<RefrigerationCompressor> highPressureCompressors = modelObject.highPressureCompressors();

  if( !highPressureCompressors.empty() )
  {
    // Name
    name = " High Pressure Compressor List";
    idfObject.setString(Refrigeration_TranscriticalSystemFields::HighPressureCompressororCompressorListName, idfObject.name().get() + name);

    IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList);

    m_idfObjects.push_back(_compressorList);

    _compressorList.setName(idfObject.name().get() + name);

    for( auto & highPressureCompressor :  highPressureCompressors )
    {
      boost::optional<IdfObject> _compressor = translateAndMapModelObject(highPressureCompressor);

      if( _compressor )
      {
        IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup();

        eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName,_compressor->name().get()); 
      }
    }
  }

//LowPressureCompressorListName
  std::vector<RefrigerationCompressor> lowPressureCompressors = modelObject.lowPressureCompressors();

  if( !lowPressureCompressors.empty() )
  {
    // Name
    name = " Low Pressure Compressor List";
    idfObject.setString(Refrigeration_TranscriticalSystemFields::LowPressureCompressororCompressorListName, idfObject.name().get() + name);

    IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList);

    m_idfObjects.push_back(_compressorList);

    _compressorList.setName(idfObject.name().get() + name);

    for( auto & lowPressureCompressor : lowPressureCompressors )
    {
      boost::optional<IdfObject> _compressor = translateAndMapModelObject(lowPressureCompressor);

      if( _compressor )
      {
        IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup();

        eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName,_compressor->name().get()); 
      }
    }
  }

// ReceiverPressure
  d = modelObject.receiverPressure();
  if (d) {
    idfObject.setDouble(Refrigeration_TranscriticalSystemFields::ReceiverPressure,d.get());
  }

// SubcoolerEffectiveness
  d = modelObject.subcoolerEffectiveness();
  if (d) {
    idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SubcoolerEffectiveness,d.get());
  }

// RefrigerationSystemWorkingFluidType
  s = modelObject.refrigerationSystemWorkingFluidType();
  if (s) {
    boost::optional<IdfObject> fluidProperties = createFluidProperties(s.get());
    if( fluidProperties ) {
      boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName,true);
      if( value ) {
        idfObject.setString(Refrigeration_TranscriticalSystemFields::RefrigerationSystemWorkingFluidType,value.get());
      }
    }
  }

// SumUASuctionPipingforMediumTemperatureLoads
  d = modelObject.sumUASuctionPipingforMediumTemperatureLoads();
  if (d) {
    idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SumUASuctionPipingforMediumTemperatureLoads,d.get());
  }

// MediumTemperatureSuctionPipingZoneName
  if( boost::optional<ThermalZone> mediumTemperatureSuctionPipingZone = modelObject.mediumTemperatureSuctionPipingZone() )
  {
    boost::optional<IdfObject> _mediumTemperatureSuctionPipingZone = translateAndMapModelObject(mediumTemperatureSuctionPipingZone.get());

    if( _mediumTemperatureSuctionPipingZone && _mediumTemperatureSuctionPipingZone->name() )
    {
      idfObject.setString(Refrigeration_TranscriticalSystemFields::MediumTemperatureSuctionPipingZoneName,_mediumTemperatureSuctionPipingZone->name().get());
    }
  }

// SumUASuctionPipingforLowTemperatureLoads
  d = modelObject.sumUASuctionPipingforLowTemperatureLoads();
  if (d) {
    idfObject.setDouble(Refrigeration_TranscriticalSystemFields::SumUASuctionPipingforLowTemperatureLoads,d.get());
  }

// LowTemperatureSuctionPipingZoneName
  if( boost::optional<ThermalZone> lowTemperatureSuctionPipingZone = modelObject.lowTemperatureSuctionPipingZone() )
  {
    boost::optional<IdfObject> _lowTemperatureSuctionPipingZone = translateAndMapModelObject(lowTemperatureSuctionPipingZone.get());

    if( _lowTemperatureSuctionPipingZone && _lowTemperatureSuctionPipingZone->name() )
    {
      idfObject.setString(Refrigeration_TranscriticalSystemFields::LowTemperatureSuctionPipingZoneName,_lowTemperatureSuctionPipingZone->name().get());
    }
  }

// EndUseSubcategory
  s = modelObject.endUseSubcategory();
  if (s) {
    idfObject.setString(Refrigeration_TranscriticalSystemFields::EndUseSubcategory,s.get());
  }

  return idfObject;

}
boost::optional<IdfObject> ForwardTranslator::translateRefrigerationSystem( RefrigerationSystem & modelObject )
{
  OptionalModelObject temp;
  OptionalString optS;
  boost::optional<std::string> s;
  boost::optional<double> d;
  std::string name;

// Name
  IdfObject refrigerationSystem = createRegisterAndNameIdfObject(openstudio::IddObjectType::Refrigeration_System,
                                                          modelObject);

//Refrigerated Case or Walkin or CaseAndWalkInList Name
  std::vector<RefrigerationCase> cases = modelObject.cases();
  std::vector<RefrigerationWalkIn> walkins = modelObject.walkins();
  std::vector<RefrigerationAirChiller> airChillers = modelObject.airChillers();

  if( !cases.empty() || !walkins.empty() || !airChillers.empty() )
  {
  	// Name
  	name = " Case and Walkin List";
  	refrigerationSystem.setString(Refrigeration_SystemFields::RefrigeratedCaseorWalkinorCaseAndWalkInListName, refrigerationSystem.name().get() + name);

  	IdfObject _caseAndWalkinList(IddObjectType::Refrigeration_CaseAndWalkInList);

  	m_idfObjects.push_back(_caseAndWalkinList);

  	_caseAndWalkinList.setName(refrigerationSystem.name().get() + name);

  	for( std::vector<RefrigerationCase>::iterator it = cases.begin();
  	   it != cases.end();
  	   ++it )
  	{
  		boost::optional<IdfObject> _case = translateAndMapModelObject(*it);

  		if( _case )
  		{
  		  IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

  		  eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_case->name().get()); 
  		}
  	}

  	for( std::vector<RefrigerationWalkIn>::iterator it = walkins.begin();
  	   it != walkins.end();
  	   ++it )
  	{
  		boost::optional<IdfObject> _walkin = translateAndMapModelObject(*it);

  		if( _walkin )
  		{
  		  IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

  		  eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_walkin->name().get()); 
  		}
  	}

    for( std::vector<RefrigerationAirChiller>::iterator it = airChillers.begin();
       it != airChillers.end();
       it++ )
    {
      boost::optional<IdfObject> _airChiller = translateAndMapModelObject(*it);

      if( _airChiller )
      {
        IdfExtensibleGroup eg = _caseAndWalkinList.pushExtensibleGroup();

        eg.setString(Refrigeration_CaseAndWalkInListExtensibleFields::CaseorWalkInName,_airChiller->name().get()); 
      }
    }
  }

//Refrigeration Transfer Load or TransferLoad List Name
  std::vector<RefrigerationSecondarySystem> secondarySystemLoads = modelObject.secondarySystemLoads();
  std::vector<RefrigerationCondenserCascade> cascadeCondenserLoads = modelObject.cascadeCondenserLoads();

  if( !secondarySystemLoads.empty() || !cascadeCondenserLoads.empty() )
  {
    // Name
    name = " Transfer Load List";
    refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationTransferLoadorTransferLoadListName, refrigerationSystem.name().get() + name);

    IdfObject _transferLoadList(IddObjectType::Refrigeration_TransferLoadList);

    m_idfObjects.push_back(_transferLoadList);

    _transferLoadList.setName(refrigerationSystem.name().get() + name);

    for( std::vector<RefrigerationSecondarySystem>::iterator it = secondarySystemLoads.begin();
       it != secondarySystemLoads.end();
       ++it )
    {
      boost::optional<IdfObject> _secondarySystemLoad = translateAndMapModelObject(*it);

      if( _secondarySystemLoad )
      {
        IdfExtensibleGroup eg = _transferLoadList.pushExtensibleGroup();

        eg.setString(Refrigeration_TransferLoadListExtensibleFields::CascadeCondenserNameorSecondarySystemName,_secondarySystemLoad->name().get()); 
      }
    }

    for( std::vector<RefrigerationCondenserCascade>::iterator it = cascadeCondenserLoads.begin();
       it != cascadeCondenserLoads.end();
       ++it )
    {
      boost::optional<IdfObject> _cascadeCondenserLoad = translateAndMapModelObject(*it);

      if( _cascadeCondenserLoad )
      {
        IdfExtensibleGroup eg = _transferLoadList.pushExtensibleGroup();

        eg.setString(Refrigeration_TransferLoadListExtensibleFields::CascadeCondenserNameorSecondarySystemName,_cascadeCondenserLoad->name().get()); 
      }
    }
  }

//Refrigeration Condenser Name
  boost::optional<ModelObject> refrigerationCondenser = modelObject.refrigerationCondenser();

  if( refrigerationCondenser )
  {
    boost::optional<IdfObject> _refrigerationCondenser = translateAndMapModelObject(refrigerationCondenser.get());

    if( _refrigerationCondenser && _refrigerationCondenser->name() )
    {
      refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationCondenserName,_refrigerationCondenser->name().get());
    }
  }

//Compressor or CompressorList Name
  std::vector<RefrigerationCompressor> compressors = modelObject.compressors();

  if( !compressors.empty() )
  {
    // Name
    name = " Compressor List";
    refrigerationSystem.setString(Refrigeration_SystemFields::CompressororCompressorListName, refrigerationSystem.name().get() + name);

    IdfObject _compressorList(IddObjectType::Refrigeration_CompressorList);

    m_idfObjects.push_back(_compressorList);

    _compressorList.setName(refrigerationSystem.name().get() + name);

    for( std::vector<RefrigerationCompressor>::iterator it = compressors.begin();
       it != compressors.end();
       ++it )
    {
      boost::optional<IdfObject> _compressor = translateAndMapModelObject(*it);

      if( _compressor )
      {
        IdfExtensibleGroup eg = _compressorList.pushExtensibleGroup();

        eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName,_compressor->name().get()); 
      }
    }
  }

//Minimum Condensing Temperature
  d = modelObject.minimumCondensingTemperature();
  if (d) {
    refrigerationSystem.setDouble(Refrigeration_SystemFields::MinimumCondensingTemperature,d.get());
  }

//Refrigeration System Working Fluid Type
  s = modelObject.refrigerationSystemWorkingFluidType();
  if (s) {
    boost::optional<IdfObject> fluidProperties = createFluidProperties(s.get());
    if( fluidProperties ) {
      boost::optional<std::string> value = fluidProperties.get().getString(FluidProperties_NameFields::FluidName,true);
      if( value ) {
        refrigerationSystem.setString(Refrigeration_SystemFields::RefrigerationSystemWorkingFluidType,value.get());
      }
    }
  }

//Suction Temperature Control Type
  s = modelObject.suctionTemperatureControlType();
  if (s) {
    refrigerationSystem.setString(Refrigeration_SystemFields::SuctionTemperatureControlType,s.get());
  }

//Mechanical Subcooler Name
  boost::optional<RefrigerationSubcoolerMechanical> mechanicalSubcooler = modelObject.mechanicalSubcooler();

  if( mechanicalSubcooler )
  {
    boost::optional<IdfObject> _mechanicalSubcooler = translateAndMapModelObject(mechanicalSubcooler.get());

    if( _mechanicalSubcooler && _mechanicalSubcooler->name() )
    {
      refrigerationSystem.setString(Refrigeration_SystemFields::MechanicalSubcoolerName,_mechanicalSubcooler->name().get());
    }
  }

//Liquid Suction Heat Exchanger Subcooler Name
  boost::optional<RefrigerationSubcoolerLiquidSuction> liquidSuctionHeatExchangerSubcooler = modelObject.liquidSuctionHeatExchangerSubcooler();

  if( liquidSuctionHeatExchangerSubcooler )
  {
    boost::optional<IdfObject> _liquidSuctionHeatExchangerSubcooler = translateAndMapModelObject(liquidSuctionHeatExchangerSubcooler.get());

    if( _liquidSuctionHeatExchangerSubcooler && _liquidSuctionHeatExchangerSubcooler->name() )
    {
      refrigerationSystem.setString(Refrigeration_SystemFields::LiquidSuctionHeatExchangerSubcoolerName,_liquidSuctionHeatExchangerSubcooler->name().get());
    }
  }

//Sum UA Suction Piping
  d = modelObject.sumUASuctionPiping();
  if (d) {
    refrigerationSystem.setDouble(Refrigeration_SystemFields::SumUASuctionPiping,d.get());
  }

//Suction Piping Zone Name
  boost::optional<ThermalZone> suctionPipingZone = modelObject.suctionPipingZone();

  if( suctionPipingZone )
  {
    boost::optional<IdfObject> _suctionPipingZone = translateAndMapModelObject(suctionPipingZone.get());

    if( _suctionPipingZone && _suctionPipingZone->name() )
    {
      refrigerationSystem.setString(Refrigeration_SystemFields::SuctionPipingZoneName,_suctionPipingZone->name().get());
    }
  }

//End-Use Subcategory
  s = modelObject.endUseSubcategory();
  if (s) {
    refrigerationSystem.setString(Refrigeration_SystemFields::EndUseSubcategory,s.get());
  }

//Number of Compressor Stages 
  s = modelObject.numberofCompressorStages();
  if (s) {
    refrigerationSystem.setString(Refrigeration_SystemFields::NumberofCompressorStages,s.get());
  }

//Intercooler Type 
  s = modelObject.intercoolerType();
  if (s) {
    refrigerationSystem.setString(Refrigeration_SystemFields::IntercoolerType,s.get());
  }

//Shell-and-Coil Intercooler Effectiveness 
  d = modelObject.shellandCoilIntercoolerEffectiveness();
  if (d) {
    refrigerationSystem.setDouble(Refrigeration_SystemFields::ShellandCoilIntercoolerEffectiveness,d.get());
  }

//High-Stage Compressor or CompressorList Name
  std::vector<RefrigerationCompressor> highStageCompressors = modelObject.highStageCompressors();

  if( !highStageCompressors.empty() )
  {
    // Name
    name = " High Stage Compressor List";
    refrigerationSystem.setString(Refrigeration_SystemFields::HighStageCompressororCompressorListName, refrigerationSystem.name().get() + name);

    IdfObject _highStageCompressorList(IddObjectType::Refrigeration_CompressorList);

    m_idfObjects.push_back(_highStageCompressorList);

    _highStageCompressorList.setName(refrigerationSystem.name().get() + name);

    for( std::vector<RefrigerationCompressor>::iterator it = highStageCompressors.begin();
       it != highStageCompressors.end();
       it++ )
    {
      boost::optional<IdfObject> _highStageCompressor = translateAndMapModelObject(*it);

      if( _highStageCompressor )
      {
        IdfExtensibleGroup eg = _highStageCompressorList.pushExtensibleGroup();

        eg.setString(Refrigeration_CompressorListExtensibleFields::RefrigerationCompressorName,_highStageCompressor->name().get()); 
      }
    }
  }

  return refrigerationSystem;

}