Registered: 1435637569 Posts: 304
Reply with quote
I hear tell a few folks were wondering about the Run Script feature in Device Monitor->Diagnostics->Advanced. This is mostly meant for scientific study, automation, testing, etc.
The scripting language is IronPython so you can use normal Python libraries to save files and such. The script runs in a background thread while Device Monitor is running. As a reference, here are the functions available through the Python scripting at present: ECig.Puff(time) Time is in seconds. ECig.ClearTracking() Removes all variables from the graph. ECig.Track(state) Adds a variable to the graph. ECig.IsTracked(state) Returns True if the variable is on the graph. ECig.StopTracking(state) Removes a variable from the graph. Recorder.Record(filename) Starts recording a CSV file. You can't change which variables are on the graph while recording. Recorder.StopRecording() Stops recording a CSV file. Recorder.IsRecording Returns True if the Device Monitor is recording. UI.Message(text) Pops up a message box. The ECig object also has an indexer. x = ECig[state] ECig[state] = y States are strings representing the variables in the device monitor. For example, ECig['Power Set'], ECig['Current'], ECig['Battery Cell 1']. Here is a sample script. It records current, voltage, and power while doing 3-second puffs ranging from 5 to 30 watts: import time ECig.ClearTracking() ECig.Track('Current') ECig.Track('Voltage') ECig.Track('Power') Recorder.Record(r'C:\Users\James\Test.csv') time.sleep(1) for p in xrange(5, 35, 5): ECig['Power Set'] = p ECig.Puff(3) time.sleep(6) Recorder.StopRecording()
Registered: 1435988963 Posts: 43
Reply with quote
This is excellent! I didn't realize it was python. Nice! Thanks for posting this, James!