added beamStatus.py, called every 5 sec

This commit is contained in:
Ryan Tang 2023-01-05 16:57:31 -05:00
parent 3ccf64424b
commit 45af719e29
4 changed files with 49 additions and 8 deletions

25
beamStatus.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/python3
import os
url="http://localhost:8086/write?db=accel"
import random
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)
#print('</body>')
#print('</html>')

14
geo.js
View File

@ -326,9 +326,9 @@ let sourceLine;
{ {
let RFSource1a = new beamRectElement([windowSize[0]*0.9, windowSize[1]*0.9], 0, 40, 100, color.RFsourcce); let RFSource1a = new beamRectElement([windowSize[0]*0.9, windowSize[1]*0.9], 0, 40, 100, color.RFsourcce);
let RFSource1b = new beamRectElement(RFSource1a.exitPos, 0, 40, 20, color.RFsourcce); let RFSource1b = new beamRectElement(RFSource1a.exitPos, 0, 40, 20, color.RFsourcce);
let s0 = new beamSpliter(RFSource1b.GetExitPos(120), 50, Math.PI, color.Dipole); let s0 = new beamSpliter(RFSource1b.GetExitPos(120), 80, Math.PI, color.Dipole);
let tandem = new tandemClass(RFSource1b.GetExitPos(200), 300, 100, color.Tandem); let tandem = new tandemClass(RFSource1b.GetExitPos(200), 300, 200, color.Tandem);
let q0 = new beamRectElement(tandem.GetExitPos(50), 0, 60, 60, color.Qpole); let q0 = new beamRectElement(tandem.GetExitPos(50), 0, 60, 60, color.Qpole);
let df0a = new beamRectElement(q0.GetExitPos(50), 0, 30, 40, color.Deflector); let df0a = new beamRectElement(q0.GetExitPos(50), 0, 30, 40, color.Deflector);
@ -341,7 +341,7 @@ let sourceLine;
let targetRoom1; let targetRoom1;
{ {
let dipole = new beamDipole(sourceLine.tandem.GetExitPos(300), 80, Math.PI/2, 0, color.Dipole); let dipole = new beamDipole(sourceLine.tandem.GetExitPos(300), 80, Math.PI/2, 0, color.Dipole);
let fan = new beamSpliter(dipole.GetExitPos(100), 50, -100 * deg, color.Deflector); let fan = new beamSpliter(dipole.GetExitPos(100), 80, -100 * deg, color.Deflector);
let upperLine; let upperLine;
{ {
@ -498,7 +498,7 @@ let posArray; // thsi is a collection of the position of beamlines
let Resolut = [ let Resolut = [
sourceLine.RFSource1b.GetExitPos(0), sourceLine.RFSource1b.GetExitPos(0),
sourceLine.RFSource1b.GetExitPos(1500), targetRoom2.d2.entracePos,
targetRoom2.d2.GetExitPos(0), targetRoom2.d2.GetExitPos(0),
targetRoom2.d2.GetExitPos(1700), targetRoom2.d2.GetExitPos(1700),
targetRoom2.fan2.GetExitPos(0.7, 500), targetRoom2.fan2.GetExitPos(0.7, 500),
@ -508,7 +508,7 @@ let posArray; // thsi is a collection of the position of beamlines
let Anasen = [ let Anasen = [
sourceLine.RFSource1b.GetExitPos(0), sourceLine.RFSource1b.GetExitPos(0),
sourceLine.RFSource1b.GetExitPos(1500), targetRoom2.d2.entracePos,
targetRoom2.d2.GetExitPos(0), targetRoom2.d2.GetExitPos(0),
targetRoom2.d2.GetExitPos(1700), targetRoom2.d2.GetExitPos(1700),
targetRoom2.fan2.GetExitPos(0.5, 500) targetRoom2.fan2.GetExitPos(0.5, 500)
@ -516,7 +516,7 @@ let posArray; // thsi is a collection of the position of beamlines
let SPS = [ let SPS = [
sourceLine.RFSource1b.GetExitPos(0), sourceLine.RFSource1b.GetExitPos(0),
sourceLine.RFSource1b.GetExitPos(1500), targetRoom2.d2.entracePos,
targetRoom2.d2.GetExitPos(0), targetRoom2.d2.GetExitPos(0),
targetRoom2.d2.GetExitPos(1700), targetRoom2.d2.GetExitPos(1700),
targetRoom2.fan2.GetExitPos(0.3, 500), targetRoom2.fan2.GetExitPos(0.3, 500),
@ -525,7 +525,7 @@ let posArray; // thsi is a collection of the position of beamlines
let Clarion2 = [ let Clarion2 = [
sourceLine.RFSource1b.GetExitPos(0), sourceLine.RFSource1b.GetExitPos(0),
sourceLine.RFSource1b.GetExitPos(1500), targetRoom2.d2.entracePos,
targetRoom2.d2.GetExitPos(0), targetRoom2.d2.GetExitPos(0),
targetRoom2.d2.GetExitPos(1700), targetRoom2.d2.GetExitPos(1700),
targetRoom2.fan2.GetExitPos(0.3, 500), targetRoom2.fan2.GetExitPos(0.3, 500),

View File

@ -190,7 +190,7 @@ function GetBeamSetting(){
beam_Line = data[9]; beam_Line = data[9];
SwitchMagnet = data[10]; SwitchMagnet = data[10];
} }
client.open('GET', "test.py", false); client.open('GET', "beamInfo.py", false);
client.send(); client.send();
} }
@ -241,6 +241,22 @@ setInterval(BeamSettings, updateTime * 60 * 1000);
lineMotion(); 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);
</script> </script>
<!-- <!--