diff --git a/.buildinfo b/.buildinfo index b602c54..1a047ce 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 04d2f41850cd55ec274beba588f1c8af +config: a5982bb17ea053458b5065f77967bd9b tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/CONTRIBUTING.html b/CONTRIBUTING.html index 3dff60c..df90f5e 100644 --- a/CONTRIBUTING.html +++ b/CONTRIBUTING.html @@ -4,7 +4,7 @@ - Contributing guidelines — PowerSensor 3 1.3.2 documentation + Contributing guidelines — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/INSTALLATION_DEVICE.html b/INSTALLATION_DEVICE.html index 27264c5..1326958 100644 --- a/INSTALLATION_DEVICE.html +++ b/INSTALLATION_DEVICE.html @@ -4,7 +4,7 @@ - Device installation guide — PowerSensor 3 1.3.2 documentation + Device installation guide — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/INSTALLATION_HOST.html b/INSTALLATION_HOST.html index 14e8d73..4e935fc 100644 --- a/INSTALLATION_HOST.html +++ b/INSTALLATION_HOST.html @@ -4,7 +4,7 @@ - Host library installation guide — PowerSensor 3 1.3.2 documentation + Host library installation guide — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/USERGUIDE.html b/USERGUIDE.html index d239761..ebdd4ba 100644 --- a/USERGUIDE.html +++ b/USERGUIDE.html @@ -4,7 +4,7 @@ - User guide — PowerSensor 3 1.3.2 documentation + User guide — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -98,51 +98,54 @@

Configuring PowerSensorpsconfig configures PowerSensor. For each of the up to 8 connected sensors, the type and calibration values can be set. These values are stored on the device’s emulated EEPROM, so configuration only needs to happend once. psconfig can also toggle the attached display and print the current sensor values.

psconfig accepts the parameters as described below. The order of parameters is important. Further on, we give examples of full configuration commands for a typical PowerSensor setup.

$ psconfig -h
-usage: psconfig [-h] [-d device] [-s sensor] [-t type] [-a | -v volt] [-n sensitivity] [-o on/off] [-p] [-l]
+usage: psconfig [-h] [-d device] [-s sensor] [-t type] [-m name] [-a | -v volt] [-n sensitivity] [-x polarity] [-o on/off] [-p]
 -h prints this help
 -d selects the device (default: /dev/ttyACM0)
 -s selects the sensor (0-8)
 -t sets the sensor type. This also sets the sensitivity to the default value if the sensor is of a type known to this programme (see list at the bottom of this help).
+-m sets the sensor pair name. Setting this for either of the sensors of a pair sets the same pair name for both sensors
 -v sets the reference voltage level
--n set the sensitivity in mV/A for current sensors (even sensors) or unitless gain for voltage sensors (odd sensors)
--o turns a sensor on (1) or off (0)
+-a automatically calibrate vref of the current sensor. The input to the sensor must be zero volt or ampere
+-n set the sensitivity in mV/A for current sensors (even sensors) or unitless gain for voltage sensors (odd sensors)
+-x sets the polarity of a sensor. 1 for normal, -1 for inverted
+-o turns a sensor on (1) or off (0)
 -p prints configured values
--l toggles device display on/off
 example: psconfig -d /dev/ttyACM0 -s 0 -t MLX10 -v 1.65 -o 1 -s 1 -t voltage0 -v 0 -n 0.95 -o 1 -p
 Known current sensor types: MLX10, MLX20, MLX50, MLX75.
 

Parameters that are not specified are left unmodified on the device.

- +

The -v values may be adjusted to get the right null levels, depending on the local magnetic field. An easier way to calibrate them, is to fully turn of the host system power (so that no current is flowing through the current sensors), and to configure the PowerSensor from another machine (by temporarily connecting the USB cable to that other machine). In this case, the null levels can be configured automatically. Example when four sensors are connected:

+
$ psconfig -d/dev/ttyACM0 -s 0 -a -s 1 -a -s2 -a -s 3 -a
+
+
+

This feature is especially useful for the current sensors. For voltage sensors, the reference voltage is typically (very close to) zero.

Testing the PowerSensor

To see if the PowerSensor works correctly, one can either use the -p option of psconfig:

$ psconfig -p
-sensor 0 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off
-sensor 1 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off
-sensor 2 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off
-sensor 3 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off
-sensor 4 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off
-sensor 5 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off
-sensor 6 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 62.5 mV/A, Status: on
-sensor 7 (voltage): type: Voltage, Vref: 0 V, Gain: 0.0883871, Status: on
-Current usage pair 0: 0 W
-Current usage pair 1: 0 W
-Current usage pair 2: 0 W
-Current usage pair 3: 28.5437 W
-Total usage: 28.5437 W
+psconfig version 1.3.2
+
+sensor 0, pair 0 (current): type: MLX10, name: NA, Vref: 1.636 V, Sensitivity: 120 mV/A, polarity: 1, Status: off
+sensor 1, pair 0 (voltage): type: voltage, name: NA, Vref: 0 V, Gain: 0.091, polarity: 1, Status: off
+sensor 2, pair 1 (current): type: NA, name: NA, Vref: 0 V, Sensitivity: 0 mV/A, polarity: 1, Status: off
+sensor 3, pair 1 (voltage): type: NA, name: NA, Vref: 0 V, Gain: 0, polarity: 1, Status: off
+sensor 4, pair 2 (current): type: NA, name: NA, Vref: 0 V, Sensitivity: 0 mV/A, polarity: 1, Status: off
+sensor 5, pair 2 (voltage): type: NA, name: NA, Vref: 0 V, Gain: 0, polarity: 1, Status: off
+sensor 6, pair 3 (current): type: MLX10, name: Jetson, Vref: 1.62247 V, Sensitivity: 120 mV/A, polarity: 1, Status: on
+sensor 7, pair 3 (voltage): type: voltage, name: Jetson, Vref: 0 V, Gain: 0.0877, polarity: 1, Status: on
+Current usage pair 0 (sensors 0, 1): 0 W
+Current usage pair 1 (sensors 2, 3): 0 W
+Current usage pair 2 (sensors 4, 5): 0 W
+Current usage pair 3 (sensors 6, 7): 0.0175141 W
+Total usage: 0.0175141 W
 

Or use the pstest utility to measure and report energy consumption for a few seconds. Run pstest -h for more options.

$ pstest
+pstest version 1.3.2
+
 exp. time: 0.0002 s, measured: 0.00571626 s, 0.00114577 J, 0.200441 W
 exp. time: 0.0004 s, measured: 0.000343234 s, 0.0112714 J, 32.8388 W
 exp. time: 0.0008 s, measured: 0.00090007 s, 0.0293691 J, 32.6298 W
@@ -164,7 +167,9 @@ 

Testing the PowerSensor

Monitor power use of an existing application

Adapting an application to use the library is not obligatory; the psrun utility can monitor the power use of a device during the execution of an application that does not use the library. Run psrun -h for more options

-
pstest <application>
+
psrun <application>
+psrun version 1.3.2
+
 < application output >
 5.02273 s, 144.12 J, 28.6935 W
 
diff --git a/_sources/USERGUIDE.md.txt b/_sources/USERGUIDE.md.txt index 751f656..c2398aa 100644 --- a/_sources/USERGUIDE.md.txt +++ b/_sources/USERGUIDE.md.txt @@ -8,54 +8,59 @@ Please make sure that the PowerSensor is installed correctly by completing the [ ``` $ psconfig -h -usage: psconfig [-h] [-d device] [-s sensor] [-t type] [-a | -v volt] [-n sensitivity] [-o on/off] [-p] [-l] +usage: psconfig [-h] [-d device] [-s sensor] [-t type] [-m name] [-a | -v volt] [-n sensitivity] [-x polarity] [-o on/off] [-p] -h prints this help -d selects the device (default: /dev/ttyACM0) -s selects the sensor (0-8) -t sets the sensor type. This also sets the sensitivity to the default value if the sensor is of a type known to this programme (see list at the bottom of this help). +-m sets the sensor pair name. Setting this for either of the sensors of a pair sets the same pair name for both sensors -v sets the reference voltage level +-a automatically calibrate vref of the current sensor. The input to the sensor must be zero volt or ampere -n set the sensitivity in mV/A for current sensors (even sensors) or unitless gain for voltage sensors (odd sensors) +-x sets the polarity of a sensor. 1 for normal, -1 for inverted -o turns a sensor on (1) or off (0) -p prints configured values --l toggles device display on/off example: psconfig -d /dev/ttyACM0 -s 0 -t MLX10 -v 1.65 -o 1 -s 1 -t voltage0 -v 0 -n 0.95 -o 1 -p Known current sensor types: MLX10, MLX20, MLX50, MLX75. ``` Parameters that are not specified are left unmodified on the device. - + +This feature is especially useful for the current sensors. For voltage sensors, the reference voltage is typically (very close to) zero. ## Testing the PowerSensor To see if the PowerSensor works correctly, one can either use the `-p` option of `psconfig`: ``` $ psconfig -p -sensor 0 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off -sensor 1 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off -sensor 2 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off -sensor 3 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off -sensor 4 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 0 mV/A, Status: off -sensor 5 (voltage): type: Voltage, Vref: 0 V, Gain: 0, Status: off -sensor 6 (current): type: MLX20, Vref: 1.63871 V, Sensitivity: 62.5 mV/A, Status: on -sensor 7 (voltage): type: Voltage, Vref: 0 V, Gain: 0.0883871, Status: on -Current usage pair 0: 0 W -Current usage pair 1: 0 W -Current usage pair 2: 0 W -Current usage pair 3: 28.5437 W -Total usage: 28.5437 W +psconfig version 1.3.2 + +sensor 0, pair 0 (current): type: MLX10, name: NA, Vref: 1.636 V, Sensitivity: 120 mV/A, polarity: 1, Status: off +sensor 1, pair 0 (voltage): type: voltage, name: NA, Vref: 0 V, Gain: 0.091, polarity: 1, Status: off +sensor 2, pair 1 (current): type: NA, name: NA, Vref: 0 V, Sensitivity: 0 mV/A, polarity: 1, Status: off +sensor 3, pair 1 (voltage): type: NA, name: NA, Vref: 0 V, Gain: 0, polarity: 1, Status: off +sensor 4, pair 2 (current): type: NA, name: NA, Vref: 0 V, Sensitivity: 0 mV/A, polarity: 1, Status: off +sensor 5, pair 2 (voltage): type: NA, name: NA, Vref: 0 V, Gain: 0, polarity: 1, Status: off +sensor 6, pair 3 (current): type: MLX10, name: Jetson, Vref: 1.62247 V, Sensitivity: 120 mV/A, polarity: 1, Status: on +sensor 7, pair 3 (voltage): type: voltage, name: Jetson, Vref: 0 V, Gain: 0.0877, polarity: 1, Status: on +Current usage pair 0 (sensors 0, 1): 0 W +Current usage pair 1 (sensors 2, 3): 0 W +Current usage pair 2 (sensors 4, 5): 0 W +Current usage pair 3 (sensors 6, 7): 0.0175141 W +Total usage: 0.0175141 W ``` Or use the `pstest` utility to measure and report energy consumption for a few seconds. Run `pstest -h` for more options. ``` $ pstest +pstest version 1.3.2 + exp. time: 0.0002 s, measured: 0.00571626 s, 0.00114577 J, 0.200441 W exp. time: 0.0004 s, measured: 0.000343234 s, 0.0112714 J, 32.8388 W exp. time: 0.0008 s, measured: 0.00090007 s, 0.0293691 J, 32.6298 W @@ -76,7 +81,9 @@ exp. time: 3.2768 s, measured: 3.27701 s, 93.377 J, 28.4946 W ## Monitor power use of an existing application Adapting an application to use the library is not obligatory; the `psrun` utility can monitor the power use of a device during the execution of an application that does not use the library. Run `psrun -h` for more options ``` -pstest +psrun +psrun version 1.3.2 + < application output > 5.02273 s, 144.12 J, 28.6935 W ``` @@ -128,4 +135,4 @@ start = ps.read() stop = ps.read() print(f'{ps.Joules(start, stop):.2f}J, {ps.seconds(start, stop):.2f}s, {ps.Watt(start, stop):.2f}W') -``` \ No newline at end of file +``` diff --git a/_sources/api/program_listing_file_host_include_PowerSensor.hpp.rst.txt b/_sources/api/program_listing_file_host_include_PowerSensor.hpp.rst.txt index 66ea92a..4db6236 100644 --- a/_sources/api/program_listing_file_host_include_PowerSensor.hpp.rst.txt +++ b/_sources/api/program_listing_file_host_include_PowerSensor.hpp.rst.txt @@ -29,7 +29,7 @@ Program Listing for File PowerSensor.hpp static const unsigned MAX_PAIRS = MAX_SENSORS / 2; static const float VOLTAGE = 3.3; static const unsigned MAX_LEVEL = 1023; - static const std::string POWERSENSOR_VERSION = "1.3.2"; + static const std::string POWERSENSOR_VERSION = "1.3.3"; struct State { std::array consumedEnergy; @@ -59,12 +59,14 @@ Program Listing for File PowerSensor.hpp void setVref(unsigned int sensorID, const float vref); void setSensitivity(unsigned int sensorID, const float slope); void setInUse(unsigned int sensorID, const bool inUse); + void setPolarity(unsigned int sensorID, const int polarity); std::string getType(unsigned int sensorID) const; std::string getPairName(unsigned int pairID) const; float getVref(unsigned int sensorID) const; float getSensitivity(unsigned int sensorID) const; bool getInUse(unsigned int sensorID) const; + int getPolarity(unsigned int sensorID) const; private: static const unsigned MAX_TYPE_LENGTH = 16; @@ -120,6 +122,7 @@ Program Listing for File PowerSensor.hpp void setVref(const float vref); void setSensitivity(const float slope); void setInUse(const bool inUse); + void setPolarity(const int polarity); double getValue() const; void readFromEEPROM(int fd); void writeToEEPROM(int fd) const; diff --git a/_sources/api/program_listing_file_host_src_PowerSensor.cc.rst.txt b/_sources/api/program_listing_file_host_src_PowerSensor.cc.rst.txt index ad52346..6dd6966 100644 --- a/_sources/api/program_listing_file_host_src_PowerSensor.cc.rst.txt +++ b/_sources/api/program_listing_file_host_src_PowerSensor.cc.rst.txt @@ -458,13 +458,25 @@ Program Listing for File PowerSensor.cc } float PowerSensor::getSensitivity(unsigned int sensorID) const { - return sensors[sensorID].sensitivity; + // negative sensitivity corresponds to inverted polarity + // polarity is considered a separate variable instead so we return the abs value here + return std::abs(sensors[sensorID].sensitivity); } bool PowerSensor::getInUse(unsigned int sensorID) const { return sensors[sensorID].inUse; } + int PowerSensor::getPolarity(unsigned int sensorID) const { + int polarity; + if (sensors[sensorID].sensitivity >= 0) { + polarity = 1; + } else { + polarity = -1; + } + return polarity; + } + void PowerSensor::setType(unsigned int sensorID, const std::string type) { sensors[sensorID].setType(type); } @@ -488,4 +500,8 @@ Program Listing for File PowerSensor.cc sensors[sensorID].setInUse(inUse); } + void PowerSensor::setPolarity(unsigned int sensorID, const int polarity) { + sensors[sensorID].setPolarity(polarity); + } + } // namespace PowerSensor3 diff --git a/_sources/api/program_listing_file_host_src_sensors.cc.rst.txt b/_sources/api/program_listing_file_host_src_sensors.cc.rst.txt index 1a42d36..3a04be7 100644 --- a/_sources/api/program_listing_file_host_src_sensors.cc.rst.txt +++ b/_sources/api/program_listing_file_host_src_sensors.cc.rst.txt @@ -118,4 +118,15 @@ Program Listing for File sensors.cc this->inUse = inUse; } + void PowerSensor::Sensor::setPolarity(const int polarity) { + if (polarity == 1) { + this->sensitivity = std::abs(this->sensitivity); + } else if (polarity == -1) { + this->sensitivity = -std::abs(this->sensitivity); + } else { + std::cerr << "Polarity must be -1 or 1, got " << polarity << std::endl; + exit(1); + } + } + } // namespace PowerSensor3 diff --git a/_static/basic.css b/_static/basic.css index 7577acb..cfc60b8 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -670,6 +670,16 @@ dd { margin-left: 30px; } +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + dl > dd:last-child, dl > dd:last-child > :last-child { margin-bottom: 0; @@ -738,6 +748,14 @@ abbr, acronym { cursor: help; } +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + /* -- code displays --------------------------------------------------------- */ pre { diff --git a/_static/documentation_options.js b/_static/documentation_options.js index 69e84c9..69eeb02 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '1.3.2', + VERSION: '1.3.3', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/_static/pygments.css b/_static/pygments.css index 08bec68..84ab303 100644 --- a/_static/pygments.css +++ b/_static/pygments.css @@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: .highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #E40000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #008400 } /* Generic.Inserted */ diff --git a/api/classPowerSensor3_1_1PowerSensor.html b/api/classPowerSensor3_1_1PowerSensor.html index f04bcd9..8a2051e 100644 --- a/api/classPowerSensor3_1_1PowerSensor.html +++ b/api/classPowerSensor3_1_1PowerSensor.html @@ -4,7 +4,7 @@ - Class PowerSensor — PowerSensor 3 1.3.2 documentation + Class PowerSensor — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -251,6 +251,20 @@

Class Documentation +
+void setPolarity(unsigned int sensorID, const int polarity)
+

Set polarity of given sensor.

+
+
Parameters:
+
    +
  • sensorID

  • +
  • polarity – (-1 or 1)

  • +
+
+
+
+
std::string getType(unsigned int sensorID) const
@@ -321,6 +335,20 @@

Class Documentation +
+int getPolarity(unsigned int sensorID) const
+

Get polarity of given sensor.

+
+
Parameters:
+

sensorID

+
+
Returns:
+

int (-1 or 1)

+
+
+

+

diff --git a/api/classPowerSensor3_1_1Semaphore.html b/api/classPowerSensor3_1_1Semaphore.html index dc50f6f..fabbe69 100644 --- a/api/classPowerSensor3_1_1Semaphore.html +++ b/api/classPowerSensor3_1_1Semaphore.html @@ -4,7 +4,7 @@ - Class Semaphore — PowerSensor 3 1.3.2 documentation + Class Semaphore — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/class_view_hierarchy.html b/api/class_view_hierarchy.html index 2a0c421..aad3815 100644 --- a/api/class_view_hierarchy.html +++ b/api/class_view_hierarchy.html @@ -4,7 +4,7 @@ - Class Hierarchy — PowerSensor 3 1.3.2 documentation + Class Hierarchy — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/dir_host.html b/api/dir_host.html index 8c6c9b5..d61d2b4 100644 --- a/api/dir_host.html +++ b/api/dir_host.html @@ -4,7 +4,7 @@ - Directory host — PowerSensor 3 1.3.2 documentation + Directory host — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/dir_host_include.html b/api/dir_host_include.html index 2006af5..17e9da6 100644 --- a/api/dir_host_include.html +++ b/api/dir_host_include.html @@ -4,7 +4,7 @@ - Directory include — PowerSensor 3 1.3.2 documentation + Directory include — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/dir_host_src.html b/api/dir_host_src.html index 3f2d9e7..7cfb3b0 100644 --- a/api/dir_host_src.html +++ b/api/dir_host_src.html @@ -4,7 +4,7 @@ - Directory src — PowerSensor 3 1.3.2 documentation + Directory src — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/file_host_include_PowerSensor.hpp.html b/api/file_host_include_PowerSensor.hpp.html index d14d466..deeab27 100644 --- a/api/file_host_include_PowerSensor.hpp.html +++ b/api/file_host_include_PowerSensor.hpp.html @@ -4,7 +4,7 @@ - File PowerSensor.hpp — PowerSensor 3 1.3.2 documentation + File PowerSensor.hpp — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/file_host_include_Semaphore.hpp.html b/api/file_host_include_Semaphore.hpp.html index 5e95288..0c46d85 100644 --- a/api/file_host_include_Semaphore.hpp.html +++ b/api/file_host_include_Semaphore.hpp.html @@ -4,7 +4,7 @@ - File Semaphore.hpp — PowerSensor 3 1.3.2 documentation + File Semaphore.hpp — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/file_host_src_PowerSensor.cc.html b/api/file_host_src_PowerSensor.cc.html index 830316f..7888b92 100644 --- a/api/file_host_src_PowerSensor.cc.html +++ b/api/file_host_src_PowerSensor.cc.html @@ -4,7 +4,7 @@ - File PowerSensor.cc — PowerSensor 3 1.3.2 documentation + File PowerSensor.cc — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/file_host_src_sensors.cc.html b/api/file_host_src_sensors.cc.html index 968d4d9..69a7b00 100644 --- a/api/file_host_src_sensors.cc.html +++ b/api/file_host_src_sensors.cc.html @@ -4,7 +4,7 @@ - File sensors.cc — PowerSensor 3 1.3.2 documentation + File sensors.cc — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/file_view_hierarchy.html b/api/file_view_hierarchy.html index 66b3251..4f668a2 100644 --- a/api/file_view_hierarchy.html +++ b/api/file_view_hierarchy.html @@ -4,7 +4,7 @@ - File Hierarchy — PowerSensor 3 1.3.2 documentation + File Hierarchy — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/function_PowerSensor_8cc_1ad2274f347f0f7850aaeb575d09009619.html b/api/function_PowerSensor_8cc_1ad2274f347f0f7850aaeb575d09009619.html index 5c08781..5848aaf 100644 --- a/api/function_PowerSensor_8cc_1ad2274f347f0f7850aaeb575d09009619.html +++ b/api/function_PowerSensor_8cc_1ad2274f347f0f7850aaeb575d09009619.html @@ -4,7 +4,7 @@ - Function PowerSensor3::checkPairID — PowerSensor 3 1.3.2 documentation + Function PowerSensor3::checkPairID — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/function_PowerSensor_8hpp_1ac2ce7d60c052fe85935d22394913de14.html b/api/function_PowerSensor_8hpp_1ac2ce7d60c052fe85935d22394913de14.html index a5090a4..9344b5b 100644 --- a/api/function_PowerSensor_8hpp_1ac2ce7d60c052fe85935d22394913de14.html +++ b/api/function_PowerSensor_8hpp_1ac2ce7d60c052fe85935d22394913de14.html @@ -4,7 +4,7 @@ - Function PowerSensor3::Watt — PowerSensor 3 1.3.2 documentation + Function PowerSensor3::Watt — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/function_PowerSensor_8hpp_1ae490411ea64641cf23f9ee5c17c3d31f.html b/api/function_PowerSensor_8hpp_1ae490411ea64641cf23f9ee5c17c3d31f.html index ffbe81a..e9ef0aa 100644 --- a/api/function_PowerSensor_8hpp_1ae490411ea64641cf23f9ee5c17c3d31f.html +++ b/api/function_PowerSensor_8hpp_1ae490411ea64641cf23f9ee5c17c3d31f.html @@ -4,7 +4,7 @@ - Function PowerSensor3::Joules — PowerSensor 3 1.3.2 documentation + Function PowerSensor3::Joules — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/function_PowerSensor_8hpp_1ae6fc94932b6a4aef443528c842404a04.html b/api/function_PowerSensor_8hpp_1ae6fc94932b6a4aef443528c842404a04.html index 010ab23..7d69e32 100644 --- a/api/function_PowerSensor_8hpp_1ae6fc94932b6a4aef443528c842404a04.html +++ b/api/function_PowerSensor_8hpp_1ae6fc94932b6a4aef443528c842404a04.html @@ -4,7 +4,7 @@ - Function PowerSensor3::seconds — PowerSensor 3 1.3.2 documentation + Function PowerSensor3::seconds — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/library_root.html b/api/library_root.html index 9fd4fcc..1927aef 100644 --- a/api/library_root.html +++ b/api/library_root.html @@ -4,7 +4,7 @@ - Class Hierarchy — PowerSensor 3 1.3.2 documentation + Class Hierarchy — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/namespace_PowerSensor3.html b/api/namespace_PowerSensor3.html index b9543f3..475cb86 100644 --- a/api/namespace_PowerSensor3.html +++ b/api/namespace_PowerSensor3.html @@ -4,7 +4,7 @@ - Namespace PowerSensor3 — PowerSensor 3 1.3.2 documentation + Namespace PowerSensor3 — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/page_view_hierarchy.html b/api/page_view_hierarchy.html index b1ec14d..a1e7848 100644 --- a/api/page_view_hierarchy.html +++ b/api/page_view_hierarchy.html @@ -4,7 +4,7 @@ - <no title> — PowerSensor 3 1.3.2 documentation + <no title> — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/program_listing_file_host_include_PowerSensor.hpp.html b/api/program_listing_file_host_include_PowerSensor.hpp.html index 18f30bc..a8cdce0 100644 --- a/api/program_listing_file_host_include_PowerSensor.hpp.html +++ b/api/program_listing_file_host_include_PowerSensor.hpp.html @@ -4,7 +4,7 @@ - Program Listing for File PowerSensor.hpp — PowerSensor 3 1.3.2 documentation + Program Listing for File PowerSensor.hpp — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -103,7 +103,7 @@ static const unsigned MAX_PAIRS = MAX_SENSORS / 2; static const float VOLTAGE = 3.3; static const unsigned MAX_LEVEL = 1023; -static const std::string POWERSENSOR_VERSION = "1.3.2"; +static const std::string POWERSENSOR_VERSION = "1.3.3"; struct State { std::array<double, MAX_PAIRS> consumedEnergy; @@ -133,12 +133,14 @@ void setVref(unsigned int sensorID, const float vref); void setSensitivity(unsigned int sensorID, const float slope); void setInUse(unsigned int sensorID, const bool inUse); + void setPolarity(unsigned int sensorID, const int polarity); std::string getType(unsigned int sensorID) const; std::string getPairName(unsigned int pairID) const; float getVref(unsigned int sensorID) const; float getSensitivity(unsigned int sensorID) const; bool getInUse(unsigned int sensorID) const; + int getPolarity(unsigned int sensorID) const; private: static const unsigned MAX_TYPE_LENGTH = 16; @@ -194,6 +196,7 @@ void setVref(const float vref); void setSensitivity(const float slope); void setInUse(const bool inUse); + void setPolarity(const int polarity); double getValue() const; void readFromEEPROM(int fd); void writeToEEPROM(int fd) const; diff --git a/api/program_listing_file_host_include_Semaphore.hpp.html b/api/program_listing_file_host_include_Semaphore.hpp.html index 4a12200..0e1652c 100644 --- a/api/program_listing_file_host_include_Semaphore.hpp.html +++ b/api/program_listing_file_host_include_Semaphore.hpp.html @@ -4,7 +4,7 @@ - Program Listing for File Semaphore.hpp — PowerSensor 3 1.3.2 documentation + Program Listing for File Semaphore.hpp — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/program_listing_file_host_src_PowerSensor.cc.html b/api/program_listing_file_host_src_PowerSensor.cc.html index 2605a5d..085cbca 100644 --- a/api/program_listing_file_host_src_PowerSensor.cc.html +++ b/api/program_listing_file_host_src_PowerSensor.cc.html @@ -4,7 +4,7 @@ - Program Listing for File PowerSensor.cc — PowerSensor 3 1.3.2 documentation + Program Listing for File PowerSensor.cc — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -532,13 +532,25 @@ } float PowerSensor::getSensitivity(unsigned int sensorID) const { - return sensors[sensorID].sensitivity; + // negative sensitivity corresponds to inverted polarity + // polarity is considered a separate variable instead so we return the abs value here + return std::abs(sensors[sensorID].sensitivity); } bool PowerSensor::getInUse(unsigned int sensorID) const { return sensors[sensorID].inUse; } + int PowerSensor::getPolarity(unsigned int sensorID) const { + int polarity; + if (sensors[sensorID].sensitivity >= 0) { + polarity = 1; + } else { + polarity = -1; + } + return polarity; + } + void PowerSensor::setType(unsigned int sensorID, const std::string type) { sensors[sensorID].setType(type); } @@ -562,6 +574,10 @@ sensors[sensorID].setInUse(inUse); } + void PowerSensor::setPolarity(unsigned int sensorID, const int polarity) { + sensors[sensorID].setPolarity(polarity); + } + } // namespace PowerSensor3
diff --git a/api/program_listing_file_host_src_sensors.cc.html b/api/program_listing_file_host_src_sensors.cc.html index d8dd6cc..7a3b11f 100644 --- a/api/program_listing_file_host_src_sensors.cc.html +++ b/api/program_listing_file_host_src_sensors.cc.html @@ -4,7 +4,7 @@ - Program Listing for File sensors.cc — PowerSensor 3 1.3.2 documentation + Program Listing for File sensors.cc — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -192,6 +192,17 @@ this->inUse = inUse; } +void PowerSensor::Sensor::setPolarity(const int polarity) { + if (polarity == 1) { + this->sensitivity = std::abs(this->sensitivity); + } else if (polarity == -1) { + this->sensitivity = -std::abs(this->sensitivity); + } else { + std::cerr << "Polarity must be -1 or 1, got " << polarity << std::endl; + exit(1); + } +} + } // namespace PowerSensor3

diff --git a/api/structPowerSensor3_1_1PowerSensor_1_1Sensor.html b/api/structPowerSensor3_1_1PowerSensor_1_1Sensor.html index ebe9ce0..66e7b95 100644 --- a/api/structPowerSensor3_1_1PowerSensor_1_1Sensor.html +++ b/api/structPowerSensor3_1_1PowerSensor_1_1Sensor.html @@ -4,7 +4,7 @@ - Struct PowerSensor::Sensor — PowerSensor 3 1.3.2 documentation + Struct PowerSensor::Sensor — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -166,6 +166,17 @@

Struct Documentation +
+
+void setPolarity(const int polarity)
+

Set polarity of sensor.

+
+
Parameters:
+

polarity – (-1 or 1)

+
+
+
+
double getValue() const
diff --git a/api/structPowerSensor3_1_1PowerSensor_1_1SensorPair.html b/api/structPowerSensor3_1_1PowerSensor_1_1SensorPair.html index cf3e028..8b04075 100644 --- a/api/structPowerSensor3_1_1PowerSensor_1_1SensorPair.html +++ b/api/structPowerSensor3_1_1PowerSensor_1_1SensorPair.html @@ -4,7 +4,7 @@ - Struct PowerSensor::SensorPair — PowerSensor 3 1.3.2 documentation + Struct PowerSensor::SensorPair — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/structPowerSensor3_1_1PowerSensor_1_1Sensor_1_1EEPROM.html b/api/structPowerSensor3_1_1PowerSensor_1_1Sensor_1_1EEPROM.html index 533d766..c0b2849 100644 --- a/api/structPowerSensor3_1_1PowerSensor_1_1Sensor_1_1EEPROM.html +++ b/api/structPowerSensor3_1_1PowerSensor_1_1Sensor_1_1EEPROM.html @@ -4,7 +4,7 @@ - Struct Sensor::EEPROM — PowerSensor 3 1.3.2 documentation + Struct Sensor::EEPROM — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/structPowerSensor3_1_1State.html b/api/structPowerSensor3_1_1State.html index 21763e2..716b44b 100644 --- a/api/structPowerSensor3_1_1State.html +++ b/api/structPowerSensor3_1_1State.html @@ -4,7 +4,7 @@ - Struct State — PowerSensor 3 1.3.2 documentation + Struct State — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/unabridged_api.html b/api/unabridged_api.html index 05aa1c9..0397557 100644 --- a/api/unabridged_api.html +++ b/api/unabridged_api.html @@ -4,7 +4,7 @@ - Full API — PowerSensor 3 1.3.2 documentation + Full API — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/unabridged_orphan.html b/api/unabridged_orphan.html index cc09b55..918f175 100644 --- a/api/unabridged_orphan.html +++ b/api/unabridged_orphan.html @@ -4,7 +4,7 @@ - Full API — PowerSensor 3 1.3.2 documentation + Full API — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1a0937b653999b14c16d75fc408f4dce05.html b/api/variable_PowerSensor_8hpp_1a0937b653999b14c16d75fc408f4dce05.html index d88ba5b..952c97a 100644 --- a/api/variable_PowerSensor_8hpp_1a0937b653999b14c16d75fc408f4dce05.html +++ b/api/variable_PowerSensor_8hpp_1a0937b653999b14c16d75fc408f4dce05.html @@ -4,7 +4,7 @@ - Variable inUse — PowerSensor 3 1.3.2 documentation + Variable inUse — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1a3671c548db820b579e96778fbb9c583d.html b/api/variable_PowerSensor_8hpp_1a3671c548db820b579e96778fbb9c583d.html index b32a793..339e010 100644 --- a/api/variable_PowerSensor_8hpp_1a3671c548db820b579e96778fbb9c583d.html +++ b/api/variable_PowerSensor_8hpp_1a3671c548db820b579e96778fbb9c583d.html @@ -4,7 +4,7 @@ - Variable PowerSensor3::MAX_PAIRS — PowerSensor 3 1.3.2 documentation + Variable PowerSensor3::MAX_PAIRS — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1a4363b65a393b0ca493fa20d6c1e244c2.html b/api/variable_PowerSensor_8hpp_1a4363b65a393b0ca493fa20d6c1e244c2.html index 20e17cf..e1937fa 100644 --- a/api/variable_PowerSensor_8hpp_1a4363b65a393b0ca493fa20d6c1e244c2.html +++ b/api/variable_PowerSensor_8hpp_1a4363b65a393b0ca493fa20d6c1e244c2.html @@ -4,7 +4,7 @@ - Variable vref — PowerSensor 3 1.3.2 documentation + Variable vref — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752.html b/api/variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752.html index fec9775..73dfa5a 100644 --- a/api/variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752.html +++ b/api/variable_PowerSensor_8hpp_1a4c021e360fe90ac735ac7eb7aaf57752.html @@ -4,7 +4,7 @@ - Variable PowerSensor3::MAX_SENSORS — PowerSensor 3 1.3.2 documentation + Variable PowerSensor3::MAX_SENSORS — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1ab69949bfe080f3ea38645f0ff58ac91e.html b/api/variable_PowerSensor_8hpp_1ab69949bfe080f3ea38645f0ff58ac91e.html index 580fb91..1b0530c 100644 --- a/api/variable_PowerSensor_8hpp_1ab69949bfe080f3ea38645f0ff58ac91e.html +++ b/api/variable_PowerSensor_8hpp_1ab69949bfe080f3ea38645f0ff58ac91e.html @@ -4,7 +4,7 @@ - Variable type — PowerSensor 3 1.3.2 documentation + Variable type — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1ac518d2e94791ccc6f84de95271e52c76.html b/api/variable_PowerSensor_8hpp_1ac518d2e94791ccc6f84de95271e52c76.html index 13960f3..4cd0ef6 100644 --- a/api/variable_PowerSensor_8hpp_1ac518d2e94791ccc6f84de95271e52c76.html +++ b/api/variable_PowerSensor_8hpp_1ac518d2e94791ccc6f84de95271e52c76.html @@ -4,7 +4,7 @@ - Variable sensitivity — PowerSensor 3 1.3.2 documentation + Variable sensitivity — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1ad5f19dbc0cf42a2013d721d67522821c.html b/api/variable_PowerSensor_8hpp_1ad5f19dbc0cf42a2013d721d67522821c.html index b646d9e..af3c923 100644 --- a/api/variable_PowerSensor_8hpp_1ad5f19dbc0cf42a2013d721d67522821c.html +++ b/api/variable_PowerSensor_8hpp_1ad5f19dbc0cf42a2013d721d67522821c.html @@ -4,7 +4,7 @@ - Variable pairName — PowerSensor 3 1.3.2 documentation + Variable pairName — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1adfbb9cfc8c3d695ba1444d7048257ee4.html b/api/variable_PowerSensor_8hpp_1adfbb9cfc8c3d695ba1444d7048257ee4.html index c90bccf..8797cff 100644 --- a/api/variable_PowerSensor_8hpp_1adfbb9cfc8c3d695ba1444d7048257ee4.html +++ b/api/variable_PowerSensor_8hpp_1adfbb9cfc8c3d695ba1444d7048257ee4.html @@ -4,7 +4,7 @@ - Variable PowerSensor3::MAX_LEVEL — PowerSensor 3 1.3.2 documentation + Variable PowerSensor3::MAX_LEVEL — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a.html b/api/variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a.html index ad372d8..b04892f 100644 --- a/api/variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a.html +++ b/api/variable_PowerSensor_8hpp_1ae0c4657f6b5d13ad46465ee685a1fb1a.html @@ -4,7 +4,7 @@ - Variable PowerSensor3::VOLTAGE — PowerSensor 3 1.3.2 documentation + Variable PowerSensor3::VOLTAGE — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + diff --git a/api/variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056.html b/api/variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056.html index 3e81950..73ebdbe 100644 --- a/api/variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056.html +++ b/api/variable_PowerSensor_8hpp_1af9abdd8d4a87b5a2eb33f1f06a147056.html @@ -4,7 +4,7 @@ - Variable PowerSensor3::POWERSENSOR_VERSION — PowerSensor 3 1.3.2 documentation + Variable PowerSensor3::POWERSENSOR_VERSION — PowerSensor 3 1.3.3 documentation @@ -12,13 +12,13 @@ - - - - - - - + + + + + + + @@ -93,7 +93,7 @@

Variable Documentation

-static const std::string PowerSensor3::POWERSENSOR_VERSION = "1.3.2"
+static const std::string PowerSensor3::POWERSENSOR_VERSION = "1.3.3"

diff --git a/genindex.html b/genindex.html index cba05ce..08d4f3e 100644 --- a/genindex.html +++ b/genindex.html @@ -3,7 +3,7 @@ - Index — PowerSensor 3 1.3.2 documentation + Index — PowerSensor 3 1.3.3 documentation @@ -11,13 +11,13 @@ - - - - - - - + + + + + + + @@ -106,6 +106,8 @@

P

  • PowerSensor3::PowerSensor::getInUse (C++ function)
  • PowerSensor3::PowerSensor::getPairName (C++ function) +
  • +
  • PowerSensor3::PowerSensor::getPolarity (C++ function)
  • PowerSensor3::PowerSensor::getSensitivity (C++ function)
  • @@ -151,12 +153,14 @@

    P

  • PowerSensor3::PowerSensor::Sensor::setPairName (C++ function)
  • -
  • PowerSensor3::PowerSensor::Sensor::setSensitivity (C++ function) +
  • PowerSensor3::PowerSensor::Sensor::setPolarity (C++ function)
  • -
  • PowerSensor3::PowerSensor::Sensor::setType (C++ function) +
  • PowerSensor3::PowerSensor::Sensor::setSensitivity (C++ function)