Scanner prototype as a scriptHi HKJ,
As a follow-up to my
Scanner Popup proposal, I made a prototype as a script: a relay board plus one meter, scanning the channels in turn.
- Devices selected with getDevice("BMM") and getDevice("relay"), channel count taken from the scanner's own channels
- Settle, dwell and off wait (break before make) set in a popup
- Its own table: a row per cycle, a column per channel, names and SI format from the meter
- All relays open at start and end, every device call guarded with isLoaded()
Function tested on TC 3.57 with a Yokogawa 7552 and an LCUS-4.
[ Attachment Invalid Or Does Not Exist ]
The output is:
"index","time","minutes","dateTime","Volt_DC_CH1","Volt_DC_CH2","Volt_DC_CH3","Volt_DC_CH4"
0,33.201,0.55335240000083,1791985078.872,2.5006,2.5006,2.5006,2.5006
1,66.419,1.10700429666322,1791985112.091,2.5006,2.5006,2.5006,2.5006
2,99.638,1.66063241499942,1791985145.309,2.5006,2.5006,2.5006,2.5006
3,132.857,2.21428748333516,1791985178.528,2.5006,2.5006,2.5006,2.5006My dilemma is where it should live. As an external script it is easy to change and test, but a user has to find and load it. Putting it in the Other menu of my relay defs would make it one click away, but then the same script sits in every relay def, with all # escaped as \x23 and the runScript strings nested inside runScriptAsync. Every fix would have to be repeated in each def. A Scanner Popup in TC would solve that, since it would work with any relay board and any meter without touching a def.
Two things forced me to build commands as text and run them with runScript:
- tableAddRow does not accept an array, so a row for a variable channel count has to be built as a string
- #valueFormat does not evaluate a name in brackets, unlike #scale
Would either of those be possible? Then the script would not need runScript at all.