3,8 → 3,9 |
#include "HVtest_ui.h" |
|
#define HVSLOT 3 |
#define NTICSMAX 120 |
|
static int p1h, pID, rID, tfID; |
static int p1h, pID, rID; //, tfID; |
|
int CVICALLBACK refreshTimer (int panel, int control, int event, void *callbackData, |
int eventData1, int eventData2) { |
19,16 → 20,21 |
const int ch0=100*mo; |
|
int mainonoff,HVonoffall; |
int HVonoff[4],HVonoff_rID[4]={P1_HVonoff_0,P1_HVonoff_1,P1_HVonoff_2,P1_HVonoff_3}; |
int HVvdis_rID[4]={P1_HVvdis_0,P1_HVvdis_1,P1_HVvdis_2,P1_HVvdis_3}; |
int HVcdis_rID[4]={P1_HVcdis_0,P1_HVcdis_1,P1_HVcdis_2,P1_HVcdis_3}; |
int HVonoff[4]={0,0,0,0}; |
int HVonoff_rID[4]={P1_HVonoff_1,P1_HVonoff_2,P1_HVonoff_3,P1_HVonoff_4}; |
int HVvdis_rID[4]={P1_HVvdis_1,P1_HVvdis_2,P1_HVvdis_3,P1_HVvdis_4}; |
int HVcdis_rID[4]={P1_HVcdis_1,P1_HVcdis_2,P1_HVcdis_3,P1_HVcdis_4}; |
int iret; |
int i, j; |
double ret; |
double HVvset[4],HVcset[4],HVvrise,HVvfall; |
int i; |
int TESTon=0,ntics=0; |
double HVvset[4],HVcset[4],HVvrise; //,HVvfall; |
double HVvdis[4],HVcdis[4]; |
char cret[2000]; |
// char cret[2000]; |
char cMainSwitch[2][30]= {"Turn system OFF?","Turn system ON?"}; |
char HVBid[4][4]; |
int HVBid_rID[4]={P1_HVBid_1,P1_HVBid_2,P1_HVBid_3,P1_HVBid_4}; |
char HVBfname[4][200]; |
FILE *HVBfp[4]={NULL,NULL,NULL,NULL}; |
|
HSNMP crate1; |
|
49,7 → 55,9 |
|
if ((p1h = LoadPanel (0, "HVtest_ui.uir", P1)) < 0) return -1; |
DisplayPanel (p1h); |
SetCtrlVal (p1h, P1_TESTon, 0); |
|
|
//Initial state |
mainonoff=getMainSwitch(crate1); |
SetCtrlVal (p1h, P1_MSW, mainonoff); |
88,16 → 96,39 |
mainonoff=getMainSwitch(crate1); |
SetCtrlVal (p1h, P1_MSW, mainonoff); |
SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
iret=getMainStatus(crate1); |
SetCtrlVal (p1h, P1_MST, iret); |
if (mainonoff) { |
iret=getMainStatus(crate1); |
SetCtrlVal (p1h, P1_MST, iret); |
// ret=getOutputSenseMeasurement(crate1, ch); |
for (i=0;i<4;i++) { |
HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
for (i=0; i<4; i++) { |
HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
} |
PlotStripChart (p1h, P1_G1, HVcdis, 4, 0, 0, VAL_DOUBLE); |
if (TESTon) { |
ntics++; |
for (i=0;i<4;i++) |
fprintf(HVBfp[i],"%5d %10.1f %10.4f\n",ntics,HVvdis[i],HVcdis[i]); |
switch (ntics) { |
case 5: |
SetCtrlVal(p1h,P1_HVonoffall, 1); |
QueueUserEvent (1001, p1h, P1_HVonoffall); |
break; |
case NTICSMAX-25: |
SetCtrlVal(p1h,P1_HVonoffall, 0); |
QueueUserEvent (1001, p1h, P1_HVonoffall); |
break; |
case NTICSMAX: |
SetCtrlVal (p1h, P1_TESTon, 0); |
QueueUserEvent (1001, p1h, P1_TESTon); |
break; |
default: |
break; |
} |
} |
} |
PlotStripChart (p1h, P1_G1, HVcdis, 4, 0, 0, VAL_DOUBLE); |
break; |
case P1_MSW: |
GetCtrlVal (p1h, P1_MSW, &mainonoff); |
152,6 → 183,23 |
HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
break; |
case P1_TESTon: |
GetCtrlVal (p1h, P1_TESTon, &TESTon); |
if (TESTon) { |
ntics=0; |
ClearStripChart (p1h, P1_G1); |
for (i=0;i<4;i++) { |
GetCtrlVal(p1h, HVBid_rID[i], HVBid[i]); |
sprintf(HVBfname[i],"HVB_%s.dat",HVBid[i]); |
HVBfp[i]=fopen(HVBfname[i],"w"); |
} |
} else { |
SetCtrlVal(p1h,P1_HVonoffall, 0); |
QueueUserEvent (1001, p1h, P1_HVonoffall); |
for (i=0;i<4;i++) |
fclose(HVBfp[i]); |
} |
break; |
// case P1_VFA0: |
// GetCtrlVal (p1h, P1_VFA0, &ret); |
// setOutputFallRate(crate1, ch, ret); |