Changed default feed valve strategy
This commit is contained in:
parent
5b91c4000d
commit
582741da1d
12
main.py
12
main.py
|
|
@ -54,6 +54,8 @@ latest_data: Dict[str, Any] = {
|
||||||
"PatientSkid": {"QSkid": 0.0},
|
"PatientSkid": {"QSkid": 0.0},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_FEED_VALVE = 0.0
|
||||||
|
|
||||||
# RECORDER
|
# RECORDER
|
||||||
recording_flag = False
|
recording_flag = False
|
||||||
recording_task = None
|
recording_task = None
|
||||||
|
|
@ -167,6 +169,11 @@ def monitor_page(request: Request):
|
||||||
with open("static/monitor.html") as f:
|
with open("static/monitor.html") as f:
|
||||||
return HTMLResponse(f.read())
|
return HTMLResponse(f.read())
|
||||||
|
|
||||||
|
@app.get("/multi-monitor-page", response_class=HTMLResponse)
|
||||||
|
def monitor_page(request: Request):
|
||||||
|
with open("static/multi_pu_dashboard.html") as f:
|
||||||
|
return HTMLResponse(f.read())
|
||||||
|
|
||||||
|
|
||||||
# ======== CAN + BACKEND ROUTES ========
|
# ======== CAN + BACKEND ROUTES ========
|
||||||
|
|
||||||
|
|
@ -191,6 +198,7 @@ def connect_toggle():
|
||||||
|
|
||||||
@app.post("/command/{state}/pu/{pu_number}")
|
@app.post("/command/{state}/pu/{pu_number}")
|
||||||
def send_command(state: str, pu_number: int, ploop_setpoint: float = Query(...)):
|
def send_command(state: str, pu_number: int, ploop_setpoint: float = Query(...)):
|
||||||
|
global DEFAULT_FEED_VALVE
|
||||||
VALID_STATES = {
|
VALID_STATES = {
|
||||||
"IDLE",
|
"IDLE",
|
||||||
"PRE-PRODUCTION",
|
"PRE-PRODUCTION",
|
||||||
|
|
@ -211,7 +219,7 @@ def send_command(state: str, pu_number: int, ploop_setpoint: float = Query(...))
|
||||||
if state == "PRE-PRODUCTION":
|
if state == "PRE-PRODUCTION":
|
||||||
valve_backend.send_command(70)
|
valve_backend.send_command(70)
|
||||||
elif "IDLE":
|
elif "IDLE":
|
||||||
valve_backend.send_command(0)
|
valve_backend.send_command(DEFAULT_FEED_VALVE)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
can_backend.send_state_command(state, pu_number, ploop_setpoint)
|
can_backend.send_state_command(state, pu_number, ploop_setpoint)
|
||||||
|
|
@ -278,6 +286,8 @@ def can_status():
|
||||||
@app.post("/command/feed_valve")
|
@app.post("/command/feed_valve")
|
||||||
def feedvalve_control(MV01_opening: int = Query(...)):
|
def feedvalve_control(MV01_opening: int = Query(...)):
|
||||||
"""Control MV01 feed valve"""
|
"""Control MV01 feed valve"""
|
||||||
|
global DEFAULT_FEED_VALVE
|
||||||
|
DEFAULT_FEED_VALVE = MV01_opening
|
||||||
valve_backend.send_command(MV01_opening)
|
valve_backend.send_command(MV01_opening)
|
||||||
logging.info(f"Feed valve opening to {MV01_opening}")
|
logging.info(f"Feed valve opening to {MV01_opening}")
|
||||||
return {"status": "ok"}
|
return {"status": "ok"}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user