# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


import numpy as np
import sys
import time
import serial
import glob
import logger
from copy import deepcopy
from config import config
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#!/usr/bin/python
numcells = config['battery']['numcells']
log = logger.logging.getLogger(__name__)
log.setLevel(logger.logging.DEBUG)
log.addHandler(logger.errfile)
initrawdat ={'DataValid':False,'BatI':0.0,'SOC':100.0,\
               'CellV':[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\
               'Temp':[-50.0,-50.0,-50.0,-50.0,-50.0,-50.0,-50.0,-50.0]}


class Rawdat():
  """class for obtaining data from and controlling indidvdual PIP inverters.
  When class is instantiated the SN of the PIP is used to tie the instance of
  the class to the particular machine"""

  def __init__(self,interfacesinuse):
    self.rawdat = deepcopy(initrawdat)
    self.reply ='' # placeholder for reply from sendcmd
    self.pylondown=0.0
    try:
      self.findpylon()
    except serial.serialutil.SerialException as err:
      self.pylondown=time.time() # flag pylontech is down
      log.error(err)



# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


# Path: pylon.py
import numpy as np
import sys
import time
import serial
import glob
import logger
from copy import deepcopy
from config import config

# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


#!/usr/bin/python
numcells = config['battery']['numcells']
log = logger.logging.getLogger(__name__)
log.setLevel(logger.logging.DEBUG)
log.addHandler(logger.errfile)
initrawdat ={'DataValid':False,'BatI':0.0,'SOC':100.0,\
               'CellV':[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],\
               'Temp':[-50.0,-50.0,-50.0,-50.0,-50.0,-50.0,-50.0,-50.0]}


class Rawdat():
  """class for obtaining data from and controlling indidvdual PIP inverters.
  When class is instantiated the SN of the PIP is used to tie the instance of
  the class to the particular machine"""

  def __init__(self,interfacesinuse):
    self.rawdat = deepcopy(initrawdat)
    self.reply ='' # placeholder for reply from sendcmd
    self.pylondown=0.0
    try:
      self.findpylon()
    except serial.serialutil.SerialException as err:
      self.pylondown=time.time() # flag pylontech is down
      log.error(err)



    self.floatv=48.0