YOKOGAWA WT200 User Manual page 210

Digital power meter
Table of Contents

Advertisement

14.5 Sample Program
14-48
'***************************************************************************
'*
'*
sample program 2 for the WT200
'*
'***************************************************************************
'*
'*
used to read and display the following data in harmonic analysis mode. *
'*
'*
PLL source (voltage) frequency
'*
harmonic distortion of current
'*
total rms value of each harmonic from 1st to 50th of current
'*
analysis value of fundamental (1st) of current, analysis value of
'*
each harmonic (2nd to 50th)
'*
'***************************************************************************
REM $INCLUDE: 'qbdecl.bas'
DECLARE SUB gpiberr (msg$)
DIM D$(53)
CALL IBDEV(0, 1, 0, T10s, 1, 0, DEV%)
IF (DEV% <= 0) THEN CALL gpiberr("Ibdev error")
' interface clear
CALL IBCLR(DEV%)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibclr error")
' set measurement condition
WRT$ = "HARMONICS:STATE ON;ELEMENT 1;SYNCHRONIZE V,1;THD IEC"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
' set communication output items
' 1. set all function off
' 2. set necessary function on
WRT$ = "MEASURE:HARMONICS:ITEM:PRESET CLEAR"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
WRT$ = "MEASURE:HARMONICS:ITEM:SYNCHRONIZE ON;ATHD ON;A ON"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
' set filter to detect completion of refreshing data
WRT$ = "STATUS:FILTER1 FALL"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
' read/display measured data
PRINT ""
FOR I = 1 TO 10
'clear extended event register
WRT$ = "STATUS:EESR?"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
RD$ = SPACE$(255)
CALL IBRD(DEV%, RD$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibrd error")
'wait for completion of refreshing data
WRT$ = "COMMUNICATE:WAIT 1"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
'request output of measured data
WRT$ = "MEASURE:HARMONICS:VALUE?"
CALL IBWRT(DEV%, WRT$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibwrt error")
'read analyzed data
RD$ = SPACE$(1024)
CALL IBRD(DEV%, RD$)
IF (IBSTA% AND EERR) THEN CALL gpiberr("Ibrd error")
C$ = LEFT$(RD$, ibcnt%)
FOR J = 0 TO 52
L = LEN(C$)
B = INSTR(C$, ",")
IF B = 0 THEN B = INSTR(C$, CHR$(10))
D$(J) = LEFT$(C$, B - 1)
C$ = MID$(C$, (B + 1), L)
NEXT J
*
*
*
*
*
*
*
*
*
*
*
IM 253421-01E

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents