Subversion Repositories f9daq

Rev

Rev 155 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 155 Rev 156
Line 162... Line 162...
162
//  double voltage;
162
//  double voltage;
163
  double vSet=0;
163
  double vSet=0;
164
  int ch=0;
164
  int ch=0;
165
  int iret;
165
  int iret;
166
//  int i, j;
166
//  int i, j;
-
 
167
  char cret[2000];
167
 
168
 
168
  HSNMP crate1;
169
  HSNMP crate1;
169
 
170
 
170
  if (InitCVIRTE (hInstance, 0, 0) == 0)
171
  if (InitCVIRTE (hInstance, 0, 0) == 0)
171
    return -1;    /* out of memory */
172
    return -1;    /* out of memory */
Line 174... Line 175...
174
  MPOD_Open(0,"arich-mpod1.kek.jp");
175
  MPOD_Open(0,"arich-mpod1.kek.jp");
175
  crate1 = crateHsnmp[0];
176
  crate1 = crateHsnmp[0];
176
 
177
 
177
  printf("-----------------------------------------------------------------\n");
178
  printf("-----------------------------------------------------------------\n");
178
 
179
 
-
 
180
  strcpy(cret, MPOD_GetString(0,"moduleDescription.ma0"));
-
 
181
  printf("Module type: %s\n",cret);
-
 
182
 
179
  iret=getMainSwitch(crate1);
183
  iret=getMainSwitch(crate1);
180
  printf("Main Switch = %i\n", iret);
184
  printf("Main Switch = %i\n", iret);
181
 
185
 
182
//  iret=MPOD_GetInt(0,"moduleNumber.0");
186
//  iret=MPOD_GetInt(0,"moduleNumber.0");
183
  iret=MPOD_GetIntCh(0,"moduleNumber",0);
187
  iret=MPOD_GetIntCh(0,"moduleNumber",0);
184
  printf("Module Number = %i\n", iret);
188
  printf("Module Number = %i\n", iret);
185
 
189
 
-
 
190
  iret=MPOD_GetIntCh(0,"fanNominalSpeed",0);
-
 
191
  printf("Fan nominal speed = %i\n", iret);
-
 
192
 
186
  ret=MPOD_GetDouble(0,"outputVoltage.1");
193
  ret=MPOD_GetDouble(0,"outputVoltage.1");
187
  printf("Output Voltage = %f.\n", ret);
194
  printf("Output Voltage = %f.\n", ret);
188
 
195
 
189
  vSet = getOutputVoltage(crate1, ch);
196
//  vSet = getOutputVoltage(crate1, ch);
-
 
197
  vSet = MPOD_GetDoubleCh(0, "outputVoltage", ch+1);
190
  printf("Output Voltage %i = %f.\n", ch, vSet);
198
  printf("Output Voltage %i = %f.\n", ch, vSet);
191
 
199
 
192
//Test Channel Status
200
//Test Channel Status
193
  iret=getChannelSwitch(crate1, ch);
201
  iret=getChannelSwitch(crate1, ch);
194
  printf("Channel Status %i = %i\n", ch, iret);
202
  printf("Channel Status %i = %i\n", ch, iret);
195
 
203
 
196
//Test Reading the Sense Measurement
204
//Test Reading the Sense Measurement
197
  ret = getOutputSenseMeasurement(crate1, ch);
205
  ret = getOutputSenseMeasurement(crate1, ch);
198
  printf("Sense Voltage =  %f\n", ret);
206
  printf("Sense Voltage =  %f\n", ret);
199
 
207
 
200
//Test Reading the Current
208
//Test Reading the Current
201
  ret = getCurrentMeasurement(crate1, ch);
209
  ret = getCurrentMeasurement(crate1, ch);
202
  printf("Current Measurement =  %f\n", ret);
210
  printf("Current Measurement =  %f\n", ret);
Line 209... Line 217...
209
  iret=getChannelSwitch(crate1, ch);
217
  iret=getChannelSwitch(crate1, ch);
210
  printf("Channel Status %i = %i\n", ch, iret);
218
  printf("Channel Status %i = %i\n", ch, iret);
211
 
219
 
212
//Test Reading the Sense Measurement
220
//Test Reading the Sense Measurement
213
  ret = getOutputSenseMeasurement(crate1, ch);
221
  ret = getOutputSenseMeasurement(crate1, ch);
214
  printf("Sense Voltage =  %f\n", ret);
222
  printf("Sense Voltage =  %f\n", ret);
215
 
223
 
216
//Test Reading the Current
224
//Test Reading the Current
217
  ret = getCurrentMeasurement(crate1, ch);
225
  ret = getCurrentMeasurement(crate1, ch);
218
  printf("Current Measurement =  %f\n", ret);
226
  printf("Current Measurement =  %f\n", ret);
219
 
227
 
220
  getchar();
228
  getchar();
221
 
229
 
222
  printf("Turning channel %i OFF\n", ch);
230
  printf("Turning channel %i OFF\n", ch);
223
  setChannelSwitch(crate1, ch, 0);
231
  setChannelSwitch(crate1, ch, 0);
224
 
232
 
225
  printf("-----------------------------------------------------------------\n");
233
  printf("-----------------------------------------------------------------\n");
226
 
234
 
227
  Delay(1);
235
  Delay(1);
228
 
236
 
229
  MPOD_Close(0);
237
  MPOD_Close(0);
230
  MPOD_End();
238
  MPOD_End();
231
 
239
 
232
  return 0;
240
  return 0;
233
}
241
}
234
 
242
 
235
#endif /* MPOD_MAIN */
243
#endif /* MPOD_MAIN */
236
 
244
 
237
int _VI_FUNC MPOD_Start (void)
245
int _VI_FUNC MPOD_Start (void)
238
{
246
{
239
  int i;
247
  int i;
Line 263... Line 271...
263
  getNode(oidstr, &tmpObject);
271
  getNode(oidstr, &tmpObject);
264
  return snmpGetInt(crateHsnmp[mpodn], &tmpObject);
272
  return snmpGetInt(crateHsnmp[mpodn], &tmpObject);
265
}
273
}
266
 
274
 
267
int _VI_FUNC MPOD_SetInt (int mpodn, char *oidstr, int iset)
275
int _VI_FUNC MPOD_SetInt (int mpodn, char *oidstr, int iset)
268
{
276
{
269
  SnmpObject tmpObject;
277
  SnmpObject tmpObject;
270
 
278
 
271
  getNode(oidstr, &tmpObject);
279
  getNode(oidstr, &tmpObject);
272
  return snmpSetInt(crateHsnmp[mpodn], &tmpObject, iset);
280
  return snmpSetInt(crateHsnmp[mpodn], &tmpObject, iset);
273
}
281
}
274
 
282
 
275
double _VI_FUNC MPOD_GetDouble (int mpodn, char *oidstr)
283
double _VI_FUNC MPOD_GetDouble (int mpodn, char *oidstr)
276
{
284
{
277
  SnmpObject tmpObject;
285
  SnmpObject tmpObject;
278
 
286
 
279
  getNode(oidstr, &tmpObject);
287
  getNode(oidstr, &tmpObject);
280
  return snmpGetDouble(crateHsnmp[mpodn], &tmpObject);
288
  return snmpGetDouble(crateHsnmp[mpodn], &tmpObject);
281
}
289
}
282
 
290
 
283
double _VI_FUNC MPOD_SetDouble (int mpodn, char *oidstr, double dset)
291
double _VI_FUNC MPOD_SetDouble (int mpodn, char *oidstr, double dset)
284
{
292
{
285
  SnmpObject tmpObject;
293
  SnmpObject tmpObject;
286
 
294
 
287
  getNode(oidstr, &tmpObject);
295
  getNode(oidstr, &tmpObject);
288
  return snmpSetDouble(crateHsnmp[mpodn], &tmpObject, dset);
296
  return snmpSetDouble(crateHsnmp[mpodn], &tmpObject, dset);
-
 
297
}
-
 
298
 
-
 
299
char * _VI_FUNC MPOD_GetString (int mpodn, char *oidstr)
-
 
300
{
-
 
301
  SnmpObject tmpObject;
-
 
302
 
-
 
303
  getNode(oidstr, &tmpObject);
-
 
304
  return snmpGetString(crateHsnmp[mpodn], &tmpObject);
289
}
305
}
290
 
306
 
291
int _VI_FUNC MPOD_GetIntCh (int mpodn, char *oidstrbase, int ich)
307
int _VI_FUNC MPOD_GetIntCh (int mpodn, char *oidstrbase, int ich)
292
{
308
{
293
  SnmpObject tmpObject;
309
  SnmpObject tmpObject;
Line 317... Line 333...
317
{
333
{
318
  SnmpObject tmpObject;
334
  SnmpObject tmpObject;
319
 
335
 
320
  getIndexNode(oidstrbase, ich, &tmpObject);
336
  getIndexNode(oidstrbase, ich, &tmpObject);
321
  return snmpSetDouble(crateHsnmp[mpodn], &tmpObject, dset);
337
  return snmpSetDouble(crateHsnmp[mpodn], &tmpObject, dset);
-
 
338
}
-
 
339
 
-
 
340
char * _VI_FUNC MPOD_GetStringCh (int mpodn, char oidstrbase[], int ich)
-
 
341
{
-
 
342
  SnmpObject tmpObject;
-
 
343
 
-
 
344
  getIndexNode(oidstrbase, ich, &tmpObject);
-
 
345
   return snmpGetString(crateHsnmp[mpodn], &tmpObject);
322
}
346
}
323
 
347
 
324
int _VI_FUNC MPOD_Close (int mpodn)
348
int _VI_FUNC MPOD_Close (int mpodn)
325
{
349
{
326
  snmpClose(crateHsnmp[mpodn]);
350
  snmpClose(crateHsnmp[mpodn]);