1
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3<html><head><title>Python: module telemetry.internal.platform.profiler.monsoon</title>
4<meta charset="utf-8">
5</head><body bgcolor="#f0f0f8">
6
7<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
8<tr bgcolor="#7799ee">
9<td valign=bottom>&nbsp;<br>
10<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.internal.html"><font color="#ffffff">internal</font></a>.<a href="telemetry.internal.platform.html"><font color="#ffffff">platform</font></a>.<a href="telemetry.internal.platform.profiler.html"><font color="#ffffff">profiler</font></a>.monsoon</strong></big></big></font></td
11><td align=right valign=bottom
12><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/internal/platform/profiler/monsoon.py">telemetry/internal/platform/profiler/monsoon.py</a></font></td></tr></table>
13    <p><tt>Interface&nbsp;for&nbsp;a&nbsp;USB-connected&nbsp;<a href="#Monsoon">Monsoon</a>&nbsp;power&nbsp;meter.<br>
14&nbsp;<br>
15<a href="http://msoon.com/LabEquipment/PowerMonitor/">http://msoon.com/LabEquipment/PowerMonitor/</a><br>
16Currently&nbsp;Unix-only.&nbsp;Relies&nbsp;on&nbsp;fcntl,&nbsp;/dev,&nbsp;and&nbsp;/tmp.</tt></p>
17<p>
18<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
19<tr bgcolor="#aa55cc">
20<td colspan=3 valign=bottom>&nbsp;<br>
21<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
22
23<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
24<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="collections.html">collections</a><br>
25<a href="logging.html">logging</a><br>
26</td><td width="25%" valign=top><a href="os.html">os</a><br>
27<a href="select.html">select</a><br>
28</td><td width="25%" valign=top><a href="serial.html">serial</a><br>
29<a href="struct.html">struct</a><br>
30</td><td width="25%" valign=top><a href="time.html">time</a><br>
31</td></tr></table></td></tr></table><p>
32<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
33<tr bgcolor="#ee77aa">
34<td colspan=3 valign=bottom>&nbsp;<br>
35<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
36
37<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
38<td width="100%"><dl>
39<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
40</font></dt><dd>
41<dl>
42<dt><font face="helvetica, arial"><a href="telemetry.internal.platform.profiler.monsoon.html#Monsoon">Monsoon</a>
43</font></dt></dl>
44</dd>
45<dt><font face="helvetica, arial"><a href="__builtin__.html#tuple">__builtin__.tuple</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
46</font></dt><dd>
47<dl>
48<dt><font face="helvetica, arial"><a href="telemetry.internal.platform.profiler.monsoon.html#Power">Power</a>
49</font></dt></dl>
50</dd>
51</dl>
52 <p>
53<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
54<tr bgcolor="#ffc8d8">
55<td colspan=3 valign=bottom>&nbsp;<br>
56<font color="#000000" face="helvetica, arial"><a name="Monsoon">class <strong>Monsoon</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
57
58<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
59<td colspan=2><tt>Provides&nbsp;a&nbsp;simple&nbsp;class&nbsp;to&nbsp;use&nbsp;the&nbsp;power&nbsp;meter.<br>
60&nbsp;<br>
61mon&nbsp;=&nbsp;monsoon.<a href="#Monsoon">Monsoon</a>()<br>
62mon.<a href="#Monsoon-SetVoltage">SetVoltage</a>(3.7)<br>
63mon.<a href="#Monsoon-StartDataCollection">StartDataCollection</a>()<br>
64mydata&nbsp;=&nbsp;[]<br>
65while&nbsp;len(mydata)&nbsp;&lt;&nbsp;1000:<br>
66&nbsp;&nbsp;mydata.extend(mon.<a href="#Monsoon-CollectData">CollectData</a>())<br>
67mon.<a href="#Monsoon-StopDataCollection">StopDataCollection</a>()<br>&nbsp;</tt></td></tr>
68<tr><td>&nbsp;</td>
69<td width="100%">Methods defined here:<br>
70<dl><dt><a name="Monsoon-CollectData"><strong>CollectData</strong></a>(self)</dt><dd><tt>Return&nbsp;some&nbsp;current&nbsp;samples.&nbsp;&nbsp;Call&nbsp;<a href="#Monsoon-StartDataCollection">StartDataCollection</a>()&nbsp;first.</tt></dd></dl>
71
72<dl><dt><a name="Monsoon-GetStatus"><strong>GetStatus</strong></a>(self)</dt><dd><tt>Requests&nbsp;and&nbsp;waits&nbsp;for&nbsp;status.&nbsp;&nbsp;Returns&nbsp;status&nbsp;dictionary.</tt></dd></dl>
73
74<dl><dt><a name="Monsoon-SetMaxCurrent"><strong>SetMaxCurrent</strong></a>(self, a)</dt><dd><tt>Set&nbsp;the&nbsp;max&nbsp;output&nbsp;current.&nbsp;the&nbsp;unit&nbsp;of&nbsp;|a|&nbsp;:&nbsp;Amperes</tt></dd></dl>
75
76<dl><dt><a name="Monsoon-SetStartupCurrent"><strong>SetStartupCurrent</strong></a>(self, a)</dt><dd><tt>Set&nbsp;the&nbsp;max&nbsp;startup&nbsp;output&nbsp;current.&nbsp;the&nbsp;unit&nbsp;of&nbsp;|a|&nbsp;:&nbsp;Amperes</tt></dd></dl>
77
78<dl><dt><a name="Monsoon-SetUsbPassthrough"><strong>SetUsbPassthrough</strong></a>(self, val)</dt><dd><tt>Set&nbsp;the&nbsp;USB&nbsp;passthrough&nbsp;mode:&nbsp;0&nbsp;=&nbsp;off,&nbsp;1&nbsp;=&nbsp;on,&nbsp;&nbsp;2&nbsp;=&nbsp;auto.</tt></dd></dl>
79
80<dl><dt><a name="Monsoon-SetVoltage"><strong>SetVoltage</strong></a>(self, v)</dt><dd><tt>Set&nbsp;the&nbsp;output&nbsp;voltage,&nbsp;0&nbsp;to&nbsp;disable.</tt></dd></dl>
81
82<dl><dt><a name="Monsoon-StartDataCollection"><strong>StartDataCollection</strong></a>(self)</dt><dd><tt>Tell&nbsp;the&nbsp;device&nbsp;to&nbsp;start&nbsp;collecting&nbsp;and&nbsp;sending&nbsp;measurement&nbsp;data.</tt></dd></dl>
83
84<dl><dt><a name="Monsoon-StopDataCollection"><strong>StopDataCollection</strong></a>(self)</dt><dd><tt>Tell&nbsp;the&nbsp;device&nbsp;to&nbsp;stop&nbsp;collecting&nbsp;measurement&nbsp;data.</tt></dd></dl>
85
86<dl><dt><a name="Monsoon-__init__"><strong>__init__</strong></a>(self, device<font color="#909090">=None</font>, serialno<font color="#909090">=None</font>, wait<font color="#909090">=True</font>)</dt><dd><tt>Establish&nbsp;a&nbsp;connection&nbsp;to&nbsp;a&nbsp;<a href="#Monsoon">Monsoon</a>.<br>
87&nbsp;<br>
88By&nbsp;default,&nbsp;opens&nbsp;the&nbsp;first&nbsp;available&nbsp;port,&nbsp;waiting&nbsp;if&nbsp;none&nbsp;are&nbsp;ready.<br>
89A&nbsp;particular&nbsp;port&nbsp;can&nbsp;be&nbsp;specified&nbsp;with&nbsp;'device',&nbsp;or&nbsp;a&nbsp;particular&nbsp;<a href="#Monsoon">Monsoon</a><br>
90can&nbsp;be&nbsp;specified&nbsp;with&nbsp;'serialno'&nbsp;(using&nbsp;the&nbsp;number&nbsp;printed&nbsp;on&nbsp;its&nbsp;back).<br>
91With&nbsp;wait=False,&nbsp;IOError&nbsp;is&nbsp;thrown&nbsp;if&nbsp;a&nbsp;device&nbsp;is&nbsp;not&nbsp;immediately&nbsp;available.</tt></dd></dl>
92
93<hr>
94Data descriptors defined here:<br>
95<dl><dt><strong>__dict__</strong></dt>
96<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
97</dl>
98<dl><dt><strong>__weakref__</strong></dt>
99<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
100</dl>
101</td></tr></table> <p>
102<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
103<tr bgcolor="#ffc8d8">
104<td colspan=3 valign=bottom>&nbsp;<br>
105<font color="#000000" face="helvetica, arial"><a name="Power">class <strong>Power</strong></a>(<a href="__builtin__.html#tuple">__builtin__.tuple</a>)</font></td></tr>
106
107<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
108<td colspan=2><tt><a href="#Power">Power</a>(amps,&nbsp;volts)<br>&nbsp;</tt></td></tr>
109<tr><td>&nbsp;</td>
110<td width="100%"><dl><dt>Method resolution order:</dt>
111<dd><a href="telemetry.internal.platform.profiler.monsoon.html#Power">Power</a></dd>
112<dd><a href="__builtin__.html#tuple">__builtin__.tuple</a></dd>
113<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
114</dl>
115<hr>
116Methods defined here:<br>
117<dl><dt><a name="Power-__getnewargs__"><strong>__getnewargs__</strong></a>(self)</dt><dd><tt>Return&nbsp;self&nbsp;as&nbsp;a&nbsp;plain&nbsp;<a href="__builtin__.html#tuple">tuple</a>.&nbsp;&nbsp;Used&nbsp;by&nbsp;copy&nbsp;and&nbsp;pickle.</tt></dd></dl>
118
119<dl><dt><a name="Power-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Exclude&nbsp;the&nbsp;OrderedDict&nbsp;from&nbsp;pickling</tt></dd></dl>
120
121<dl><dt><a name="Power-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;nicely&nbsp;formatted&nbsp;representation&nbsp;string</tt></dd></dl>
122
123<dl><dt><a name="Power-_asdict"><strong>_asdict</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;new&nbsp;OrderedDict&nbsp;which&nbsp;maps&nbsp;field&nbsp;names&nbsp;to&nbsp;their&nbsp;values</tt></dd></dl>
124
125<dl><dt><a name="Power-_replace"><strong>_replace</strong></a>(_self, **kwds)</dt><dd><tt>Return&nbsp;a&nbsp;new&nbsp;<a href="#Power">Power</a>&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;replacing&nbsp;specified&nbsp;fields&nbsp;with&nbsp;new&nbsp;values</tt></dd></dl>
126
127<hr>
128Class methods defined here:<br>
129<dl><dt><a name="Power-_make"><strong>_make</strong></a>(cls, iterable, new<font color="#909090">=&lt;built-in method __new__ of type object&gt;</font>, len<font color="#909090">=&lt;built-in function len&gt;</font>)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Make&nbsp;a&nbsp;new&nbsp;<a href="#Power">Power</a>&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;from&nbsp;a&nbsp;sequence&nbsp;or&nbsp;iterable</tt></dd></dl>
130
131<hr>
132Static methods defined here:<br>
133<dl><dt><a name="Power-__new__"><strong>__new__</strong></a>(_cls, amps, volts)</dt><dd><tt>Create&nbsp;new&nbsp;instance&nbsp;of&nbsp;<a href="#Power">Power</a>(amps,&nbsp;volts)</tt></dd></dl>
134
135<hr>
136Data descriptors defined here:<br>
137<dl><dt><strong>__dict__</strong></dt>
138<dd><tt>Return&nbsp;a&nbsp;new&nbsp;OrderedDict&nbsp;which&nbsp;maps&nbsp;field&nbsp;names&nbsp;to&nbsp;their&nbsp;values</tt></dd>
139</dl>
140<dl><dt><strong>amps</strong></dt>
141<dd><tt>Alias&nbsp;for&nbsp;field&nbsp;number&nbsp;0</tt></dd>
142</dl>
143<dl><dt><strong>volts</strong></dt>
144<dd><tt>Alias&nbsp;for&nbsp;field&nbsp;number&nbsp;1</tt></dd>
145</dl>
146<hr>
147Data and other attributes defined here:<br>
148<dl><dt><strong>_fields</strong> = ('amps', 'volts')</dl>
149
150<hr>
151Methods inherited from <a href="__builtin__.html#tuple">__builtin__.tuple</a>:<br>
152<dl><dt><a name="Power-__add__"><strong>__add__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__add__">__add__</a>(y)&nbsp;&lt;==&gt;&nbsp;x+y</tt></dd></dl>
153
154<dl><dt><a name="Power-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__contains__">__contains__</a>(y)&nbsp;&lt;==&gt;&nbsp;y&nbsp;in&nbsp;x</tt></dd></dl>
155
156<dl><dt><a name="Power-__eq__"><strong>__eq__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__eq__">__eq__</a>(y)&nbsp;&lt;==&gt;&nbsp;x==y</tt></dd></dl>
157
158<dl><dt><a name="Power-__ge__"><strong>__ge__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__ge__">__ge__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;=y</tt></dd></dl>
159
160<dl><dt><a name="Power-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
161
162<dl><dt><a name="Power-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>
163
164<dl><dt><a name="Power-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
165&nbsp;<br>
166Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>
167
168<dl><dt><a name="Power-__gt__"><strong>__gt__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__gt__">__gt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;y</tt></dd></dl>
169
170<dl><dt><a name="Power-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__hash__">__hash__</a>()&nbsp;&lt;==&gt;&nbsp;hash(x)</tt></dd></dl>
171
172<dl><dt><a name="Power-__iter__"><strong>__iter__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__iter__">__iter__</a>()&nbsp;&lt;==&gt;&nbsp;iter(x)</tt></dd></dl>
173
174<dl><dt><a name="Power-__le__"><strong>__le__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__le__">__le__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;=y</tt></dd></dl>
175
176<dl><dt><a name="Power-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__len__">__len__</a>()&nbsp;&lt;==&gt;&nbsp;len(x)</tt></dd></dl>
177
178<dl><dt><a name="Power-__lt__"><strong>__lt__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__lt__">__lt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;y</tt></dd></dl>
179
180<dl><dt><a name="Power-__mul__"><strong>__mul__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__mul__">__mul__</a>(n)&nbsp;&lt;==&gt;&nbsp;x*n</tt></dd></dl>
181
182<dl><dt><a name="Power-__ne__"><strong>__ne__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__ne__">__ne__</a>(y)&nbsp;&lt;==&gt;&nbsp;x!=y</tt></dd></dl>
183
184<dl><dt><a name="Power-__rmul__"><strong>__rmul__</strong></a>(...)</dt><dd><tt>x.<a href="#Power-__rmul__">__rmul__</a>(n)&nbsp;&lt;==&gt;&nbsp;n*x</tt></dd></dl>
185
186<dl><dt><a name="Power-__sizeof__"><strong>__sizeof__</strong></a>(...)</dt><dd><tt>T.<a href="#Power-__sizeof__">__sizeof__</a>()&nbsp;--&nbsp;size&nbsp;of&nbsp;T&nbsp;in&nbsp;memory,&nbsp;in&nbsp;bytes</tt></dd></dl>
187
188<dl><dt><a name="Power-count"><strong>count</strong></a>(...)</dt><dd><tt>T.<a href="#Power-count">count</a>(value)&nbsp;-&gt;&nbsp;integer&nbsp;--&nbsp;return&nbsp;number&nbsp;of&nbsp;occurrences&nbsp;of&nbsp;value</tt></dd></dl>
189
190<dl><dt><a name="Power-index"><strong>index</strong></a>(...)</dt><dd><tt>T.<a href="#Power-index">index</a>(value,&nbsp;[start,&nbsp;[stop]])&nbsp;-&gt;&nbsp;integer&nbsp;--&nbsp;return&nbsp;first&nbsp;index&nbsp;of&nbsp;value.<br>
191Raises&nbsp;ValueError&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;not&nbsp;present.</tt></dd></dl>
192
193</td></tr></table></td></tr></table>
194</body></html>