FoxLabDashBoard/index.html
2024-02-20 12:42:28 -05:00

274 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Fox's Lab Accelerator Dashboard</title>
</head>
<style>
body{
background-color : black;
}
#iframe1{
position:absolute;
top : 55%;
left : 10%;
width: 60%;
height: 40%;
z-index:1000;
border: 1px solid green;
}
#iframe2{
position:absolute;
top : 60%;
left : 10%;
width: 100;
height: 100;
z-index:1001;
border: 1px solid green;
}
canvas{
width: 99%;
height:98%;
border: 1px solid yellow;
}
#beamLine{
position: absolute;
z-index: 0;
}
#static{
position: absolute;
z-index: 1;
}
#clock{
font-size: 30px;
color: white;
background-color: black;
position: absolute;
z-index: 3;
}
#BeamInfo{
color: orange;
position:absolute;
font-size: 100px;
top : 25%;
left : 35%;
z-index:1001;
}
#SrcInfo{
color: white;
position:absolute;
font-size: 15px;
bottom : 5%;
right : 10%;
z-index:1001;
}
#InflectorInfo{
color: black;
position:absolute;
font-size: 15px;
bottom : 14%;
right : 10.1%;
z-index:1001;
}
#TandemInfo{
color: white;
position:absolute;
font-size: 15px;
bottom : 30%;
right : 10%;
z-index:1001;
}
#DipoleInfo{
color: black;
position:absolute;
font-size: 15px;
z-index:1001;
}
#SwitchInfo{
color: black;
position:absolute;
font-size: 15px;
top : 15%;
left : 40%;
z-index:1001;
}
#footnote{
color: aqua;
position:absolute;
bottom : 2%;
right : 1%;
width: 100;
height: 100;
z-index:1001;
}
</style>
<body>
<div id='clock'></div>
<div id='footnote'></div>
<div id="BeamInfo"></div>
<div id="SrcInfo"></div>
<div id="InflectorInfo"></div>
<div id="TandemInfo"></div>
<div id="DipoleInfo"></div>
<div id="SwitchInfo"></div>
<!--<iframe src="http://localhost:3000/d-solo/MFym59G4k/new-dashboard?orgId=1&from=1672071127881&to=1672092727881&theme=dark&panelId=2" id="iframe1"></iframe>-->
<!--<iframe src="http://localhost:3000/d-solo/MFym59G4k/new-dashboard?orgId=1&from=1672071308654&to=1672092908654&panelId=4" id="iframe2"></iframe>-->
<!-- <iframe src="http://192.168.0.201:3000/d/MFym59G4k/new-dashboard?orgId=1&refresh=5s" id="iframe1"></iframe> -->
<!-- <iframe src="http://fsunuc.physics.fsu.edu/grafana/dashboard/snapshot/Fs5IQSqCZrKEtLP2TnCB08PWt7Hpp917" id="iframe1"></iframe> -->
<canvas width="3840" height="2160" id='beamLine' > Your browser doe snot support HTML canvas</canvas>
<canvas width="3840" height="2160" id='static' > Your browser doe snot support HTML canvas</canvas>
</body>
<!-- ################################################ -->
<script>
function time() {
let clock = document.getElementById('clock');
let d = new Date();
clock.textContent = d;
}
time();
setInterval(time, 1000);
</script>
<script type="text/javascript" src="geo.js"></script>
<script>
let updateTime = 10; //min
document.getElementById("footnote").innerHTML = "Accelarator setting update every " + updateTime + " min.";
let Mass;
let Sym;
let preAccel;
let inflector;
let LEB_volatage;
let TandemPot;
let beamEnergy;
let beamCharge;
let dipoleField;
let beam_Line = 'RESOLUT';
let SwitchMagnet;
function GetBeamSetting(){
let client = new XMLHttpRequest();
client.onreadystatechange = function() {
let data = client.responseText.split(" ");
// alert(data);
beamMass = data[0];
Sym = data[1];
preAccel = data[2];
inflector = data[3];
LEB_volatage = data[4];
TandemPot = data[5];
beamEnergy = parseFloat(data[6]);
beamCharge = parseInt(data[7]);
dipoleField = data[8];
beam_Line = data[9];
SwitchMagnet = data[10];
}
client.open('GET', "beamInfo.py", false);
client.send();
}
function BeamSettings(){
GetBeamSetting();
//format beamInfo
let beamKEA = beamEnergy/parseFloat(beamMass);'42%'
let beamInfo = "<sup>"+ beamMass + "</sup>" + Sym + "("+ beamCharge + "<sup>+</sup>) " + beamKEA.toFixed(2) + " MeV/u";
document.getElementById("BeamInfo").innerHTML = beamInfo;
//srouce info
document.getElementById("SrcInfo").innerHTML = preAccel + " kV";
//inflector info
document.getElementById("InflectorInfo").innerHTML = inflector + " A";
//tadem info
document.getElementById("TandemInfo").innerHTML = TandemPot + " MV";
destination = beam_Line;
// if( beam_Line == "GammaTable") destination = "Gamma";
if( beam_Line == "GammaTable") destination = 'Catrina';
// alert(destination);
//Dipole info
if( beam_Line == 'RESOLUT'){
document.getElementById("DipoleInfo").style.left = targetRoom2.d2.entracePos[0]-80 + 'px';
document.getElementById("DipoleInfo").style.top = targetRoom2.d2.entracePos[1]-50 + 'px';
}else{
document.getElementById("DipoleInfo").style.left = targetRoom1.dipole.entracePos[0]-80 + 'px';
document.getElementById("DipoleInfo").style.top = targetRoom1.dipole.entracePos[1]-50 + 'px';
}
document.getElementById("DipoleInfo").innerHTML = dipoleField + " G";
//Switching magnet info
if( beam_Line == 'RESOLUT'){
document.getElementById("SwitchInfo").style.left = targetRoom2.fan2.entracePos[0]-80 + 'px';
document.getElementById("SwitchInfo").style.top = targetRoom2.fan2.entracePos[1] + 'px';
}else{
document.getElementById("SwitchInfo").style.left = targetRoom1.fan.entracePos[0]-80 + 'px';
document.getElementById("SwitchInfo").style.top = targetRoom1.fan.entracePos[1] + 'px';
}
document.getElementById("SwitchInfo").innerHTML = SwitchMagnet + " A";
EnableDetector();
}
BeamSettings();
setInterval(BeamSettings, updateTime * 60 * 1000);
lineMotion();
</script>
<script>
function GetBeamStatus(){
let client = new XMLHttpRequest();
client.onreadystatechange = function() {
let data = client.responseText;
}
client.open('GET', "beamStatus.py", false);
client.send();
}
setInterval(GetBeamStatus, 5* 1000);
function refreshPage() {
location.reload();
}
setTimeout(refreshPage, 60*60*1000); // REFRESH PAGE EVERY HOUR
</script>
<!--
<script src="FoxLabDashBoard/geo.js"></script>
-->
</html>