Beispiel #1
0
 Schedule CoilHeatingWater_Impl::availabilitySchedule() const {
   OptionalSchedule value = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_WaterFields::AvailabilityScheduleName);
   if (!value){
     // it is an error if we get here, however we don't want to crash
     // so we hook up to global always on schedule
     LOG(Error, "Required availability schedule not set, using 'Always On' schedule");
     value = this->model().alwaysOnDiscreteSchedule();
     OS_ASSERT(value);
     const_cast<CoilHeatingWater_Impl*>(this)->setAvailabilitySchedule(*value);
     value = getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_Coil_Heating_WaterFields::AvailabilityScheduleName);
   }
   OS_ASSERT(value);
   return value.get();
 }
boost::optional<IdfObject> ForwardTranslator::translateThermostatSetpointDualSetpoint( ThermostatSetpointDualSetpoint& modelObject )
{
  IdfObject tsds(openstudio::IddObjectType::ThermostatSetpoint_DualSetpoint);

  m_idfObjects.push_back(tsds);

  OptionalString s = modelObject.name();
  if( s )
  {
    tsds.setName(*s);
  }

  OptionalSchedule sched = modelObject.getHeatingSchedule();
  if(sched)
  {
    translateAndMapModelObject(*sched);
    tsds.setString(ThermostatSetpoint_DualSetpointFields::HeatingSetpointTemperatureScheduleName,sched->name().get());
  }
  sched = modelObject.getCoolingSchedule();
  if(sched)
  {
    translateAndMapModelObject(*sched);
    tsds.setString(ThermostatSetpoint_DualSetpointFields::CoolingSetpointTemperatureScheduleName,sched->name().get());
  }

  return boost::optional<IdfObject>(tsds);
}
boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXTwoSpeedWithoutUnitary( model::CoilCoolingDXTwoSpeed & modelObject )
{
  //setup two boost optionals to use to store get method returns
  boost::optional<std::string> s;
  boost::optional<double> d;

  //create the IdfObject that will be the coil
  IdfObject idfObject(IddObjectType::Coil_Cooling_DX_TwoSpeed);

  //Name
  m_idfObjects.push_back(idfObject);
  s = modelObject.name();
  if( s )
  {
    idfObject.setName(*s);
  }

  //  A2 , \field Availability Schedule Name
  Schedule sched = modelObject.getAvailabilitySchedule();
  translateAndMapModelObject(sched);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::AvailabilityScheduleName,
                      sched.name().get() );

  //  N1 , \field Rated High Speed Total Cooling Capacity
  d = modelObject.getRatedHighSpeedTotalCoolingCapacity();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedTotalCoolingCapacity,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedTotalCoolingCapacity,"Autosize");
  }

  //  N2 , \field Rated High Speed Sensible Heat Ratio
  d = modelObject.getRatedHighSpeedSensibleHeatRatio();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedSensibleHeatRatio,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedSensibleHeatRatio,"Autosize");
  }

  //  N3 , \field Rated High Speed COP
  d = modelObject.getRatedHighSpeedCOP();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedCOP,*d);
  }

  //  N4 , \field Rated High Speed Air Flow Rate
  d = modelObject.getRatedHighSpeedAirFlowRate();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedAirFlowRate,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedHighSpeedAirFlowRate,"Autosize");
  }

  //A3 , \field Air Inlet Node Name
  OptionalModelObject omo = modelObject.inletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::AirInletNodeName,*s );
    }
  }

  //A4 , \field Air Outlet Node Name
  omo= modelObject.outletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::AirOutletNodeName,*s);
    }
  }

  //  A5 , \field Total Cooling Capacity Function of Temperature Curve Name
  Curve cb =  modelObject.getTotalCoolingCapacityFunctionOfTemperatureCurve();
  translateAndMapModelObject(cb);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::TotalCoolingCapacityFunctionofTemperatureCurveName,
                     cb.name().get());

  //  A6 , \field Total Cooling Capacity Function of Flow Fraction Curve Name
  cb =  modelObject.getTotalCoolingCapacityFunctionOfFlowFractionCurve();
  translateAndMapModelObject(cb);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::TotalCoolingCapacityFunctionofFlowFractionCurveName,
                     cb.name().get());

  //  A7 , \field Energy Input Ratio Function of Temperature Curve Name
  cb =modelObject.getEnergyInputRatioFunctionOfTemperatureCurve();
  translateAndMapModelObject(cb);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::EnergyInputRatioFunctionofTemperatureCurveName,
                      cb.name().get());

  //  A8 , \field Energy Input Ratio Function of Flow Fraction Curve Name
  Curve cq = modelObject.getEnergyInputRatioFunctionOfFlowFractionCurve();
  translateAndMapModelObject(cq);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::EnergyInputRatioFunctionofFlowFractionCurveName,
                      cq.name().get());

  //  A9 , \field Part Load Fraction Correlation Curve Name
  cq = modelObject.getPartLoadFractionCorrelationCurve();
  translateAndMapModelObject(cq);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::PartLoadFractionCorrelationCurveName,
                      cq.name().get());

  //  N5 , \field Rated Low Speed Total Cooling Capacity
  d = modelObject.getRatedLowSpeedTotalCoolingCapacity();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedTotalCoolingCapacity,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedTotalCoolingCapacity,"Autosize");
  }

  //  N6 , \field Rated Low Speed Sensible Heat Ratio
  d = modelObject.getRatedLowSpeedSensibleHeatRatio();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedSensibleHeatRatio,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedSensibleHeatRatio,"Autosize");
  }

  //  N7 , \field Rated Low Speed COP
  d = modelObject.getRatedLowSpeedCOP();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedCOP,*d);
  }

  //  N8 , \field Rated Low Speed Air Flow Rate
  d = modelObject.getRatedLowSpeedAirFlowRate();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedAirFlowRate,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::RatedLowSpeedAirFlowRate,"Autosize");
  }

  //  A10, \field Low Speed Total Cooling Capacity Function of Temperature Curve Name
  cq = modelObject.getLowSpeedTotalCoolingCapacityFunctionOfTemperatureCurve();
  translateAndMapModelObject(cq);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::LowSpeedTotalCoolingCapacityFunctionofTemperatureCurveName,
                      cq.name().get());

  //  A11, \field Low Speed Energy Input Ratio Function of Temperature Curve Name
  cq = modelObject.getLowSpeedEnergyInputRatioFunctionOfTemperatureCurve();
  translateAndMapModelObject(cq);
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::LowSpeedEnergyInputRatioFunctionofTemperatureCurveName,
                      cq.name().get());

  //  A12, \field Condenser Air Inlet Node Name
  s=modelObject.getCondenserAirInletNodeName();
  if(s)
  {
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::CondenserAirInletNodeName,*s);
  }

  //  A13, \field Condenser Type
  idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::CondenserType,modelObject.getCondenserType());

  //   N9, \field High Speed Evaporative Condenser Effectiveness
  d=modelObject.getHighSpeedEvaporativeCondenserEffectiveness();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::HighSpeedEvaporativeCondenserEffectiveness,*d);
  }

  //  N10, \field High Speed Evaporative Condenser Air Flow Rate
  d=modelObject.getHighSpeedEvaporativeCondenserAirFlowRate();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::HighSpeedEvaporativeCondenserAirFlowRate,*d);
  }

  //  N11, \field High Speed Evaporative Condenser Pump Rated Power Consumption
  d=modelObject.getHighSpeedEvaporativeCondenserPumpRatedPowerConsumption();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::HighSpeedEvaporativeCondenserPumpRatedPowerConsumption,*d);
  }

  //  N12, \field Low Speed Evaporative Condenser Effectiveness
  d=modelObject.getLowSpeedEvaporativeCondenserEffectiveness();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::LowSpeedEvaporativeCondenserEffectiveness,*d);
  }

  //  N13, \field Low Speed Evaporative Condenser Air Flow Rate
  d=modelObject.getLowSpeedEvaporativeCondenserAirFlowRate();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::LowSpeedEvaporativeCondenserAirFlowRate,*d);
  }

  //  N14, \field Low Speed Evaporative Condenser Pump Rated Power Consumption
  d=modelObject.getLowSpeedEvaporativeCondenserPumpRatedPowerConsumption();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::LowSpeedEvaporativeCondenserPumpRatedPowerConsumption,*d);
  }

  //TODO
  //  A14, \field Supply Water Storage Tank Name
  //getSupplyWaterStorageTankName

  //TODO
  //  A15, \field Condensate Collection Water Storage Tank Name
  //getCondensateCollectionWaterStorageTankName

  //  N15, \field Basin Heater Capacity
  d=modelObject.getBasinHeaterCapacity();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::BasinHeaterCapacity,*d);
  }

  //  N16, \field Basin Heater Setpoint Temperature
  d=modelObject.getBasinHeaterSetpointTemperature();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_TwoSpeedFields::BasinHeaterSetpointTemperature,*d);
  }

  //  A16; \field Basin Heater Operating Schedule Name
  OptionalSchedule os = modelObject.getBasinHeaterOperatingSchedule();
  if( os )
  {
    translateAndMapModelObject(*os);
    idfObject.setString(Coil_Cooling_DX_TwoSpeedFields::BasinHeaterOperatingScheduleName,
                        os->name().get() );
  }

  return idfObject;
}
boost::optional<IdfObject> ForwardTranslator::translatePumpConstantSpeed( 
    PumpConstantSpeed& modelObject)
{
  boost::optional<std::string> s;
  boost::optional<double> value;
  OptionalSchedule schedule;

  IdfObject idfObject(IddObjectType::Pump_ConstantSpeed);

  m_idfObjects.push_back(idfObject);

  // Name

  s = modelObject.name();
  if( s )
  {
    idfObject.setName(*s);
  }

  // InletNodeName

  if( boost::optional<ModelObject> mo = modelObject.inletModelObject() )
  {
    if( boost::optional<Node> node = mo->optionalCast<Node>() )
    {
      idfObject.setString(Pump_ConstantSpeedFields::InletNodeName,node->name().get());
    }
  }

  // OutletNodeName

  if( boost::optional<ModelObject> mo = modelObject.outletModelObject() )
  {
    if( boost::optional<Node> node = mo->optionalCast<Node>() )
    {
      idfObject.setString(Pump_ConstantSpeedFields::OutletNodeName,node->name().get());
    }
  }

  // RatedFlowRate

  if( modelObject.isRatedFlowRateAutosized() )
  {
    idfObject.setString(Pump_ConstantSpeedFields::RatedFlowRate,"Autosize");
  }
  else if( (value = modelObject.ratedFlowRate()) )
  {
    idfObject.setDouble(Pump_ConstantSpeedFields::RatedFlowRate,value.get());
  }

  // RatedPumpHead

  if( (value = modelObject.ratedPumpHead()) )
  {
    idfObject.setDouble(Pump_ConstantSpeedFields::RatedPumpHead,value.get());
  }

  // RatedPowerConsumption

  if( modelObject.isRatedPowerConsumptionAutosized() )
  {
    idfObject.setString(Pump_ConstantSpeedFields::RatedPowerConsumption,"Autosize");
  }
  else if( (value = modelObject.ratedPowerConsumption()) )
  {
    idfObject.setDouble(Pump_ConstantSpeedFields::RatedPowerConsumption,value.get());
  }

  // MotorEfficiency

  if( (value = modelObject.motorEfficiency()) )
  {
    idfObject.setDouble(Pump_ConstantSpeedFields::MotorEfficiency,value.get());
  }

  // FractionofMotorInefficienciestoFluidStream  

  if( (value = modelObject.fractionofMotorInefficienciestoFluidStream()) )
  {
    idfObject.setDouble(Pump_ConstantSpeedFields::FractionofMotorInefficienciestoFluidStream,value.get());
  } 

  // PumpControlType

  if( (s = modelObject.pumpControlType()) )
  {
    idfObject.setString(Pump_ConstantSpeedFields::PumpControlType,s.get());
  }

  // PumpFlowRateSchedule

  if ((schedule = modelObject.pumpFlowRateSchedule())) {
    idfObject.setString(Pump_ConstantSpeedFields::PumpFlowRateScheduleName,schedule->name().get());
  }

  // PumpCurve

  if (OptionalCurve curve = modelObject.pumpCurve()) {
    idfObject.setString(Pump_ConstantSpeedFields::PumpCurveName,curve->name().get());
  }

  // ImpellerDiameter

  if ((value = modelObject.impellerDiameter())) {
    idfObject.setDouble(Pump_ConstantSpeedFields::ImpellerDiameter,value.get());
  }

  // SkinLossRadiativeFraction

  if ((value = modelObject.skinLossRadiativeFraction())) {
    idfObject.setDouble(Pump_ConstantSpeedFields::SkinLossRadiativeFraction,value.get());
  }

  return idfObject;
}
boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingDXSingleSpeedWithoutUnitary( model::CoilCoolingDXSingleSpeed & modelObject )
{
  OptionalString s;
  IdfObject idfObject(IddObjectType::Coil_Cooling_DX_SingleSpeed);

  s = modelObject.name();
  if( s )
  {
    idfObject.setName(*s);
  }

  // hook up required objects
  try {
    Schedule sched = modelObject.getAvailabilitySchedule();
    translateAndMapModelObject(sched);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::AvailabilityScheduleName,
                        sched.name().get() );

    Curve cb =  modelObject.getTotalCoolingCapacityFunctionOfTemperatureCurve();
    translateAndMapModelObject(cb);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofTemperatureCurveName,
                       cb.name().get());

    Curve cq = modelObject.getTotalCoolingCapacityFunctionOfFlowFractionCurve();
    translateAndMapModelObject(cq);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::TotalCoolingCapacityFunctionofFlowFractionCurveName,
                        cq.name().get());

    cb =modelObject.getEnergyInputRatioFunctionOfTemperatureCurve();
    translateAndMapModelObject(cb);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::EnergyInputRatioFunctionofTemperatureCurveName,
                        cb.name().get());

    cq=modelObject.getEnergyInputRatioFunctionOfFlowFractionCurve();
    translateAndMapModelObject(cq);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::EnergyInputRatioFunctionofFlowFractionCurveName,
                        cq.name().get());

    cq=modelObject.getPartLoadFractionCorrelationCurve();
    translateAndMapModelObject(cq);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::PartLoadFractionCorrelationCurveName,
                        cq.name().get());
  }
  catch (std::exception& e) {
    LOG(Error,"Could not translate " << modelObject.briefDescription() << ", because " 
        << e.what() << ".");
    return boost::none;
  }

  OptionalDouble d = modelObject.ratedTotalCoolingCapacity();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedTotalCoolingCapacity,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::GrossRatedTotalCoolingCapacity,"Autosize");
  }

  d = modelObject.ratedSensibleHeatRatio();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedSensibleHeatRatio,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::GrossRatedSensibleHeatRatio,"Autosize");
  }

  d = modelObject.getRatedCOP();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::GrossRatedCoolingCOP,*d);
  }

  d = modelObject.ratedAirFlowRate();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::RatedAirFlowRate,*d);
  }
  else
  {
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::RatedAirFlowRate,"Autosize");
  }

  d = modelObject.getRatedEvaporatorFanPowerPerVolumeFlowRate();
  if( d )
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::RatedEvaporatorFanPowerPerVolumeFlowRate,*d);
  }

  OptionalModelObject omo = modelObject.inletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::AirInletNodeName,*s );
    }
  }

  omo= modelObject.outletModelObject();
  if( omo )
  {
    translateAndMapModelObject(*omo);
    s = omo->name();
    if(s)
    {
      idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::AirOutletNodeName,*s);
    }
  }

  d=modelObject.getNominalTimeForCondensateRemovalToBegin();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::NominalTimeforCondensateRemovaltoBegin,*d);
  }

  d=modelObject.getRatioOfInitialMoistureEvaporationRateAndSteadyStateLatentCapacity();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::RatioofInitialMoistureEvaporationRateandSteadyStateLatentCapacity,*d);
  }

  d=modelObject.getMaximumCyclingRate();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::MaximumCyclingRate,*d);
  }

  d=modelObject.getLatentCapacityTimeConstant();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::LatentCapacityTimeConstant,*d);
  }

  s=modelObject.getCondenserAirInletNodeName();
  if(s)
  {
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::CondenserAirInletNodeName,*s);
  }

  idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::CondenserType,modelObject.getCondenserType());

  d=modelObject.getEvaporativeCondenserEffectiveness();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::EvaporativeCondenserEffectiveness,*d);
  }

  d=modelObject.getEvaporativeCondenserAirFlowRate();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::EvaporativeCondenserAirFlowRate,*d);
  }

  d=modelObject.getEvaporativeCondenserPumpRatedPowerConsumption();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::EvaporativeCondenserPumpRatedPowerConsumption,*d);
  }

  d=modelObject.getCrankcaseHeaterCapacity();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::CrankcaseHeaterCapacity,*d);
  }

  d=modelObject.getMaximumOutdoorDryBulbTemperatureForCrankcaseHeaterOperation();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::MaximumOutdoorDryBulbTemperatureforCrankcaseHeaterOperation,*d);
  }

  //TODO
  //getSupplyWaterStorageTankName
  //getCondensateCollectionWaterStorageTankName

  d=modelObject.getBasinHeaterCapacity();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::BasinHeaterCapacity,*d);
  }

  d=modelObject.getBasinHeaterSetpointTemperature();
  if(d)
  {
    idfObject.setDouble(Coil_Cooling_DX_SingleSpeedFields::BasinHeaterSetpointTemperature,*d);
  }

  OptionalSchedule os = modelObject.getBasinHeaterOperatingSchedule();
  if( os )
  {
    translateAndMapModelObject(*os);
    idfObject.setString(Coil_Cooling_DX_SingleSpeedFields::BasinHeaterOperatingScheduleName,
                        os->name().get() );
  }

  m_idfObjects.push_back(idfObject);
  return idfObject;
}
boost::optional<IdfObject> ForwardTranslator::translatePumpVariableSpeed( 
    PumpVariableSpeed& modelObject)
{
  boost::optional<std::string> s;
  boost::optional<double> value;
  OptionalSchedule schedule;

  IdfObject idfObject(IddObjectType::Pump_VariableSpeed);

  m_idfObjects.push_back(idfObject);

  // Name

  s = modelObject.name();
  if( s )
  {
    idfObject.setName(*s);
  }

  // InletNodeName

  if( boost::optional<ModelObject> mo = modelObject.inletModelObject() )
  {
    if( boost::optional<Node> node = mo->optionalCast<Node>() )
    {
      idfObject.setString(Pump_VariableSpeedFields::InletNodeName,node->name().get());
    }
  }

  // OutletNodeName

  if( boost::optional<ModelObject> mo = modelObject.outletModelObject() )
  {
    if( boost::optional<Node> node = mo->optionalCast<Node>() )
    {
      idfObject.setString(Pump_VariableSpeedFields::OutletNodeName,node->name().get());
    }
  }

  // RatedFlowRate

  if( modelObject.isRatedFlowRateAutosized() )
  {
    idfObject.setString(Pump_VariableSpeedFields::RatedFlowRate,"Autosize");
  }
  else if( value = modelObject.ratedFlowRate() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::RatedFlowRate,value.get());
  }

  // RatedPumpHead

  if( value = modelObject.ratedPumpHead() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::RatedPumpHead,value.get());
  }

  // RatedPowerConsumption

  if( modelObject.isRatedPowerConsumptionAutosized() )
  {
    idfObject.setString(Pump_VariableSpeedFields::RatedPowerConsumption,"Autosize");
  }
  else if( value = modelObject.ratedPowerConsumption() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::RatedPowerConsumption,value.get());
  }

  // MotorEfficiency

  if( value = modelObject.motorEfficiency() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::MotorEfficiency,value.get());
  }

  // FractionofMotorInefficienciestoFluidStream  

  if( value = modelObject.fractionofMotorInefficienciestoFluidStream() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::FractionofMotorInefficienciestoFluidStream,value.get());
  } 

  // Coefficient1ofthePartLoadPerformanceCurve

  if( value = modelObject.coefficient1ofthePartLoadPerformanceCurve() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::Coefficient1ofthePartLoadPerformanceCurve,value.get());
  }

  // Coefficient2ofthePartLoadPerformanceCurve

  if( value = modelObject.coefficient2ofthePartLoadPerformanceCurve() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::Coefficient2ofthePartLoadPerformanceCurve,value.get());
  }

  // Coefficient3ofthePartLoadPerformanceCurve

  if( value = modelObject.coefficient3ofthePartLoadPerformanceCurve() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::Coefficient3ofthePartLoadPerformanceCurve,value.get());
  }

  // Coefficient4ofthePartLoadPerformanceCurve

  if( value = modelObject.coefficient4ofthePartLoadPerformanceCurve() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::Coefficient4ofthePartLoadPerformanceCurve,value.get());
  }

  // MinimumFlowRate

  if( value = modelObject.minimumFlowRate() )
  {
    idfObject.setDouble(Pump_VariableSpeedFields::MinimumFlowRate,value.get());
  }

  // PumpControlType

  if( s = modelObject.pumpControlType() )
  {
    idfObject.setString(Pump_VariableSpeedFields::PumpControlType,s.get());
  }

  // PumpFlowRateSchedule

  if (schedule = modelObject.pumpFlowRateSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::PumpFlowRateScheduleName,schedule->name().get());
  }

  // PumpCurve

  if (OptionalCurve curve = modelObject.pumpCurve()) {
    idfObject.setString(Pump_VariableSpeedFields::PumpCurveName,curve->name().get());
  }

  // ImpellerDiameter

  if (value = modelObject.impellerDiameter()) {
    idfObject.setDouble(Pump_VariableSpeedFields::ImpellerDiameter,value.get());
  }

  // VFDControlType

  if (s = modelObject.vFDControlType()) {
    idfObject.setString(Pump_VariableSpeedFields::VFDControlType,s.get());
  }

  // PumpRPMSchedule

  if (schedule = modelObject.pumpRPMSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::PumprpmScheduleName,schedule->name().get());
  }

  // MinimumPressureSchedule

  if (schedule = modelObject.minimumPressureSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::MinimumPressureSchedule,schedule->name().get());
  }

  // MaximumPressureSchedule

  if (schedule = modelObject.maximumPressureSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::MaximumPressureSchedule,schedule->name().get());
  }

  // MinimumRPMSchedule

  if (schedule = modelObject.minimumRPMSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::MinimumRPMSchedule,schedule->name().get());
  }

  // MaximumRPMSchedule

  if (schedule = modelObject.maximumRPMSchedule()) {
    idfObject.setString(Pump_VariableSpeedFields::MaximumRPMSchedule,schedule->name().get());
  }

  return idfObject;
}