# -*- coding:utf-8 -*-
import json
from src.Data import AutoClaveRealTimeData
from model.Algorithm import Algorithm
from configparser import ConfigParser
from datetime import datetime

class ACGetDataDIS(Algorithm):

    def __init__(self, DISTool, dataObj):

        self.DISTool = DISTool
        self.dataObj = dataObj

    
    def getType(self):
        return "ACGetDataDIS"

    def run(self):
        
        sourceData = self.DISTool.getRecords_test()
        conf = ConfigParser()
        conf.read(self.DISTool.getConfPath())
        #print(sourceData)

        for claveId in range(1, self.dataObj.getClaveNum()+1):
            # Use configuration file

            inTempChannel = conf.get('AutoClave'+str(claveId),'inTempChannel')
            inTempSlope = conf.get('AutoClave'+str(claveId),'inTempSlope')
            inTempShift = conf.get('AutoClave'+str(claveId),'inTempShift')
                            
            outTempChannel = conf.get('AutoClave'+str(claveId),'outTempChannel')
            outTempSlope = conf.get('AutoClave'+str(claveId),'outTempSlope')
            outTempShift = conf.get('AutoClave'+str(claveId),'outTempShift')

            inPressChannel = conf.get('AutoClave'+str(claveId),'inPressChannel')
            inPressSlope = conf.get('AutoClave'+str(claveId),'inPressSlope')
            inPressShift = conf.get('AutoClave'+str(claveId),'inPressShift')

            stateChannel = conf.get('AutoClave'+str(claveId),'stateChannel')  

            for devRec in sourceData:
                data = json.loads(devRec['data'])
                dev_id = data['device_id']
                if dev_id == self.dataObj.getDevId(claveId): 
                    services = data['services'][0]
                    properties = services['properties']
                    try:
                        time = datetime.strptime(services['event_time'],'%Y%m%dT%H%M%SZ').timestamp()
                        time = time + 3600*8
                    
                        recData = AutoClaveRealTimeData(claveId)
                        recData.setTime(time)
                        inTemp = float(properties[inTempChannel]) * float(inTempSlope) + float(inTempShift)
                        outTemp = float(properties[outTempChannel]) * float(outTempSlope) + float(outTempShift)
                        inPress = float(properties[inPressChannel]) * float(inPressSlope) + float(inPressShift)

                        recData.setInTemp(inTemp)
                        recData.setOutTemp(outTemp)
                        recData.setInPress(inPress)

                        recData.setState(float(properties[stateChannel]))
                        self.dataObj.pushData(claveId, recData)
                    except:
                        pass
    

        return self.dataObj
c7ee971c7517ed65bc7d8453af56b179ada8fc1e
<mask token>


class ACGetDataDIS(Algorithm):
    <mask token>

    def getType(self):
        return 'ACGetDataDIS'
    <mask token>

<mask token>


class ACGetDataDIS(Algorithm):
    <mask token>

    def getType(self):
        return 'ACGetDataDIS'

    def run(self):
        sourceData = self.DISTool.getRecords_test()
        conf = ConfigParser()
        conf.read(self.DISTool.getConfPath())
        for claveId in range(1, self.dataObj.getClaveNum() + 1):
            inTempChannel = conf.get('AutoClave' + str(claveId),
                'inTempChannel')
            inTempSlope = conf.get('AutoClave' + str(claveId), 'inTempSlope')
            inTempShift = conf.get('AutoClave' + str(claveId), 'inTempShift')
            outTempChannel = conf.get('AutoClave' + str(claveId),
                'outTempChannel')
            outTempSlope = conf.get('AutoClave' + str(claveId), 'outTempSlope')
            outTempShift = conf.get('AutoClave' + str(claveId), 'outTempShift')
            inPressChannel = conf.get('AutoClave' + str(claveId),
                'inPressChannel')
            inPressSlope = conf.get('AutoClave' + str(claveId), 'inPressSlope')
            inPressShift = conf.get('AutoClave' + str(claveId), 'inPressShift')
            stateChannel = conf.get('AutoClave' + str(claveId), 'stateChannel')
            for devRec in sourceData:
                data = json.loads(devRec['data'])
                dev_id = data['device_id']
                if dev_id == self.dataObj.getDevId(claveId):
                    services = data['services'][0]
                    properties = services['properties']
                    try:
                        time = datetime.strptime(services['event_time'],
                            '%Y%m%dT%H%M%SZ').timestamp()
                        time = time + 3600 * 8
                        recData = AutoClaveRealTimeData(claveId)
                        recData.setTime(time)
                        inTemp = float(properties[inTempChannel]) * float(
                            inTempSlope) + float(inTempShift)
                        outTemp = float(properties[outTempChannel]) * float(
                            outTempSlope) + float(outTempShift)
                        inPress = float(properties[inPressChannel]) * float(
                            inPressSlope) + float(inPressShift)
                        recData.setInTemp(inTemp)
                        recData.setOutTemp(outTemp)
                        recData.setInPress(inPress)
                        recData.setState(float(properties[stateChannel]))
                        self.dataObj.pushData(claveId, recData)
                    except:
                        pass
        return self.dataObj

<mask token>


class ACGetDataDIS(Algorithm):

    def __init__(self, DISTool, dataObj):
        self.DISTool = DISTool
        self.dataObj = dataObj

    def getType(self):
        return 'ACGetDataDIS'

    def run(self):
        sourceData = self.DISTool.getRecords_test()
        conf = ConfigParser()
        conf.read(self.DISTool.getConfPath())
        for claveId in range(1, self.dataObj.getClaveNum() + 1):
            inTempChannel = conf.get('AutoClave' + str(claveId),
                'inTempChannel')
            inTempSlope = conf.get('AutoClave' + str(claveId), 'inTempSlope')
            inTempShift = conf.get('AutoClave' + str(claveId), 'inTempShift')
            outTempChannel = conf.get('AutoClave' + str(claveId),
                'outTempChannel')
            outTempSlope = conf.get('AutoClave' + str(claveId), 'outTempSlope')
            outTempShift = conf.get('AutoClave' + str(claveId), 'outTempShift')
            inPressChannel = conf.get('AutoClave' + str(claveId),
                'inPressChannel')
            inPressSlope = conf.get('AutoClave' + str(claveId), 'inPressSlope')
            inPressShift = conf.get('AutoClave' + str(claveId), 'inPressShift')
            stateChannel = conf.get('AutoClave' + str(claveId), 'stateChannel')
            for devRec in sourceData:
                data = json.loads(devRec['data'])
                dev_id = data['device_id']
                if dev_id == self.dataObj.getDevId(claveId):
                    services = data['services'][0]
                    properties = services['properties']
                    try:
                        time = datetime.strptime(services['event_time'],
                            '%Y%m%dT%H%M%SZ').timestamp()
                        time = time + 3600 * 8
                        recData = AutoClaveRealTimeData(claveId)
                        recData.setTime(time)
                        inTemp = float(properties[inTempChannel]) * float(
                            inTempSlope) + float(inTempShift)
                        outTemp = float(properties[outTempChannel]) * float(
                            outTempSlope) + float(outTempShift)
                        inPress = float(properties[inPressChannel]) * float(
                            inPressSlope) + float(inPressShift)
                        recData.setInTemp(inTemp)
                        recData.setOutTemp(outTemp)
                        recData.setInPress(inPress)
                        recData.setState(float(properties[stateChannel]))
                        self.dataObj.pushData(claveId, recData)
                    except:
                        pass
        return self.dataObj

import json
from src.Data import AutoClaveRealTimeData
from model.Algorithm import Algorithm
from configparser import ConfigParser
from datetime import datetime


class ACGetDataDIS(Algorithm):

    def __init__(self, DISTool, dataObj):
        self.DISTool = DISTool
        self.dataObj = dataObj

    def getType(self):
        return 'ACGetDataDIS'

    def run(self):
        sourceData = self.DISTool.getRecords_test()
        conf = ConfigParser()
        conf.read(self.DISTool.getConfPath())
        for claveId in range(1, self.dataObj.getClaveNum() + 1):
            inTempChannel = conf.get('AutoClave' + str(claveId),
                'inTempChannel')
            inTempSlope = conf.get('AutoClave' + str(claveId), 'inTempSlope')
            inTempShift = conf.get('AutoClave' + str(claveId), 'inTempShift')
            outTempChannel = conf.get('AutoClave' + str(claveId),
                'outTempChannel')
            outTempSlope = conf.get('AutoClave' + str(claveId), 'outTempSlope')
            outTempShift = conf.get('AutoClave' + str(claveId), 'outTempShift')
            inPressChannel = conf.get('AutoClave' + str(claveId),
                'inPressChannel')
            inPressSlope = conf.get('AutoClave' + str(claveId), 'inPressSlope')
            inPressShift = conf.get('AutoClave' + str(claveId), 'inPressShift')
            stateChannel = conf.get('AutoClave' + str(claveId), 'stateChannel')
            for devRec in sourceData:
                data = json.loads(devRec['data'])
                dev_id = data['device_id']
                if dev_id == self.dataObj.getDevId(claveId):
                    services = data['services'][0]
                    properties = services['properties']
                    try:
                        time = datetime.strptime(services['event_time'],
                            '%Y%m%dT%H%M%SZ').timestamp()
                        time = time + 3600 * 8
                        recData = AutoClaveRealTimeData(claveId)
                        recData.setTime(time)
                        inTemp = float(properties[inTempChannel]) * float(
                            inTempSlope) + float(inTempShift)
                        outTemp = float(properties[outTempChannel]) * float(
                            outTempSlope) + float(outTempShift)
                        inPress = float(properties[inPressChannel]) * float(
                            inPressSlope) + float(inPressShift)
                        recData.setInTemp(inTemp)
                        recData.setOutTemp(outTemp)
                        recData.setInPress(inPress)
                        recData.setState(float(properties[stateChannel]))
                        self.dataObj.pushData(claveId, recData)
                    except:
                        pass
        return self.dataObj

# -*- coding:utf-8 -*-
import json
from src.Data import AutoClaveRealTimeData
from model.Algorithm import Algorithm
from configparser import ConfigParser
from datetime import datetime

class ACGetDataDIS(Algorithm):

    def __init__(self, DISTool, dataObj):

        self.DISTool = DISTool
        self.dataObj = dataObj

    
    def getType(self):
        return "ACGetDataDIS"

    def run(self):
        
        sourceData = self.DISTool.getRecords_test()
        conf = ConfigParser()
        conf.read(self.DISTool.getConfPath())
        #print(sourceData)

        for claveId in range(1, self.dataObj.getClaveNum()+1):
            # Use configuration file

            inTempChannel = conf.get('AutoClave'+str(claveId),'inTempChannel')
            inTempSlope = conf.get('AutoClave'+str(claveId),'inTempSlope')
            inTempShift = conf.get('AutoClave'+str(claveId),'inTempShift')
                            
            outTempChannel = conf.get('AutoClave'+str(claveId),'outTempChannel')
            outTempSlope = conf.get('AutoClave'+str(claveId),'outTempSlope')
            outTempShift = conf.get('AutoClave'+str(claveId),'outTempShift')

            inPressChannel = conf.get('AutoClave'+str(claveId),'inPressChannel')
            inPressSlope = conf.get('AutoClave'+str(claveId),'inPressSlope')
            inPressShift = conf.get('AutoClave'+str(claveId),'inPressShift')

            stateChannel = conf.get('AutoClave'+str(claveId),'stateChannel')  

            for devRec in sourceData:
                data = json.loads(devRec['data'])
                dev_id = data['device_id']
                if dev_id == self.dataObj.getDevId(claveId): 
                    services = data['services'][0]
                    properties = services['properties']
                    try:
                        time = datetime.strptime(services['event_time'],'%Y%m%dT%H%M%SZ').timestamp()
                        time = time + 3600*8
                    
                        recData = AutoClaveRealTimeData(claveId)
                        recData.setTime(time)
                        inTemp = float(properties[inTempChannel]) * float(inTempSlope) + float(inTempShift)
                        outTemp = float(properties[outTempChannel]) * float(outTempSlope) + float(outTempShift)
                        inPress = float(properties[inPressChannel]) * float(inPressSlope) + float(inPressShift)

                        recData.setInTemp(inTemp)
                        recData.setOutTemp(outTemp)
                        recData.setInPress(inPress)

                        recData.setState(float(properties[stateChannel]))
                        self.dataObj.pushData(claveId, recData)
                    except:
                        pass
    

        return self.dataObj