Evolv DNA Forum
Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
James

Avatar / Picture

Administrator
Registered:
Posts: 304
Reply with quote  #1 
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()


AllenH

Member
Registered:
Posts: 43
Reply with quote  #2 
This is excellent!  I didn't realize it was python.  Nice!  Thanks for posting this, James!

-Allen
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.