# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent driver west_6100 = { protocol = modbus_ap class = environment simulation_group = environment_simulation add_args = 'id' make_args = 'id' Group = { priv = user; data = true; control = true; mutable = true; type = float; readable = 1; fetch_function = getDecimal; read_function = rdDecimal; write_function = wrDecimal; var sensor = { read_command = "1"; permlink = "T.S01"; } var setpoint = { read_command = "2"; permlink = "T.SP01"; write_command = "2"; writeable = 1; driveable = sensor; lowerlimit = 0; upperlimit = 1600; tolerance = 1; property settle_time = 30; } var w_sp = { read_command = "21"; write_command = "21"; writeable = 1; } var ramprate = { read_command = "24"; write_command = "24"; writeable = 1; } var alarm1 = { read_command = "13"; write_command = "13"; writeable = 1; } var alarm2 = { read_command = "14"; write_command = "14"; writeable = 1; } type = int; fetch_function = getInteger; read_function = rdInteger; write_function = wrInteger; var power = { read_command = "3";} var powermax = { read_command = "20"; write_command = "20"; writeable = 1; } } group aux = { data = false; control = false; mutable = false; readable = 2; nxsave = false; fetch_function = getInteger; read_function = rdInteger; var model = { type = int; read_command = "122"; } var decimal = { type = int; read_command = "18"; value = 0; } var instatus = { type = int; read_command = "133"; } } code fetch_function getInteger = { @TCL set cmd "1:3:${cmd_str}:1:U16" @END } code read_function rdInteger = { @TCL @END } code write_function wrInteger = { @TCL set cmd "1:16:${cmd_str}:1:U16:${par}" @END } # Decimal Adjusted fields code fetch_function getDecimal = { @TCL set cmd "1:3:${cmd_str}:1:U16" @END } code read_function rdDecimal = { @TCL set decimal [hval ${tc_root}/aux/decimal] if { ${decimal} > 0 } { set data [expr {pow(10, -${decimal}) * ${data}}] } @END } code write_function wrDecimal = { @TCL set decimal [hval ${tc_root}/aux/decimal] set par [sct target] if { ${decimal} > 0 } { set par [expr {pow(10, ${decimal}) * ${par}}] } set par [expr {round(${par})}] set cmd "1:16:${cmd_str}:1:U16:${par}" @END } }