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


import sys
import time
import logger
from os import rename
from shutil import copy as filecopy
from copy import deepcopy
from ast import literal_eval
from configparser import SafeConfigParser
from config import config
    section['dod'][1] = round(section['dod'][1]/section['ah'][3], 6)
    section['dod'][3] = max(section['dod'][3], source['dod'][3])
#    section['amps'][1] = max(section['amps'][1], source['amps'][1])
#    section['amps'][0] = min(section['amps'][0], source['amps'][0])
#    section['amps'][2] = min(section['amps'][2], source['amps'][2])
    for i in range(len(config['CurrentInputs'])):
      section['ioutmax'][i] = max(section['ioutmax'][i], source['ioutmax'][i])
      section['iinmax'][i] = min(section['iinmax'][i], source['iinmax'][i])
      section['kwoutmax'][i] = max(section['kwoutmax'][i], source['kwoutmax'][i])
      section['kwinmax'][i] = min(section['kwinmax'][i], source['kwinmax'][i])
      section['kwhin'][i] = round(source['kwhin'][i]+section['kwhin'][i], 5)
      section['kwhout'][i] = round(source['kwhout'][i]+section['kwhout'][i], 5)
    for i in range(len(self.summary['current']['maxvoltages'])):
      section['maxvoltages'][i] = max(section['maxvoltages'][i], source['maxvoltages'][i])
      section['minvoltages'][i] = min(section['minvoltages'][i], source['minvoltages'][i])
      section['maxnocharge'][i] = max(section['maxnocharge'][i], source['maxnocharge'][i])
      section['minnoload'][i] = min(section['minnoload'][i], source['minnoload'][i])
    for i in range(numcells):
      section['baltime'][i] = round(section['baltime'][i]+source['baltime'][i],4)
    for i in range(len(config['TemperatureInputs'])):
      section['tmax'][i] = max(section['tmax'][i], source['tmax'][i])
      section['tmin'][i] = min(section['tmin'][i], source['tmin'][i])
    section['timestamp'] = self.summary['current']['timestamp']

  def writesummary(self):
    """ Write summary file """

    for section in summaryfile.sections():
      for option in summaryfile.options(section):
        summaryfile.set(section, option, str(self.summary[section][option]))

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


# Path: summary.py
import sys
import time
import logger
from os import rename
from shutil import copy as filecopy
from copy import deepcopy
from ast import literal_eval
from configparser import SafeConfigParser
from config import config

    section['dod'][1] = round(section['dod'][1]/section['ah'][3], 6)
    section['dod'][3] = max(section['dod'][3], source['dod'][3])
#    section['amps'][1] = max(section['amps'][1], source['amps'][1])
#    section['amps'][0] = min(section['amps'][0], source['amps'][0])
#    section['amps'][2] = min(section['amps'][2], source['amps'][2])
    for i in range(len(config['CurrentInputs'])):
      section['ioutmax'][i] = max(section['ioutmax'][i], source['ioutmax'][i])
      section['iinmax'][i] = min(section['iinmax'][i], source['iinmax'][i])
      section['kwoutmax'][i] = max(section['kwoutmax'][i], source['kwoutmax'][i])
      section['kwinmax'][i] = min(section['kwinmax'][i], source['kwinmax'][i])
      section['kwhin'][i] = round(source['kwhin'][i]+section['kwhin'][i], 5)
      section['kwhout'][i] = round(source['kwhout'][i]+section['kwhout'][i], 5)
    for i in range(len(self.summary['current']['maxvoltages'])):
      section['maxvoltages'][i] = max(section['maxvoltages'][i], source['maxvoltages'][i])
      section['minvoltages'][i] = min(section['minvoltages'][i], source['minvoltages'][i])
      section['maxnocharge'][i] = max(section['maxnocharge'][i], source['maxnocharge'][i])
      section['minnoload'][i] = min(section['minnoload'][i], source['minnoload'][i])
    for i in range(numcells):
      section['baltime'][i] = round(section['baltime'][i]+source['baltime'][i],4)
    for i in range(len(config['TemperatureInputs'])):
      section['tmax'][i] = max(section['tmax'][i], source['tmax'][i])
      section['tmin'][i] = min(section['tmin'][i], source['tmin'][i])
    section['timestamp'] = self.summary['current']['timestamp']

  def writesummary(self):
    """ Write summary file """

    for section in summaryfile.sections():
      for option in summaryfile.options(section):
        summaryfile.set(section, option, str(self.summary[section][option]))

    of = open(config['files']['summaryfile'],'w')