V 10
1
LANG:1 8 (NoName)
PANEL,262 74 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 47
"loadvalues"
""
1 10 170 E E E 1 E 1 E N {0,0,0} E N {204,153,102} E E
 E E
42 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 172 208 193
1 2 0 "s" 0 0 0 65 0 0  12 172
 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 19 Load new RST values
2 48
"Text1"
""
1 10 10 E E E 1 E 1 E N {0,0,0} E N {204,153,102} E E
 E E
43 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 Long Term Tests
2 53
"Text2"
""
1 30 53 E E E 1 E 1 E N {0,0,0} E N {255,204,153} E E
 E E
48 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 32 55 99 70
0 2 0 "s" 0 0 0 192 0 0  32 55
 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 11 Nb of Loops
2 54
"Text3"
""
1 30 83 E E E 1 E 1 E N {0,0,0} E N {255,204,153} E E
 E E
49 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 32 85 105 100
0 2 0 "s" 0 0 0 192 0 0  32 85
 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 13 Time Interval
13 39
"LoadON"
""
1 40 210 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
35 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 208 112 242
T 
1
LANG:1 7 Load ON
"/* Load ON
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, j, valuemax, tell;
file paraDB;
int id, channelNB;
string address;
// Parameters for all values in one line of the file opened:
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;
dyn_float sendTest;
float errorOpen;
// Values relevant for the changing of states
float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
// Names of the corresponding parameters to be used in addressing
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
// Might not now be needed:
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

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

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

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

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

     // Loop all parameters on one channel
     valuemax=1296;
     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);
         //p DebugN (id, channelNB, name, s03w,  s04w, offFatalL, offWarningL, offValue, offWarningH, offFatalH, 
              //p s10w, stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
              //p  s16w, onFatalL, onWarningL, onValue, onWarningH, onFatalH);
         //if(channelNB=0) DebugN(\"channel\",channelNB,\"quantity\",name,\"off\",offValue,\"on\",onValue);
         // Correction for error in conf_para file:channel nb starts with 1 not 0 
         channelNB = channelNB -1;
         //p DebugN(\"channelNB\", channelNB);
         
         // Load datapoint OFF STATE, for send values lines 2,6,10,12,16,17,18,19,20,21,22,24,26,27
         // the array sendTest starts with line nb 1 in cnf_para

         sendTest = makeDynFloat(0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1);
         j= i+1 - 27*channelNB;
          
         // Check if send value according to array;
         if (sendTest[j]==1) {
            sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
            //p DebugN(\"name\", name, \"channel\", channelNB, \"address\", address);
   
            //sscanf(offValue,\"%f\",fLVch_Vcc);
            //DebugN(\"off\", offValue, LVch_Vcc);

            dpSet(address, onValue);
            //p DebugN(\"address\", address, \"onValue\", onValue);
         }
         // Missing set upper alarms!!  
     }
}

//dpSetWait(datapoint1, initValue[j]);
//rewind(ParaDB);
fclose(paraDB);              
//fclose(Cnf_ParaM.txt);  
}
                 
                 
                 
  " 0
 E E E
13 40
"LoadSTB"
""
1 40 240 E E E 1 E 1 E N "_3DText" E N {255,204,153} E E
 E E
36 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 238 112 272
T 
1
LANG:1 8 Load STB
"/* Load STB
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, j, valuemax, tell;
file paraDB;
int id, channelNB;
string address;
// Parameters for all values in one line of the file opened:
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;
dyn_float sendTest;
float errorOpen;
// Values relevant for the changing of states
float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
// Names of the corresponding parameters to be used in addressing
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
// Might not now be needed:
float  fLVch_Vcc, fLVch_Vdd, fLVchVCSV, fLVchPINV, fLVchDTrp, fLVchCTrp, fLVchTLim, fLVchTTrp, 
       fLVchCLKS, fLVchCLKR, fLVchVOut, fHVchVolt, fHVchITrp, fHVchRamp; 

// Open Database
paraDB = fopen(\"Cnf_ParaV.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 all parameters on one channel
     valuemax=1296;
     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;
         DebugN(\"channelNB\", channelNB);
         
         // Load datapoint OFF STATE, for send values lines 2,6,10,12,16,17,18,19,20,21,22,24,26,27
         // the array sendTest starts with line nb 1 in cnf_para

         sendTest = makeDynFloat(0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1);
         j= i+1 - 27*channelNB;
          
         // Check if send value according to array;
         if (sendTest[j]==1) {
            sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
            DebugN(\"name\", name, \"channel\", channelNB, \"address\", address);
   
            //sscanf(offValue,\"%f\",fLVch_Vcc);
            //DebugN(\"off\", offValue, LVch_Vcc);

            dpSet(address, stbValue);
            DebugN(\"address\", address, \"stbValue\", stbValue);
         }
         // Missing set upper alarms!!  
     }
}

//dpSetWait(datapoint1, initValue[j]);
//rewind(ParaDB);
fclose(paraDB);              
//fclose(Cnf_ParaM.txt);  
}
                 
                 
                 
  " 0
 E E E
13 30
"LoadOff"
""
1 40 270 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 ""
38 268 112 302
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, j, valuemax, tell;
file paraDB;
int id, channelNB;
string address;
// Parameters for all values in one line of the file opened:
string s02w, s03w,  s04w, s05w, s06w, s07w, s08w, s09w,
       s10w, s11w, s12w, s13w, s14w, s15w, s16w, s17w, s18w, s19w, s20w, s21w;
string fstr, name;
dyn_float sendTest;
float errorOpen;
// Values relevant for the changing of states
float offFatalL, offWarningL, offValue, offWarningH, offFatalH,
      stbFatalL, stbWarningL, stbValue, stbWarningH, stbFatalH, 
      onFatalL, onWarningL, onValue, onWarningH, onFatalH;
// Names of the corresponding parameters to be used in addressing
string LVch_Vcc, LVch_Vdd, LVchVCSV, LVchPINV,LVchDTrp, LVchCTrp, LVchTLim, LVchTTrp, 
       LVchCLKS, LVchCLKR, LVchVOut, HVchVolt, HVchITrp, HVchRamp; 
// Might not now be needed:
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\");   

// 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 all parameters on one channel
     valuemax=1296;
     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;
         DebugN(\"channelNB\", channelNB);
         
         // Load datapoint OFF STATE, for send values lines 2,6,10,12,16,17,18,19,20,21,22,24,26,27
         // the array sendTest starts with line nb 1 in cnf_para

         sendTest = makeDynFloat(0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1,1,1,1,1,1,0,1,0,1,1);
         j= i+1 - 27*channelNB;
          
         // Check if send value according to array;
         if (sendTest[j]==1) {
            sprintf(address, \"Crate00.Channel%02d.%s.Send:_original.._value\", channelNB, name );
            DebugN(\"name\", name, \"channel\", channelNB, \"address\", address);
   
            //sscanf(offValue,\"%f\",fLVch_Vcc);
            //DebugN(\"off\", offValue, LVch_Vcc);

            dpSet(address, offValue);
            DebugN(\"address\", address, \"offValue\", offValue);
         }
         // Missing set upper alarms!!  
     }
}

//dpSetWait(datapoint1, initValue[j]);
//rewind(ParaDB);
fclose(paraDB);              
//fclose(Cnf_ParaM.txt);  
}
                 
                 
                 
  " 0
 E E E
13 35
"Button9"
""
1 110 210 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 208 182 242
T 
1
LANG:1 8 File Rec
"main()
{
file paraDB;
string error;

// Open file
paraDB = fclose(\"Cnf_ParaN.txt\");
//
error = ferror(paraDB); 
//f (error!=0)   DebugN(\"error in closing file\");
//paraDB = fopen(\"Cnf_ParaO.txt\",\"r\");
//error = ferror(paraDB); 
//if (error!=0)   DebugN(\"error in opening 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 38
"Button1"
""
1 110 240 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 ""
108 238 182 272
T 
1
LANG:1 7 Compare
"/* 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 34
"CheckSend"
""
1 40 300 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 298 182 332
T 
1
LANG:1 14 Check and Send
"/* Load Values to ELMB
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*==========================================================================*/
/*          SYSTEM CONFIGs CREATOR - Tests and Load Values to ELMB          */
/*==========================================================================*/
/*                        History:                                          */
/*                 17.07.2003 H.Sandaker                                    */
/*===================================-======================================*/

main()
{

   PS_LVcheck();
   PS_LVSet(); 
   
   PS_HVcheck();
   PS_HVSet();
 
}

PS_HVcheck()
{
dyn_errClass err;
int i,j, channel;
string DPsend, DPrecv;
float VALsend, VALrecv;
dyn_string valset1, valset2; 
dyn_float initValue;

//User Wait
setValue(\"\", \"backCol\", \"Blue\");

//Send SDO's to all updated HV channels
for (i=0;i<=47;i++){

    //Read one HV channel
    channel=i+100;
    dpSetWait(\"Crate00.Controller.CCchRead.Send:_original.._value\", channel);
    
    //Compare Send and Receive values for this channel
    valset1=makeDynString(\"HVchVolt\",\"HVchITrp\",\"HVchRamp\"); 
    for (j=1;j<=3; j++){
        sprintf(DPsend, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,valset1[j]);
        sprintf(DPrecv, \"Crate00.Channel%02d.%s.Recv:_original.._value\",i,valset1[j]);
        dpGet(DPsend, VALsend);
        dpGet(DPrecv, VALrecv);
        
        //Send new value to crate controller only when changed
        if (VALsend != VALrecv) {
           dpSetWait(DPsend, VALsend);
        }

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


}


PS_LVcheck()
{
dyn_errClass err;
int i,j, channel;
string DPsend, DPrecv;
float VALsend, VALrecv;
dyn_string valset1, valset2; 
dyn_float initValue;

//User wait
setValue(\"\", \"backCol\", \"Green\");

//Send SDO's to all updated LV channels
for (i=0;i<=47;i++){

    //Read one LV channel
    dpSetWait(\"Crate00.Controller.CCchRead.Send:_original.._value\",i);
    
    //Compare Send and Receive values for this channel
    valset2=makeDynString(\"LVcaTrip\",\"LVcaMask\",\"LVch_Vcc\",\"LVch_Vdd\",\"LVchVCSV\",\"LVchPINV\",
                          \"LVchDTrp\",\"LVchCTrp\",\"LVchTTrp\",\"LVchTLim\",\"LVchCLKS\",\"LVchCLKR\",\"LVchVOut\");
    for (j=3;j<=13;j++){
        sprintf(DPsend, \"Crate00.Channel%02d.%s.Send:_original.._value\",i,valset2[j]);
        sprintf(DPrecv, \"Crate00.Channel%02d.%s.Recv:_original.._value\",i,valset2[j]);
        dpGet(DPsend, VALsend);
        dpGet(DPrecv, VALrecv);
        
        //Send new value to crate controller only when changed
        if (VALsend != VALrecv) {
           dpSetWait(DPsend, VALsend);
        }
    }
}
//set this LV channels after changing all new values
dpSetWait(\"Crate00.Controller.CCch_Set.Send:_original.._value\", i);

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


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

//User wait
setValue(\"\", \"backCol\", \"Yellow\");

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

    //set this HV channel
    dpSetWait(\"Crate00.Controller.CCch_Set.Send:_original.._value\", i);
    delay(0,50);

  setValue(\"\", \"backCol\", \"\");
 
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err); 
}

}

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

//User wait
setValue(\"\", \"backCol\", \"Red\");

for (i=0;i<=47;i++){
    
    //set this HV channel
    channel=100+i;
    dpSetWait(\"Crate00.Controller.CCch_Set.Send:_original.._value\", channel);
    delay(0,50);
    }
    
  setValue(\"\", \"backCol\", \"\");
 
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err); 
}
" 0
 E E E
13 51
"Button8"
""
1 100 120 E E E 1 E 1 E N {0,0,0} E N {255,204,153} E E
 E E
46 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 ""
98 118 192 152
T 
1
LANG:1 11 LOOP ON/OFF
"// SimpleCtrlScriptStart {invalid}
main()
{

int iState, i, NbLoops, TimeInt;
string sNewValue;
string max;
 
//NbLoops=100;
//TimeInt=5;

dpGet(\"Test.Numb:_original.._value\", NbLoops);
dpGet(\"Test.Indx:_original.._value\", TimeInt);
DebugN(\" Loops\",NbLoops,TimeInt);
//getValue()
//  getValue(\"\", \"text\", sTmp);
//  sscanf(sTmp, \"%d\", iNewValue);

setValue(\"\", \"backCol\", \"Red\");

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

dpGet(\"ChangeState.parameters:_original.._value\", sNewValue);
dpGet(\"ChangeState.trigger:_original.._value\", iState);
DebugN(\"- X0- Parameters\", sNewValue, iState);

   if (sNewValue==\"0\"){
      sNewValue=\"1\";
      DebugN(\"- X1- Parameters\", sNewValue, iState);
      dpSetWait(\"ChangeState.parameters:_original.._value\", sNewValue);
      dpSetWait(\"ChangeState.trigger:_original.._value\", 1);
    delay(1,0);  
      DebugN(\"- XX- Turning channels on\");
      }
   else {
      sNewValue=\"0\";
      DebugN(\"- X2- Parameters\", sNewValue, iState); 
      dpSetWait(\"ChangeState.parameters:_original.._value\", sNewValue);
      dpSetWait(\"ChangeState.trigger:_original.._value\", 1);
    delay(1,0); 
      DebugN(\"- XX- Turning channels off\");
      }
      delay(TimeInt,0); 
      dpSetWait(\"ChangeState.trigger:_original.._value\", 0); 
   }  
   setValue(\"\", \"backCol\", \"{225,204,170}\");
}


// SimpleCtrlScript {EP_setDP}
// DP1 {Crate1.HVchRamp}
// Config1 {:_original.._value}
// Type1 {int}
// Value1 {1}
// SimpleCtrlScriptEnd {EP_setDP}
" 0
 E E E
14 58
"NbofLoops"
""
1 130 50 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
53 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 ""
128 48 192 74
3 "s" 0 0 0 0 0 0 
E
"// SimpleCtrlScriptStart {valid}
main()
{
  EP_textFieldIn();
  EP_setInvalid();
}

EP_textFieldIn()
{
dyn_errClass err;

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

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

}


EP_textFieldInCB(string dp, int iNewValue)
{
  setValue(\"\", \"text\", dpValToString(dp, iNewValue, FALSE) );
}

EP_setInvalid()
{
dyn_errClass err;

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

  dpConnect(\"EP_setInvalidCB\",
            \"SCTmops1:Test.Numb:_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:Test.Numb}
// DPConfig {:_online.._value}
// DPType {int}
// UseDPUnit {FALSE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
// SimpleCtrlScript {EP_setInvalid}
// DP {SCTmops1:Test.Numb}
// DPConfig {:_online.._invalid}
// DPType {bool}
// Attribut {color}
// SimpleCtrlScriptEnd {EP_setInvalid}
" 0

"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldOut();
}

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

  getValue(\"\", \"text\", sTmp);
  sscanf(sTmp, \"%d\", iNewValue);

  if( iNewValue != sTmp )
  {
    ChildPanelOnCentral( \"vision/MessageWarning\",
                         getCatStr( \"e_para\", \"warning\" ),
                         makeDynString( getCatStr( \"e_para\", \"wrongFormat\" )));
    return;
  }

  dpSetWait(\"SCTmops1:Test.Numb:_original.._value\", iNewValue);
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);
}

// SimpleCtrlScript {EP_textFieldOut}
// DP {SCTmops1:Test.Numb}
// Config {:_online.._value}
// DPType {int}
// SimpleCtrlScriptEnd {EP_textFieldOut}
" 0

14 59
"TextField1"
""
1 260 130 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
54 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 ""
128 78 192 104
3 "s" 0 0 0 0 0 0 
E
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldIn();
  EP_setInvalid();
}

EP_textFieldIn()
{
dyn_errClass err;

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

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

}


EP_textFieldInCB(string dp, int iNewValue)
{
  setValue(\"\", \"text\", dpValToString(dp, iNewValue, FALSE) );
}

EP_setInvalid()
{
dyn_errClass err;

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

  dpConnect(\"EP_setInvalidCB\",
            \"SCTmops1:Test.Indx:_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:Test.Indx}
// DPConfig {:_online.._value}
// DPType {int}
// UseDPUnit {FALSE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
// SimpleCtrlScript {EP_setInvalid}
// DP {SCTmops1:Test.Indx}
// DPConfig {:_online.._invalid}
// DPType {bool}
// Attribut {color}
// SimpleCtrlScriptEnd {EP_setInvalid}
" 0

"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_textFieldOut();
}

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

  getValue(\"\", \"text\", sTmp);
  sscanf(sTmp, \"%d\", iNewValue);

  if( iNewValue != sTmp )
  {
    ChildPanelOnCentral( \"vision/MessageWarning\",
                         getCatStr( \"e_para\", \"warning\" ),
                         makeDynString( getCatStr( \"e_para\", \"wrongFormat\" )));
    return;
  }
if(iNewValue<6)
{
 setValue(\"\", \"text\", \"too low\");
}
if(iNewValue>=6)
{
  dpSetWait(\"SCTmops1:Test.Indx:_original.._value\", iNewValue);
} 
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);
}

// SimpleCtrlScript {EP_textFieldOut}
// DP {SCTmops1:Test.Numb}
// Config {:_online.._value}
// DPType {int}
// SimpleCtrlScriptEnd {EP_textFieldOut}
" 0

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