V 10
1
LANG:1 8 (NoName)
PANEL,284 126 229 396 N "_3DFace" 0
EEE E E 1 -1 -1 0  30 70
"" 0 1
EE 2
"CBRef""1"
"EClose"E
""
DISPLAY_LAYER, 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
LAYER, 0 
1
LANG:1 6 Layer1
6 21
"Border1"
""
1 10 340 E E E 1 E 1 E N {0,0,0} E N {255,204,153} E E
 E E
20 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  1 E 10 10 210 340
2 22
"Text4"
""
1 10 10 E E E 1 E 1 E N {0,0,0} E N {204,153,102} E E
 E E
21 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  1 E 12 12 208 33
1 2 0 "s" 0 0 0 65 0 0  12 12
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 15 DAQ Transitions
2 1
"Text1"
""
1 30 310 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
2 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  0 E 32 312 78 328
0 2 0 "s" 0 0 0 64 0 0  32 312
 1
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
1
LANG:1 3 RST
2 3
"Text2"
""
1 101 280 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
4 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldIn();
}

EP_textFieldIn()
{
dyn_errClass err;

  if( dpSubStr( \"ChangeRST.trigger:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_textFieldInCB\",
            \"ChangeRST.trigger:_online.._value\");

  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}


EP_textFieldInCB(string dp, int iNewValue)
{
int i,icard;
string datapoint1;

 if(iNewValue==false){
  setValue(\"\", \"text\", \"DCS\" );  
}

 if(iNewValue==true){
  setValue(\"\", \"text\", \"DAQ\" );
}


}




// SimpleCtrlScript {EP_textFieldIn}
// DP {Crate00.DDC.DCS_STATES}
// DPConfig {:_online.._value}
// DPType {int}
// UseDPUnit {TRUE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
" 0
 E 0 1 1 0 1 E U  1 E 103 282 189 298
1 2 0 "s" 0 0 0 64 0 0  103 282
 1
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
1
LANG:1 10 DCS States
2 4
"Text3"
""
1 20 282 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
5 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  0 E 22 284 98 300
0 2 0 "s" 0 0 0 64 0 0  22 284
 1
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
1
LANG:1 10 In Charge:
2 36
"Text5"
""
1 40 140 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
32 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
E E 0 1 1 0 1 E U  0 E 42 142 98 158
0 2 0 "s" 0 0 0 64 0 0  42 142
 1
1
LANG:1 117 -microsoft windows-Courier New-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,49,Courier New
0 ""
1
LANG:1 7 Status:
2 37
"CurrState"
""
1 110 140 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
33 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N "_Transparent"
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldIn();
  EP_setBackColor();

  EP_setInvalid();
}

EP_setBackColor()
{
dyn_errClass err;

  if( dpSubStr( \"ChangeRST.parameters:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_setBackColorCB\", 
            \"ChangeRST.parameters:_online.._value\",
            \"ChangeRST.parameters:_online.._invalid\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}


EP_setBackColorCB(string dpSource, float fNewValue, string dpInvalid, bool boInvalid)
{

  if (boInvalid)
    setValue(\"\", \"backCol\", \"_invalid\");
  else if (fNewValue < 3){

    setValue(\"\", \"backCol\", \"Green\");
    }   
  else
    setValue(\"\", \"backCol\", \"White\");
}

EP_textFieldIn()
{
dyn_errClass err;

  if( dpSubStr( \"SCTmops1:Crate00.Stat:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_textFieldInCB\",
            \"SCTmops1:Crate00.Stat:_online.._value\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}

EP_textFieldInCB(string dp, unsigned uNewValue)
{
  setValue(\"\", \"text\", dpValToString(dp, uNewValue, TRUE) );
}





EP_setInvalid()
{
dyn_errClass err;

  if( dpSubStr( \"SCTmops1:Crate00.Stat:_online.._invalid\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_setInvalidCB\",
            \"SCTmops1:Crate00.Stat:_online.._invalid\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}

EP_setInvalidCB(string dp, bool boInvalid)
{
  setValue(\"\", \"color\", (boInvalid ? \"_invalid\" : \"\"));
}

// SimpleCtrlScript {EP_textFieldIn}
// DP {SCTmops1:Crate00.Stat}
// DPConfig {:_online.._value}
// DPType {unsigned}
// UseDPUnit {TRUE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
// SimpleCtrlScript {EP_setInvalid}
// DP {SCTmops1:Crate00.Stat}
// DPConfig {:_online.._invalid}
// DPType {bool}
// Attribut {color}
// SimpleCtrlScriptEnd {EP_setInvalid}
" 0
 E 0 1 1 0 1 E U  1 E 112 142 178 158
1 2 0 "s" 0 0 0 64 0 0  112 142
 1
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
1
LANG:1 9 CurrState
22 20
"DCSLocal"
""
1 101 310 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
20 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 119 -microsoft windows-Courier New-normal-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,400,0,0,0,0,3,2,1,49,Courier New
0 ""
99 308 193 334
11
1
LANG:1 3 Off
 1
1
LANG:1 6 Loaded
 0
1
LANG:1 6 Active
 0
1
LANG:1 10 DAQ Loaded
 0
1
LANG:1 10 Configured
 0
1
LANG:1 7 Running
 0
1
LANG:1 5 Pause
 0
1
LANG:1 10 Stop Pause
 0
1
LANG:1 11 Deconfigure
 0
1
LANG:1 6 Deload
 0
1
LANG:1 4 Stop
 0
E
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldOut();
}

EP_textFieldOut()
{
int iNewValue;
string sNewValue;
dyn_errClass err;
string sTmp;
int iTmp;

  getValue(\"\", \"text\", sTmp);

//OFF - PS does nothing  
  if(sTmp==\"Off\"){
    sTmp=\"0\";
    iTmp=0;
}
  
//Loaded - PS does nothing   
  if(sTmp==\"Loaded\") {
  sTmp=\"1\";
  iTmp=1;
  }
  
//Active - PS does nothing   
  if(sTmp==\"Active\") {
  sTmp=\"2\";
  iTmp=2;
  }

//DAQ Loaded - PS loads values to ELMB 
  if(sTmp==\"DAQ Loaded\") {
  sTmp=\"10\";
  iTmp=10;
  LVHVon();
  }

//OFF - PS does nothing     
  if(sTmp==\"Configured\") {
  sTmp=\"11\";
  iTmp=11;
  SendLV();
  }

//OFF - PS does nothing     
  if(sTmp==\"Running\") {
  sTmp=\"12\";
  iTmp=12;
  SendHV();
  }

//OFF - PS does nothing     
    if(sTmp==\"Pause\") {
  sTmp=\"13\";
  iTmp=13;
  }
 
 //OFF - PS does nothing    
  if(sTmp==\"Stop Pause\") {
  sTmp=\"14\";
  iTmp=14;
  }

//OFF - PS does nothing     
  if(sTmp==\"Deconfigure\") {
  sTmp=\"15\";
  iTmp=15;
  LVoff();
  HVoff();
  }

//OFF - PS does nothing     
  if(sTmp==\"Deload\") {
  sTmp=\"16\";
  iTmp=16;
  SendHV();
  }

//OFF - PS does nothing     
  if(sTmp==\"Stop\") {
  sTmp=\"17\";
  iTmp=17;
  SendLV();
  }
  
  sscanf(sTmp, \"%d\", iNewValue);
  if( iNewValue != sTmp )
  {
    ChildPanelOnCentral( \"vision/MessageWarning\",
                         getCatStr( \"e_para\", \"warning\" ),
                         makeDynString( getCatStr( \"e_para\", \"wrongFormat\" )));
    return;
  }
  
 
dpSetWait(\"ChangeRST.parameters:_original.._value\",iTmp );
 
}

LVHVon()
{
dyn_errClass err;
string datapoint1;
int i,j;
dyn_string valset; 
dyn_float initValue;

//HV parameters

for (i=0;i<=47;i++){

  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchVolt\" );
  dpSetWait(datapoint1, 100);
  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchITrp\" );
  dpSetWait(datapoint1, 1100);
  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchRamp\" );
  dpSetWait(datapoint1, 3);
    
  }
  
//LV parameters

for (i=0;i<=47;i++){

valset=makeDynString(\"LVcaTrip\",\"LVcaMask\",\"LVch_Vcc\",\"LVch_Vdd\",\"LVchVCSV\",\"LVchPINV\",\"LVchDTrp\",\"LVchCTrp\",\"LVchTTrp\",\"LVchTLim\",\"LVchCLKS\",\"LVchCLKR\",\"LVchVOut\");
initValue=makeDynFloat(46*2.5,15,3.5*50,4*50,4*25,6*20,50/2,50/2,128+50,128+60,0,0,1);
 for(j=1; j<=13; j++)
    {
	if(j<=2)
	  {
      }
 	else
      {
      sprintf(datapoint1, \"Crate000.Channel%02d.%s.Send:_original.._value\",i,valset[j] );
      dpSetWait(datapoint1, initValue[j]);

      }
   }
   
   
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);       
 }
}


SendHV()
{
dyn_errClass err;
int  channel, i;



for (i=0;i<=48;i++){


channel=i+100;
dpSetWait(\"Crate000.Controller.CCch_Set.Send:_original.._value\", channel);
delay(0,10);

 
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);
 }
}

SendLV()
{
dyn_errClass err;
int lv, icard, channel, i;
int set;

dpGet(\"HVch.Numb:_original.._value\", lv); 
icard=lv/4;

for (i=0;i<=47;i++){

delay(0,50);
dpSetWait(\"Crate000.Controller.CCch_Set.Send:_original.._value\", i);
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);
 }
}

HVoff()
{
dyn_errClass err;
int i;
string datapoint1;


for (i=0;i<=47;i++){
  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchVolt\" );
  dpSetWait(datapoint1, 0);
  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchITrp\" );
  dpSetWait(datapoint1, 1100);
  sprintf(datapoint1, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,\"HVchRamp\" );
  dpSetWait(datapoint1, 3);

  
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);       
}
}

LVoff()
{
dyn_errClass err;
string datapoint1;
int i,j;
dyn_string valset; 
dyn_float initValue;


for (i=0;i<=47;i++){

valset=makeDynString(\"LVcaTrip\",\"LVcaMask\",\"LVch_Vcc\",\"LVch_Vdd\",\"LVchVCSV\",\"LVchPINV\",\"LVchDTrp\",\"LVchCTrp\",\"LVchTTrp\",\"LVchTLim\",\"LVchCLKS\",\"LVchCLKR\",\"LVchVOut\");
initValue=makeDynFloat(46*2.5,15,0,0,0,0,50/2,50/2,128+50,128+60,0,0,0);
 for(j=1; j<=13; j++)
    {
	if(j<=2)
	  {
      }
 	else
      {
      sprintf(datapoint1, \"Crate000.Channel%02d.%s.Send:_original.._value\",i,valset[j] );
      dpSetWait(datapoint1, initValue[j]);

      }
   }
   
  
  
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);       
 }
}

// SimpleCtrlScript {EP_textFieldOut}
// DP {Crate00.DDC.DCS_STATES}
// Config {:_original.._value}
// DPType {int}
// SimpleCtrlScriptEnd {EP_textFieldOut}
" 0

E
 0 0
13 33
"Button7"
""
1 40 40 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
29 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
38 38 112 72
T 
1
LANG:1 7 Load ON
"/* Load OFF
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*                          SYSTEM CONFIGs CREATOR                          */
/*==========================================================================*/
/*                 Based on template from  Basiladze                        */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

LoadDB(); 

}


LoadDB() {
// Load database into Send values

int i,valuemax, tell;
file paraDB;
int id, channelNB;
string address;
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;

float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaM.txt\",\"r\");   

// Skip first line:

fgets(fstr, 300, paraDB); 
DebugN(fstr);

// GET VALUES:

//fscanf (f,\"%f\",value[i]); // read as float again  
//DebugN(value[i]); // output for checking
  
fgets(fstr, 300, paraDB);        

//Take away \"'s!
strreplace(fstr, \"\\\"\", \"\");
DebugN(fstr);

//valuemax=5;
//for (i=0; i++; i<=valuemax;) {
sscanf (fstr,\"%d%d%s%s%s%f%f%f%f%f%s%f%f%f%f%f%s%f%f%f%f%f\", 
        id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
DebugN(id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
        
// Load datapoint OFF STATE

sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
 
DebugN(\"name\", name, \"channel\", channelNB);
   
//sscanf(offValue,\"%f\",fLVch_Vcc);
//DebugN(\"off\", offValue, LVch_Vcc);

dpSet(address, offValue);
DebugN(\"address\", address, \"offValue\", offValue);


//dpSetWait(datapoint1, initValue[j]);

// Missing set alarms!!    

rewind(paraDB);
fclose(paraDB);               
 
}
                 
                 
                 
  " 0
 E E E
13 32
"Button6"
""
1 40 70 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
28 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
38 68 112 102
T 
1
LANG:1 8 Load STB
"/* Load OFF
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*                          SYSTEM CONFIGs CREATOR                          */
/*==========================================================================*/
/*                 Based on template from  Basiladze                        */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

LoadDB(); 

}


LoadDB() {
// Load database into Send values

int i,valuemax, tell;
file paraDB;
int id, channelNB;
string address;
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;

float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaM.txt\",\"r\");   

// Skip first line:

fgets(fstr, 300, paraDB); 
DebugN(fstr);

// GET VALUES:

//fscanf (f,\"%f\",value[i]); // read as float again  
//DebugN(value[i]); // output for checking
  
fgets(fstr, 300, paraDB);        

//Take away \"'s!
strreplace(fstr, \"\\\"\", \"\");
DebugN(fstr);

//valuemax=5;
//for (i=0; i++; i<=valuemax;) {
sscanf (fstr,\"%d%d%s%s%s%f%f%f%f%f%s%f%f%f%f%f%s%f%f%f%f%f\", 
        id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
DebugN(id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
        
// Load datapoint OFF STATE

sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
 
DebugN(\"name\", name, \"channel\", channelNB);
   
//sscanf(offValue,\"%f\",fLVch_Vcc);
//DebugN(\"off\", offValue, LVch_Vcc);

dpSet(address, offValue);
DebugN(\"address\", address, \"offValue\", offValue);


//dpSetWait(datapoint1, initValue[j]);

// Missing set alarms!!    

rewind(paraDB);
fclose(paraDB);               
 
}
                 
                 
                 
  " 0
 E E E
13 30
"LoadOff"
""
1 110 40 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
27 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
108 38 182 72
T 
1
LANG:1 9 Load OFF 
"/* Load OFF
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*                          SYSTEM CONFIGs CREATOR                          */
/*==========================================================================*/
/*                 Based on template from  Basiladze                        */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

LoadDB(); 

}


LoadDB() {
// Load database into Send values

int i, valuemax, tell;
file paraDB;
int id, channelNB;
string address;
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;

float errorOpen;
float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaN.txt\",\"r\");   

// Check for errors
errorOpen = ferror(paraDB);

if (errorOpen!=0) {
   DebugN(\"File did not open / correctly\");
   }

else {
     // Skip first line:
//     fgets(fstr, 300, paraDB); 
//     DebugN(fstr);

     // Loop on one channel
     valuemax=5;
     for (i=0; i<=valuemax; i++) {

     // GET VALUES:
     //fscanf (f,\"%f\",value[i]); // read as float again  
     //DebugN(value[i]); // output for checking
  
     fgets(fstr, 300, paraDB);        

     //Take away \"'s!
     strreplace(fstr, \"\\\"\", \"\");
     DebugN(fstr);


         DebugN (\"i\", i);
         sscanf (fstr,\"%d%d%s%s%s%f%f%f%f%f%s%f%f%f%f%f%s%f%f%f%f%f\", 
                id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
                s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
                s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
         DebugN (id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
                s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
                s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
         
         // Correction for error in conf_para file:channel nb starts with 1 not 0 
         channelNB = channelNB -1;
         
         // Load datapoint OFF STATE, for send values lines 2,6,10,12,16,17,18,19,20,21,22,245,26,27
         if (i==2&&i==6) {
            sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
            DebugN(\"name\", name, \"channel\", channelNB);
   
            //sscanf(offValue,\"%f\",fLVch_Vcc);
            //DebugN(\"off\", offValue, LVch_Vcc);

            dpSet(address, offValue);
            DebugN(\"address\", address, \"offValue\", offValue);
         }
     }
}
//dpSetWait(datapoint1, initValue[j]);

// Missing set alarms!!    

//rewind(ParaDB);
fclose(paraDB);              
//fclose(Cnf_ParaM.txt);  
}
                 
                 
                 
  " 0
 E E E
13 35
"Button9"
""
1 110 70 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
31 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
108 68 182 102
T 
1
LANG:1 8 File Rec
"main()
{
file paraDB;
string error;

// Open file
paraDB = fclose(\"Cnf_ParaN.txt\",\"r\");
//paraDB = fopen(\"Cnf_ParaO.txt\",\"r\");
error = ferror(paraDB);   
DebugN(\"opened file\");

if (error!=0) {
   paraDB = fclose(\"Cnf_ParaN.txt\");
   DebugN(\"if closed file\");
   error = ferror(paraDB);
   DebugN(error);
   }
else {
   paraDB = fclose(\"Cnf_ParaN.txt\");
   DebugN(\" else closed file\");
   error = ferror(paraDB);
   DebugN(error);
   }   
}" 0
 E E E
13 34
"Button8"
""
1 40 100 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
30 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
38 98 182 132
T 
1
LANG:1 14 Check and Send
"/* Load OFF
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*                          SYSTEM CONFIGs CREATOR                          */
/*==========================================================================*/
/*                 Based on template from  Basiladze                        */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

LoadDB(); 

}


LoadDB() {
// Load database into Send values

int i,valuemax, tell;
file paraDB;
int id, channelNB;
string address;
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;

float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaM.txt\",\"r\");   

// Skip first line:

fgets(fstr, 300, paraDB); 
DebugN(fstr);

// GET VALUES:

//fscanf (f,\"%f\",value[i]); // read as float again  
//DebugN(value[i]); // output for checking
  
fgets(fstr, 300, paraDB);        

//Take away \"'s!
strreplace(fstr, \"\\\"\", \"\");
DebugN(fstr);

//valuemax=5;
//for (i=0; i++; i<=valuemax;) {
sscanf (fstr,\"%d%d%s%s%s%f%f%f%f%f%s%f%f%f%f%f%s%f%f%f%f%f\", 
        id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
DebugN(id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
        
// Load datapoint OFF STATE

sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
 
DebugN(\"name\", name, \"channel\", channelNB);
   
//sscanf(offValue,\"%f\",fLVch_Vcc);
//DebugN(\"off\", offValue, LVch_Vcc);

dpSet(address, offValue);
DebugN(\"address\", address, \"offValue\", offValue);


//dpSetWait(datapoint1, initValue[j]);

// Missing set alarms!!    

rewind(paraDB);
fclose(paraDB);               
 
}
                 
                 
                 
  " 0
 E E E
13 38
"Button1"
""
1 40 200 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
34 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-110-100-100-*-*-iso8859-1|-12,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
38 198 182 232
T 
1
LANG:1 15 Compare Loaded 
"/* Load OFF
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*                          SYSTEM CONFIGs CREATOR                          */
/*==========================================================================*/
/*                 Based on template from  Basiladze                        */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

LoadDB(); 

}


LoadDB() {
// Load database into Send values

int i,valuemax, tell;
file paraDB;
int id, channelNB;
string address;
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;

float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaM.txt\",\"r\");   

// Skip first line:

fgets(fstr, 300, paraDB); 
DebugN(fstr);

// GET VALUES:

//fscanf (f,\"%f\",value[i]); // read as float again  
//DebugN(value[i]); // output for checking
  
fgets(fstr, 300, paraDB);        

//Take away \"'s!
strreplace(fstr, \"\\\"\", \"\");
DebugN(fstr);

//valuemax=5;
//for (i=0; i++; i<=valuemax;) {
sscanf (fstr,\"%d%d%s%s%s%f%f%f%f%f%s%f%f%f%f%f%s%f%f%f%f%f\", 
        id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
DebugN(id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
        s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
        s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
        
// Load datapoint OFF STATE

sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
 
DebugN(\"name\", name, \"channel\", channelNB);
   
//sscanf(offValue,\"%f\",fLVch_Vcc);
//DebugN(\"off\", offValue, LVch_Vcc);

dpSet(address, offValue);
DebugN(\"address\", address, \"offValue\", offValue);


//dpSetWait(datapoint1, initValue[j]);

// Missing set alarms!!    

rewind(paraDB);
fclose(paraDB);               
 
}
                 
                 
                 
  " 0
 E E E
0
LAYER, 1 
1
LANG:1 6 Layer2
0
LAYER, 2 
1
LANG:1 6 Layer3
0
LAYER, 3 
1
LANG:1 6 Layer4
0
LAYER, 4 
1
LANG:1 6 Layer5
0
LAYER, 5 
1
LANG:1 6 Layer6
0
LAYER, 6 
1
LANG:1 6 Layer7
0
LAYER, 7 
1
LANG:1 6 Layer8
0
0