Rev 163 | Rev 165 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 163 | Rev 164 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "MPOD.h" |
1 | #include "MPOD.h" |
2 | #include <utility.h> |
2 | #include <utility.h> |
3 | #include "HVtest_ui.h" |
3 | #include "HVtest_ui.h" |
4 | 4 | ||
5 | #define HVSLOT 3 |
5 | #define HVSLOT 3 |
- | 6 | #define NTICSMAX 120 |
|
6 | 7 | ||
7 | static int p1h, pID, rID |
8 | static int p1h, pID, rID; //, tfID; |
8 | 9 | ||
9 | int CVICALLBACK refreshTimer (int panel, int control, int event, void *callbackData, |
10 | int CVICALLBACK refreshTimer (int panel, int control, int event, void *callbackData, |
10 | int eventData1, int eventData2) { |
11 | int eventData1, int eventData2) { |
11 | QueueUserEvent (9000, p1h, P1_REFRESHTIMER); |
12 | QueueUserEvent (9000, p1h, P1_REFRESHTIMER); |
12 | return (0); |
13 | return (0); |
Line 17... | Line 18... | ||
17 | 18 | ||
18 | const int mo=HVSLOT; |
19 | const int mo=HVSLOT; |
19 | const int ch0=100*mo; |
20 | const int ch0=100*mo; |
20 | 21 | ||
21 | int mainonoff,HVonoffall; |
22 | int mainonoff,HVonoffall; |
- | 23 | int HVonoff[4]={0,0,0,0}; |
|
22 | int |
24 | int HVonoff_rID[4]={P1_HVonoff_1,P1_HVonoff_2,P1_HVonoff_3,P1_HVonoff_4}; |
23 | int HVvdis_rID[4]={ |
25 | int HVvdis_rID[4]={P1_HVvdis_1,P1_HVvdis_2,P1_HVvdis_3,P1_HVvdis_4}; |
24 | int HVcdis_rID[4]={ |
26 | int HVcdis_rID[4]={P1_HVcdis_1,P1_HVcdis_2,P1_HVcdis_3,P1_HVcdis_4}; |
25 | int iret; |
27 | int iret; |
26 | int i |
28 | int i; |
27 |
|
29 | int TESTon=0,ntics=0; |
28 | double HVvset[4],HVcset[4],HVvrise |
30 | double HVvset[4],HVcset[4],HVvrise; //,HVvfall; |
29 | double HVvdis[4],HVcdis[4]; |
31 | double HVvdis[4],HVcdis[4]; |
30 |
|
32 | // char cret[2000]; |
31 | char cMainSwitch[2][30]= {"Turn system OFF?","Turn system ON?"}; |
33 | char cMainSwitch[2][30]= {"Turn system OFF?","Turn system ON?"}; |
- | 34 | char HVBid[4][4]; |
|
- | 35 | int HVBid_rID[4]={P1_HVBid_1,P1_HVBid_2,P1_HVBid_3,P1_HVBid_4}; |
|
- | 36 | char HVBfname[4][200]; |
|
- | 37 | FILE *HVBfp[4]={NULL,NULL,NULL,NULL}; |
|
32 | 38 | ||
33 | HSNMP crate1; |
39 | HSNMP crate1; |
34 | 40 | ||
35 | if (InitCVIRTE (hInstance, 0, 0) == 0) |
41 | if (InitCVIRTE (hInstance, 0, 0) == 0) |
36 | return -1; /* out of memory */ |
42 | return -1; /* out of memory */ |
Line 47... | Line 53... | ||
47 | // iret=MPOD_GetIntCh(0,"fanNominalSpeed",0); |
53 | // iret=MPOD_GetIntCh(0,"fanNominalSpeed",0); |
48 | // printf("Fan nominal speed = %i\n", iret); |
54 | // printf("Fan nominal speed = %i\n", iret); |
49 | 55 | ||
50 | if ((p1h = LoadPanel (0, "HVtest_ui.uir", P1)) < 0) return -1; |
56 | if ((p1h = LoadPanel (0, "HVtest_ui.uir", P1)) < 0) return -1; |
51 | DisplayPanel (p1h); |
57 | DisplayPanel (p1h); |
- | 58 | SetCtrlVal (p1h, P1_TESTon, 0); |
|
52 | 59 | ||
- | 60 | ||
53 | //Initial state |
61 | //Initial state |
54 | mainonoff=getMainSwitch(crate1); |
62 | mainonoff=getMainSwitch(crate1); |
55 | SetCtrlVal (p1h, P1_MSW, mainonoff); |
63 | SetCtrlVal (p1h, P1_MSW, mainonoff); |
56 | SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
64 | SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
57 | iret=getMainStatus(crate1); |
65 | iret=getMainStatus(crate1); |
Line 86... | Line 94... | ||
86 | switch (rID) { |
94 | switch (rID) { |
87 | case P1_REFRESHTIMER: |
95 | case P1_REFRESHTIMER: |
88 | mainonoff=getMainSwitch(crate1); |
96 | mainonoff=getMainSwitch(crate1); |
89 | SetCtrlVal (p1h, P1_MSW, mainonoff); |
97 | SetCtrlVal (p1h, P1_MSW, mainonoff); |
90 | SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
98 | SetCtrlVal (p1h, P1_MSWLED, mainonoff); |
- | 99 | if (mainonoff) { |
|
91 | iret=getMainStatus(crate1); |
100 | iret=getMainStatus(crate1); |
92 | SetCtrlVal (p1h, P1_MST, iret); |
101 | SetCtrlVal (p1h, P1_MST, iret); |
93 | // ret=getOutputSenseMeasurement(crate1, ch); |
102 | // ret=getOutputSenseMeasurement(crate1, ch); |
94 | for |
103 | for (i=0; i<4; i++) { |
95 | HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
104 | HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
96 | SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
105 | SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
97 | HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
106 | HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
98 | SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
107 | SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
- | 108 | } |
|
- | 109 | PlotStripChart (p1h, P1_G1, HVcdis, 4, 0, 0, VAL_DOUBLE); |
|
- | 110 | if (TESTon) { |
|
- | 111 | ntics++; |
|
- | 112 | for (i=0;i<4;i++) |
|
- | 113 | fprintf(HVBfp[i],"%5d %10.1f %10.4f\n",ntics,HVvdis[i],HVcdis[i]); |
|
- | 114 | switch (ntics) { |
|
- | 115 | case 5: |
|
- | 116 | SetCtrlVal(p1h,P1_HVonoffall, 1); |
|
- | 117 | QueueUserEvent (1001, p1h, P1_HVonoffall); |
|
- | 118 | break; |
|
- | 119 | case NTICSMAX-25: |
|
- | 120 | SetCtrlVal(p1h,P1_HVonoffall, 0); |
|
- | 121 | QueueUserEvent (1001, p1h, P1_HVonoffall); |
|
- | 122 | break; |
|
- | 123 | case NTICSMAX: |
|
- | 124 | SetCtrlVal (p1h, P1_TESTon, 0); |
|
- | 125 | QueueUserEvent (1001, p1h, P1_TESTon); |
|
- | 126 | break; |
|
- | 127 | default: |
|
- | 128 | break; |
|
- | 129 | } |
|
- | 130 | } |
|
99 | } |
131 | } |
100 | PlotStripChart (p1h, P1_G1, HVcdis, 4, 0, 0, VAL_DOUBLE); |
- | |
101 | break; |
132 | break; |
102 | case P1_MSW: |
133 | case P1_MSW: |
103 | GetCtrlVal (p1h, P1_MSW, &mainonoff); |
134 | GetCtrlVal (p1h, P1_MSW, &mainonoff); |
104 | if (ConfirmPopup("Main switch!!!", cMainSwitch[mainonoff])) |
135 | if (ConfirmPopup("Main switch!!!", cMainSwitch[mainonoff])) |
105 | setMainSwitch(crate1, mainonoff); |
136 | setMainSwitch(crate1, mainonoff); |
Line 150... | Line 181... | ||
150 | GetCtrlVal (p1h, P1_HVvrise, &HVvrise); |
181 | GetCtrlVal (p1h, P1_HVvrise, &HVvrise); |
151 | setModuleRampSpeedVoltage(crate1, mo, HVvrise); |
182 | setModuleRampSpeedVoltage(crate1, mo, HVvrise); |
152 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
183 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
153 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
184 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
154 | break; |
185 | break; |
- | 186 | case P1_TESTon: |
|
- | 187 | GetCtrlVal (p1h, P1_TESTon, &TESTon); |
|
- | 188 | if (TESTon) { |
|
- | 189 | ntics=0; |
|
- | 190 | ClearStripChart (p1h, P1_G1); |
|
- | 191 | for (i=0;i<4;i++) { |
|
- | 192 | GetCtrlVal(p1h, HVBid_rID[i], HVBid[i]); |
|
- | 193 | sprintf(HVBfname[i],"HVB_%s.dat",HVBid[i]); |
|
- | 194 | HVBfp[i]=fopen(HVBfname[i],"w"); |
|
- | 195 | } |
|
- | 196 | } else { |
|
- | 197 | SetCtrlVal(p1h,P1_HVonoffall, 0); |
|
- | 198 | QueueUserEvent (1001, p1h, P1_HVonoffall); |
|
- | 199 | for (i=0;i<4;i++) |
|
- | 200 | fclose(HVBfp[i]); |
|
- | 201 | } |
|
- | 202 | break; |
|
155 | // case P1_VFA0: |
203 | // case P1_VFA0: |
156 | // GetCtrlVal (p1h, P1_VFA0, &ret); |
204 | // GetCtrlVal (p1h, P1_VFA0, &ret); |
157 | // setOutputFallRate(crate1, ch, ret); |
205 | // setOutputFallRate(crate1, ch, ret); |
158 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |
206 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |
159 | // SetCtrlVal (p1h, P1_VFA0, vfall[0]); |
207 | // SetCtrlVal (p1h, P1_VFA0, vfall[0]); |