def bdrhistory(): global b wday = b.Days.index(request.args.get('wday')) P_Ch = int(request.args.get('P_Ch')) T_Ch = int(request.args.get('T_Ch')) P_Ch2 = int(request.args.get('P_Ch2')) T_Ch2 = int(request.args.get('T_Ch2')) b = bluefors() b.selectday(wday) [startimeP, tp, P, P_stat] = b.pressurelog(P_Ch) [startimeT, tt, T] = b.temperaturelog(T_Ch) if P_Ch2 > 0 and T_Ch2 > 0: [startimeP, tp2, P2, P_stat2] = b.pressurelog(P_Ch2) [startimeT, tt2, T2] = b.temperaturelog(T_Ch2) elif P_Ch2 > 0: [startimeP, tp2, P2, P_stat2] = b.pressurelog(P_Ch2) [startimeT, tt2, T2] = [startimeT, tt, T] elif T_Ch2 > 0: [startimeP, tp2, P2, P_stat2] = [startimeP, tp, P, P_stat] [startimeT, tt2, T2] = b.temperaturelog(T_Ch2) else: [startimeP, tp2, P2, P_stat2] = [startimeP, tp, P, P_stat] [startimeT, tt2, T2] = [startimeT, tt, T] return jsonify(startimeP=startimeP, startimeT=startimeT, tp=tp, P=P, P_stat=P_stat, tt=tt, T=T, tp2=tp2, P2=P2, P_stat2=P_stat2, tt2=tt2, T2=T2)
def bdrhistory(): global b, bdrlogs wday = int(request.args.get('wday')) P_Ch = int(request.args.get('P_Ch')) T_Ch = int(request.args.get('T_Ch')) P_Ch2 = int(request.args.get('P_Ch2')) T_Ch2 = int(request.args.get('T_Ch2')) OptionS = request.args.get('OptS') OptionV = request.args.get('OptV') b = bluefors() b.selectday(wday) tp, P, P_stat = b.pressurelog(P_Ch) tt, T = b.temperaturelog(T_Ch) tp2, P2, P_stat2 = b.pressurelog(P_Ch2) tt2, T2 = b.temperaturelog(T_Ch2) if OptionS == 'flow': tos, Opts = b.flowmeterlog() else: tos, Opts = b.statuslog(OptionS) tov, Optv = b.channellog(OptionV) bdrlogs = dict(bdr_P=P,bdr_T=T) # for forecast # print("T: %s"%bdrlogs['bdr_%s'%('T')][-15:]) log = pauselog() #disable logging (NOT applicable on Apache) return jsonify(log=str(log), tp=tp, P=P, P_stat=P_stat, tt=tt, T=T, tp2=tp2, P2=P2, P_stat2=P_stat2, tt2=tt2, T2=T2, tos=tos, Opts=Opts, tov=tov, Optv=Optv)
def allstatus(): dr = bluefors() dr.selectday(-1) # Logging Latest Key-Readings for ALL latestbdr = {} for i in range(6): latestbdr.update({"P%s" % (i + 1): dr.pressurelog(i + 1)[1][-1]}) for i in [1, 2, 5, 6, 7]: latestbdr.update({"T%s" % (i + 1): dr.temperaturelog(i + 1)[1][-1]}) set_status("BDR", latestbdr) status = {} status['PSGV'] = get_status('PSGV')["state"] status['AWG'] = get_status('AWG')["state"] log = pauselog() #disable logging (NOT applicable on Apache) return jsonify(log=str(log), latestbdr=latestbdr, status=status)
def bdr(): global b b = bluefors() return render_template("blog/machn/bdr.html", Days=b.Days)
def bdrinit(): global b b = bluefors() return jsonify(Days=b.Days)
def bdrtemperature(): b = bluefors() b.selectday(3) [startime, t, T] = b.temperature(5) return jsonify(startime=startime, t=t, T=T)