This commit is contained in:
Ryan Tang 2024-02-20 12:42:28 -05:00
parent b9370dc6f8
commit 54d14dba22
5 changed files with 54 additions and 49 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/python3
#!/usr/bin/env python3
def printHTML(str):
print("<br>====|%s|" % str)
print("<br>==---------------==|%s|" % str)
def FindString(x, str1, str2):
pos1 = x.find(str1)
@ -11,9 +11,11 @@ def FindString(x, str1, str2):
offset = len(str1)
# print(str1, str2, pos1, pos2)
if( pos1 > -1 and pos2 > -1):
haha = x[pos1+offset:pos2].strip()
#printHTML(haha)
# printHTML(haha)
return haha
else:
return '404'
@ -40,7 +42,8 @@ print("Content-type:text/html\r\n\r\n")
#print('<body>')
for x in file:
#print("<br>" + x)
# print("<br>" + x)
# print("==========|" + x)
if( isotope == '404') :
isotope = FindString(x, 'nucleus is', 'and')
if( preacc == '404'):
@ -69,20 +72,22 @@ for x in file:
switchingMagnet = FindString(x, 'Current is', 'A')
#print('<p>===================<p>')
#print("Isotope: " + isotope.upper() + "<br>")
#print("PreAcceleration: " + preacc + " kV <br>")
#print("Inflector: " + inflector + " A<br>")
#print("LEB Voltage: " + LEB_Voltage + " V<br>")
#print("LEB feedback: " + LEB_Feedback + " V<br>")
#print("Tandem Pot.: " + tandam_pot + " MV<br>")
#print("Beam Energy: " + beam_energy + " MeV<br>")
#print("Beam Charge: " + charge + "<br>")
#print("Frac. Charge: " + charge_frac + "<br>")
#print("Beta: " + beta + "<br>")
#print("Analyzing Magnet: " + analysisMagnet + " G<br>")
#print("Beam Line: " + beamLine + "<br>")
#print("Switching Magnet: " + switchingMagnet + " A<br>")
#if beamLine has space, remove it
# print('<p>===================<p>')
# print("Isotope: " + isotope.upper() + "<br>")
# print("PreAcceleration: " + preacc + " kV <br>")
# print("Inflector: " + inflector + " A<br>")
# print("LEB Voltage: " + LEB_Voltage + " V<br>")
# print("LEB feedback: " + LEB_Feedback + " V<br>")
# print("Tandem Pot.: " + tandam_pot + " MV<br>")
# print("Beam Energy: " + beam_energy + " MeV<br>")
# print("Beam Charge: " + charge + "<br>")
# print("Frac. Charge: " + charge_frac + "<br>")
# print("Beta: " + beta + "<br>")
# print("Analyzing Magnet: " + analysisMagnet + " G<br>")
# print("Beam Line: " + beamLine + "<br>")
# print("Switching Magnet: " + switchingMagnet + " A<br>")
import re
@ -100,7 +105,7 @@ print(MassNumber,
beam_energy,
charge,
analysisMagnet,
beamLine,
beamLine.replace(" ",""),
switchingMagnet
)

View File

@ -10,14 +10,12 @@ num = random.random()*100
cmd = "curl -XPOST " + url + " --data-binary " + "\'testing value=" + str(num) + "\'"
print("Content-type:text/html\r\n\r\n")
print(cmd)
os.system(cmd)
# os.system(cmd)

22
geo.js
View File

@ -535,7 +535,7 @@ let posArray; // thsi is a collection of the position of beamlines
posArray = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2};
}
let beamLineHaHa;
let beamLineMarching;
{
let Gamma = new multiBeamLine(posArray.Gamma);
let Catrina = new multiBeamLine(posArray.Catrina);
@ -547,17 +547,17 @@ let beamLineHaHa;
let SPS = new multiBeamLine(posArray.SPS);
let Clarion2 = new multiBeamLine(posArray.Clarion2);
beamLineHaHa = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2};
beamLineMarching = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2};
}
//============================== Draw
var destination = 'Gamma';
let destination = 'Gamma';
function DisableAllDetector(){
for( const ele in beamLineHaHa){
beamLineHaHa[ele].draw(false);
for( const ele in beamLineMarching){
beamLineMarching[ele].draw(false);
}
for( const ele in sourceLine){
@ -634,12 +634,12 @@ function EnableDetector(){
}
function lineMotion(){
if( destination == 'Gamma' ) beamLineHaHa.Gamma.march();
if( destination == 'Catrina') beamLineHaHa.Catrina.march();
if( destination == 'RESOLUT') beamLineHaHa.Resolut.march();
if( destination == 'Anasen') beamLineHaHa.Anasen.march();
if( destination == 'SPS') beamLineHaHa.SPS.march();
if( destination == 'Clarion2') beamLineHaHa.Clarion2.march();
if( destination == 'Gamma' ) beamLineMarching.Gamma.march();
if( destination == 'Catrina') beamLineMarching.Catrina.march();
if( destination == 'RESOLUT') beamLineMarching.Resolut.march();
if( destination == 'Anasen') beamLineMarching.Anasen.march();
if( destination == 'SPS') beamLineMarching.SPS.march();
if( destination == 'Clarion2') beamLineMarching.Clarion2.march();
setTimeout(lineMotion, 50);
}

View File

@ -133,7 +133,8 @@
<!--<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://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>
@ -145,10 +146,8 @@
function time() {
let clock = document.getElementById('clock');
let d = new Date();
clock.textContent = d;
}
time();
setInterval(time, 1000);
@ -159,25 +158,25 @@ setInterval(time, 1000);
<script>
let updateTime = 10; //min
document.getElementById("footnote").innerHTML = "Accelrator setting update every " + updateTime + " min.";
document.getElementById("footnote").innerHTML = "Accelarator setting update every " + updateTime + " min.";
var Mass;
var Sym;
var preAccel;
var inflector;
var LEB_volatage;
var TandemPot;
var beamEnergy;
var beamCharge;
var dipoleField;
var beam_Line = 'RESOLUT';
var SwitchMagnet;
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);
// alert(data);
beamMass = data[0];
Sym = data[1];
preAccel = data[2];
@ -212,6 +211,9 @@ function BeamSettings(){
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'){