void AirTerminalSingleDuctParallelPIUReheat_Impl::setFan( HVACComponent & hvacComponent )
  {
    bool isTypeCorrect = false;

    if( hvacComponent.iddObjectType() == IddObjectType::OS_Fan_ConstantVolume )
    {
      isTypeCorrect = true;
    }

    if( isTypeCorrect )
    {
      setPointer(OS_AirTerminal_SingleDuct_ParallelPIU_ReheatFields::FanName,hvacComponent.handle());
    }
  }
  void AirTerminalSingleDuctParallelPIUReheat_Impl::setReheatCoil( HVACComponent & hvacComponent )
  {
    bool isTypeCorrect = false;

    if( hvacComponent.iddObjectType() == IddObjectType::OS_Coil_Heating_Electric )
    {
      isTypeCorrect = true;
    }
    else if( hvacComponent.iddObjectType() == IddObjectType::OS_Coil_Heating_Gas )
    {
      isTypeCorrect = true;
    }
    else if( hvacComponent.iddObjectType() == IddObjectType::OS_Coil_Heating_Water )
    {
      isTypeCorrect = true;
    }

    if( isTypeCorrect )
    {
      setPointer(OS_AirTerminal_SingleDuct_ParallelPIU_ReheatFields::ReheatCoilName,hvacComponent.handle());
    }
  }
boost::optional<IdfObject> ForwardTranslator::translateZoneHVACPackagedTerminalAirConditioner( 
    ZoneHVACPackagedTerminalAirConditioner & modelObject )
{
  boost::optional<std::string> s;
  boost::optional<double> value;

  IdfObject idfObject(IddObjectType::ZoneHVAC_PackagedTerminalAirConditioner);

  m_idfObjects.push_back(idfObject);

  // Name

  std::string baseName = modelObject.name().get();

  idfObject.setName(baseName);

  std::string mixedAirNodeName = baseName + " Mixed Air Node";

  std::string coolingCoilOutletNodeName = baseName + " Cooling Coil Outlet Node";

  std::string heatingCoilOutletNodeName = baseName + " Heating Coil Outlet Node";

  std::string reliefAirNodeName = baseName + " Relief Air Node";

  std::string oaNodeName = baseName + " OA Node";

  // AvailabilityScheduleName

  if( boost::optional<Schedule> schedule = modelObject.availabilitySchedule() )
  {
    if( boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get()) )
    {
      idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::AvailabilityScheduleName,_schedule->name().get());
    }
  }

  // AirInletNodeName

  boost::optional<std::string> airInletNodeName;

  if( boost::optional<Node> node = modelObject.inletNode() )
  {
    if( (s = node->name()) )
    {
      airInletNodeName = s;

      idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::AirInletNodeName,s.get());
    }
  }

  // AirOutletNodeName

  boost::optional<std::string> airOutletNodeName;

  if( boost::optional<Node> node = modelObject.outletNode() )
  {
    if( (s = node->name()) )
    {
      airOutletNodeName = s;

      idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::AirOutletNodeName,s.get());
    }
  }

  // OutdoorAirMixerObjectType
  idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirMixerObjectType,
                      modelObject.outdoorAirMixerObjectType());

  // OutdoorAirMixerName
  
  std::string oaMixerName = modelObject.name().get() + " OA Mixer";  

  idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirMixerName,oaMixerName);

  IdfObject _outdoorAirMixer(IddObjectType::OutdoorAir_Mixer);
  _outdoorAirMixer.setName(oaMixerName);
  m_idfObjects.push_back(_outdoorAirMixer);

  _outdoorAirMixer.setString(OutdoorAir_MixerFields::MixedAirNodeName,mixedAirNodeName);

  _outdoorAirMixer.setString(OutdoorAir_MixerFields::OutdoorAirStreamNodeName,oaNodeName);

  IdfObject _oaNodeList(openstudio::IddObjectType::OutdoorAir_NodeList);
  _oaNodeList.setString(0,oaNodeName);
  m_idfObjects.push_back(_oaNodeList);

  _outdoorAirMixer.setString(OutdoorAir_MixerFields::ReliefAirStreamNodeName,reliefAirNodeName);

  if(airInletNodeName)
  {
    _outdoorAirMixer.setString(OutdoorAir_MixerFields::ReturnAirStreamNodeName,airInletNodeName.get());
  }

  // SupplyAirFlowRateDuringCoolingOperation

  if( modelObject.isSupplyAirFlowRateDuringCoolingOperationAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateDuringCoolingOperation,"Autosize");
  }
  else if( (value = modelObject.supplyAirFlowRateDuringCoolingOperation()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateDuringCoolingOperation,value.get());
  }

  // SupplyAirFlowRateDuringHeatingOperation

  if( modelObject.isSupplyAirFlowRateDuringHeatingOperationAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateDuringHeatingOperation,"Autosize");
  }
  else if( (value = modelObject.supplyAirFlowRateDuringHeatingOperation()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateDuringHeatingOperation,value.get());
  }

  // SupplyAirFlowRateWhenNoCoolingorHeatingisNeeded

  if( modelObject.isSupplyAirFlowRateWhenNoCoolingorHeatingisNeededAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateWhenNoCoolingorHeatingisNeeded,"Autosize");
  } 
  else if( (value = modelObject.supplyAirFlowRateWhenNoCoolingorHeatingisNeeded()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFlowRateWhenNoCoolingorHeatingisNeeded,value.get());
  }

  // OutdoorAirFlowRateDuringCoolingOperation
  
  if( modelObject.isOutdoorAirFlowRateDuringCoolingOperationAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateDuringCoolingOperation,"Autosize");
  }
  else if( (value = modelObject.outdoorAirFlowRateDuringCoolingOperation()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateDuringCoolingOperation,value.get());
  }

  // OutdoorAirFlowRateDuringHeatingOperation
  
  if( modelObject.isOutdoorAirFlowRateDuringHeatingOperationAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateDuringHeatingOperation,"Autosize");
  }
  else if( (value = modelObject.outdoorAirFlowRateDuringHeatingOperation()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateDuringHeatingOperation,value.get());
  }

  // OutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded
  
  if( modelObject.isOutdoorAirFlowRateWhenNoCoolingorHeatingisNeededAutosized() )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded,"Autosize");
  }
  else if( (value = modelObject.outdoorAirFlowRateWhenNoCoolingorHeatingisNeeded()) )
  {
    idfObject.setDouble(ZoneHVAC_PackagedTerminalAirConditionerFields::OutdoorAirFlowRateWhenNoCoolingorHeatingisNeeded,value.get());
  }

  // SupplyAirFanObjectType

  HVACComponent supplyAirFan = modelObject.supplyAirFan();

  if( boost::optional<IdfObject> _supplyAirFan = translateAndMapModelObject(supplyAirFan) )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFanObjectType,_supplyAirFan->iddObject().name() );

    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFanName,_supplyAirFan->name().get());

    if( airOutletNodeName )
    {
      if( _supplyAirFan->iddObject().type() == IddObjectType::Fan_ConstantVolume )
      {
        _supplyAirFan->setString(Fan_ConstantVolumeFields::AirInletNodeName,heatingCoilOutletNodeName);

        _supplyAirFan->setString(Fan_ConstantVolumeFields::AirOutletNodeName,airOutletNodeName.get());
      }
    }
  }

  // HeatingCoilObjectType
  
  HVACComponent heatingCoil = modelObject.heatingCoil();

  if( boost::optional<IdfObject> _heatingCoil = translateAndMapModelObject(heatingCoil) )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::HeatingCoilObjectType,_heatingCoil->iddObject().name() );

    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::HeatingCoilName,_heatingCoil->name().get() ); 

    if( _heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Water )
    {
      _heatingCoil->setString(Coil_Heating_WaterFields::AirInletNodeName,coolingCoilOutletNodeName);

      _heatingCoil->setString(Coil_Heating_WaterFields::AirOutletNodeName,heatingCoilOutletNodeName);
    }
    else if( _heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Gas )
    {
      _heatingCoil->setString(Coil_Heating_GasFields::AirInletNodeName,coolingCoilOutletNodeName);

      _heatingCoil->setString(Coil_Heating_GasFields::AirOutletNodeName,heatingCoilOutletNodeName);
    }
    else if( _heatingCoil->iddObject().type() == IddObjectType::Coil_Heating_Electric )
    {
      _heatingCoil->setString(Coil_Heating_ElectricFields::AirInletNodeName,coolingCoilOutletNodeName);

      _heatingCoil->setString(Coil_Heating_ElectricFields::AirOutletNodeName,heatingCoilOutletNodeName);
    }
  }

  // CoolingCoilObjectType

  HVACComponent coolingCoil = modelObject.coolingCoil();

  boost::optional<IdfObject> _coolingCoil;

  if( boost::optional<CoilCoolingDXSingleSpeed> dxCoil = coolingCoil.optionalCast<CoilCoolingDXSingleSpeed>() )
  {
    _coolingCoil = translateCoilCoolingDXSingleSpeedWithoutUnitary(dxCoil.get());

    m_map.insert(std::make_pair(coolingCoil.handle(),_coolingCoil.get()));
  }
  else
  {
    _coolingCoil = translateAndMapModelObject(coolingCoil);
  }

  if( _coolingCoil )
  {
    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::CoolingCoilObjectType,_coolingCoil->iddObject().name() );

    idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::CoolingCoilName,_coolingCoil->name().get() );

    if( _coolingCoil->iddObject().type() == IddObjectType::Coil_Cooling_DX_SingleSpeed )
    {
      _coolingCoil->setString(Coil_Cooling_DX_SingleSpeedFields::AirInletNodeName,mixedAirNodeName);

      _coolingCoil->setString(Coil_Cooling_DX_SingleSpeedFields::AirOutletNodeName,coolingCoilOutletNodeName);
    }
  }

  // FanPlacement

  idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::FanPlacement,modelObject.fanPlacement());

  // SupplyAirFanOperatingModeScheduleName
  
  if( boost::optional<Schedule> schedule = modelObject.supplyAirFanOperatingModeSchedule() )
  {
    if( boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule.get()) )
    {
      idfObject.setString(ZoneHVAC_PackagedTerminalAirConditionerFields::SupplyAirFanOperatingModeScheduleName,_schedule->name().get());
    }
  }

  return idfObject;
}
bool ZoneHVACTerminalUnitVariableRefrigerantFlow_Impl::setSupplyAirFan(const HVACComponent & component)
{
    return setPointer(OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlowFields::SupplyAirFan,component.handle());
}
Пример #5
0
void ControllerWaterCoil_Impl::setWaterCoil( const HVACComponent & comp )
{
  auto result = setPointer(OS_Controller_WaterCoilFields::WaterCoilName,comp.handle());
  OS_ASSERT(result);
}
Пример #6
0
 bool ZoneHVACUnitHeater_Impl::setHeatingCoil(const HVACComponent & heatingCoil) 
 {
   bool result = setPointer(OS_ZoneHVAC_UnitHeaterFields::HeatingCoilName, heatingCoil.handle());
   return result;
 }
Пример #7
0
 bool ZoneHVACUnitHeater_Impl::setSupplyAirFan(const HVACComponent& HVACComponent) 
 {
   bool result = setPointer(OS_ZoneHVAC_UnitHeaterFields::SupplyAirFanName, HVACComponent.handle());
   return result;
 }
 bool AirTerminalSingleDuctConstantVolumeFourPipeBeam_Impl::setHeatingCoil(const HVACComponent& coilHeatingFourPipeBeam) {
   bool result = setPointer(OS_AirTerminal_SingleDuct_ConstantVolume_FourPipeBeamFields::HeatingCoilName, coilHeatingFourPipeBeam.handle());
   if (!result) {
     if ( !coilHeatingFourPipeBeam.optionalCast<CoilHeatingFourPipeBeam>() ) {
       LOG(Error, "Cannot set the heating coil to something else than CoilHeatingFourPipeBeam for " << briefDescription());
     }
   }
   return result;
 }
 bool ZoneHVACLowTempRadiantVarFlow_Impl::setCoolingCoil(HVACComponent& coolingCoil) 
 {
   bool result = setPointer(OS_ZoneHVAC_LowTemperatureRadiant_VariableFlowFields::LowTempRadiantVariableFlowCoolingCoilName, coolingCoil.handle());
   return result;
 }
Пример #10
0
  bool HVACComponent_Impl::removeFromLoop( const HVACComponent & systemStartComponent, 
    const HVACComponent & systemEndComponent,
    unsigned componentInletPort,
    unsigned componentOutletPort )
  {
    auto _model = model();
    auto thisObject = getObject<HVACComponent>();
    
    if( systemStartComponent.model() != _model ) return false;
    if( systemEndComponent.model() != _model ) return false;

    auto inletComponent = connectedObject( componentInletPort );
    auto outletComponent = connectedObject( componentOutletPort );
    auto inletComponentOutletPort = connectedObjectPort( componentInletPort );
    auto outletComponentInletPort = connectedObjectPort( componentOutletPort );

    if( ! inletComponent ) return false;
    if( ! outletComponent ) return false;
    if( ! inletComponentOutletPort ) return false;
    if( ! outletComponentInletPort ) return false;

    auto inletNode = inletComponent->optionalCast<Node>();
    auto outletNode = outletComponent->optionalCast<Node>();
    boost::optional<Splitter> splitter;
    boost::optional<Mixer> mixer;

    if( inletNode ) {
      if( auto mo = inletNode->inletModelObject() ) {
        splitter = mo->optionalCast<Splitter>();
      }
    }
    if( outletNode ) {
      if( auto mo = outletNode->outletModelObject() ) {
        mixer = mo->optionalCast<Mixer>();
      }
    }

    if( systemStartComponent.handle() == inletComponent->handle() 
        && systemEndComponent.handle() == outletComponent->handle() ) {
      // This component is between the systemStartComponent and the systemEndComponent
      // ie. the supply or demand inlet or outlet Nodes,
      // or the oa system end points on either the relief or inlet air streams.
      _model.disconnect(thisObject,componentInletPort); 
      _model.disconnect(thisObject,componentOutletPort); 

      _model.connect( inletComponent.get(), inletComponentOutletPort.get(), 
                       outletComponent.get(), outletComponentInletPort.get() );
      
      return true;
    } else if( systemEndComponent.handle() == outletComponent->handle() ) {
      // Here the systemEndComponent is immediately downstream of this component,
      // but there are other components (besides systemStartComponent) upstream.
      boost::optional<ModelObject> newInletComponent;
      boost::optional<unsigned> newInletComponentOutletPort;

      // Make sure we don't end up with two nodes next to each other after this component is removed
      if( inletNode && outletNode ) {
        newInletComponent = inletNode->inletModelObject();
        newInletComponentOutletPort = inletNode->connectedObjectPort(inletNode->inletPort());
        OS_ASSERT(newInletComponent);
        OS_ASSERT(newInletComponentOutletPort);
      } else {
        newInletComponent = inletComponent;
        newInletComponentOutletPort = inletComponentOutletPort;
      }

      _model.disconnect(thisObject,componentInletPort); 
      _model.disconnect(thisObject,componentOutletPort); 

      // inletNode->remove() would have failed if we did it before the disconnect
      if( inletNode && outletNode ) {
        inletNode->remove();
      }

      _model.connect( newInletComponent.get(), newInletComponentOutletPort.get(), 
                       outletComponent.get(), outletComponentInletPort.get() );
      return true;
    } else if( splitter && mixer ) {
      // If the component is the only component (except nodes) between a splitter mixer pair
      OS_ASSERT(inletNode);
      OS_ASSERT(outletNode);

      int i = splitter->branchIndexForOutletModelObject(inletNode.get());
      int j = mixer->branchIndexForInletModelObject(outletNode.get());

      OS_ASSERT(i == j);

      splitter->removePortForBranch(i);
      mixer->removePortForBranch(i);

      _model.disconnect(thisObject,componentInletPort); 
      _model.disconnect(thisObject,componentOutletPort); 

      inletNode->remove();
      outletNode->remove();

      if( ! splitter->lastOutletModelObject() )
      {
        Node newNode(_model);
        _model.connect(splitter.get(),splitter->nextOutletPort(),newNode,newNode.inletPort());
        _model.connect(newNode,newNode.outletPort(),mixer.get(),mixer->nextInletPort());
      }

      return true;
    } else {
      boost::optional<ModelObject> newOutletComponent; 
      boost::optional<unsigned> newOutletComponentInletPort;

      if( inletNode && outletNode ) {
        newOutletComponent = outletNode->outletModelObject();
        newOutletComponentInletPort = outletNode->connectedObjectPort(outletNode->outletPort());
      }

      if( ! newOutletComponent ) newOutletComponent = outletComponent;
      if( ! newOutletComponentInletPort ) newOutletComponentInletPort = outletComponentInletPort;

      _model.disconnect(thisObject,componentInletPort); 
      _model.disconnect(thisObject,componentOutletPort); 

      // outletNode->remove() would have failed if we did it before the disconnect
      if( inletNode && outletNode ) {
        outletNode->remove();
      }

      model().connect( inletComponent.get(), inletComponentOutletPort.get(), 
                       newOutletComponent.get(), newOutletComponentInletPort.get() );

      return true;
    }

    return false;
  }
 bool ZoneHVACEnergyRecoveryVentilator_Impl::setExhaustAirFan(const HVACComponent& exhaustAirFan) {
   bool result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::ExhaustAirFanName, exhaustAirFan.handle());
   return result;
 }
 bool ZoneHVACEnergyRecoveryVentilator_Impl::setHeatExchanger(const HVACComponent& hxAirToAirSensibleAndLatent) {
   bool result = setPointer(OS_ZoneHVAC_EnergyRecoveryVentilatorFields::HeatExchangerName, hxAirToAirSensibleAndLatent.handle());
   return result;
 }
Пример #13
0
bool PortList_Impl::setHVACComponent(const HVACComponent & hvacComponent)
{
  return setPointer(OS_PortListFields::HVACComponent,hvacComponent.handle());
}