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): def printHTML(str):
print("<br>====|%s|" % str) print("<br>==---------------==|%s|" % str)
def FindString(x, str1, str2): def FindString(x, str1, str2):
pos1 = x.find(str1) pos1 = x.find(str1)
@ -11,6 +11,8 @@ def FindString(x, str1, str2):
offset = len(str1) offset = len(str1)
# print(str1, str2, pos1, pos2)
if( pos1 > -1 and pos2 > -1): if( pos1 > -1 and pos2 > -1):
haha = x[pos1+offset:pos2].strip() haha = x[pos1+offset:pos2].strip()
# printHTML(haha) # printHTML(haha)
@ -41,6 +43,7 @@ print("Content-type:text/html\r\n\r\n")
for x in file: for x in file:
# print("<br>" + x) # print("<br>" + x)
# print("==========|" + x)
if( isotope == '404') : if( isotope == '404') :
isotope = FindString(x, 'nucleus is', 'and') isotope = FindString(x, 'nucleus is', 'and')
if( preacc == '404'): if( preacc == '404'):
@ -69,6 +72,8 @@ for x in file:
switchingMagnet = FindString(x, 'Current is', 'A') switchingMagnet = FindString(x, 'Current is', 'A')
#if beamLine has space, remove it
# print('<p>===================<p>') # print('<p>===================<p>')
# print("Isotope: " + isotope.upper() + "<br>") # print("Isotope: " + isotope.upper() + "<br>")
# print("PreAcceleration: " + preacc + " kV <br>") # print("PreAcceleration: " + preacc + " kV <br>")
@ -100,7 +105,7 @@ print(MassNumber,
beam_energy, beam_energy,
charge, charge,
analysisMagnet, analysisMagnet,
beamLine, beamLine.replace(" ",""),
switchingMagnet switchingMagnet
) )

View File

@ -10,14 +10,12 @@ num = random.random()*100
cmd = "curl -XPOST " + url + " --data-binary " + "\'testing value=" + str(num) + "\'" cmd = "curl -XPOST " + url + " --data-binary " + "\'testing value=" + str(num) + "\'"
print("Content-type:text/html\r\n\r\n") print("Content-type:text/html\r\n\r\n")
print(cmd) 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}; posArray = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2};
} }
let beamLineHaHa; let beamLineMarching;
{ {
let Gamma = new multiBeamLine(posArray.Gamma); let Gamma = new multiBeamLine(posArray.Gamma);
let Catrina = new multiBeamLine(posArray.Catrina); let Catrina = new multiBeamLine(posArray.Catrina);
@ -547,17 +547,17 @@ let beamLineHaHa;
let SPS = new multiBeamLine(posArray.SPS); let SPS = new multiBeamLine(posArray.SPS);
let Clarion2 = new multiBeamLine(posArray.Clarion2); 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 //============================== Draw
var destination = 'Gamma'; let destination = 'Gamma';
function DisableAllDetector(){ function DisableAllDetector(){
for( const ele in beamLineHaHa){ for( const ele in beamLineMarching){
beamLineHaHa[ele].draw(false); beamLineMarching[ele].draw(false);
} }
for( const ele in sourceLine){ for( const ele in sourceLine){
@ -634,12 +634,12 @@ function EnableDetector(){
} }
function lineMotion(){ function lineMotion(){
if( destination == 'Gamma' ) beamLineHaHa.Gamma.march(); if( destination == 'Gamma' ) beamLineMarching.Gamma.march();
if( destination == 'Catrina') beamLineHaHa.Catrina.march(); if( destination == 'Catrina') beamLineMarching.Catrina.march();
if( destination == 'RESOLUT') beamLineHaHa.Resolut.march(); if( destination == 'RESOLUT') beamLineMarching.Resolut.march();
if( destination == 'Anasen') beamLineHaHa.Anasen.march(); if( destination == 'Anasen') beamLineMarching.Anasen.march();
if( destination == 'SPS') beamLineHaHa.SPS.march(); if( destination == 'SPS') beamLineMarching.SPS.march();
if( destination == 'Clarion2') beamLineHaHa.Clarion2.march(); if( destination == 'Clarion2') beamLineMarching.Clarion2.march();
setTimeout(lineMotion, 50); 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=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://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='beamLine' > Your browser doe snot support HTML canvas</canvas>
<canvas width="3840" height="2160" id='static' > 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() { function time() {
let clock = document.getElementById('clock'); let clock = document.getElementById('clock');
let d = new Date(); let d = new Date();
clock.textContent = d; clock.textContent = d;
} }
time(); time();
setInterval(time, 1000); setInterval(time, 1000);
@ -159,19 +158,19 @@ setInterval(time, 1000);
<script> <script>
let updateTime = 10; //min 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; let Mass;
var Sym; let Sym;
var preAccel; let preAccel;
var inflector; let inflector;
var LEB_volatage; let LEB_volatage;
var TandemPot; let TandemPot;
var beamEnergy; let beamEnergy;
var beamCharge; let beamCharge;
var dipoleField; let dipoleField;
var beam_Line = 'RESOLUT'; let beam_Line = 'RESOLUT';
var SwitchMagnet; let SwitchMagnet;
function GetBeamSetting(){ function GetBeamSetting(){
let client = new XMLHttpRequest(); let client = new XMLHttpRequest();
@ -212,6 +211,9 @@ function BeamSettings(){
document.getElementById("TandemInfo").innerHTML = TandemPot + " MV"; document.getElementById("TandemInfo").innerHTML = TandemPot + " MV";
destination = beam_Line; destination = beam_Line;
// if( beam_Line == "GammaTable") destination = "Gamma";
if( beam_Line == "GammaTable") destination = 'Catrina';
// alert(destination);
//Dipole info //Dipole info
if( beam_Line == 'RESOLUT'){ if( beam_Line == 'RESOLUT'){