
; TestController must be restarted before any changes in this file will be used.
; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html, but do not include this driver type (i.e. scpiCmd with tx & rx? definitions).

#metadef
; 600Watt discharge power
#idString ATorch,ATorch DL24M,
#name ATorch DL24M
#handle ATDL24M
#sections Protocol3
#replaceText MinCurrent 0.003
#replaceText MinVoltage 2
#replaceText MaxCurrent 40
#replaceText MaxVoltage 200

#metadef
; 600Watt discharge power
#idString ATorch,ATorch DL24M-H,
#name ATorch DL24M-H V2
#handle ATDL24MH
#sections Protocol2
#replaceText MinCurrent 0.2
#replaceText MinVoltage 0
#replaceText MaxCurrent 40
#replaceText MaxVoltage 200

#metadef
; 600Watt discharge power
#idString ATorch,ATorch DL24M-H,
#name ATorch DL24M-H
#handle ATDL24MH
#sections Protocol1
#replaceText MinCurrent 0.2
#replaceText MinVoltage 0
#replaceText MaxCurrent 40
#replaceText MaxVoltage 200


#metadef
; 150Watt discharge power
#idString ATorch,ATorch DL24,
#name ATorch DL24
#handle ATDL24
#sections Protocol1
#replaceText MinCurrent 0.2
#replaceText MinVoltage 0
#replaceText MaxCurrent 20
#replaceText MaxVoltage 200

#metadef
; 180Watt discharge power
#idString ATorch,ATorch DL24P,
#name ATorch DL24P
#handle ATDL24P
#sections Protocol1
#replaceText MinCurrent 0.2
#replaceText MinVoltage 0
#replaceText MaxCurrent 20
#replaceText MaxVoltage 200



#metadef
#idString ATorch,ATorch PX100,
#name ATorch PX100
#handle PX100
#sections Protocol1
#replaceText MinCurrent 0
#replaceText MinVoltage 0
#replaceText MaxCurrent 10
#replaceText MaxVoltage 50



#meta
#idString ATorch,ATorch PX100,
#name ATorch PX100
#handle PX100
#port comfixedbaud
#baudrate 9600
#driver ATorchPX100

#notes These loads uses 3 different versions of the PX100 protocol, each defined load type will only work with one of the protocols. Duplicate #metadef and add V2 or V3 to the name when changing to a newer protocol for a already existing load.
At the current time V3 of the protocol is not complete, but mostly working.


; Possible factors: none, /hms, /10, /100, /1000
#scpiCmd on? rx? 0x10
#scpiCmd voltage? rx? 0x11 /1000
#scpiCmd current? rx? 0x12 /1000
#scpiCmd time? rx? 0x13 /hms
#scpiCmd capacity? rx? 0x14 /1000
#scpiCmd energy? rx? 0x15 /1000
#scpiCmd temperature? rx? 0x16 
#scpiCmd setVoltage? rx? 0x18 /100
#scpiCmd setTime? rx? 0x19 /hms

#metaSection Protocol1
; Possible factors: none, *dd, *10, *100, *1000
#scpiCmd on tx 1 (value) *dd
#scpiCmd setVoltage tx 3 (value) *dd
#scpiCmd setTime tx 4 (value)
#scpiCmd reset tx 5 0
#scpiCmd setCurrent tx 2 (value) *dd
#scpiCmd setCurrent? rx? 0x17 /100

#metaSection Protocol2
; Possible factors: none, *dd, *10, *100, *1000
#scpiCmd on tx 1 (value) *dd
#scpiCmd setVoltage tx 3 (value) *dd
#scpiCmd setTime tx 4 (value)
#scpiCmd reset tx 5 0

#scpiCmd setCurrent tx 2 (value*1000)
#scpiCmd setCurrent? rx? 0x17 /1000

#metaSection Protocol3
#PXVersion 3
; Possible factors: none, *dd, *10, *100, *1000
#scpiCmd on tx 1 (value) *dd
#scpiCmd setVoltage tx 3 (value*10)
#scpiCmd setTime tx 4 (value)
#scpiCmd reset tx 5 0

#scpiCmd setCurrent tx 2 (value*1000)
#scpiCmd setCurrent? rx? 0x17 /1000

#metaSection

; This type will specify the handle name for the first device with this type
; This makes it possible to easy get generic handle names for a setup, that will work with a script
#interfaceType Load
; These function will adjust settings
#interface setVoltage setVoltage (value)
#interface setCurrent setCurrent (value)
#interface setOn on (value)
; These function will return the value applied with the set function
#interface getVoltage setVoltage?
#interface getCurrent setCurrent?
#interface getOn on?
; These functions will read the actual values
; These can either contain a number that will reference to a data column or they can contain a command to read the value
#interface readVoltage 0
#interface readCurrent 1
#interface readCapacity 2
#interface readEnergy 3


; A list of possible column name with unit and formatter (SI, Time, Int, D0..D8, X0..X8) 
; Format: #value ColumnName Unit Format
#value Voltage V D3
#value Current A D3
#value Capacity Ah D3
#value Energy Wh D1

; How to poll for data, this is used for table and #values?
; Number of returned values must match number of columns defined with #value
; This is a single line command
#askValues voltage?;current?;capacity?;energy?

#readingDelay 2

#cmdSetup number Voltage
:read: setVoltage?
:write: setVoltage
:updatedelayed: 0.5
V MinVoltage MaxVoltage

#cmdSetup number Current
:read: setCurrent?
:write: setCurrent
:updatedelayed: 0.5
A MinCurrent MaxCurrent

#cmdSetup number Time
:read: setTime?
:write: setTime
:updatedelayed: 0.5
:tip: Maximum on-time in seconds, use 0 to disable
s 0 65535

#cmdSetup buttonsOn On
:read: on?
:write: on
:updatedelayed: 0.5
Off 0
On 1

#cmdSetup button Reset
:write: reset
:tip: Reset counters