Ejemplo n.º 1
0
  bool ZoneHVACComponent_Impl::addToNode(Node & node)
  {
    bool result = false;
  
    boost::optional<ThermalZone> thermalZone;
    boost::optional<AirTerminalSingleDuctInletSideMixer> terminal;
  
    if( boost::optional<ModelObject> outlet = node.outletModelObject() ) {
      if( boost::optional<PortList> pl = outlet->optionalCast<PortList>() ) {
        thermalZone = pl->thermalZone();
      }
    }
  
    if( boost::optional<ModelObject> inlet = node.inletModelObject() ) {
      terminal = inlet->optionalCast<AirTerminalSingleDuctInletSideMixer>();
    }
  
    if( thermalZone && terminal ) {
      if( this->thermalZone() ) {
        removeFromThermalZone();
      }
      thermalZone->setUseIdealAirLoads(false);
      ZoneHVACComponent thisObject = getObject<ZoneHVACComponent>();
      thermalZone->addEquipment(thisObject);
      thermalZone->setCoolingPriority(thisObject,1);
      thermalZone->setHeatingPriority(thisObject,1);
      Model t_model = model();
      ModelObject thisModelObject = getObject<model::ZoneHVACComponent>();
      unsigned targetPort = node.connectedObjectPort( node.outletPort() ).get();
      ModelObject targetModelObject = node.connectedObject( node.outletPort() ).get();
      Node newNode( t_model );
      t_model.connect( node, node.outletPort(),
                       thisModelObject, inletPort() );
      t_model.connect( thisModelObject, outletPort(),
                       newNode, newNode.inletPort() );
      t_model.connect( newNode, newNode.outletPort(),
                       targetModelObject, targetPort );

      Node exhaustNode(t_model);
      PortList exhaustPortList = thermalZone->exhaustPortList();
      unsigned nextPort = exhaustPortList.nextPort();
      t_model.connect(exhaustPortList,nextPort,exhaustNode,exhaustNode.inletPort());
      t_model.connect(exhaustNode,exhaustNode.outletPort(),terminal.get(),terminal->secondaryAirInletPort());

      result = true;
    }
  
    return result;
  }
Ejemplo n.º 2
0
  bool ZoneHVACComponent_Impl::addToThermalZone(ThermalZone & thermalZone)
  {
    Model m = this->model();

    if( thermalZone.model() != m ) {
      return false;
    }

    if( thermalZone.isPlenum() ) {
      return false;
    }

    removeFromThermalZone();

    thermalZone.setUseIdealAirLoads(false);

    // Connect nodes if this is an air based zone hvac component
    if( inletPort() != 0u && outletPort() != 0u ) {
      // Exhaust Node
      Node exhaustNode(m);
      PortList exhaustPortList = thermalZone.exhaustPortList();
      unsigned nextPort = exhaustPortList.nextPort();
      m.connect(exhaustPortList,nextPort,exhaustNode,exhaustNode.inletPort());
      ModelObject mo = this->getObject<ModelObject>();
      m.connect(exhaustNode,exhaustNode.outletPort(),mo,this->inletPort());

      // Air Inlet Node
      Node airInletNode(m);
      PortList inletPortList = thermalZone.inletPortList();
      unsigned nextInletPort = inletPortList.nextPort();
      m.connect(airInletNode,airInletNode.outletPort(),inletPortList,nextInletPort);
      m.connect(mo,this->outletPort(),airInletNode,airInletNode.inletPort());
    }

    thermalZone.addEquipment(this->getObject<ZoneHVACComponent>());

    return true;
  }
Ejemplo n.º 3
0
  bool FanZoneExhaust_Impl::addToThermalZone(ThermalZone & thermalZone)
  {
    Model m = this->model();

    if( thermalZone.model() != m )
    {
      return false;
    }

    removeFromThermalZone();

    thermalZone.setUseIdealAirLoads(false);

    // Zone Exhaust Node (Exhaust Fan Inlet node)

    Node exhaustNode(m);

    PortList exhaustPortList = thermalZone.exhaustPortList();

    unsigned nextPort = exhaustPortList.nextPort();

    m.connect(exhaustPortList,nextPort,exhaustNode,exhaustNode.inletPort());

    ModelObject mo = this->getObject<ModelObject>();

    m.connect(exhaustNode,exhaustNode.outletPort(),mo,this->inletPort());

    // Node (Exhaust Fan Outlet Node) 

    Node exhaustFanOutletNode(m);

    m.connect(mo,this->outletPort(),exhaustFanOutletNode,exhaustFanOutletNode.inletPort());

    thermalZone.addEquipment(this->getObject<ZoneHVACComponent>());

    return true;
  }