Rev 162 | Rev 164 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 162 | Rev 163 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "MPOD.h" |
1 | #include "MPOD.h" |
- | 2 | #include <utility.h> |
|
2 | #include "HVtest_ui.h" |
3 | #include "HVtest_ui.h" |
3 | 4 | ||
4 | #define HVSLOT 3 |
5 | #define HVSLOT 3 |
5 | 6 | ||
6 | static int p1h, pID, rID, tfID; |
7 | static int p1h, pID, rID, tfID; |
Line 12... | Line 13... | ||
12 | } |
13 | } |
13 | 14 | ||
14 | int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, |
15 | int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, |
15 | LPSTR lpszCmdLine, int nCmdShow) { |
16 | LPSTR lpszCmdLine, int nCmdShow) { |
16 | 17 | ||
17 | const int mo= |
18 | const int mo=HVSLOT; |
18 | const int ch0=100*mo; |
19 | const int ch0=100*mo; |
19 | 20 | ||
20 | int mainonoff,HVonoffall; |
21 | int mainonoff,HVonoffall; |
21 | int HVonoff[4],HVonoff_rID[4]={P1_HVonoff_0,P1_HVonoff_1,P1_HVonoff_2,P1_HVonoff_3}; |
22 | int HVonoff[4],HVonoff_rID[4]={P1_HVonoff_0,P1_HVonoff_1,P1_HVonoff_2,P1_HVonoff_3}; |
22 | int HVvdis_rID[4]={P1_HVvdis_0,P1_HVvdis_1,P1_HVvdis_2,P1_HVvdis_3}; |
23 | int HVvdis_rID[4]={P1_HVvdis_0,P1_HVvdis_1,P1_HVvdis_2,P1_HVvdis_3}; |
Line 63... | Line 64... | ||
63 | HVonoff[i]=getChannelSwitch(crate1, ch0+i); |
64 | HVonoff[i]=getChannelSwitch(crate1, ch0+i); |
64 | if (HVonoff[i]) HVonoffall=1; |
65 | if (HVonoff[i]) HVonoffall=1; |
65 | } |
66 | } |
66 | for (i=0;i<4;i++) { |
67 | for (i=0;i<4;i++) { |
67 | if (!HVonoffall) HVonoff[i]=1; |
68 | if (!HVonoffall) HVonoff[i]=1; |
68 | SetCtrlVal (p1h, HVonoff_rID[i], HVonoff[i]); |
69 | SetCtrlVal (p1h, HVonoff_rID[i], HVonoff[i]); |
69 | } |
70 | } |
70 | HVvset[0]=getOutputVoltage(crate1,ch0); |
71 | HVvset[0]=getOutputVoltage(crate1,ch0); |
71 | SetCtrlVal (p1h, P1_HVvset, HVvset[0]); |
72 | SetCtrlVal (p1h, P1_HVvset, HVvset[0]); |
72 | HVcset[0]=1e+6*getOutputCurrent(crate1,ch0); |
73 | HVcset[0]=1e+6*getOutputCurrent(crate1,ch0); |
73 | SetCtrlVal (p1h, P1_HVcset, HVcset[0]); |
74 | SetCtrlVal (p1h, P1_HVcset, HVcset[0]); |
- | 75 | SetAxisScalingMode (p1h, P1_G1, VAL_LEFT_YAXIS, VAL_MANUAL, -(HVcset[0]+1), 1.); |
|
74 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
76 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
75 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
77 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
76 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |
78 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |
77 | // SetCtrlVal (p1h, P1_VFA0, vfall[0]); |
79 | // SetCtrlVal (p1h, P1_VFA0, vfall[0]); |
78 | } |
80 | } |
Line 92... | Line 94... | ||
92 | for (i=0;i<4;i++) { |
94 | for (i=0;i<4;i++) { |
93 | HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
95 | HVvdis[i]=getOutputTerminalMeasurement(crate1, ch0+i); |
94 | SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
96 | SetCtrlVal (p1h, HVvdis_rID[i], HVvdis[i]); |
95 | HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
97 | HVcdis[i]=1e+6*getCurrentMeasurement(crate1, ch0+i); |
96 | SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
98 | SetCtrlVal (p1h, HVcdis_rID[i], HVcdis[i]); |
- | 99 | } |
|
97 |
|
100 | PlotStripChart (p1h, P1_G1, HVcdis, 4, 0, 0, VAL_DOUBLE); |
98 | break; |
101 | break; |
99 | case P1_MSW: |
102 | case P1_MSW: |
100 | GetCtrlVal (p1h, P1_MSW, &mainonoff); |
103 | GetCtrlVal (p1h, P1_MSW, &mainonoff); |
101 | if (ConfirmPopup("Main switch!!!", cMainSwitch[mainonoff])) |
104 | if (ConfirmPopup("Main switch!!!", cMainSwitch[mainonoff])) |
102 | setMainSwitch(crate1, mainonoff); |
105 | setMainSwitch(crate1, mainonoff); |
Line 113... | Line 116... | ||
113 | } |
116 | } |
114 | HVvset[0]=getOutputVoltage(crate1,ch0); |
117 | HVvset[0]=getOutputVoltage(crate1,ch0); |
115 | SetCtrlVal (p1h, P1_HVvset, HVvset[0]); |
118 | SetCtrlVal (p1h, P1_HVvset, HVvset[0]); |
116 | HVcset[0]=1e+6*getOutputCurrent(crate1,ch0); |
119 | HVcset[0]=1e+6*getOutputCurrent(crate1,ch0); |
117 | SetCtrlVal (p1h, P1_HVcset, HVcset[0]); |
120 | SetCtrlVal (p1h, P1_HVcset, HVcset[0]); |
- | 121 | SetAxisScalingMode (p1h, P1_G1, VAL_LEFT_YAXIS, VAL_MANUAL, -(HVcset[0]+1), 1.); |
|
118 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
122 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
119 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
123 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
120 | } |
124 | } |
121 | break; |
125 | break; |
122 | } |
126 | } |
123 | if (!mainonoff) continue; |
127 | if (!mainonoff) continue; |
124 | switch (rID) { |
128 | switch (rID) { |
125 | case |
129 | case P1_HVonoffall: |
126 | GetCtrlVal (p1h, |
130 | GetCtrlVal (p1h, P1_HVonoffall, &HVonoffall); |
- | 131 | for (i=0;i<4;i++) { |
|
- | 132 | GetCtrlVal (p1h, HVonoff_rID[i], &HVonoff[i]); |
|
- | 133 | if (HVonoff[i]) |
|
127 |
|
134 | setChannelSwitch(crate1, ch0+i, HVonoffall); |
- | 135 | } |
|
128 | break; |
136 | break; |
129 | case |
137 | case P1_HVvset: |
130 | GetCtrlVal (p1h, |
138 | GetCtrlVal (p1h, P1_HVvset, &HVvset[0]); |
- | 139 | for (i=0;i<4;i++) |
|
131 | setOutputVoltage( |
140 | setOutputVoltage(crate1, ch0+i, HVvset[0]); |
132 | break; |
141 | break; |
133 | case |
142 | case P1_HVcset: |
134 | GetCtrlVal (p1h, |
143 | GetCtrlVal (p1h, P1_HVcset, &HVcset[0]); |
- | 144 | SetAxisScalingMode (p1h, P1_G1, VAL_LEFT_YAXIS, VAL_MANUAL, -(HVcset[0]+1), 1.); |
|
135 |
|
145 | HVcset[0]/=1e+6; //[uA] |
- | 146 | for (i=0;i<4;i++) |
|
136 | setOutputCurrent( |
147 | setOutputCurrent(crate1, ch0+i, HVcset[0]); |
137 | break; |
148 | break; |
138 | case |
149 | case P1_HVvrise: |
139 | GetCtrlVal (p1h, |
150 | GetCtrlVal (p1h, P1_HVvrise, &HVvrise); |
140 | setModuleRampSpeedVoltage(crate1, mo, |
151 | setModuleRampSpeedVoltage(crate1, mo, HVvrise); |
141 |
|
152 | HVvrise=getModuleRampSpeedVoltage(crate1,mo); |
142 | SetCtrlVal (p1h, |
153 | SetCtrlVal (p1h, P1_HVvrise, HVvrise); |
143 | break; |
154 | break; |
144 | // case P1_VFA0: |
155 | // case P1_VFA0: |
145 | // GetCtrlVal (p1h, P1_VFA0, &ret); |
156 | // GetCtrlVal (p1h, P1_VFA0, &ret); |
146 | // setOutputFallRate(crate1, ch, ret); |
157 | // setOutputFallRate(crate1, ch, ret); |
147 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |
158 | // vfall[0]=abs(getOutputFallRate(crate1,ch)); |