updates to html page
This commit is contained in:
parent
79b9f2d95d
commit
efd44dbf3e
6
main.py
6
main.py
|
|
@ -31,7 +31,7 @@ if platform.system() in ["Darwin"]: # macOS or Windows
|
|||
else:
|
||||
from classCAN import CANBackend # Your real backend
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
logging.getLogger("uvicorn.access").setLevel(logging.WARNING)
|
||||
|
||||
|
|
@ -392,6 +392,7 @@ async def auto_test_pu3():
|
|||
|
||||
# PATIENT SKID HELPERS
|
||||
async def update_latest_flow():
|
||||
global active_PUs
|
||||
async with aiohttp.ClientSession() as session:
|
||||
while True:
|
||||
try:
|
||||
|
|
@ -400,6 +401,9 @@ async def update_latest_flow():
|
|||
latest_flow = int(data["log"]["flow"])
|
||||
logging.debug(f"Updated flow: {latest_flow}")
|
||||
latest_data["PatientSkid"]["QSkid"] = latest_flow
|
||||
# for index in active_PUs :
|
||||
# logging.debug("PU_"+str(index))
|
||||
# latest_data["PU_"+str(index)]["QSkid"] = latest_flow # Adding the data to all actives PUs
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"Error fetching flow: {e}")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
|
@ -11,23 +12,28 @@
|
|||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.plot-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.large-plot {
|
||||
width: 45%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.small-plot {
|
||||
width: 30%;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.status-container {
|
||||
background-color: #f0f0f0;
|
||||
padding: 10px;
|
||||
|
|
@ -38,6 +44,7 @@
|
|||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1 id="pageTitle">Live Monitoring Dashboard</h1>
|
||||
<div class="status-container">
|
||||
|
|
@ -50,12 +57,12 @@
|
|||
<div id="flow-plot-2" class="large-plot"></div>
|
||||
<div id="pressure-plot-2" class="large-plot"></div>
|
||||
<div id="conductivity-plot" class="large-plot"></div>
|
||||
<div id="MV02_sp-plot" class="small-plot"></div>
|
||||
<div id="MV03_sp-plot" class="small-plot"></div>
|
||||
<div id="MV07-plot" class="small-plot"></div>
|
||||
<div id="MV02-plot" class="small-plot"></div>
|
||||
<div id="MV03-plot" class="small-plot"></div>
|
||||
<div id="MV04_sp-05-plot" class="small-plot"></div>
|
||||
<div id="MV06_sp-plot" class="small-plot"></div>
|
||||
<div id="MV07_sp-plot" class="small-plot"></div>
|
||||
<div id="MV08_sp-plot" class="small-plot"></div>
|
||||
<div id="MV06-plot" class="small-plot"></div>
|
||||
<div id="MV08-plot" class="small-plot"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
@ -63,7 +70,7 @@
|
|||
const puNumber = urlParams.get('pu_number') || '1';
|
||||
document.getElementById('pageTitle').textContent = `Live Monitoring Dashboard - PU ${puNumber}`;
|
||||
|
||||
const maxPoints = 100;
|
||||
const maxPoints = 50;
|
||||
|
||||
async function updatePlots() {
|
||||
try {
|
||||
|
|
@ -99,13 +106,17 @@
|
|||
y: [[puData.Cfeed], [puData.Cperm], [puData.Cdilute]]
|
||||
}, [0, 1, 2], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV07-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV07_sp], [puData.MV07]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV02_sp-plot', {
|
||||
Plotly.extendTraces('MV02-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV02_sp], [puData.MV02]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV03_sp-plot', {
|
||||
Plotly.extendTraces('MV03-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV03_sp], [puData.MV03]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
|
@ -115,17 +126,13 @@
|
|||
y: [[puData.MV04_sp], [puData.MV04], [puData.MV05_sp], [puData.MV05]]
|
||||
}, [0, 1, 2, 3], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV06_sp-plot', {
|
||||
Plotly.extendTraces('MV06-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV06_sp], [puData.MV06]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV07_sp-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV07_sp], [puData.MV07]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
||||
Plotly.extendTraces('MV08_sp-plot', {
|
||||
Plotly.extendTraces('MV08-plot', {
|
||||
x: [[t], [t]],
|
||||
y: [[puData.MV08_sp], [puData.MV08]]
|
||||
}, [0, 1], maxPoints);
|
||||
|
|
@ -190,18 +197,18 @@
|
|||
});
|
||||
|
||||
|
||||
Plotly.newPlot('MV02_sp-plot', [
|
||||
Plotly.newPlot('MV02-plot', [
|
||||
{ x: time0, y: [0], name: 'MV02_sp', mode: 'lines' },
|
||||
{ x: time0, y: [0], name: 'MV02', mode: 'lines' }
|
||||
], {
|
||||
title: 'MV02: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: { range: [0, 100] }
|
||||
title: 'MV02: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: {}
|
||||
});
|
||||
|
||||
Plotly.newPlot('MV03_sp-plot', [
|
||||
Plotly.newPlot('MV03-plot', [
|
||||
{ x: time0, y: [0], name: 'MV03_sp', mode: 'lines' },
|
||||
{ x: time0, y: [0], name: 'MV03', mode: 'lines' }
|
||||
], {
|
||||
title: 'MV03: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: { range: [0, 100] }
|
||||
title: 'MV03: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: {}
|
||||
});
|
||||
|
||||
Plotly.newPlot('MV04_sp-05-plot', [
|
||||
|
|
@ -213,21 +220,21 @@
|
|||
title: 'MV04 & MV05: Setpoints and Actuals', xaxis: { type: 'date' }, yaxis: { range: [0, 100] }
|
||||
});
|
||||
|
||||
Plotly.newPlot('MV06_sp-plot', [
|
||||
Plotly.newPlot('MV06-plot', [
|
||||
{ x: time0, y: [0], name: 'MV06_sp', mode: 'lines' },
|
||||
{ x: time0, y: [0], name: 'MV06', mode: 'lines' }
|
||||
], {
|
||||
title: 'MV06: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: { range: [0, 100] }
|
||||
title: 'MV06: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: {}
|
||||
});
|
||||
|
||||
Plotly.newPlot('MV07_sp-plot', [
|
||||
Plotly.newPlot('MV07-plot', [
|
||||
{ x: time0, y: [0], name: 'MV07_sp', mode: 'lines' },
|
||||
{ x: time0, y: [0], name: 'MV07', mode: 'lines' }
|
||||
], {
|
||||
title: 'MV07: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: { range: [0, 100] }
|
||||
title: 'MV07: Setpoint vs Actual', xaxis: { type: 'date' }, yaxis: {}
|
||||
});
|
||||
|
||||
Plotly.newPlot('MV08_sp-plot', [
|
||||
Plotly.newPlot('MV08-plot', [
|
||||
{ x: time0, y: [0], name: 'MV08_sp', mode: 'lines' },
|
||||
{ x: time0, y: [0], name: 'MV08', mode: 'lines' }
|
||||
], {
|
||||
|
|
@ -244,4 +251,5 @@
|
|||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue
Block a user