/HVtest/HVtest.c |
---|
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,6 → 96,7 |
mainonoff=getMainSwitch(crate1); |
SetCtrlVal (p1h, P1_MSW, mainonoff); |
SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
if (mainonoff) { |
iret=getMainStatus(crate1); |
SetCtrlVal (p1h, P1_MST, iret); |
// ret=getOutputSenseMeasurement(crate1, ch); |
98,7 → 107,29 |
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; |
} |
} |
} |
break; |
case P1_MSW: |
GetCtrlVal (p1h, P1_MSW, &mainonoff); |
if (ConfirmPopup("Main switch!!!", cMainSwitch[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); |
/HVtest/HVtest_ui.h |
---|
18,19 → 18,19 |
#define P1_EXIT 3 /* control type: command, callback function: (none) */ |
#define P1_HVcset 4 /* control type: numeric, callback function: (none) */ |
#define P1_HVvrise 5 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_3 6 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_3 7 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_2 8 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_2 9 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_1 10 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_1 11 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_0 12 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_0 13 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_4 6 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_4 7 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_3 8 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_3 9 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_2 10 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_2 11 /* control type: numeric, callback function: (none) */ |
#define P1_HVcdis_1 12 /* control type: numeric, callback function: (none) */ |
#define P1_HVvdis_1 13 /* control type: numeric, callback function: (none) */ |
#define P1_HVvset 14 /* control type: numeric, callback function: (none) */ |
#define P1_HVonoff_3 15 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_2 16 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_1 17 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_0 18 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_4 15 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_3 16 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_2 17 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoff_1 18 /* control type: radioButton, callback function: (none) */ |
#define P1_HVonoffall 19 /* control type: radioButton, callback function: (none) */ |
#define P1_REFRESHTIMER 20 /* control type: timer, callback function: refreshTimer */ |
#define P1_MSW 21 /* control type: binary, callback function: (none) */ |
38,11 → 38,17 |
#define P1_MSWLED 23 /* control type: LED, callback function: (none) */ |
#define P1_MST 24 /* control type: numeric, callback function: (none) */ |
#define P1_MFS 25 /* control type: numeric, callback function: (none) */ |
#define P1_HVBid_4 26 /* control type: string, callback function: (none) */ |
#define P1_HVBid_3 27 /* control type: string, callback function: (none) */ |
#define P1_HVBid_2 28 /* control type: string, callback function: (none) */ |
#define P1_HVBid_1 29 /* control type: string, callback function: (none) */ |
#define P1_TESTon 30 /* control type: textButton, callback function: (none) */ |
/* Control Arrays: */ |
#define CTRLARRAY 1 |
#define HV_onoffs 1 |
#define HVB_IDs 2 |
/* Menu Bars, Menus, and Menu Items: */ |
/HVtest/HVtest_ui.uir |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |