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> <br> 10<font color="#ffffff" face="helvetica, arial"> <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 for a USB-connected <a href="#Monsoon">Monsoon</a> power meter.<br> 14 <br> 15<a href="http://msoon.com/LabEquipment/PowerMonitor/">http://msoon.com/LabEquipment/PowerMonitor/</a><br> 16Currently Unix-only. Relies on fcntl, /dev, and /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> <br> 21<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 22 23<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </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> <br> 35<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 36 37<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </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> <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> </tt></td> 59<td colspan=2><tt>Provides a simple class to use the power meter.<br> 60 <br> 61mon = 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 = []<br> 65while len(mydata) < 1000:<br> 66 mydata.extend(mon.<a href="#Monsoon-CollectData">CollectData</a>())<br> 67mon.<a href="#Monsoon-StopDataCollection">StopDataCollection</a>()<br> </tt></td></tr> 68<tr><td> </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 some current samples. Call <a href="#Monsoon-StartDataCollection">StartDataCollection</a>() first.</tt></dd></dl> 71 72<dl><dt><a name="Monsoon-GetStatus"><strong>GetStatus</strong></a>(self)</dt><dd><tt>Requests and waits for status. Returns status dictionary.</tt></dd></dl> 73 74<dl><dt><a name="Monsoon-SetMaxCurrent"><strong>SetMaxCurrent</strong></a>(self, a)</dt><dd><tt>Set the max output current. the unit of |a| : Amperes</tt></dd></dl> 75 76<dl><dt><a name="Monsoon-SetStartupCurrent"><strong>SetStartupCurrent</strong></a>(self, a)</dt><dd><tt>Set the max startup output current. the unit of |a| : Amperes</tt></dd></dl> 77 78<dl><dt><a name="Monsoon-SetUsbPassthrough"><strong>SetUsbPassthrough</strong></a>(self, val)</dt><dd><tt>Set the USB passthrough mode: 0 = off, 1 = on, 2 = auto.</tt></dd></dl> 79 80<dl><dt><a name="Monsoon-SetVoltage"><strong>SetVoltage</strong></a>(self, v)</dt><dd><tt>Set the output voltage, 0 to disable.</tt></dd></dl> 81 82<dl><dt><a name="Monsoon-StartDataCollection"><strong>StartDataCollection</strong></a>(self)</dt><dd><tt>Tell the device to start collecting and sending measurement data.</tt></dd></dl> 83 84<dl><dt><a name="Monsoon-StopDataCollection"><strong>StopDataCollection</strong></a>(self)</dt><dd><tt>Tell the device to stop collecting measurement 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 a connection to a <a href="#Monsoon">Monsoon</a>.<br> 87 <br> 88By default, opens the first available port, waiting if none are ready.<br> 89A particular port can be specified with 'device', or a particular <a href="#Monsoon">Monsoon</a><br> 90can be specified with 'serialno' (using the number printed on its back).<br> 91With wait=False, IOError is thrown if a device is not immediately available.</tt></dd></dl> 92 93<hr> 94Data descriptors defined here:<br> 95<dl><dt><strong>__dict__</strong></dt> 96<dd><tt>dictionary for instance variables (if defined)</tt></dd> 97</dl> 98<dl><dt><strong>__weakref__</strong></dt> 99<dd><tt>list of weak references to the object (if 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> <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> </tt></td> 108<td colspan=2><tt><a href="#Power">Power</a>(amps, volts)<br> </tt></td></tr> 109<tr><td> </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 self as a plain <a href="__builtin__.html#tuple">tuple</a>. Used by copy and pickle.</tt></dd></dl> 118 119<dl><dt><a name="Power-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Exclude the OrderedDict from pickling</tt></dd></dl> 120 121<dl><dt><a name="Power-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return a nicely formatted representation string</tt></dd></dl> 122 123<dl><dt><a name="Power-_asdict"><strong>_asdict</strong></a>(self)</dt><dd><tt>Return a new OrderedDict which maps field names to their values</tt></dd></dl> 124 125<dl><dt><a name="Power-_replace"><strong>_replace</strong></a>(_self, **kwds)</dt><dd><tt>Return a new <a href="#Power">Power</a> <a href="__builtin__.html#object">object</a> replacing specified fields with new 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">=<built-in method __new__ of type object></font>, len<font color="#909090">=<built-in function len></font>)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Make a new <a href="#Power">Power</a> <a href="__builtin__.html#object">object</a> from a sequence or 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 new instance of <a href="#Power">Power</a>(amps, volts)</tt></dd></dl> 134 135<hr> 136Data descriptors defined here:<br> 137<dl><dt><strong>__dict__</strong></dt> 138<dd><tt>Return a new OrderedDict which maps field names to their values</tt></dd> 139</dl> 140<dl><dt><strong>amps</strong></dt> 141<dd><tt>Alias for field number 0</tt></dd> 142</dl> 143<dl><dt><strong>volts</strong></dt> 144<dd><tt>Alias for field number 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) <==> 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) <==> y in 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) <==> 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) <==> x>=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') <==> 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) <==> 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, j) <==> x[i:j]<br> 165 <br> 166Use of negative indices is not 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) <==> x>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>() <==> 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>() <==> 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) <==> x<=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>() <==> 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) <==> x<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) <==> 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) <==> 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) <==> 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>() -- size of T in memory, in 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) -> integer -- return number of occurrences of 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, [start, [stop]]) -> integer -- return first index of value.<br> 191Raises ValueError if the value is not present.</tt></dd></dl> 192 193</td></tr></table></td></tr></table> 194</body></html>