# to 0x49. Not sure why but I'll mask them out
# so that we don't get invalid month errors.
self.__year = year
-# self.__costPerKWH = cost
self.__amps = amps
self.__realTime = False #Changes to True when realtime data is being read
def getSecond(self):
return self.__sec
-# def getCostPerKWH(self):
-# return self.__costPerKWH
-
def getAmps(self):
return self.__amps
self.__month = CM160Data.LAST_VALID_MONTH
def getCompatDateStr(self):
- """Get the date as a string in the same format the original C# based
- OWLServer used"""
+ """Get the date as a string in the same format the original C# based OWLServer used"""
return "%04d-%02d-%02d %02d:%02d:%02d" % (self.__year, self.__month, self.__day, self.__hour, self.__min, self.__sec)
def getCompatStr(self):
if len(elems) == 4:
try:
self.__amps = float(elems[2])
-# self.__costPerKWH = float(elems[3])
t = elems[0]
d = elems[1]
dateElems = d.split("/")
return loaded
def sameMin(self, cm160Data):
- """Return True if the cm160Data has the same year, day, month, hour and min
- as this object"""
+ """Return True if the cm160Data has the same year, day, month, hour and min as this object"""
if cm160Data == None:
return False
if self.__year == cm160Data.getYear() and\
return False
def after(self, cm160Data):
- """Return True if the data held in this (self) object has a later date/time
- than the data held in the cm160Data object"""
+ """Return True if the data held in this (self) object has a later date/time than the data held in the cm160Data object"""
#If we don't have a CM160Data object
if cm160Data == None:
#We can't say it's after
return False
def between(self, startTime, stopTime):
- """Return True if the data held in this (self) object is between
- startTime and stopTime.
- Also returns true if equal to either startTime and stopTime.
- """
+ """Return True if the data held in this (self) object is between startTime and stopTime.
+ Also returns true if equal to either startTime and stopTime. """
selfTime = CM160Data.GetTime(self)
if selfTime == None:
return False
return False
-
-
-
#*********************** CM160 ***************************
class CM160:
- Reading data from the CM160 unit
- Saving the data via a DataStore object
- When running the CM160 object has three threads
+ When running the CM160 object has two threads
- The main thread, responsible for reading data from the CM160 serial port
and pushing the data received into a queue.
- The queue reader thread which read packets of data from the above queue