Ejemplo n.º 1
0
def optimiseRun():
    global opt
    global comment
    time.sleep(30)
    comment = "Starting Optimise"
    info = "I, " + comment
    logWrite(info)
    while Run:
        while OPT:
            sleep(2)
        FlueChange(-FlueStep)
        time.sleep(FlueChangeSleep)
        while (RateChange(FlueChangeSleep) > 0):
            print("Opt", RateChange(FlueChangeSleep))
            FlueChange(-FlueStep)
            time.sleep(FlueChangeSleep)
        while (RateChange(FlueChangeSleep) < 0):
            print("Opt", RateChange(FlueChangeSleep))
            FlueChange(+FlueStep * 2)
            time.sleep(FlueChangeSleep)
        FlueChange(FlueStep)
        opt = True
        comment = "Optimise done"
        info = "I, " + comment
        time.sleep(100)
    comment = "Optimise End"
    info = "I, " + comment
    logWrite(info)
    return ()
Ejemplo n.º 2
0
def SetRate(rise):
    if (not Auto):
        return ()
    #end=len(log)-1
    GasStepMult = 2
    currentLog = getLogTop()
    currentStep = getCurrentStep()
    info = "F, Wanted Rise=" + str(rise) + " 10s=" + str(
        currentLog['tempTopRate10s']) + " 30s=" + str(
            currentLog['tempTopRate10s']) + " 5m=" + str(
                currentLog['tempTopRate5m']) + " Step=" + str(
                    currentStep['step']) + " Err=" + str(TRiseError * rise)
    logWrite(info)

    if (abs(rise * 10) > abs(
            currentLog['tempTopRate30s'])):  #See how far away we are
        GasStepMult = 4
        info = "F, Change Step Fast=" + str(GasStepMult)
        logWrite(info)

    if ((DiffError(currentLog['tempTopRate5m'], rise, TRiseError * rise) == 1)
            or (DiffError(currentLog['tempStepRate'], rise, TRiseError * rise)
                == 1)):  #going too fast
        gasChange(-GasStep * GasStepMult * 2)
        info = "F, Going too Fast"
        logWrite(info)
        #	optimise()
        return ()

    if (DiffError(currentLog['tempTopRate10s'], rise,
                  TRiseError * rise * 0.5) == -1):  #Go faster
        info = "F, Going too SLow"
        logWrite(info)
        #	FlueChange(FlueStep)
        gasChange(GasStep * GasStepMult)
        #	optimise()
        return ()

    info = "F, Going About Right"
    logWrite(info)
    return ()
Ejemplo n.º 3
0
def graphRun(action=""):
    global RunGraph, RunGraphP, wholeFireGraph, runningGraph, graphStepTime
    if action == "pause":
        RunGraphP = False
    elif action == "restart":
        RunGraphP = True
    elif action == "stop":
        RunGraph = False
    elif action == "start" or action == "":
        RunGraph = True
        RunGraphP = True
        from k_graph import drawGraph
        logWrite("I Starting - Graph ")
        new = ""
        old = ""
        while (RunGraph):
            while (RunGraphP):
                runningGraph = True
                d = selectGraph(
                    graphStepTime,
                    ('timeE', 'tempTop', 'tempBot', "tempTopRate5m",
                     'tempBotRate30s', 'gas', 'gasRate60s'))
                if d[0] != 0:
                    #["timeE", min, max, data....]
                    #print("d len",len(d[0]))
                    new = makeTimeFile("wholeFireGraph.png")
                    drawGraph(d, new)
                    old = wholeFireGraph
                    wholeFireGraph = new
                    rm(old)
                logWrite("I, Graph file created " + new + " Old: " + old)
                time.sleep(graphSleepTime)
        runningGraph = False
        logWrite("I, Ending - Graph ")
Ejemplo n.º 4
0
def logRun(action=""):
    global RunLog, RunLogP, runningLog
    if action == "pause":
        RunLogP = False
    elif action == "restart":
        RunLogP = True
    elif action == "stop":
        RunLog = False
    elif action == "start" or action == "":
        RunLog = True
        RunLogP = True
        makeLogFile()
        p = point()
        r = []
        for item in p.data:
            r.append(item)
        rr = "H, " + str(r).strip('[]')
        logWrite(rr)
        logWrite("I, Starting - Logging ")
        while (RunLog):
            while (RunLogP):
                runningLog = True
                #logWrite("1")
                tempT, vTop = k_temp_get(CTempTop)
                tempB, vBot = k_temp_get(CTempBot)
                #logWrite("2")
                gasP = getGas()
                gasN = gas_get()
                #logWrite("3")
                flueP = getFlue()
                #logWrite("4")
                opt = 0
                comment = ""
                p = addPoint(tempT, tempB, gasP, gasN, flueP, opt, vTop, vBot,
                             comment)
                #print("p=",p.data)
                writePoint(p)
                time.sleep(logSleepTime)
        runningLog = False
        #Stopping Logging
        logWrite("I, Ending Logging in 100s")
        time.sleep(100)
        logWrite("I, Ended Logging NOW")
        logClose()
Ejemplo n.º 5
0
def fireRun(action=""):
    global RunFire, RunFireP, runningFire
    if action == "pause":
        RunFireP = False
    elif action == "restart":
        RunFireP = True
    elif action == "stop":
        RunFire = False
    elif action == "start" or action == "":
        global TempStepAve
        global FireRunEnd
        global comment
        global GuideStep
        soak = False
        RunFire = True
        RunFireP = True
        time.sleep(2)
        NewStep = True
        endSoakTime = 0
        logWrite("I, Starting - Fire ")
        createGuidList(0)
        guideStep = getNextStep()
        while RunFire:
            while RunFireP:
                runningFire = True
                currentTopLog = getLogTop()
                logWrite("F, GuideStep: " + str(guideStep["step"]))
                if (guideStep["step"] == 0):
                    #End of run, finish
                    NewStep = False
                    RunFire = False
                    RunFireP = False
                    setGas(0)
                    setFlue(0)
                    logWrite("F, Ending Fire Run")
                    break

                if (NewStep):
                    # Set Flue only when its a new step
                    setFlue(guideStep["flue"])
                    NewStep = False

                if (guideStep["setRate"] == 0 and not soak):
                    #Start a new Soak if we are not doing one, cant have two soaks together
                    endSoakTime = currentTopLog["timeE"] + (
                        guideStep["soakTime"] * 60)
                    logWrite("F, Starting Soak " + str(endSoakTime))
                    soak = True

                # Now see if we need to go faster or slower temp can change in 35 sec
                SetRate(guideStep["setRate"])
                #   optimise()
                #   reduce(GuideList[GuideStep][GReduce])
                logWrite("Soak=" + str(soak) + " Guide=" +
                         str(guideStep["setTemp"]) + " current=" +
                         str(currentTopLog["tempTopAve10s"]))
                if (soak and endSoakTime > currentTopLog["timeE"]) or (
                        not soak and
                    (guideStep["setTemp"] < currentTopLog["tempTopAve10s"])):
                    # Set new Step
                    guideStep = getNextStep()
                    NewStep = True
                    StepStartTime = getLogTop(
                    )["timeE"]  # save the start point of this step StepStartTime
                    info = "F, New Guide " + str(guideStep)
                    logWrite(info)
                time.sleep(fireSleepTime)

            #setGas(OFF)
            #setFlue(OFF)
            logWrite("F, Ending - Fire ")
            FireRunEnd = True
            runningFire = False
            return