V 10
1
LANG:1 4 HVLV
PANEL,258 100 1191 745 N {102,102,204} 0
"main()
{
//     Read();
//   dpConnect(\"setOpening\",\"SCTdcs01:setOpening.trigger:_online.._value\");
//   dpSet(\"SCTps:Crate0.DDC.DCS_STATES:_original.._value\",0);
 //  Load();
//   dpSet(\"SCTps:Crate0.DDC.DCS_STATES:_original.._value\",1);
 //  Configure();
//   dpSet(\"SCTps:Crate0.DDC.DCS_STATES:_original.._value\",2);
//   Monitor();
//   dpSet(\"SCTps:Crate0.DDC.DCS_STATES:_original.._value\",3);
   
//   Configure();
//   DebugN(\"configure\");

//   Monitor();
//   DebugN(\"monitor\");
   

}


//Read all monitored values from ELMB



void Read()
{
dyn_errClass err;
int lv, icard, channel, i;

dpGet(\"SCTps:Item.HV:_original.._value\", lv); 
icard=lv/4;

for (i=icard*4;i<=icard*4+47;i++){
DebugN(\"WE CALLED IT\");
//DebugN(\"lv\", lv ,\"icard\", icard,\"i\", i);
channel=i;
dpSet(\"SCTps:Crate0.Elmb_0.CCcmRead:_original.._value\", channel);
channel=i+100;
delay(0,10);
dpSet(\"SCTps:Crate0.Elmb_0.CCcmRead:_original.._value\", channel);
delay(0,10);

DebugN(\"i\", i,\"channel\", channel); 
 
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);
 }
}

//

void setOpening(string dpeTrigger, bool state)
{
string paramStr;
dyn_string param;
//string dp_path;
float value;
int i;
bool bit;
string port;
int response;

if(state)
{
  response=0;
  dpGet(\"SCTdcs01:setOpening.trigger:_online.._value\", paramStr);
  param=strsplit(paramStr,\"|\");

  //sscanf(param[1],\"%s\",dp_path);
  sscanf(param[1],\"%f\",value);

  //SCTdcs01:Limi01.FatL
  response=dpSetWait(\"SCTps:Crate0.DDC.DCS_STATES:_original.._value\",value);
      if(response!=0)
         response=0-response;

   dpSet(\"SCTdcs01:setOpening.response:_original.._value\",response,
         \"SCTdcs01:setOpening.trigger:_original.._value\",!state);
 }
}

//-----------------------------------------------------------
// Load initialisation values into the ELMB
//-----------------------------------------------------------

Load()
{
dyn_errClass err;
int i,j,k,l,m,n,icard;
dyn_string valset, valset2, valset3; 
string datapoint1, datapoint2, datapoint3;
dyn_float initValue, initValue2, initValue3;


// Set Channel number to zero
//-----------------------------------------------------------
dpSetWait(\"SCTps:Item.HV:_original.._value\", 0);


// Starting the ELMB
//-----------------------------------------------------------
dpSetWait(\"SCTps:Crate0.Elmb_0.NMT:_original.._value\", 1); 
//DebugN(\"ELMB\");

//Setting configuration of the HV Channels and Cards to the ELMB
//------------------------------------------------------------------ 
valset=makeDynString(\"HVccMask\",\"HVcoVolt\",\"HVcoITrp\",\"HVcoRamp\");
initValue= makeDynFloat(0,100,1000,3);

for(j=1; j<=4; j++)
    {
	if(j==1)
	  {
	  for(i=0; i<=5; i++)
         {
         sprintf(datapoint1, \"SCTps:Crate0.HVCard_%d.%s:_original.._value\",i,valset[j]);
         dpSetWait(datapoint1, initValue[j]);
         }
 	  }
 	  else
 	  {
       for(i=0; i<=47; i++)
         {
        sprintf(datapoint1, \"SCTps:Crate0.Channel_%d.HV.%s:_original.._value\",i,valset[j] );
        dpSetWait(datapoint1, initValue[j]);
         }
        }
       }

//Setting configuration of the LV Cards and channels to the ELMB 
//-----------------------------------------------------------------

valset2=makeDynString(\"LVccTrip\",\"LVccMask\",\"LVco_Vcc\",\"LVco_Vdd\",\"LVcoVCSV\",\"LVcoPINV\", \"LVcoDTrp\", \"LVcoCTrp\", \"LVcoTLim\", \"LVcoTTrp\", \"LVcoCLKS\", \"LVcoCLKR\", \"LVcoVOut\");
initValue2=makeDynFloat(46*2.5,0,3.5*50,4*50,4*25,6*20,50/2,50/2,128,148,0,0,1);

for(j=1; j<=13; j++)
    {
	if(j<=2)
	  {
	  for(i=0; i<=11; i++)
         {
         sprintf(datapoint2, \"SCTps:Crate0.LVCard_%d.%s:_original.._value\",i,valset2[j]);
         dpSetWait(datapoint2, initValue2[j]);
	     DebugN(\"TTrip\", initValue2[1],\"LVMask\",initValue2[2]);
         }
 	  }
 	  else
 	  {
       for(i=0; i<=47; i++)
         {
        sprintf(datapoint2, \"SCTps:Crate0.Channel_%d.LV.%s:_original.._value\",i,valset2[j] );
        dpSetWait(datapoint2, initValue2[j]);
         }
        }
       }
  err = getLastError();
  if (dynlen(err) > 0)
    errorDialog(err);       
}

//-----------------------------------------------------------
// Transmitting the right values from the ELMB to the Cards
//-----------------------------------------------------------

Configure() {
DebugN(\"Configure\");  
     dpSetWait(\"SCTps:Crate0.Elmb_0.CCco_Set:_original.._value\", 255); 
  }


//-----------------------------------------------------------
// Starting monitoring state
//-----------------------------------------------------------

Monitor() {
  DebugN(\"Monitor\");
  }

" 0
EE E E 1 -1 -1 0  0 10
"" 0 1
EE 2
"CBRef""1"
"EClose"E
""
DISPLAY_LAYER, 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
LAYER, 0 
1
LANG:1 6 Layer1
6 81
"Border1"
""
1 20 730 E E E 1 E 1 E N {0,0,0} E N {204,204,204} E E
 E E
77 0 0 0 0 0
EE E
0
1
LANG:1 0 
1
"dashclr"N {204,204,204}
E E 0 1 1 0 0 E U  1 E 20 540 260 730
2 70
"ERRORMESSSAGES"
""
1 29 551 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
66 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( \"SCTps:Crate0.ERROR.Elmb:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_textFieldInCB\",
            \"SCTps:Crate0.ERROR.Elmb:_online.._value\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}

EP_textFieldInCB(string dp, int iNewValue)
{
  if (iNewValue==8100){
    setValue(\"\", \"text\", \"CAN Communication Error: Error in Register\");
    }
  if (iNewValue==8130){
    setValue(\"\", \"text\", \"Life Guarding: CAN controller has been reinitialized\");
    }
  if (iNewValue==8210){
    setValue(\"\", \"text\", \"RPDO: Minimum DLC (Data Length Code) reguired\");
    }
  if (iNewValue==5000){
    setValue(\"\", \"text\", \"Slave processor not responding\");
    }
  if (iNewValue==5000){
    setValue(\"\", \"text\", \"CRC Error\");
    }
}

// SimpleCtrlScript {EP_textFieldIn}
// DP {SCTps:Crate0.ERROR.Elmb}
// DPConfig {:_online.._value}
// DPType {int}
// UseDPUnit {TRUE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
" 0
 E 0 1 1 0 1 E U  0 E 31 553 217 608
0 2 0 "s" 0 0 0 64 0 0  31 553
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 21 Hardware Error (NMT):
2 71
"Text3"
""
1 30 621 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
67 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( \"SCTps:Crate0.Channel_1.HV.HVcoVolt:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_textFieldInCB\",
            \"SCTps:Crate0.Channel_1.HV.HVcoVolt:_online.._value\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}


EP_textFieldInCB(string dp, int iNewValue)
{
 
 if (iNewValue==0){
  setValue(\"\", \"text\", \"ELMB is OK\" );
  }
 if (iNewValue==1){
  setValue(\"\", \"text\", \"Channel XX is not working\" );
  }
}


// SimpleCtrlScript {EP_textFieldIn}
// DP {SCTps:Crate0.Channel_1.HV.HVcoVolt}
// DPConfig {:_online.._value}
// DPType {int}
// UseDPUnit {TRUE}
// UseDPFormat {TRUE}
// SimpleCtrlScriptEnd {EP_textFieldIn}
" 0
 E 0 1 1 0 1 E U  0 E 32 623 258 678
0 2 0 "s" 0 0 0 64 0 0  32 623
 1
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 17 ELMB Errot (PDO):
30 79
"Frame1"
""
1 20 729 E E E 1 E 1 E N "_3DText" E N "_Transparent" E E
 E E
75 0 0 0 0 0
EE E
1
1
LANG:1 0 
0
E E 0 1 1 0 1 E U  0 E 20 535 260 730
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 0 
6 83
"Border2"
""
1 20 50 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
79 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 20 20 460 50
2 84
"Text1"
""
1 30 22 E E E 1 E 1 E N {0,0,0} E N "_Transparent" E E
 E E
80 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 24 443 48
0 2 0 "s" 0 0 0 192 0 0  32 24
 1
1
LANG:1 107 -microsoft windows-Arial-bold-i-normal-*-*-180-100-100-*-*-iso8859-1|-21,0,0,0,700,255,0,0,0,3,2,1,34,Arial
0 ""
1
LANG:1 33 POWER SUPPLY DCS  -  EXPERT PANEL
28 69
"Tab2"
""
1 116 260 E E E 1 E 1 E N "_3DText" E N "_3DFace" E E
 E E
65 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 ""
18 68 262 532
E3
"Global CMD" 1
LANG:1 10 Global CMD
1 "Global.pnl" 1
LANG:1 0 
0
"Local CMD" 1
LANG:1 9 Local CMD
1 "Local.pnl" 1
LANG:1 0 
0
"Save" 1
LANG:1 4 Save
1 "Save.pnl" 1
LANG:1 0 
0
28 46
"Tab1"
""
1 352 1089 E E E 1 E 1 E N "_3DText" E N "_3DFace" E E
 E E
43 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 ""
268 68 1092 732
E2
"Values" 1
LANG:1 6 Values
1 "Values.pnl" 1
LANG:1 0 
0
"Global Monitoring" 1
LANG:1 17 Global Monitoring
1 "Glmon.pnl" 1
LANG:1 0 
0
13 77
"Button1"
""
1 90 685 E E E 1 E 1 E N "_3DText" E N {255,204,102} E E
 E E
73 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 ""
88 683 192 717
T 
1
LANG:1 11 Show Errors
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_childPanelOn();
}

EP_childPanelOn()
{
  ChildPanelOnCentral(\"vision/SC/AlertScreen\",
      \"\",
      makeDynString(\"\"));
}

// SimpleCtrlScript {EP_childPanelOn}
// Function {ChildPanelOnCentral}
// File {vision/SC/AlertScreen}
// Panel {}
// Parent {}
// Module {}
// OffsetX {0}
// OffsetY {0}
// SimpleCtrlScriptEnd {EP_childPanelOn}
" 0
 E E E
13 78
"Button2"
""
1 230 560 E E E 1 E 1 E N "_3DText" E N "_3DFace" E E
 E E
74 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 ""
228 558 252 612
T 
1
LANG:1 2 HW
E E E "// SimpleCtrlScriptStart {valid}
main()
{
  EP_setBackColor();
}

EP_setBackColor()
{
dyn_errClass err;

  if( dpSubStr( \"SCTps:Crate0.ERROR.Elmb:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_setBackColorCB\", 
            \"SCTps:Crate0.ERROR.Elmb:_online.._value\",
            \"SCTps:Crate0.ERROR.Elmb:_online.._invalid\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}


EP_setBackColorCB(string dpSource, int iNewValue, string dpInvalid, bool boInvalid)
{
  if (boInvalid)
    setValue(\"\", \"backCol\", \"_invalid\");
  else if (iNewValue < 3000)
    setValue(\"\", \"backCol\", \"Green\");
  else if (iNewValue < 4000)
    setValue(\"\", \"backCol\", \"Gelb\");
  else if (iNewValue < 5000)
    setValue(\"\", \"backCol\", \"{255,153,51}\");
  else
    setValue(\"\", \"backCol\", \"Red\");
}

// SimpleCtrlScript {EP_setBackColor}
// DP {SCTps:Crate0.ERROR.Elmb}
// DPConfig {:_online.._value}
// DPType {int}
// AlertHdl {FALSE}
// DPEInvalid {SCTps:Crate0.ERROR.Elmb}
// DPEConfigInvalid {:_online.._invalid}
// Operator1 {less}
// Operant1 {3000}
// Color1 {Green}
// Operator2 {less}
// Operant2 {4000}
// Color2 {Gelb}
// Operator3 {less}
// Operant3 {5000}
// Color3 {\\{255,153,51\\}}
// Operator4 {else}
// Operant4 {}
// Color4 {Red}
// SimpleCtrlScriptEnd {EP_setBackColor}
" 0

13 80
"Button3"
""
1 230 620 E E E 1 E 1 E N "_3DText" E N "_3DFace" E E
 E E
76 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 ""
228 618 252 672
T 
1
LANG:1 1 M
E E E "// SimpleCtrlScriptStart {valid}
main()
{
  EP_setBackColor();
}

EP_setBackColor()
{
dyn_errClass err;

  if( dpSubStr( \"SCTps:Crate0.ERROR.Elmb:_online.._value\", DPSUB_DP_EL ) == \"\" )
  {
    setValue(\"\", \"color\", \"_dpdoesnotexist\");
    return;
  }

  dpConnect(\"EP_setBackColorCB\", 
            \"SCTps:Crate0.ERROR.Elmb:_online.._value\",
            \"SCTps:Crate0.ERROR.Elmb:_online.._invalid\");
  err = getLastError();
  if (dynlen(err) > 0)
    setValue(\"\", \"color\", \"_dpdoesnotexist\");

}


EP_setBackColorCB(string dpSource, int iNewValue, string dpInvalid, bool boInvalid)
{
  if (boInvalid)
    setValue(\"\", \"backCol\", \"_invalid\");
  else if (iNewValue < 3000)
    setValue(\"\", \"backCol\", \"Green\");
  else if (iNewValue < 4000)
    setValue(\"\", \"backCol\", \"Gelb\");
  else if (iNewValue < 5000)
    setValue(\"\", \"backCol\", \"{255,153,51}\");
  else
    setValue(\"\", \"backCol\", \"Red\");
}

// SimpleCtrlScript {EP_setBackColor}
// DP {SCTps:Crate0.ERROR.Elmb}
// DPConfig {:_online.._value}
// DPType {int}
// AlertHdl {FALSE}
// DPEInvalid {SCTps:Crate0.ERROR.Elmb}
// DPEConfigInvalid {:_online.._invalid}
// Operator1 {less}
// Operant1 {3000}
// Color1 {Green}
// Operator2 {less}
// Operant2 {4000}
// Color2 {Gelb}
// Operator3 {less}
// Operant3 {5000}
// Color3 {\\{255,153,51\\}}
// Operator4 {else}
// Operant4 {}
// Color4 {Red}
// SimpleCtrlScriptEnd {EP_setBackColor}
" 0

13 85
"Button4"
""
1 980 20 E E E 1 E 1 E N "_3DText" E N {204,153,102} E E
 E E
81 0 0 0 0 0
EE E
0
1
LANG:1 0 
0
1
LANG:1 105 -microsoft windows-Arial-bold-r-normal-*-*-120-100-100-*-*-iso8859-1|-13,0,0,0,700,0,0,0,0,3,2,1,34,Arial
0 ""
978 18 1092 52
T 
1
LANG:1 4 USER
"// SimpleCtrlScriptStart {invalid}
main()
{
  EP_childPanelOn();
}

EP_childPanelOn()
{
  ChildPanelOnCentral(\"Userpnl.pnl\",
      \"\",
      makeDynString(\"\"));
}

// SimpleCtrlScript {EP_childPanelOn}
// Function {ChildPanelOnCentral}
// File {HVLV.pnl}
// Panel {}
// Parent {}
// Module {}
// OffsetX {0}
// OffsetY {0}
// SimpleCtrlScriptEnd {EP_childPanelOn}
" 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