;Yokogawa WT5000 series Power Analyzers
;  Tested over Ethernet with Test Controller V2.01.  Earlier versions might not work.
;2/2/22 Rev A

;Per Yokogawa Communications Interface User's Manual:
; Socket Interface Specifications
;   Electrical and mechanical specifications Complies with IEEE802.3
;   Simultaneous connections 1
;   Communication protocol None
;   Port number 10002/tcp
;   Terminator LF(0Ah)
;   Connection timeout Infinite

#verifyDevice Ctl_server_is_ready. loginy?
; Below ID string response to query? *idn? from up to date unit on 7/2/21.
#idString YOKOGAWA,WT5000,
#name Yokogawa WT5000
#handle WT5000
#port LXI

#eol \n
#author gby
#notes Yokogawa WT5000 series instruments are multi-channel power analyzers.  This driver uses the Ethernet communications option with socket connection.  Automatically logs into the Yokogawa with user name anonymous and blank password.  If the device has other account settings this will not work.  A modified form of this device file might work with USB or GPIB communications.

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
; Yokogawa allows any quantity (V, I, Watt, speed, ...) on any channel.  So below lists no units.

#value CH1 - D3
#value CH2 - D3
#value Ch3 - D3
#value Ch4 - D3
#value Ch5 - D3
#value Ch6 - D3
#value Ch7 - D3
#value Ch8 - D3
#value Ch9 - D3
#value Ch10 - D3
#value Ch11 - D3
#value Ch12 - D3
#value Ch13 - D3
#value Ch14 - D3
#value Ch15 - D3
#value Ch16 - D3
#value CH17 - D3
#value CH18 - D3
#value Ch19 - D3
#value Ch20 - D3
#value Ch21 - D3
#value Ch22 - D3
#value Ch23 - D3
#value Ch24 - D3
#value Ch25 - D3
#value Ch26 - D3
#value Ch27 - D3
#value Ch28 - D3
#value Ch29 - D3
#value Ch30 - D3
#value Ch31 - D3
#value Ch32 - D3

; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.--
; Number of returned values must match number of columns defined with #value
; This is a single line command

;  Yokogawa :num:norm:val? gets data values 1 through the set value of :NUMeric:NORMal:NUMber
#askValues :num:norm:val?

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
#askValuesReadFormat ffffffffffffffffffffffffffffffff

; Initial commands to meter when establishing connection, used to disable local control
; Set recorder to full sample rate, immediate trigger, take only 1 point, send as decimal numbers.
; Leave REC.CHx channels selections at whatever is in the drive.

;  Below sets the Yokogawa to:
;      - send numeric values as ascii IEEE single precision float numbers.
;      - turns command echo off for query replies.  Just returns value.
;      - to only return the first 32 of a possible 255 values from :NUM:NORM:VAL?
;
;  Changing the number of channels logged requires changing:
;      number of #value lines
;      number of format characters in #askValuesReadFormat.
#initCmd :NUMERIC:FORMAT ASCII; communicate:header 0; :NUMERIC:NORMAL:NUMBER 32

; Final command to meter before breaking connection, used to restore local control
; Put REC data format back to default.
;#finalCmd

;************   Programming Interface **********

#interfaceType PA