From 5a0dc278d035350f7a2c2307341f65397bb7560b Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 14 Jan 2020 20:17:43 +0100 Subject: [PATCH] api/nxtdevices: add Energy Meter --- doc/api/nxtdevices.rst | 4 ++++ pybricks/nxtdevices.py | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/doc/api/nxtdevices.rst b/doc/api/nxtdevices.rst index 4b7562d..7ac81de 100644 --- a/doc/api/nxtdevices.rst +++ b/doc/api/nxtdevices.rst @@ -50,3 +50,7 @@ NXT Sound Sensor NXT Temperature Sensor ^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: pybricks.nxtdevices.TemperatureSensor + +NXT Energy Meter +^^^^^^^^^^^^^^^^^ +.. autoclass:: pybricks.nxtdevices.EnergyMeter diff --git a/pybricks/nxtdevices.py b/pybricks/nxtdevices.py index d491331..72d893f 100644 --- a/pybricks/nxtdevices.py +++ b/pybricks/nxtdevices.py @@ -169,3 +169,55 @@ class TemperatureSensor(): """ pass + + +class EnergyMeter(): + """LEGO® MINDSTORMS® Education NXT Energy Meter.""" + + def __init__(self, port): + """ + + Arguments: + port (Port): Port to which the sensor is connected. + + """ + pass + + def storage(self): + """Get the total available energy stored in the battery. + + Returns: + :ref:`energy`: Remaining stored energy. + + """ + pass + + def input(self): + """This measures the electrical signals at the input (bottom) side + of the energy meter. It measures the voltage applied to it and the + current passing through it. The product of these two values is power. + This power value is the rate at which the stored energy increases. This + power is supplied by an energy source such as the provided solar panel + or an externally driven motor. + + Returns: + (:ref:`voltage`, :ref:`current`, :ref:`power`): Voltage, current, + and power measured at the input port. + + """ + pass + + def output(self): + """This measures the electrical signals at the output (top) side + of the energy meter. It measures the voltage applied to the external + load and the current passing to it. The product of these two values + is power. This power value is the rate at which the stored energy + decreases. This power is consumed by the load, such as a light or a + motor. + + Returns: + (:ref:`voltage`, :ref:`current`, :ref:`power`): Voltage, current, + and power measured at the output port. + + """ + pass