improving the info display
This commit is contained in:
parent
651a3ad7c1
commit
81455c6d62
103
geo.js
103
geo.js
|
@ -23,11 +23,11 @@ function distance(xy1, xy2){
|
||||||
|
|
||||||
let colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"];
|
let colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"];
|
||||||
|
|
||||||
let color = {
|
let color = { //[on, off]
|
||||||
BeamPipe : ['red', 'grey'],
|
BeamPipe : ['red', 'grey'],
|
||||||
Dipole : ['gold', '#CDCD5B'],
|
Dipole : ['gold', '#DEDE6C'],
|
||||||
Deflector : ['Orange', '#228522'],
|
Deflector : ['Orange', '#228522'],
|
||||||
Qpole : ['#7F7FFF', '#8F8FBC'],
|
Qpole : ['#4E4EEE', '#8F8FBC'],
|
||||||
Detector : ['Yellow', '#8B8B0A'],
|
Detector : ['Yellow', '#8B8B0A'],
|
||||||
LINAC : ['Cyan', '#44AAAA'],
|
LINAC : ['Cyan', '#44AAAA'],
|
||||||
Tandem : [ '#782F40', '#CEB888'],
|
Tandem : [ '#782F40', '#CEB888'],
|
||||||
|
@ -137,7 +137,7 @@ class multiBeamLine extends basicShape{
|
||||||
this.clear();
|
this.clear();
|
||||||
let ctx = this.layer.getContext('2d');
|
let ctx = this.layer.getContext('2d');
|
||||||
if(isDashed){
|
if(isDashed){
|
||||||
ctx.setLineDash([4,4]);
|
ctx.setLineDash([8,8]);
|
||||||
ctx.lineDashOffset = -this.offset;
|
ctx.lineDashOffset = -this.offset;
|
||||||
ctx.strokeStyle = this.color[0];
|
ctx.strokeStyle = this.color[0];
|
||||||
}else{
|
}else{
|
||||||
|
@ -149,8 +149,8 @@ class multiBeamLine extends basicShape{
|
||||||
}
|
}
|
||||||
|
|
||||||
march(){
|
march(){
|
||||||
this.offset+=1;
|
this.offset+=2;
|
||||||
if( this.offset > 8) this.offset = 0;
|
if( this.offset > 16) this.offset = 0;
|
||||||
this.draw(true);
|
this.draw(true);
|
||||||
//setTimeout(this.march.bind(this), 20);
|
//setTimeout(this.march.bind(this), 20);
|
||||||
}
|
}
|
||||||
|
@ -552,43 +552,51 @@ let beamLineHaHa;
|
||||||
|
|
||||||
|
|
||||||
//============================== Draw
|
//============================== Draw
|
||||||
|
var destination = 'Gamma';
|
||||||
|
|
||||||
for( const ele in beamLineHaHa){
|
function DisableAllDetector(){
|
||||||
beamLineHaHa[ele].draw(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for( const ele in sourceLine){
|
for( const ele in beamLineHaHa){
|
||||||
sourceLine[ele].draw(true);
|
beamLineHaHa[ele].draw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetRoom1.dipole.draw(true);
|
for( const ele in sourceLine){
|
||||||
targetRoom1.fan.draw(true);
|
sourceLine[ele].draw(true);
|
||||||
targetRoom1.upperLine.q1a.draw(true);
|
}
|
||||||
targetRoom1.upperLine.df1a.draw(true);
|
|
||||||
targetRoom1.upperLine.GammaStation.draw(false);
|
for( const ele in targetRoom1){
|
||||||
targetRoom1.upperLine.Catrina.draw(false);
|
try{
|
||||||
targetRoom1.lowerLine.q1c.draw(false);
|
targetRoom1[ele].draw(false);
|
||||||
targetRoom1.lowerLine.df1c.draw(false);
|
}catch(err){
|
||||||
|
for( const haha in targetRoom1[ele]){
|
||||||
for( const ele in targetRoom2){
|
try{
|
||||||
try{
|
targetRoom1[ele][haha].draw(false);
|
||||||
targetRoom2[ele].draw(false);
|
}catch(err){
|
||||||
}catch(err){
|
|
||||||
for( const haha in targetRoom2[ele]){
|
}
|
||||||
try{
|
}
|
||||||
targetRoom2[ele][haha].draw(false);
|
}
|
||||||
}catch(err){
|
}
|
||||||
for( const kaka in targetRoom2[ele][haha]){
|
|
||||||
targetRoom2[ele][haha][kaka].draw(false);
|
for( const ele in targetRoom2){
|
||||||
|
try{
|
||||||
|
targetRoom2[ele].draw(false);
|
||||||
|
}catch(err){
|
||||||
|
for( const haha in targetRoom2[ele]){
|
||||||
|
try{
|
||||||
|
targetRoom2[ele][haha].draw(false);
|
||||||
|
}catch(err){
|
||||||
|
for( const kaka in targetRoom2[ele][haha]){
|
||||||
|
targetRoom2[ele][haha][kaka].draw(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var destination = 'Gamma';
|
|
||||||
|
|
||||||
function EnableDetector(){
|
function EnableDetector(){
|
||||||
|
DisableAllDetector();
|
||||||
if( destination == 'Gamma' ) targetRoom1.upperLine.GammaStation.draw(true);
|
if( destination == 'Gamma' ) targetRoom1.upperLine.GammaStation.draw(true);
|
||||||
if( destination == 'Catrina') targetRoom1.upperLine.Catrina.draw(true);
|
if( destination == 'Catrina') targetRoom1.upperLine.Catrina.draw(true);
|
||||||
if( destination == 'RESOLUT') targetRoom2.ResolutLine.Resolut.draw(true);
|
if( destination == 'RESOLUT') targetRoom2.ResolutLine.Resolut.draw(true);
|
||||||
|
@ -596,6 +604,33 @@ function EnableDetector(){
|
||||||
if( destination == 'SPS') targetRoom2.lowerLine.SplitPoleLine.SPS.draw(true);
|
if( destination == 'SPS') targetRoom2.lowerLine.SplitPoleLine.SPS.draw(true);
|
||||||
if( destination == 'Clarion2') targetRoom2.lowerLine.ClarionLine.Clarion2.draw(true);
|
if( destination == 'Clarion2') targetRoom2.lowerLine.ClarionLine.Clarion2.draw(true);
|
||||||
|
|
||||||
|
if( destination == 'Gamma' || destination == 'Catrina'){
|
||||||
|
for( const ele in targetRoom1){
|
||||||
|
try{
|
||||||
|
targetRoom2[ele].draw(true);
|
||||||
|
}catch(err){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( destination == 'RESOLUT' || destination == 'Anasen' || destination == 'SPS' || destination == 'Clarion2'){
|
||||||
|
for( const ele in targetRoom2){
|
||||||
|
try{
|
||||||
|
targetRoom2[ele].draw(true);
|
||||||
|
}catch(err){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( destination == 'RESOLUT'){
|
||||||
|
for( const ele in targetRoom2.ResolutLine){
|
||||||
|
try{
|
||||||
|
targetRoom2.ResolutLine[ele].draw(true);
|
||||||
|
}catch(err){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function lineMotion(){
|
function lineMotion(){
|
||||||
|
|
144
index.html
144
index.html
|
@ -54,11 +54,38 @@
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#text{
|
#BeamInfo{
|
||||||
|
color: orange;
|
||||||
|
position:absolute;
|
||||||
|
font-size: 100px;
|
||||||
|
top : 25%;
|
||||||
|
left : 35%;
|
||||||
|
z-index:1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
#SrcInfo{
|
||||||
|
color: white;
|
||||||
|
position:absolute;
|
||||||
|
font-size: 15px;
|
||||||
|
bottom : 9.6%;
|
||||||
|
right : 10%;
|
||||||
|
z-index:1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
#TandemInfo{
|
||||||
|
color: white;
|
||||||
|
position:absolute;
|
||||||
|
font-size: 15px;
|
||||||
|
bottom : 35%;
|
||||||
|
right : 10%;
|
||||||
|
z-index:1001;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footnote{
|
||||||
color: aqua;
|
color: aqua;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top : 20%;
|
bottom : 2%;
|
||||||
left : 45%;
|
right : 1%;
|
||||||
width: 100;
|
width: 100;
|
||||||
height: 100;
|
height: 100;
|
||||||
z-index:1001;
|
z-index:1001;
|
||||||
|
@ -68,9 +95,16 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="text"></div>
|
|
||||||
|
|
||||||
<div id='clock'></div>
|
<div id='clock'></div>
|
||||||
|
<div id='footnote'></div>
|
||||||
|
|
||||||
|
<div id="BeamInfo"></div>
|
||||||
|
|
||||||
|
<div id="SrcInfo"></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=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>-->
|
||||||
|
@ -79,64 +113,94 @@
|
||||||
|
|
||||||
<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>
|
||||||
===================
|
|
||||||
|
|
||||||
Isotope: C12
|
|
||||||
PreAcceleration: 120.0 kV
|
|
||||||
Inflector: 3.70 A
|
|
||||||
LEB Voltage: -2.62 V
|
|
||||||
LEB feedback: 0.090 V
|
|
||||||
Tandem Pot.: 7.126 MV
|
|
||||||
Beam Energy: 50.000 MeV
|
|
||||||
Beam Charge: 6
|
|
||||||
Frac. Charge: 0.044
|
|
||||||
Beta: 0.0943
|
|
||||||
Analyzing Magnet: 6813.81 G
|
|
||||||
Beam Line: RESOLUT
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<!-- ################################################ -->
|
<!-- ################################################ -->
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
let data;
|
|
||||||
|
|
||||||
function GetMassFromAZ(){
|
|
||||||
let client = new XMLHttpRequest();
|
|
||||||
client.onreadystatechange = function() {
|
|
||||||
data = client.responseText;
|
|
||||||
//alert(data);
|
|
||||||
}
|
|
||||||
client.open('GET', "test.py", false);
|
|
||||||
client.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
GetMassFromAZ();
|
|
||||||
|
|
||||||
document.getElementById("text").innerHTML = data;
|
|
||||||
|
|
||||||
var beam_Line = 'RESOLUT';
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="geo.js"></script>
|
<script type="text/javascript" src="geo.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let updateTime = 10; //min
|
||||||
|
document.getElementById("footnote").innerHTML = "Accelrator 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;
|
||||||
|
|
||||||
|
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', "test.py", false);
|
||||||
|
client.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function BeamSettings(){
|
||||||
|
GetBeamSetting();
|
||||||
|
|
||||||
|
//format beamInfo
|
||||||
|
let beamKEA = beamEnergy/parseFloat(beamMass);
|
||||||
|
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";
|
||||||
|
|
||||||
|
//tadem info
|
||||||
|
document.getElementById("TandemInfo").innerHTML = TandemPot + " MV";
|
||||||
|
|
||||||
destination = beam_Line;
|
destination = beam_Line;
|
||||||
|
|
||||||
EnableDetector();
|
EnableDetector();
|
||||||
lineMotion();
|
lineMotion();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BeamSettings();
|
||||||
|
setInterval(BeamSettings, updateTime * 60 * 1000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
60
test.py
60
test.py
|
@ -36,8 +36,8 @@ switchingMagnet = '404'
|
||||||
file = open("beam.txt")
|
file = open("beam.txt")
|
||||||
|
|
||||||
print("Content-type:text/html\r\n\r\n")
|
print("Content-type:text/html\r\n\r\n")
|
||||||
print('<html>')
|
#print('<html>')
|
||||||
print('<body>')
|
#print('<body>')
|
||||||
|
|
||||||
for x in file:
|
for x in file:
|
||||||
#print("<br>" + x)
|
#print("<br>" + x)
|
||||||
|
@ -70,30 +70,40 @@ for x in file:
|
||||||
|
|
||||||
|
|
||||||
#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>")
|
||||||
print("Inflector: " + inflector + " A<br>")
|
#print("Inflector: " + inflector + " A<br>")
|
||||||
print("LEB Voltage: " + LEB_Voltage + " V<br>")
|
#print("LEB Voltage: " + LEB_Voltage + " V<br>")
|
||||||
print("LEB feedback: " + LEB_Feedback + " V<br>")
|
#print("LEB feedback: " + LEB_Feedback + " V<br>")
|
||||||
print("Tandem Pot.: " + tandam_pot + " MV<br>")
|
#print("Tandem Pot.: " + tandam_pot + " MV<br>")
|
||||||
print("Beam Energy: " + beam_energy + " MeV<br>")
|
#print("Beam Energy: " + beam_energy + " MeV<br>")
|
||||||
print("Beam Charge: " + charge + "<br>")
|
#print("Beam Charge: " + charge + "<br>")
|
||||||
print("Frac. Charge: " + charge_frac + "<br>")
|
#print("Frac. Charge: " + charge_frac + "<br>")
|
||||||
print("Beta: " + beta + "<br>")
|
#print("Beta: " + beta + "<br>")
|
||||||
print("Analyzing Magnet: " + analysisMagnet + " G<br>")
|
#print("Analyzing Magnet: " + analysisMagnet + " G<br>")
|
||||||
print("Beam Line: " + beamLine + "<br>")
|
#print("Beam Line: " + beamLine + "<br>")
|
||||||
print("Switching Magnet: " + switchingMagnet + " A<br>")
|
#print("Switching Magnet: " + switchingMagnet + " A<br>")
|
||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
|
MassNumber = (re.findall(r'\d+', isotope))[0]
|
||||||
|
pos = isotope.find(str(MassNumber))
|
||||||
|
IsotopeSym = isotope[0:pos].upper()
|
||||||
|
|
||||||
|
|
||||||
#
|
print(MassNumber,
|
||||||
#file = open("test.txt")
|
IsotopeSym,
|
||||||
#
|
preacc,
|
||||||
#for x in file:
|
inflector,
|
||||||
# print("<br>")
|
LEB_Voltage,
|
||||||
# print(x)
|
tandam_pot,
|
||||||
#
|
beam_energy,
|
||||||
#print('<p>===================<p>')
|
charge,
|
||||||
print('</body>')
|
analysisMagnet,
|
||||||
print('</html>')
|
beamLine,
|
||||||
|
switchingMagnet
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#print('</body>')
|
||||||
|
#print('</html>')
|
Loading…
Reference in New Issue
Block a user