diff --git a/device/device.py b/device/device.py index ec557c420779257d3164392a3962dcd2cba476a6..ac5445670f9f9de796b52b38abd20fbd772a863a 100644 --- a/device/device.py +++ b/device/device.py @@ -2,6 +2,9 @@ class Device: __voltage = 0.0 __current = 0.0 + voltage = None + current = None + def __init__(self): # code to connect to device self.__voltage = 1.0 @@ -10,6 +13,7 @@ class Device: def _get_voltage(self): # read voltage from device voltage = self.__voltage + self.voltage = voltage return voltage def _set_voltage(self, new_voltage): @@ -19,14 +23,15 @@ class Device: def _get_current(self): # read current from device current = self.__curent + self.current = current return current def _set_current(self, new_current): # write current to device - self.__curent = new_current + self.__current = new_current def _calculate_resistance(self): - current = self._get_current() - voltage = self._get_voltage() + current = self.current + voltage = self.voltage resistance = voltage / current return resistance