
#idString GMC,METRAHIT ENERGY,
#name Gossen MetraHit Energy
#handle GME
#port comFixedBaud
#baudrate 38400
#driver SCPIx

#eol \r\n

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6)
#value VoltageDC V si VDC,DIO,Diode
#value CurrentDC A si IDC,ADC
#value VoltageAC V d4 VAC,VAC_F
#value CurrentAC A si IAC,AAC
#value VoltageACDC V d4 VACDC,MAINS,Power_Quality
#value CurrentACDC A si IACDC,AACDC
#value Resistance ohm si RES,RSL,BUZ,Resistance,Continuity
#value Conductance S si COND,Conductance
#value Capacitance F si CAP,Capacitance
#value Temperature °C d4 TEMP,TEMP_U,TEMP_R,Temperature_K,Temperature_PT100,Temperature_PT1000
#value Frequency Hz si FREQ_VAC,FREQ_VAC_F,FREQ_TTL,VAC,Frequence_AC,Frequence_TTL
#value DutyCycle % d3 DUTY,Duty_cycle
#value Decibel dB d2 dB,Decibel
#value Harmonic_distortion V d1 HARM_VOLT,Harmonic_distortion
#value Crest_Factor _ d2 VACDC,IACDC,AACDC
#value Event_count _ d0 EVENTS_DC,EVENTS_AC,Events,Power_Quality
#value Length m d2 LEN,Length
#value Power W si PWR,Power
#value Power_Apparent VA si PWR,Power
#value Power_Reactive VAR si PWR,Power
#value Power_Factor PF D2 PWR,Power
#value Voltage V si PWR,Power
#value Current A si PWR,Power
#value Energy Wh si Energy
#value Energy_Apparent VAh si Energy
#value Energy_Reactive VARh si Energy


#scpiCmd *idn? txrx? idn?
:readmath: var v=split(value,"[,]");v[0]+","+v[1]+","+trim(replace(v[3],"SERIAL NO.:",""))+","+trim(replace(v[4],"SW:",""));


; 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.
; This is a single line command
#askValues VAL:L?[mode:Energy,Power];VAL:E?[mode:Power_Quality];mains:num?
#askValuesReadFormat uuuuuuxxxx[mode:Energy]uuu

; Accept this delay when reading values (seconds), auto range can be very slow on this meter
#readingDelay 5

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 10

; Switch meter to this mode during start, leave empty to avoid any switching
#initialMode 

; String to ask about actual meter mode, 
; This is a single line command
#askMode set?
#askModeMathFormat getElement(value,0,",");


#interfaceType DMM
#interface readValue 0

; Strings to configure device in different modes
; First parameter must match a #value (4 parameter) and second parameter must match what #askMode returns
; First parameter is also used in shortcut menu


; Prepare the meter to response to #askValues
#prepareSample


; Initial commands to meter when establishing connection
#initCmd  txrx NOFF

#readingDelay 3

; Final command to meter before breaking connection
#finalCmd SET:APOFF 5

#cmdModeLayout 3 8

; Strings to configure device in different modes
; First parameter must match a #value (4 parameter) and second parameter must match what #askMode returns
; First parameter is also used in shortcut menu

#cmdMode VDC VDC
txrx sens:volt:dc:auto

#cmdMode VAC VAC
txrx sens:volt:ac:auto

#cmdMode VACDC VACDC
txrx sens:volt:acdc:auto

#cmdMode ADC IDC
txrx sens:curr:DC:auto

#cmdMode AAC IAC
txrx sens:curr:AC:auto

#cmdMode AACDC IACDC
txrx sens:curr:ACDC:auto

#cmdMode Frequence_AC FREQ_VAC
txrx SENS:FREQ:VAC:AUTO,volt:rang 600

;#cmdMode Frequence_TTL FREQ_TTL
;txrx sens:freq_ttl:auto

#cmdMode Duty_cycle DUTY
txrx sens:duty:auto

#cmdMode Events EVENTS_DC
txrx sens:events:dc:rang 60

#cmdMode Resistance RES
txrx sens:res:auto

#cmdMode Conductance COND
txrx sens:cond

#cmdMode Continuity BUZ
txrx sens:short

#cmdMode Temperature_K TEMP
txrx sens:temp:tc k

#cmdMode Temperature_PT100 TEMP
txrx sens:temp:rtd pt100

#cmdMode Temperature_PT1000 TEMP
txrx sens:temp:rtd pt1000

#cmdMode RSL RSL
txrx sens:rsl


#cmdMode Decibel dB
txrx sens:db

#cmdMode Diode DIO
txrx sens:diode

#cmdMode Capacitance CAP
txrx sens:CAP:AUTO

#cmdMode Length LEN
txrx sens:len:auto

#cmdMode Power_Quality MAINS
txrx sens:MAINS

#cmdMode Harmonic_distortion HARM_VOLT
txrx sens:harm:volt


#cmdMode Power PWR
txrx sens:pwr:volt:auto,curr:auto


;#cmdModeGet Get_mode


#cmdModeCheck Energy m2 0
[localMode]
[localMode]
Power


#cmdSetup number Continuity_limit General_settings
:write: txrx set:bpl
:read: bpl?
:tip: Buzzer limit for continuity
Ohm 10 500

#cmdSetup number RSL_limit General_settings
:write: txrx set:rsl
:read: rsl?
:tip: Buzzer limit for RSL resistance
Ohm 0.1 60.0

;#cmdSetup number RTD_Cable_Resistance General_settings
;:write: txrx set:TEMP:R_L
;:read: TEMP:R_L?
;:tip: Resistance in cable for RTD temperature sensor
;Ohm 0.0 20.0


#cmdSetup number Cable_capacitance General_settings
:write: txrx SET:CAPM
:read: CAPM?
:tip: Cable capacitance in pf/meter used to calculate length (Function in capacitance mode)
F 10p 500p

#cmdSetup numberint Event_low_limit General_settings
:write: txrx SET:EVENTS:TRIG:LO
:read: EVENTS:TRIG:LO?
:tip: Value is in display count, not in voltage.
Cnt -60000 60000

#cmdSetup numberint Event_high_limit General_settings
:write: txrx SET:EVENTS:TRIG:HI
:read: EVENTS:TRIG:HI?
:tip: Value is in display count, not in voltage.
Cnt -60000 60000

#cmdSetup combobox Event_speed General_settings
:write: txrx SET:EVENTS:DC:RATE
:read: EVENTS:DC:RATE?
2Hz 0.5
500Hz 0.001


#cmdSetup text Time General_settings
:write: txrx set:time
:read: time?
:textwidth: 8
:tip: Current time in hh:mm:ss format
8

#cmdSetup text Date General_settings
:write: txrx set:date
:read: date?
:textwidth: 8
:tip: Current date in yy.mm.dd format
8

#cmdSetup Button Reset_Events_/_Energy General_settings
:write: txrx watch:reset

#cmdSetup combobox Mains_Frequency Power_Quality
:write: txrx SET:MAINS:FREQ
:read: MAINS:FREQ?
50Hz 50
60Hz 60

#cmdSetup combobox Voltage_range Power_Quality
:write: txrx SET:MAINS:RANG
:read: MAINS:RANG?
:readmath: int(double(value))
6V 6
60V 60 
600V 600


#cmdSetup number Transient_limit Power_Quality
:write: txrx SET:MAINS:TRANS:LIMIT
:read: MAINS:TRANS:LIMIT?
V 200 999

#cmdSetup numberint Low_voltage Power_Quality
:write: txrx SET:MAINS:LOVOLT:LIMIT
:read: MAINS:LOVOLT:LIMIT?
:tip: Value is in display count, not in voltage.
Cnt 0 60000

#cmdSetup numberint High_voltage Power_Quality
:write: txrx SET:MAINS:HIVOLT:LIMIT
:read: MAINS:HIVOLT:LIMIT?
:tip: Value is in display count, not in voltage.
Cnt 0 60000

#cmdSetup numberint Dip_voltage Power_Quality
:write: txrx SET:MAINS:DIP:LIMIT
:read: MAINS:DIP:LIMIT?
:tip: Value is in display count, not in voltage.
Cnt 0 60000

#cmdSetup numberint Swell_voltage Power_Quality
:write: txrx SET:MAINS:SWELL:LIMIT
:read: MAINS:SWELL:LIMIT?
:tip: Value is in display count, not in voltage.
Cnt 0 60000

#cmdSetup numberint Peak_voltage Power_Quality
:write: txrx SET:MAINS:PEAK:LIMIT
:read: MAINS:PEAK:LIMIT?
:tip: Value is in display count, not in voltage.
Cnt 0 100000


#cmdSetup Button Default Default
:write: txrx set:def
