Ejemplo n.º 1
0
void BeltCnv::PreDisConnect(int IONo)
  {
  if (!PreDisConnectDirect(IONo))
    {
    if (IOId_Self(IONo)==idFeed)
      {
      for (int i=0, n=-1; i<=IONo; i++)
        if (IOId_Self(i)==idFeed)
          n++;
      if (n>=0)
        m_Q.DeleteFeed(n);
      StructureChanged(this);
      }
    else if (IOId_Self(IONo)==idProd)
      {
      for (int i=0, n=-1; i<=IONo; i++)
        if (IOId_Self(i)==idProd)
          n++;
      if (n>=0)
        m_Q.DeleteProd(n);
      StructureChanged(this);
      }
    MdlNode::PreDisConnect(IONo);
    }
  };
Ejemplo n.º 2
0
void BeltCnv::EvalProducts(CNodeEvalIndex & NEI)
  {
  switch (SolveMethod())
    {
    case SM_Direct:
      if (NoProcessJoins()>=1)
        Xfer_EvalProducts(0, Joins[0].Pressure(), NULL, NULL, NULL, NULL, NULL);
      #pragma chFIXIT(Correct conveyor output split in ProBal needs implementing)
      break;
    case SM_Inline:
    case SM_Buffered:
      {
      int Prod=0;
      for (int i=0; i<NoFlwIOs(); i++)
        if (IOId_Self(i)==idProd)
          m_Q.SetProductQmEst(Prod++, IOQmEst_Out(i));
      m_Q.EvalProducts();
      Prod=0;
      for (i=0; i<NoFlwIOs(); i++)
        if (IOId_Self(i)==idProd)
          m_Q.GetProduct(Prod++, IOConduit(i));
      }
      break;
    }
  }
Ejemplo n.º 3
0
void HydroCyclone::ConfigureJoins()
  {
  Init_NJoins(1);
  int i;
  switch (SolveMode())
    {
    case PBMODE:
    case SSMODE:
      for (i=0; (i<NoFlwIOs()); i++)
        SetIO_Join(i, 0, 0);
      break;
    case DYNMODE:
      for (i=0; (i<NoFlwIOs()); i++)
        if (IOId_Self(i)==ioidGrits)
          SetIO_Open(i, 1, false, ESS_Denied);
//          SetIO_Open(i);
        else
          {
          SetIO_Join(i, 0, 0);
          if (IOId_Self(i)==ioidFines)
            SetJoinQm_QmRatio (0, i);
          }

      break;
    }
  };
Ejemplo n.º 4
0
void HydroCyclone::EvalJoinFlows(int JoinNo)
  {
  double QmVIn = 0.0, QmSIn = 0.0;
  for (int i=0; i<NoFlwIOs() && IOId_Self(i)==ioidFeed ; i++)
    if (IO_In(i))
      {
      pSpConduit p=IOConduit(i);
      QmVIn += p->QMass(som_Liq);
      QmSIn += p->QMass(som_Sol);
      }

dbgpln("Hydrocyclone to be sorted out Liquids not done");

  long Failed = 0;
  double Passing=0;
  int nIn1=IOWithId_Self(ioidFeed);
  if (nIn1 >= 0)
    {
    pSQSzDist1 pSz;
    pSz=SQSzDist1::Ptr(IOConduit(nIn1)->Model());
    Ore2Grit=pSz->GritsFraction(PartCrv, 0.0, ByePass2Grits);
    GritFlowRatio=(Ore2Grit*QmSIn)/GTZ(QmVIn + (1.0-Ore2Grit)*QmSIn);
    Joins[0].SetQm_QmRatio(Max(1.0e-6, GritFlowRatio));
    }
  };
Ejemplo n.º 5
0
void MN_BstRes::ConfigureJoins()
{
    if (NetMethod()==NM_Probal)
    {
        for (int i=0; i<NoProcessIOs(); i++)
            SetIO_Join(i, 0);
    }
    else
    {
        for (int i=0; i<NoProcessIOs(); i++)
        {
            switch (IOId_Self(i))
            {
            case IOId_2IOIn   :
                SetIO_Join(i, 0);
                break;
            case IOId_2IOOut  :
                SetIO_Join(i, 1);
                break;
            case IOId_2IOLeakI:
                SetIO_Join(i, 0);
                break;
            case IOId_2IOLeakO:
                SetIO_Join(i, 1);
                break;
            }
        }
        LinkJoins(0, 0, 1, &m_FEP);

        SetJoin_HasVolume(0, false, true);
        SetJoin_HasVolume(1, false, true);
    }
}
Ejemplo n.º 6
0
void   CElectroCell::PostConnect(int IONo)
  {
  if (IOId_Self(IONo)==ioidVent)
    m_Vent.SysEnable =  false;

  MN_Surge::PostConnect(IONo);
  };
Ejemplo n.º 7
0
void VLL_Sep::EvalDerivs()
  {
  FlashTank::EvalDerivs();

  double QmIn, QmOut, MegIn, MegOut;
  QmIn   = 0.0;
  QmOut  = 0.0;
  MegIn  = 0.0;
  MegOut = 0.0;
  for (int i=0; i<NoFlwIOs(); i++)
    {
    SpConduit & Cd=*IOConduit(i);
    if (IO_In(i))
      {
      QmIn  += Cd.Qm(Water())+Cd.Qm(Steam());
      MegIn += Cd.Qm(MEG());
      }
    else if (IO_Out(i) && IOId_Self(i)==VLLIO_boot)
      {
      QmOut  += Cd.Qm(Water())+Cd.Qm(Steam());
      MegOut += Cd.Qm(MEG());
      }
    }

  dH2oSettled = QmIn*H2ORemEff-QmOut;
  dMEGSettled = MegIn*H2ORemEff-MegOut;
  }
Ejemplo n.º 8
0
void MN_Xfer::PostConnect(int IONo)
  {
  MdlNode::PostConnect(IONo);
  if (IOId_Self(IONo)==IOId_XferLeak)
    m_Leak.PostConnect(IONo);
  else
    IOFB(IONo,0)->AssignFlwEqnGroup(TeeEntryGroup, TeeEntryGroup.Default(), this);
  };
Ejemplo n.º 9
0
void   CElectroCell::PreDisConnect(int IONo)
  {
  MN_Surge::PreDisConnect(IONo);

  if (IOId_Self(IONo)==ioidVent)
    m_Vent.SysEnable =  true;

  };
Ejemplo n.º 10
0
void BeltCnv::PostConnect(int IONo)
  {
  if (!PostConnectDirect(IONo))
    {
    MdlNode::PostConnect(IONo);
    if (IOId_Self(IONo)==idFeed)
      {
      m_Q.AddFeed();
      StructureChanged(this);
      }
    else if (IOId_Self(IONo)==idProd)
      {
      m_Q.AddProd();
      StructureChanged(this);
      }
    }
  };
Ejemplo n.º 11
0
void Sys13::EvalProducts()
  {

  Q6.QSetM(VBA1301,/*False,*/som_ALL, QmLean, VBA1301.Press());
  Q7.QCopy(Q6, VBA1301.Press());
  if ((NoFlwIOs() > 1) && (IOId_Self(1)==idGl))      // Lean Glycol Out // mhm to check the numbers here
     IOConduit(idGl)->QCopy(Q7, VBA1301.Press());
//mhm     IOFlange(1)->Q.QCopy(Q7, VBA1301.P()); // mhm
  };
Ejemplo n.º 12
0
void FilterPress::ConfigureJoins()
  {
  Init_NoJoins(2);
  int iWashings = IOWithId_Self(ioidWashings);
  if (iWashings < 0)
    fFilt2Washings=False;
  int i;
  if (NetMethod()==NM_Probal)// || SolveMethod()!=SM_Buffered)
    {
    for (i=0; (i<NoProcessIOs()); i++)
      SetIO_Join(i, 0);
    }
  else
    {
    for (i=0; (i<NoProcessIOs()); i++)
      {
      if (IsMLnkIOId(IOId_Self(i)))
        {
        switch (IOId_Self(i))
          {
          case ioidFiltrate:
            if (!fFilt2Washings && !fDischarge)
              SetIO_Open(i, 0, false, ESS_Denied);
            else
              SetIO_Closed(i, 0);
            break;
          case ioidWashings:
            if (fFilt2Washings && !fDischarge)
              SetIO_Open(i, 0, false, ESS_Denied);
            else
              SetIO_Closed(i, 0);
            break;
          case ioidCake:
            if (fDischarge)
              SetIO_Open(i, 0, false, ESS_Denied);
            else
              SetIO_Closed(i, 0);
            break;

          case ioidFeed:    
          case ioidWash:    
            //case ioidFiltrate:
            //case ioidCake:    
            //case ioidWashings:
          case ioidVent:    
            SetIO_Join(i, 0);
            break;

          default:
            _asm int 3;
            break;
          }
        }
      else
        SetIO_Direct(i,1);
      }
    }
Ejemplo n.º 13
0
flag BeltCnv::EvalFlowEquations(eScdFlwEqnTasks Task, CSpPropInfo *pProps, int IONo, int FE, int LnkNo)
  {
  if (m_Spill.EvalFlowEquations(Task, pProps, IONo, FE, LnkNo))
    return m_Spill.EvalFlowEquationsReturn();
  if (m_Vent.EvalFlowEquations(Task, pProps, IONo, FE, LnkNo))
    return m_Vent.EvalFlowEquationsReturn();
  if (m_AccIn.EvalFlowEquations(Task, pProps, IONo, FE, LnkNo))
    return m_AccIn.EvalFlowEquationsReturn();
  if (m_AccOut.EvalFlowEquations(Task, pProps, IONo, FE, LnkNo))
    return m_AccOut.EvalFlowEquationsReturn();
  switch (Task)
    {
    case FET_GetMode:
      {
      int Feed=0;
      for (int i=0; i<IONo; i++)
        if (IOId_Self(i)==idFeed)
          Feed++;
      if (IOId_Self(IONo)==idFeed)
        {
        if (m_Q.FeedLimited(Feed))
          {
          IOFB(IONo,FE)->SetXferMode();
          IOFB(IONo,FE)->SetXferCapacity(m_Q.FeedCapacity(Feed));
          }
        else
          IOFB(IONo,FE)->SetXferMode();
        return True;
        }

      IOFB(IONo,FE)->SetQmFree();
      break;
      }
    case FET_SetQm:
      IOFB(IONo, FE)->SetDPb(0.0, 0.0);
      IOFB(IONo, FE)->SetDPbX(0.0);
      IOFB(IONo, FE)->SetDPq(0.0, 0.0);
      break;
    case FET_CalcDP:
      break;
      }
  return True;
  };
Ejemplo n.º 14
0
void CActuator::Ctrl_ConnIDStr(int i, Strng & ID, Strng & Tg)
  {
  int ix=(IOId_Self(i)-CtrlIOId(0))/2;
  if (ix<m_DataBlk.GetSize())
    {
    CActuatorBlk * pT = m_DataBlk[ix];
    ID=pT->m_sIDInput();
    Tg=pT->m_sTagInput();
    }
  else
    ID=Tg=FullObjTag();
  };
Ejemplo n.º 15
0
flag Sys13::EvalFlowEquations(CSpPropInfo *pProps, int IONo, int FE)
  {
  double Qm=0.0;
  pFlwBlk pC = IOFB(IONo, FE);
  if (IOId_Self(IONo) == idGr )      // Rich Glycol In
    {
    //mhm change to enable a controller to be used
    //Qm = Max(0.0, VB1001_Lvl-VB1001_LvlSet)*QmSetl*VLVin_Posn;
    Qm = Max(0.0,QmSetl*VLVin_Posn);
    QmRich=Qm;
    pC->SetQmReqd(Qm); // ie In
    }
  else if (IOId_Self(IONo) == idGl ) // Lean Glycol Out
    {
    Qm = (bPKA1301A ? QmCirc : 0.0) + (bPKA1301B ? QmCirc: 0.0);
    QmLean=Qm;
    pC->SetQmReqd(-Qm); // ie Out
    }
  pC->SetDPq(0.0,0.0);
  return True;
  };
Ejemplo n.º 16
0
void MN_BstRes::PreDisConnect(int IONo)
{
    switch (IOId_Self(IONo))
    {
    case IOId_2IOLeakI:
        m_LeakI.PreDisConnect(IONo);
        break;
    case IOId_2IOLeakO:
        m_LeakO.PreDisConnect(IONo);
        break;
    }
    MdlNode::PreDisConnect(IONo);
}
Ejemplo n.º 17
0
/*#F:This determines the pressure of the contents and the pressure at each
inlet and outlet of the surge unit.*/ 
void Mill1::EvalJoinPressures(long JoinMask)
  {
  switch (NetMethod())
    {
    case NM_Probal:
      MdlNode::EvalJoinPressures(JoinMask);
      break;
    case NM_Dynamic:
      IOP_RhoH_Info RhoHInfo(Contents);
      double Pm=ContainerMeanPress(RhoHInfo, POffset);
      Set_JoinP(0, Pm);
      for (int i=0; (i<NoProcessIOs()) && (IOId_Self(i)<IOId_HX); i++)
        Set_IOP_RhoH_Self(i,Pm,RhoHInfo);
      break;
    }
  };
Ejemplo n.º 18
0
void MN_Xfer::ConfigureJoins()
  {
  if (m_NetworkIsolator)
    {
    Set_NoJoins(2);
    for (int i=0; i<NoProcessIOs(); i++)
      {
      if (Nd_Rmt(i)->FlowMode()==LFM_Xfer)
        SetIO_Open(i, 1, false, ESS_Denied);
      else
        SetIO_Open(i, 0, false, ESS_Denied);
      }
    }
  else
    {
    int N=0;
    for (int i=0; i<NoProcLnkIOs(); i++)
      {
      if (Nd_Rmt(i)->FlowMode()==LFM_Xfer)
        N++;
      }
    bool UseClosedJoin=(NoProcLnkIOs()-N>=2);
    Set_NoJoins(1);
    for (int i=0; i<NoProcLnkIOs(); i++)
      {
      if (Nd_Rmt(i)->FlowMode()==LFM_Xfer)
        SetIO_Open(i, 0, false, ESS_Denied);
      else if (UseClosedJoin)  // enforce estimated flow mass balance
        SetIO_Join(i, 0);
      else
        SetIO_Open(i, 0, false, ESS_Denied);
      }
    }

  int jj=1+1;
  for (int ii=NoProcLnkIOs(), jj=1+1; ii<NoFlwIOs(); ii++)
    {
    int Id=IOId_Self(ii);
    if (Id==IOId_XferLeak)
      SetIO_Join(ii, 0);  
    else
      SetIO_Direct(ii, jj++);
    }
  };
Ejemplo n.º 19
0
void BeltCnv::EvalDiscrete()
  {

  int Feed=0;
  for (int i=0; i<NoFlwIOs(); i++)
    if (IOId_Self(i)==idFeed)
      m_Q.SetFeed(Feed++, IOQm_In(i), IOConduit(i));

  flag Moved=(m_fWasRunning && (m_Q.TotalMass()<m_MaxStallLoading || m_fStartIfStalled));
  m_Q.DumpProfile(0, "Before", 0);
  m_Q.Advance(ICGetTimeInc(), Moved);//, m_MaxVelocity, m_MaxVelocity*Speed);

  m_fWasRunning = fabs(m_BeltSB.Speed(this))>0.0;

  m_Power=(m_NLPower+(m_FLPower-m_NLPower)* m_Q.AverageLoading()/m_MaxSpillLoading)*Range(-1.0, m_BeltSB.Speed(this), 1.0);

  m_Q.DumpProfile(1, "After", 0);
  m_BeltSB.EvalDiscrete(this);

  m_AccCalc.Complete(0, m_Q);
  }
Ejemplo n.º 20
0
void MN_BstRes::PostConnect(int IONo)
{
    MdlNode::PostConnect(IONo);

    switch (IOId_Self(IONo))
    {
    case IOId_2IOIn   :
        IOFB(IONo,0)->SetParentFlwEqn(NULL);
        IOFB(IONo,0)->SetFlowModeSrc(this, false);
        break;//, &m_FEP);  break;
    case IOId_2IOOut  :
        IOFB(IONo,0)->SetParentFlwEqn(NULL);
        IOFB(IONo,0)->SetFlowModeSrc(this, false);
        break;
    case IOId_2IOLeakI:
        m_LeakI.PostConnect(IONo);
        break;
    case IOId_2IOLeakO:
        m_LeakO.PostConnect(IONo);
        break;
    }
};
Ejemplo n.º 21
0
flag X_Comp::EvalFlowEquations(CSpPropInfo *pProps, int IONo, int FE)
  {
  Pin  = Max(100.0,IOP_Rmt (IOWithId_Self(ioid_In)));
  Pout = Max(101.0,IOP_Self(IOWithId_Self(ioid_In)));

  FlwBlk &FBI = *IOFB(IOWithId_Self(ioid_In), FE);
  FlwBlk &FB  = *IOFB(IONo, FE);
  double Cflow = fabs(FBI.GetQm());

//  double PRatio=0;
//  if (SetSpeed)
//    {
////    double PCalc=(7990.392-21.47525359*SpeedRatio*266.67+26.75703018*Range(0.0,Cflow,100.0));
////    PCalc=Max(1000.0, PCalc);
////    PRatio=7990/PCalc;
//    }
//  else
//    {
//    //EfficiencyRatio = Efficiency.Zxy(kgpers2m3perhr(pI->GetQm()),kPa2Bar(Pin))/100.0; // hss 10/3/98
//
    SpeedRatio = Speed.Zxy(Cflow,kPa2Bar(Pin))/60.0;// hss 10/3/98 /100.0;
//    }
  MFlow      = kgpers2m3perhr(Cflow);
  CurrentPow = Pwr_Curve(Cflow,Pin,Pout);  // hss 20/6/96 ???
  //double xx= Speed.Yxz(Cflow,12000.0/60.0)/60.0; // CNM

  if( ! P_Status )
    {
    FB.SetQmReqd(0.0);
    FB.SetDPb(0.0, 0.0);
    FB.SetDPq(0.0, 0.0);
    }
  else
    {
    double QIn=FB.QmMeas();
    switch (IOId_Self(IONo))
      {
      // Set dP and dPdQ on this flange according Qin. The boost is determined from the
      // curve formed by the setpoint,maxpower and surge value
      case ioid_In:
        FB.SetQmFree();
        QinFlange = GTZ(QIn);
        if (Control==CTSpeed)
          {
          FB.SetDPb(GEZ(TheBoost), 0.0);
          }
        else
          {
          TheBoost=P_SetpointPressure - X_SetpointPressure - Pin;
          FB.SetDPb(TheBoost, 0.0);
          }
//        if (SetSpeed)
//          {
//          FB.SetDPb(GEZ(TheBoost), 0.0);
//          }
//        else
//          {
//          TheBoost=P_SetpointPressure - X_SetpointPressure - Pin;
//          FB.SetDPb(TheBoost, 0.0);
//          }
        FB.SetDPq(0.0, 0.0);
        #if dbgCompressor
        if (dbgComp())
          dbgpln("Comp In   QIn:%14.6g Pin:%14.6g Pout:%14.6g PSet:%14.6g XSet:%14.6g %s",
                  QIn,Pin,Pout,P_SetpointPressure, X_SetpointPressure, FullObjTag());
        #endif
        break;
      case ioid_Blow:
        {
        //double SurgeMassFlow = SurgeCondition.Xy(kPa2Bar(Pin));
        //double RqdBlowQmOut  = Max(1.0e-5, SurgeMassFlow - QinFlange );
        //Qs = SurgeMassFlow;
        FB.SetQmReqd(0.0);
        FB.SetDPb(0.0, 0.0);
        FB.SetDPq(0.0, 0.0);
        //#if dbgCompressor
        //if (dbgComp())
        //  dbgpln("Comp Blow Srg:%14.6g Rqd:%14.6g      %14s      %14s      %14s %s",
        //          SurgeMassFlow,RqdBlowQmOut,"","","",FullObjTag());
        //#endif
        }
        break;
      case ioid_Out:
        QoutFlange = LTZ(-QIn);
        CurrentQOut = ((0.5*CurrentQOut) + (0.5*(-QIn))); // 1st order filter
        FB.SetQmFree();
        FB.SetDPb(0.0, 0.0);
        FB.SetDPq(0.0, 0.0);
        break;
      }
    }

  return true;
  }
Ejemplo n.º 22
0
void Sys13::EvalDerivs()
  {
  VGA1301_Lvl=VGA1301.Level();
  HBA1301_Lvl=HBA1301.Level();
  VBA1301_Lvl=VBA1301.Level();
  VH1301_Lvl=VH1301.Level();
  VH1302_Lvl=VH1302.Level();
  VGA1301_T=VGA1301.Temp();
  HBA1301_T=HBA1301.Temp();
  VBA1301_T=VBA1301.Temp();
  VH1301_T=VH1301.Temp();
  VH1302_T=VH1302.Temp();

  double Qm;
  double P = Std_P;

  if ((NoFlwIOs() > 0) && (IOId_Self(0)==0))  // Rich Glycol In
    {
    Q1.QCopy(*IOConduit(idGr), P);

//mhm    Q1.QCopy(IOFlange(0)->Q, P);
    }
  else
    {
    Q1.QZero();
    }
  Q2.QCopy(Q1, P);
  Q3.QSetM(VGA1301,/*False, */som_ALL, Max(0.0, VGA1301_Lvl-VGA1301_LvlSet)*QmSetl, P);
  Q4.QCopy(Q3, P);
  Q5.QSetM(HBA1301,/*False, */som_ALL, Max(0.0, HBA1301_Lvl-HBA1301_LvlSet)*QmSetl, P);
  Q8.QSetM(TEGStore,/*False, */som_ALL, bLC13111 ? QmFill : 0.0, P);
  Q9.QSetM(TEGStore,/*False, */som_ALL, bLC13117 ? QmFill : 0.0, P);
  Qm=(bPK1302A ? QmXfer : 0.0) + (bPK1302B ? QmXfer : 0.0);
  if (bLC13114 && bLC13120)
    Qm/=2.0;
  Qa.QSetM(VH1301,/*False, */som_ALL, (bLC13114 ? Qm : 0.0), P);
  Qb.QSetM(VH1302,/*False, */som_ALL, (bLC13120 ? Qm : 0.0), P);
  Qc.QCopy(Qa, P);
  Qc.QAddF(Qb, som_ALL, 1.0);

  Q1m=Q1.QMass(som_ALL);
  Q2m=Q2.QMass(som_ALL);
  Q3m=Q3.QMass(som_ALL);
  Q4m=Q4.QMass(som_ALL);
  Q5m=Q5.QMass(som_ALL);
  Q6m=Q6.QMass(som_ALL);
  Q7m=Q7.QMass(som_ALL);
  Q8m=Q8.QMass(som_ALL);
  Q9m=Q9.QMass(som_ALL);
  Qam=Qa.QMass(som_ALL);
  Qbm=Qb.QMass(som_ALL);
  Qcm=Qc.QMass(som_ALL);

  #if dbgsys13
    dbgpln("System 13 - VGA1301_Lvl : %8.2f",VGA1301_Lvl);
    dbgpln("System 13 - HBA1301_Lvl : %8.2f",HBA1301_Lvl);
    dbgpln("System 13 - VBA1301_Lvl : %8.2f",VBA1301_Lvl);
    dbgpln("System 13 - VH1301_Lvl  : %8.2f",VH1301_Lvl );
    dbgpln("System 13 - VH1302_Lvl  : %8.2f",VH1302_Lvl );
    dbgpln("System 13 - Q1    : %10.2f",Q1m);
    dbgpln("System 13 - Q2    : %10.2f",Q2m);
    dbgpln("System 13 - Q3    : %10.2f",Q3m);
    dbgpln("System 13 - Q4    : %10.2f",Q4m);
    dbgpln("System 13 - Q5    : %10.2f",Q5m);
    dbgpln("System 13 - Q6    : %10.2f",Q6m);
    dbgpln("System 13 - Q7    : %10.2f",Q7m);
    dbgpln("System 13 - Q8    : %10.2f",Q8m);
    dbgpln("System 13 - Q9    : %10.2f",Q9m);
    dbgpln("System 13 - Qa    : %10.2f",Qam);
    dbgpln("System 13 - Qb    : %10.2f",Qbm);
    dbgpln("System 13 - Qc    : %10.2f",Qcm);
  #endif

  SpConduit QBoil("QBoil",NULL,TOA_Free);
  double qb=((bUHA1301A ? 1 : 0) + (bUHA1301B ? 1 : 0))*QmBoil;
  QBoil.SetQm(H2O.li(),Min(qb, HBA1301.SpMass(H2O.li())/10.0));
  //mhm QBoil.Qm(H2O.li())=Min(qb, HBA1301.SpM(H2O.li())/10.0);
  QBoil.SetTemp(HBA1301.Temp());

  VGA1301.ZeroDeriv();
  VGA1301.AddDeriv(Q2, 1);
  VGA1301.AddDeriv(Q3, -1);

  HBA1301.ZeroDeriv();
  HBA1301.AddDeriv(Q4, 1);
//  HBA1301.AddDeriv(Qc, 1, "+Qc");
// Qc is the sum of the glycol out of the VH1301 and VH1302 and according to the flowsheet should be added to VBA1301



  HBA1301.AddDeriv(Q5,    -1);
  HBA1301.AddDeriv(QBoil, -1);

  VBA1301.ZeroDeriv();
  VBA1301.AddDeriv(Q5,  1);
  VBA1301.AddDeriv(Q6, -1);
  VBA1301.AddDeriv(Qc,  1);

  VH1301.ZeroDeriv();
  VH1301.AddDeriv(Q8, 1);
  VH1301.AddDeriv(Qa, -1);

  VH1302.ZeroDeriv();
  VH1302.AddDeriv(Q9, 1);
  VH1302.AddDeriv(Qb, -1);

  };
Ejemplo n.º 23
0
void Mill1::EvalProducts(CNodeEvalIndex & NEI)
  {
  Eff = Range(0.0, Eff, 1.0);
  flag On = (bOnLine && (NetProbalMethod() || MSB.Speed(this)>DischOnSpeed));
  const int ioProd = IOWithId_Self(ioidProd);

  for (int i=0; i<NoFlwIOs(); i++)
    if (IOId_Self(i)==ioidFeed && IO_Out(i))
      IOConduit(i)->QZero();
  
  if (ioProd>=0 && On)
    {
    CB.ClrCI(3);
    StkSpConduit QFd("Fd", chLINEID(), this);

    SigmaQInPMin(QFd(), som_ALL, Id_2_Mask(ioidFeed));
    BOOL ValidData = (QFd().QMass(som_Sol)>1.0e-6);
    //SpConduit & QFd = *IOConduit(ioidFeed);

    Disch.QCopy(QFd());

    //SpConduit & QFd = *IOConduit(ioidFeed);
    ValidData = ValidData && CB.IsValidData(Disch);//QFd);

    if (ValidData && On)
      {
      double F80 = SQSzDist1::Ptr(Disch.Model())->SizePassingFraction(-1, -1, 0.80);

      CB.CrushProduct(QFd(), Disch);

      double Excess;
      double MassRate = Disch.QMass(som_Sol);
      double P80 = SQSzDist1::Ptr(Disch.Model())->SizePassingFraction(-1, -1, 0.80);
      if (Valid(P80) && (P80 > 1e-10) && Valid(F80) && (F80 > 1e-10))
        {
        F80 = F80 * 1e6;  // Convert to microns
        P80 = P80 * 1e6;
        Power  = 10.0 * MassRate * BWI * (1.0/Sqrt(P80) - 1.0/Sqrt(F80));  
        Excess = Motor - Power;
        }
      else
        {
        Power  = 0.0;
        Excess = 0.0;
        }
      if (Excess > 0.0)
        Heat = Excess * Eff;
      else
        Heat = 0.0;

      Disch.Set_totHf(Disch.totHf() + Heat);
      }
    else
      {
      //Disch.QZero();
      Power = 0.0;
      }

    IOConduit(ioProd)->QCopy(Disch);
    }
  else
    {
    Power = 0.0;
    CB.SetCI(3, !m_Pwr.SupplyConnected());
    if (ioProd>=0)
      {
      SpConduit & Qp=*IOConduit(ioProd); //Qp product
      Qp.QZero();
      SigmaQInPMin(Qp, som_ALL, Id_2_Mask(ioidFeed)); //set product = feed
      }
    }
  }
Ejemplo n.º 24
0
void Flot::EvalProducts()
  {
  double Tc;
  SigmaQInPMin(QFd, som_ALL, Id_2_Mask(idFeed));
  int iFl = IOWithId_Self(idFlot);
  int iTl = IOWithId_Self(idTails);
  rSpConduit Fl =*IOConduit(iFl);
  rSpConduit Tl =*IOConduit(iTl);

  SpMArray Mix, flot, sink;
  CDArray  TTemp, Feed, FTemp, YTemp, ATemp, 
			     FlotRec, MassSizeInt, entrain, solids;
  Eff = Range(0.01, Eff, 1.0);

  switch (SolveMode())
    {
    case PBMODE:
    case SSMODE:
      {
      if (GSM.Enabled())
        {
        if (NJoins()>=1)
          Xfer_EvalProducts(0, Joins[0].Pressure(), NULL, NULL, RB(), GSM(), NULL);
        return;
        }
      double Solids, FMass, Entrain, gangue;
      Solids = QFd.QMass(som_Sol);
      
      RB.EvalProducts(QFd);
      Tc  = QFd.Temp();
      Mix = *QFd.Model();
      
			if (Solids < 1e-6)
				{
        Tl.QCopy(QFd);
        Fl.QZero();
        return;
        }
      
      /* Move the required % of the specie to be floated to the flotation stream, 
	    together with the required recovery of aqueous components.
      Calculate the amount of solids to report to the flotation stream based on 
      the user specified grade.  If recovery has been specified as a function of
      size, then this has to be carried out for each size fraction. */
      flot = Mix;
      sink = Mix;
      if (!RM)  // Recovery is NOT a function of size.
        {
				Grd    = Range(0.01, Grd, 1.0);
				Grade2 = Range(0.001, Grade2, 1.0 - Grd);

				// Calculate mass of floated specie and mass of gangue in floats
        FMass   = Mix[(int)iFlot] * Eff;
        flot[(int)iFlot] = FMass;
		    sink[(int)iFlot] = Mix[(int)iFlot] - flot[(int)iFlot];
        Entrain = FMass * (1.0/Grd - 1.0);
        Solids  = Solids - Mix[(int)iFlot];
        gangue  = Entrain / GTZ(Solids);

        
        /* If a second specie is also floated, calculate the amount of this specie
				   reporting to the floats */ 
				if (SecFlot)
					{
					double FlotMass, SecMass;
					FlotMass = FMass / Grd;
					SecMass  = FlotMass * Grade2;
					if (Mix[(int)iSec] < SecMass)
						{
						SecMass = Mix[(int)iSec];
						LogNote(Tag(), 0, "Insufficient Secondary specie in Flotation");
						}
					flot[(int)iSec] = SecMass;
					sink[(int)iSec] = Mix[(int)iSec] - flot[(int)iSec];

					Entrain = Entrain - SecMass;
					Solids  = Solids - Mix[(int)iSec];
					gangue  = Entrain / GTZ(Solids);
					}
				

				for (int i=0; i<SDB.No(); i++)
          {
					if (!SecFlot)
						iSec = iFlot;
					if ((i != (int)iFlot) && (i != (int)iSec) )
		        {
            if (SDB[i].IsLiq())  // Reqd liquid split to floats
		          {
              flot[i] = Mix[i] * Rec;
		          sink[i] = Mix[i] - flot[i];
		          }
            if (SDB[i].IsSol())
		          {
							double masscheck = Mix[i] * gangue;
							if (masscheck > Mix[i])
							  {
							  flot[i] = Mix[i];
                sink[i] = 0.0;
								}
              else
							  {
                flot[i] = Mix[i] * gangue;
		            sink[i] = Mix[i] - flot[i];
								}
		          }
		        if (SDB[i].IsVap()) // Allow all gases to escape
			        {
              flot[i] = 0.0;
		          sink[i] = 0.0;
		          }
		        }
	        }
          
          SetProdMakeup(PMU_IOId |PMU_Image, idFlot,  flot, Tc, Std_P, QFd.Model());
          SetProdMakeup(PMU_IOId |PMU_Image, idTails, sink, Tc, Std_P, QFd.Model());
        }

      if (RM)   // Recovery IS a function of size
				{
        SigmaQInPMin(QFd, som_ALL, Id_2_Mask(idFeed));
				double TonsTotal = QFd.QMass(som_Sol);
        const double TonsLimit = 1e-6;

        SQSzDist1 &Sz   =*SQSzDist1::Ptr(QFd.Model());
        SQSzDist1 &SzFl =*SQSzDist1::Ptr(Fl.Model());
        SQSzDist1 &SzTl =*SQSzDist1::Ptr(Tl.Model());
        
				// Transfer All Qualities / Solids to Tails and Liquids 50/50
				Fl.QSetF(QFd, SetMass_Frac, 0.0, 0.5, 0.0, Std_P);
				Tl.QSetF(QFd, SetMass_Frac, 1.0, 0.5, 0.0, Std_P);

				double FlSol = 0.0;
				double TlSol = 0.0;
				flag NoSize  = True;
				for (int d=0; d<Sz.NDistributions(); d++)
          if (Sz.DistExists(d))
            {
            SzFl.AllocDist(d);
            SzTl.AllocDist(d);
            CSD_Distribution &D  = Sz.Dist(d);
            CSD_Distribution &DT = SzTl.Dist(d);
            CSD_Distribution &DF = SzFl.Dist(d);

    				// Find the total mass in each size interval
						//=============================================

						CDArray & Size = D.PriSp[0]->FracPass;
						int len = Size.GetSize();
						if (len>0)
							{
							MassSizeInt.SetSize(len);
				  	  for(int i=0 ; i<len ; i++)
							  MassSizeInt[i] = 0.0;
							}

            for (int s=0; s<D.NPriIds(); s++)
							{
							CDArray & Size = D.PriSp[s]->FracPass;
              
							int len=Size.GetSize();
							if (len>0)
								{
								CDArray SInt;
								SInt.SetSize(len);
								double Fractions, x1, y1, tmpF;
								Fractions = 0.0;
								for(long i=0 ; i<len ; i++)
									Fractions += Size[i];
								if (Fractions <= 0.0)
									Fractions = 1.0;

								for(i=0 ; i<len ; i++)
									SInt[i] = Size[i] / Fractions;

								double TonsS = 0.0;
								for (int s1=0; s1<D.NSecIds(s); s1++)
										TonsS+= QFd.Qm(D.SzId(s,s1));
								for(i=0 ; i<len ; i++)
									{
									x1      = D.Intervals()[i];
									y1      = SInt[i];
      						tmpF    = y1 * TonsS;
									MassSizeInt[i] += tmpF;
									}
								}
							}
								//============================================

						/* First calculate the mass of each specie floated in each size interval.
						   Note: This code is hard wired for Cleveland.*/
						    
            for (s=0; s<D.NPriIds(); s++)
							{
								CDArray & Size = D.PriSp[s]->FracPass;
								CDArray & ASizeRec = SizeRec.Curve(s);
								flag  flot = False;

              
								int len = Size.GetSize();
								if (len>0)
									{
									NoSize = False;
									CDArray & Float   = DF.PriSp[s]->FracPass;
									CDArray & Tailing = DT.PriSp[s]->FracPass;
									TTemp.SetSize(len);
									Feed.SetSize(len);
									FTemp.SetSize(len);
									YTemp.SetSize(len);
                  FlotRec.SetSize(len);
                  entrain.SetSize(len);
									solids.SetSize(len);

									double Fractions, x1, y1, tmpF, tmpO;
									Fractions = 0.0;
									for(long i=0 ; i<len ; i++)
										Fractions += Size[i];
									if (Fractions <= 0.0)
										Fractions = 1.0;

									for(i=0 ; i<len ; i++)
										YTemp[i] = Size[i] / Fractions;

									double TonsS = 0.0;
									for (int s1=0; s1<D.NSecIds(s); s1++)
											TonsS+= QFd.Qm(D.SzId(s,s1));
										for(i=0 ; i<len ; i++)
											{
											x1      = D.Intervals()[i];
											y1      = YTemp[i];
      								tmpF    = y1 * TonsS;
											Feed[i] = tmpF;
											}
            
										double SpcTlSol = 0.0;
										double SpcFlSol = 0.0;
										for (i=0; i<len; i++)
        							{
											Float[i] = Range(0.0, ASizeRec[i], 1.0);
											tmpO = Float[i];
											tmpF = Feed[i];
											FTemp[i]  = Float[i] * Feed[i];
											SpcFlSol += FTemp[i];
											TTemp[i]  = Feed[i] - FTemp[i];
											SpcTlSol += TTemp[i];
											}

										if (SpcTlSol < TonsLimit)
											{
											SpcFlSol   = GTZ(SpcFlSol);
											Tailing[0] = 0.0;
											Float[0]   = FTemp[0] / SpcFlSol;
											for(i=1 ; i<len ; i++)
      									{
												Tailing[i] = 0.0;
												Float[i]   = (FTemp[i] / SpcFlSol);// + Float[i-1];
												}
											}
										if (SpcFlSol < TonsLimit)
											{
											SpcTlSol   = GTZ(SpcTlSol);
											Tailing[0] = TTemp[0] / SpcTlSol;
											Float[0]   = 0.0;
											for(i=1 ; i<len ; i++)
      									{
												Float[i]   = 0.0;
												Tailing[i] = (TTemp[i] / SpcTlSol);// + Tailing[i-1];
												}
											}
										if ((SpcTlSol > TonsLimit) && (SpcFlSol > TonsLimit))
											{
											for(i=0 ; i<len ; i++)
      									{
												Tailing[i] = (TTemp[i] / SpcTlSol);
												Float[i]   = (FTemp[i] / SpcFlSol);
												}
											}

										double TotSol    = GTZ(SpcTlSol + SpcFlSol);
										double TlSolFrac = SpcTlSol/TotSol;
										double FlSolFrac = SpcFlSol/TotSol;

										int Id;
										if (s == 0)
											Id = KCl.si();
										if (s == 1)
											Id = NaCl.si();
										if (s == 2)
											Id = InSols.si();
 
 											Tl.SetQm(Id, QFd.Qm(Id) * TlSolFrac);
											Fl.SetQm(Id, QFd.Qm(Id) * FlSolFrac);

										TlSol += SpcTlSol;
										FlSol += SpcFlSol;
									}
              }
				//=========================================================
				// Calculate the grade and recovery of the desired specie.

				double MassFloat, MassIn, MassSpecie;
				MassFloat  = Max(1e-6, Fl.QMass(som_Sol));
				MassIn     = Max(1e-6, QFd.Qm((int)iFlot));
				MassSpecie = Fl.Qm((int)iFlot);
				
				TotRecover = MassSpecie/MassIn;
				Grade      = MassSpecie/MassFloat; 

				//---------------------------------------------------------
				// Now calculate the amount of liquids reporting to the float stream
											       
        double FlLiq, TlLiq;
        double QmSIn = QFd.QMass(som_Sol);
        double QmLIn = QFd.QMass(som_Liq);
        if (QmLIn > 1.0e-6)
          {

          if (Rec>1.0e-12)
            {
            Rec = Range(0.0, Rec, 0.999);
            FlLiq = FlSol / (1.0 - Rec) - FlSol;
            FlLiq = Range(0.0, FlLiq, QmLIn);
            }
          else
            FlLiq = 0.0;
          TlLiq = QmLIn - FlLiq;

          // Convert Liquids to % of feed
          FlLiq = FlLiq / QmLIn;
          TlLiq = TlLiq / QmLIn;
          }
        else
          {
          FlLiq = 0.0;
          TlLiq = 0.0;
          }
        // Convert Solids to % of feed
        TlSol = TlSol / TonsTotal;  
        FlSol = FlSol / TonsTotal;

        for (s=0; s<SDB.No(); s++)
          if (SDB[s].IsLiq())
            {
            Fl.SetQm(s, QFd.Qm(s) * FlLiq);
            Tl.SetQm(s, QFd.Qm(s) * TlLiq);
            }

        Fl.SetTemp(QFd.Temp());
        Tl.SetTemp(QFd.Temp());

        if (NoSize)
          {
          LogNote(Tag(), 0, "No Size distr. in Flotation feed");
          Tl.QCopy(QFd);
          Fl.QZero();
          }
        }
       }
      break;
      } 
    case DYNMODE:
      {
      Contents.ZeroDeriv();
      RB.EvalProducts(QFd);
      Tc  = Contents.Temp();
      Mix = (*Contents.Model());

      double MolConc, Liquid;
      Liquid  = Contents.Mass(som_Liq);
      if (Liquid >= 1.0)
        MolConc = Contents.SpMass(iColl)/SDB[iColl].MoleWt() / Liquid;
      else
        MolConc = 0.0;
      /* Determine flotation efficiency as a function of collector
         molar concentration. */
      Eff = Range(0.0, FlotFn.Yx(MolConc), 1.0);

      /*Move the required % of the specie to be floated to the flotation stream, 
	    together with the collector.*/
      flot = Mix;
      sink = Mix;
      for (int i=0; i<SDB.No(); i++)
        {
        if (i == (int)iFlot || i == iColl)
		      {
          flot[i] = Mix[i] * Eff;
		      sink[i] = Mix[i] - flot[i];
		      } 
        else   
  	      if (SDB[i].IsSol())  // Solids report to tails
		        {
            flot[i] = 0.0;
		        sink[i] = Mix[i];
		        }
		      else  // Allow all gases to escape
			      {
            flot[i] = 0.0;
		        sink[i] = 0.0;
		        }
		    } 

      for (i=0; i<NoFlwIOs(); i++)
        if (IO_Out(i))
          switch (IOId_Self(i))
            {
            case idFlot : SetProdMakeup(PMU_IOId |PMU_Image, i, flot, Tc, Std_P, QFd.Model()); break;
            case idTails: SetProdMakeup(PMU_IOId |PMU_Image, i, sink, Tc, Std_P, QFd.Model()); break;
            default:      SetProdMakeup(PMU_IOId |PMU_Image, i, Mix,  Tc, Std_P, QFd.Model()); break;
            }  
	    break;
      }
	  }
  };    
Ejemplo n.º 25
0
flag VLL_Sep::EvalPressureSens()
  {
  ExtraH2oSettled=0.0;
//  SetVLEMixFrac(H2oSettled);

  double BigDiff=0.0;

  // Must be closed and have contents
  if (!Contents.Closed() || Contents.Mass()< 1.0e-6)
    {
    ZeroVLSensitivities(0);
    return True;
    }

  Contents.SetHoldVentExpand();
  ContStartInfo Start(Contents);

//  ContStartInfo Start(C);
  // Vapour Sensitivity
  double QMassV=1.0;
  double DeltaFrac=Range(1.0e-6, 0.1*Max(1.0, Start.MassV)/NZ(fabs(QMassV)), 1.0);
  Contents.AddM(Contents, som_Vap, DeltaFrac);
  double AvgPSensV=(Contents.Press()-Start.Pres)/DeltaFrac;
  RestoreContents(Contents, Start);

  // Liquid Sensitivity
  double QMassL=1.0;
  DeltaFrac=Range(1.0e-6, 0.1*Max(1.0, Start.MassL)/NZ(fabs(QMassL)), 1.0);
  Contents.AddM(Contents, som_SL, DeltaFrac);
  double AvgPSensL=(Contents.Press()-Start.Pres)/DeltaFrac;
  RestoreContents(Contents, Start);

  SetEquilibratingV2L(0, Contents, Start);
  //SetVLSensitivities(0, Contents, Start);
  SetStaticHeadSensitivities(0, Contents, Start);
  // Flash to Equilibrium


  ContStartInfo Equil(Contents);

  double DeltaMass, Mv0, Mv1, P0, P1;
  JoinRec & J=Joins[0];
  for (int c=0; c<J.NConns(); c++)
    {
    int i=J.IONo(c);
    SpConduit &Cd=*IOConduit(i);

    double XH2OScl;
    if (IOId_Self(i)==VLLIO_boot)
      XH2OScl=1.0;
    else if (IO_In(i))
      XH2OScl=1.0-H2ORemEff;
    else
      XH2OScl=0.0;

    // Transfer to retain equil due to movement of vapour
    RestoreContents(Contents, Equil);

    DeltaMass=Max(1.0e-6, 0.001*Equil.MassV);
    P0=Contents.Press();
    Contents.AddM(Cd, som_Vap, DeltaMass);
    P1=Contents.Press();
    double PSensV=(fabs(P1-P0)>1.0e-6) ? (P1-P0)/DeltaMass : AvgPSensV;

    Mv0=Contents.Mass(som_Vap);
    ExtraH2oSettled=XH2OScl*Cd.Qm(Steam())*DeltaMass/GTZ(Cd.QMass(som_Vap));
    ConvergeStates();
    Mv1=Contents.Mass(som_Vap);
    double V2LQVFrac=(Mv0-Mv1)/DeltaMass;

    // Transfer to retain equil due to movement of liquor
    RestoreContents(Contents, Equil);

    DeltaMass=Max(1.0e-6, 0.001*Equil.MassL);
    P0=Contents.Press();
    Contents.AddM(Cd, som_SL, DeltaMass);
    P1=Contents.Press();
    //double PSensL=(P1-P0)/DeltaMass;
    double PSensL=(fabs(P1-P0)>1.0e-6) ? (P1-P0)/DeltaMass : AvgPSensL;

    Mv0=Contents.Mass(som_Vap);
    ExtraH2oSettled=XH2OScl*Cd.Qm(Water())*DeltaMass/GTZ(Cd.QMass(som_Liq));
    ConvergeStates();
    Mv1=Contents.Mass(som_Vap);

    double V2LQLFrac=(Mv0-Mv1)/DeltaMass;

    Set_IO_PSensVL(i, PSensV, PSensL);
    Set_IO_V2LQmFact(i, V2LQVFrac, V2LQLFrac);

//    dbgpln("     V2L  V:%14.6g L:%14.6g  %14.6g %14.6g  %s",
//      V2LQVFrac, V2LQLFrac, XH2OScl, ExtraH2oSettled, Nd_Rmt(i)->FullObjTag());
    }

  RestoreContents(Contents, Start);
  ExtraH2oSettled=0.0;

  Contents.ClrHoldVentExpand();

  return true;//False;
  };
Ejemplo n.º 26
0
/*This provides access to the variables of the model and calls the
BuildDataDefn for objects used by the model.*/
void BeltCnv::BuildDataDefn(DataDefnBlk & DDB)
  {
  DDB.BeginStruct(this);

  //DDB.Page   ("Parms");
  DDB.Text    ("");
  DDB.Visibility(NM_Dynamic|SM_All|HM_All);
  BuildDataDefnElevation(DDB);
  DDB.Text("");
  DDB.Double  ("BeltSpeed",    "",                DC_Ldt,  "m/s",   xidBeltSpeed,       this, isResult);
  DDB.Visibility();
  DDB.Double  ("Length",       "L",               DC_L,    "m",     xidBeltLength,      this, isParm);
  DDB.Visibility(NM_Dynamic|SM_All|HM_All);
  DDB.Double  ("MaxSpeed",     "",                DC_Ldt,  "m/s",   &m_MaxVelocity,     this, isParm);
  DDB.Double  ("MaxLoading",   "MaxSpillLoad",    DC_MpL,  "kg/m",  &m_MaxSpillLoading, this, isParm);
  DDB.Double  ("MinLoading",   "",                DC_MpL,  "kg/m",  &m_MinLoading,      this, isParm|InitHidden);
  DDB.Long    ("MaxTurndown",  "",                DC_,     "",      &m_MaxTurnDown,     this, isParm|InitHidden);

  DDB.Visibility(NM_Dynamic|SM_All|HM_All);
  DDB.Double  ("",             "MaxStallLoad",    DC_M,    "kg",    &m_MaxStallLoading, this, isParm);
  DDB.CheckBox("",             "StartIfStalled",  DC_,     "",      &m_fStartIfStalled, this, isParm);
  DDB.Byte    ("",             "WasRunning",      DC_,     "",      &m_fWasRunning,     this, isResult|InitHidden);

  DDB.Double  ("TotalMass",    "",                DC_M,    "kg",    xidTotalMass,       this, isResult);
  DDB.Double  ("AvgLoading",   "",                DC_MpL,  "kg/m",  xidAvgLoading,      this, isResult);

  if (OrigPrjFileVerNo()<90 && DDB.ForFileSnpScn())
    DDB.String  ("SpillArea",    "",              DC_,     "",      &m_sAreaTag,        this, isParmStopped);
  DDB.Double  ("TotalSpilt",   "",                DC_M,    "kg",    xidTotSpilt,        this, isParm);
  DDB.Double  ("TotalVented",  "",                DC_M,    "kg",    xidTotVented,       this, isParm);

  DDB.Page("BeltDrive", DDB_RqdPage);
  DDB.Text    ("Power Draw");
  DDB.Double  ("NoLoadPower",  "",                DC_Pwr,  "kW",    &m_NLPower,         this, isParm);
  DDB.Double  ("FullLoadPower","",                DC_Pwr,  "kW",    &m_FLPower,         this, isParm);
  DDB.Double  ("Power",        "",                DC_Pwr,  "kW",    &m_Power,           this, isResult);

  DDB.Text("");
  m_Pwr.BuildDataDefn(DDB);
  m_BeltSB.BuildDataDefn(DDB, this, "Speed", 1);
  DDB.Visibility();

  DDB.Text("");
  DDB.Long    ("NoWtMtrs",     "",                DC_,     "",      xidNWtMtrs,         this, isParm);
  static DDBValueLst DDB1[] = {
    {QPT_None,        "None" },
    {QPT_FixedPts,    "Fixed Points"},
    {QPT_AllSections, "All Section Pts"},
    {QPT_MinSections, "Min Section Pts"},
    {0}};
  DDB.CheckBox("ShowProfile",  "",                DC_,     "",      xidShowProf,        this, isParm|SetOnChange);
  DDB.Visibility(NM_Dynamic|SM_All|HM_All, m_fShowProfile);
  DDB.Long    ("ProfDispType", "",                DC_,     "",      xidProfDispType,    this, isParm, DDB1);
  //DDB.Visibility(NM_Dynamic|SM_All|HM_All, m_fShowProfile && m_ProfDispType==QPT_FixedPts);
  //DDB.Long    ("ProfilePts",   "",                DC_,     "",      xidProfPts,         this, isParm);
  DDB.Visibility(NM_Dynamic|SM_All|HM_All);
  DDB.Long    ("NSections",    "",                DC_,     "",      xidNSections,       this, isResult);
  if (DDB.BeginStruct(this, "MinSect", 0, DDB_NoPage))
    {
    DDB.Double  ("Length",     "",                DC_Frac, "%",     &m_Q.m_dMinFracSectLen,  this, isParm);
    DDB.Visibility(NM_Dynamic|SM_All|HM_All, m_Q.m_dMinFracSectLen>0);
    DDB.Double  ("LoadTol",    "",                DC_Frac, "%",     &m_Q.m_dLoadTol,  this, isParm);
    DDB.Double  ("TempTol",    "",                DC_Frac, "%",     &m_Q.m_dTempTol,  this, isParm);
    DDB.Double  ("MFracTol",   "",                DC_Frac, "%",     &m_Q.m_dMFracTol,  this, isParm);
    }
  DDB.EndStruct();

  DDB.Text("");
  BuildDataDefnShowIOs(DDB);


  if (m_WtMtrPos.GetSize())
    {
    DDB.Page("WtMtrs", DDB_RqdPage);
    if (DDB.BeginArray(this, "WtMtr", "WtMtr", m_WtMtrPos.GetSize(), 0))
      {
      for (int i=0; i<m_WtMtrPos.GetSize(); i++)
        if (DDB.BeginElement(this, i))
          {
          DDB.Double("Pos",      "",                  DC_L ,     "m",     xidWtrMtrPos0+i,      this, isParm);
          DDB.Double("Loading",  "",                  DC_MpL,    "kg/m",  xidWtrMtrLd0+i,       this, isResult|0);
          DDB.Double("Rate",     "",                  DC_Qm,     "kg/s",  xidWtrMtrRate0+i,     this, isResult|0);
          DDB.Text("");
          }
      }
    DDB.EndArray();
    }


  int FdLst[MaxIOList], PrLst[MaxIOList];
  int nFd=0, nPr=0;
  for (int i=0; i<NoFlwIOs(); i++)
    if (IOId_Self(i)==idFeed)
      FdLst[nFd++]=i;
    else if (IOId_Self(i)==idProd)
      PrLst[nPr++]=i;

  int DoOld=((!DDB.ForFiling() && !DDB.ForSnapShot() && !DDB.ForScenario() && !DDB.ForView()) ||
            (DDB.ForFiling() && DDB.DoingPutData()));

  Strng Nm;
  DDB.Page("Feeds", DDB_RqdPage);
  if (DDB.BeginArray(this, "Fd", "BltCnvFd", nFd, 0))
    for (i=0; i<nFd; i++)
      if (DDB.BeginElement(this, Nd_Rmt(FdLst[i])->FullObjTag()))
        {
        DDB.Double     ("Pos",      "",  DC_L , "m",      xidFeedPos0+i,      this, isParm);
        DDB.Visibility(NM_Dynamic|SM_All|HM_All);
        DDB.CheckBoxBtn("Limited",  "",  DC_, "",         xidFeedLimited0+i,  this, isParm);
        DDB.Visibility(NM_Dynamic|SM_All|HM_All, m_Q.FeedLimited(i));
        DDB.Double     ("Capacity", "",  DC_Frac, "%",    xidFeedCapFrac0+i,  this, isParm);
        DDB.Visibility();
        DDB.Double     ("Qm",       "",  DC_Qm , "kg/s",  xidFeedQm0+i,       this, 0);
        DDB.Text("");

        if (DoOld)
          {
          DDB.BeginElement(this, i);
          DDB.Double("Pos",     "",  DC_L , "m",    xidFeedPos0+i,       this, isParm);
          DDB.Double("Qm",     "",  DC_Qm , "kg/s",  xidFeedQm0+i,       this, 0);
          }
        }
  DDB.EndArray();

  DDB.Page("Products", DDB_RqdPage);
  if (DDB.BeginArray(this, "Pr", "BltCnvPr", nPr, 0))
    for (i=0; i<nPr; i++)
      if (DDB.BeginElement(this, Nd_Rmt(PrLst[i])->FullObjTag()))
        {
        DDB.Double("Pos",     "",   DC_L ,     "m",    xidProdPos0+i,       this, isParm);
        DDB.Double("Removal","",    DC_Frac , "%",     xidProdRemove0+i,    this, isParm);
        DDB.Double("Qm",    "",     DC_Qm ,   "kg/s",  xidProdQm0+i,        this, 0);
        DDB.Double("Loss",  "",     DC_Qm ,   "kg/s",  xidProdLoss0+i,      this, 0);

        DDB.Text("");

        if (DoOld)
          {
          DDB.BeginElement(this, i);
          //DDB.TagComment(Nd_Rmt(PrLst[i])->FullObjTag());
          //DDB.BeginElement(this, Nd_Rmt(PrLst[i])->FullObjTag());
          DDB.Double("Pos",     "",   DC_L ,     "m",    xidProdPos0+i,       this, isParm);
          DDB.Double("Removal","",    DC_Frac , "%",     xidProdRemove0+i,    this, isParm);
          DDB.Double("Qm",    "",     DC_Qm ,   "kg/s",  xidProdQm0+i,        this, 0);
          DDB.Double("Loss",  "",     DC_Qm ,   "kg/s",  xidProdLoss0+i,      this, 0);
          }
        }
  DDB.EndArray();

  if (m_fShowProfile)
    DDB.Object(&m_Q.Profile(), this);

  //BuildDataDefnAreaIOs(DDB);

  DDB.EndStruct();
  };
Ejemplo n.º 27
0
void MN_Xfer::PreDisConnect(int IONo)
  {
  if (IOId_Self(IONo)==IOId_XferLeak)
    m_Leak.PreDisConnect(IONo);
  MdlNode::PreDisConnect(IONo);
  }