Пример #1
0
void CEC_FinalConc::BuildDataDefn(DataDefnBlk & DDB)
  {
  Strng T;
  T.Set("Final Conc %s", m_Spc.m_Name());

  DDB.Text  (T());
  DDEF_Flags VFlags=DDB.GetVisibility();
  DDB.String("ExtentType",        "",        DC_,     "",      xid_RCTExtentType,          &Eq, SetOnChange|isParm, DDBExtentTypes);
  DDB.SetVisibility(VFlags);

  if (m_Spc.m_ReactTerm>=0 || m_Spc.m_ProdTerm>=0)
    {
    CCnvIndex dc;
    pchar pCnvTxt;
    SDB.AddSpCnv(DC_Conc, SDB[m_Spc.m_SpcId].SymOrTag(), "g/L", dc, pCnvTxt);
    Strng S,C("Rct"),R("Reqd");
    if (Valid(m_dRqdTemp))
      S.Set("@%.2f", K2C(m_dRqdTemp));
    else
      S="@FinalT";
    C+=S;
    R+=S;
    m_ddRqdConc.BuildDataDefn(DDB, "Conc_Rqd", "", dc, pCnvTxt, xid_RCTExtent, &Eq, C(), R());
    DDB.Double("Conc_MeasTemp",    "",          DC_T,     "C",  xid_RCTFinalConcT,  &Eq, isResult|noFile|noSnap|InitHidden);
    DDB.Double("Conc_EOStep",      "Conc_Act",  DC_,      "",   &m_dKEOStep,             &Eq, isResult);
    DDB.TagComment(S());
    DDB.Double("Conc_Final",       "",          DC_,      "",   &m_dKFinal,              &Eq, isResult|NAN_OK);
    DDB.TagComment(S());
    DDB.Double("ExtentError",      "",          DC_Frac,  "%",  xid_ExtentError, &Eq, isResult|noFile|noSnap|NAN_OK);
    }
  };
Пример #2
0
void FlashTank::BuildDataDefn(DataDefnBlk &DDB)
  {
  DDB.BeginStruct(this);
  DDB.Double ("Pressure",     "P",    DC_P,    "kPag",   xidPMean,        this, 0);
  DDB.Double ("Temperature",  "T",    DC_T,    "C",      xidTemp,        this, 0);
  DDB.Double ("Density",      "Rho",  DC_Rho,  "kg/m^3", xidRho,       this, 0);
  DDB.Double ("Level",        "Lvl",  DC_Frac, "%",      xidLevel,     this, 0);

  DDB.Text   ("Datum");
  DDB.Double ("Datum",        "Z",    DC_L    , "m",    &dDatum,        this, isResult|0      | DYNMODE);
  DDB.Double ("Datum_Rqd",    "Z_Rqd",DC_L    , "m",    &dDatum_Rqd,    this, isParmStopped | DYNMODE|NAN_OK);

  DDB.Text   (" ");
  DDB.Double  ("POffset",      "",    DC_DP,    "kPa",     &POffset,          this, 0);

  DDB.Text    ("");
  DDB.CheckBoxBtn("Closed",    "",      DC_     , "",      xidClosed,      this,
    isParmStopped|(!gs_Environment.OK() ? noView|noFile|noSnap|noScenario:0) , DDBYesNo);
  DDB.CheckBoxBtn("Networked", "", DC_     , "",       xidNetPressDamp,       this,
    isParmStopped|(!gs_Environment.OK() || !Contents.Closed() ? noView|noFile|noSnap|noScenario:0) , DDBYesNo);

  VLE.Add_OnOff(DDB);

  VLE.BuildDataDefn(DDB, NULL, NULL, DDB_RqdPage, 0);
  if (SolveMode()==DYNMODE)
    {
    DDB.Object(&Contents, this, NULL, NULL, DDB_RqdPage);
    DDB.Object(&PresetImg, this, NULL, NULL, DDB_RqdPage);
    }

  DDB.Page("IOs");
  Strng Commnt, Nm;
  for (int i=0; i<NoFlwIOs(); i++)
    {
    Nm.Set("IO_%02i", i);
    DDB.Double(Nm(),     "",  DC_Qm , "kg/s",    xidIO_Qm0+i,       this, 0);
#ifndef UsingZTagObj
    DDB.VolatileTags(Nm(), Nm());
#endif

    Commnt.Set("%s", Nd_Rmt(i)->FullObjTag());
    DDB.TagComment(Commnt());
    }
  DDB.Double("IO_Sigma",    "",  DC_Qm , "kg/s",    xidIO_QmSigma,       this, 0);

  DDB.EndStruct();
  };
Пример #3
0
void CActuator::BuildDataDefn(DataDefnBlk & DDB)
  {
  DDB.BeginStruct(this, "CActuator", NULL, DDB_NoPage);
  DDB.Text("");
  DDB.CheckBoxBtn("On",           "",         DC_, "", &bOn,           this, isParmStopped, DDBYesNo);
  DDB.CheckBoxBtn("ShowCnv",      "",         DC_, "", &bWithCnvComment,this, isParmStopped, DDBYesNo);
  DDB.Visibility();
  DDB.Long("", "Ac_Cnt",  DC_, "", idmCount,       this, isParmStopped/*|AffectsStruct*/);
  DDB.Text("");
  if (m_DataBlk.GetSize()>0)
    {
    DDB.Button("Check_tags",   "", DC_,    "",    idmCheckBtn,      this, isParmStopped);
    DDB.Text("");
    DDB.String("State",        "", DC_,    "",    &m_StateLine[0],  this, noSnap|noFile);
    DDB.Text("Error:");
    DDB.String("Msg_1",        "", DC_,    "",    &m_StateLine[1],  this, noSnap|noFile);
    DDB.String("Msg_2",        "", DC_,    "",    &m_StateLine[2],  this, noSnap|noFile);
    DDB.Text("");
    }
  DDB.Text("----------------------------------------");

  static DDBValueLst DDBFail[]={
      {Fail_None,                         "None"             },
      {Fail_Hold,                         "Hold"             },
      {Fail_Hold|Fail_Noise,              "Hold,Noise"       },
      {Fail_MinVal,                       "MinVal"           },
      {Fail_MaxVal,                       "MaxVal"           },
      {Fail_LoVal,                        "LoVal"            },
      {Fail_HiVal,                        "HiVal"            },
      {Fail_MinVal|Fail_Ramp,             "MinVal,Ramp"      },
      {Fail_MaxVal|Fail_Ramp,             "MaxVal,Ramp"      },
      {Fail_LoVal|Fail_Ramp,              "LoVal,Ramp"       },
      {Fail_HiVal|Fail_Ramp,              "HiVal,Ramp"       },
      {Fail_MinVal|Fail_Noise,            "MinVal,Noise"     },
      {Fail_MaxVal|Fail_Noise,            "MaxVal,Noise"     },
      {Fail_LoVal|Fail_Noise,             "LoVal,Noise"      },
      {Fail_HiVal|Fail_Noise,             "HiVal,Noise"      },
      {Fail_MinVal|Fail_Ramp|Fail_Noise,  "MinVal,Ramp,Noise"},
      {Fail_MaxVal|Fail_Ramp|Fail_Noise,  "MaxVal,Ramp,Noise"},
      {Fail_LoVal|Fail_Ramp|Fail_Noise,   "LoVal,Ramp,Noise" },
      {Fail_HiVal|Fail_Ramp|Fail_Noise,   "HiVal,Ramp,Noise" },
      {0}};
  static DDBValueLst DDBXForms[]={
      {XF_None,   "None"   },
      {XF_Linear, "Linear" },
      //{XF_Sqr,    "Sqr"    },
      //{XF_Sqrt,   "Sqrt"   },
      {0}};
  static DDBValueLst DDBFilters[]={
      {Flt_None,        "None"   },
      {Flt_FirstOrder,  "FirstOrder" },
      {0}};
  static DDBValueLst DDBRawXLates[]={
      {XL_None,     "None"   },
      {XL_AtoD,     "AtoD"  },
      {XL_Linear,   "Linear" },
      //{XL_PulseEncode  "PulseWidth" },
      {0}};
  char Buff[128];
  Strng Tag;
  if (DDB.BeginArray(this, "Cfg", "Ac_Cfg", m_DataBlk.GetSize()))
    {
    for (int i=0; i<m_DataBlk.GetSize(); i++)
      {
      if (1)// i>0 && (i % 2)==1)
        {
        sprintf(Buff, "%d", i);
        DDB.Page(Buff, DDB_OptPage);
        }
      DDB.BeginElement(this, i);
      CActuatorBlk * T = m_DataBlk[i];
      Strng CnvTxt;
      if (bWithCnvComment && XRefsValid() && T->m_bValid)
        GetValidCnvTxt(T->m_OutputVar, CnvTxt);
      DDB.String("ID",                 "",            DC_,          "", idmCfgTags+(i*NoOfCfgTags)+1, this, isParmStopped|isTag);
      DDB.String("OutputTag",          "",            DC_,          "", idmCfgTags+(i*NoOfCfgTags)+2, this, isParmStopped|isTag);
      //DDB.Double("RequiredValue",      "ReqdVal",         DC_,          "", &T->m_dReqdValue,               this, isResult|noFileAtAll);
      DDB.Double("RequiredValue",      "Rqd",         DC_,          "", &T->m_dReqdValue,               this, isResult|noFileAtAll);
      if (CnvTxt.Len())
        DDB.TagComment(CnvTxt());

//      DDB.Byte  ("Transform",          "",            DC_,          "",   &T->m_Xform.m_iType,  this, isParm|SetOnChange, DDBXForms);
//      DDB.Visibility(NSHM_All, T->m_Xform.m_iType);
//      DDB.Float ("Xf.Factor",          "",            DC_,          "",   &T->m_Xform.m_dFactor,      this, isParm);
//      DDB.Float ("Xf.Bias",            "",            DC_,          "",   &T->m_Xform.m_dBias,        this, isParm);
//
//      DDB.Visibility();
//
//      DDB.Byte  ("Filter",             "",            DC_,          "",   &T->m_Flt.m_iType,   this, isParm|SetOnChange, DDBFilters);
//      DDB.Visibility(NSHM_All, T->m_Flt.m_iType == Flt_FirstOrder);
//      DDB.Float ("Flt.TimeConst",      "Flt.Tau",     DC_Time,      "s",  &T->m_Flt.m_dTau,    this, isParm);
//      DDB.Double("Flt.PrevValue",      "",            DC_,          "",   &T->m_Flt.m_dPrevValue, this, InitHidden);
//      DDB.Visibility();
//
//      DDB.Byte  ("Fail.Mode",          "",            DC_,          "",   &T->m_Fail.m_iType,   this, isParm|SetOnChange, DDBFail);
//      DDB.Float ("Fail.LoValue",       "",            DC_,          "",   &T->m_Fail.m_dLoValue,   this, isParm);
//      DDB.Float ("Fail.HiValue",       "",            DC_,          "",   &T->m_Fail.m_dHiValue,   this, isParm);
//      DDB.Float ("Fail.NoiseStdDev",   "",            DC_,          "%",  &T->m_Fail.m_dNoiseStdDevFrac,   this, isParm);
//      DDB.Float ("Fail.SlewTime",      "",            DC_Time,      "s",  &T->m_Fail.m_dSlewTime,   this, isParm);
//
//
//      DDB.Float ("MinValue",           "MinV",        DC_,          "",   &T->m_dMinValue,   this, isParm);
//      DDB.Float ("MaxValue",           "MaxV",        DC_,          "",   &T->m_dMaxValue,   this, isParm);
//      DDB.Double("Value",              "",            DC_,          "",   &T->m_dValue,      this, isResult);
//
//      DDB.Float ("LoLimit",            "LL",          DC_,          "",   &T->m_dLoLimit,    this, isParm);
//      DDB.Float ("HiLimit",            "HL",          DC_,          "",   &T->m_dHiLimit,    this, isParm);
//
      flag ff=0;
      DDB.CheckBox  ("LoInvert",       "",            DC_,          "",   &T->m_bLoInvert,   this, isParm|SetOnChange);
      DDB.CheckBox  ("HiInvert",       "",            DC_,          "",   &T->m_bHiInvert,   this, isParm|SetOnChange);
      DDB.Bool      ("",               "Lo",          DC_,          "",   &T->m_bLo,         this, isResult);
      DDB.Bool      ("",               "Hi",          DC_,          "",   &T->m_bHi,         this, isResult);

//      DDB.Byte      ("RawTransform",   "",            DC_,          "",   &T->m_RawXform.m_iType,  this, isParm|SetOnChange, DDBRawXLates);
//      DDB.Visibility(NSHM_All, T->m_RawXform.m_iType>=XL_AtoD);
//      DDB.Float     ("Raw.MinValue",   "",            DC_,          "",   &T->m_RawXform.m_dMinValue,    this, isParm);
//      DDB.Float     ("Raw.MaxValue",   "",            DC_,          "",   &T->m_RawXform.m_dMaxValue,    this, isParm);
//      DDB.Visibility();
//
      //DDB.Double    ("OutputValue",    "Output",      DC_,          "",   &T->m_dOutputValue,   this, isResult);
      DDB.Double    ("OutputValue",    "Out",         DC_,          "",   &T->m_dOutputValue,   this, isResult);

      DDB.String    ("PLCAddess",      "",            DC_,          "",   &T->m_sPLCAddress,    this, isParmStopped|InitHidden);
      
      DDB.Long      ("Priority",       "",            DC_,          "",   idmCfgTags+(i*NoOfCfgTags)+4, this, isParmStopped|InitHidden);
      DDB.Text("----------------------------------------");
      }
    }
  DDB.EndArray();

  DDB.EndStruct();
  }