Develop its own diagnostic

https://www.dacm-logiciels.fr/tracewin
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

I see. Thank you very much for your explanation.

Bruce
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

In relation to my own diagnostic, I want to develop my own "adjust" element. Could you show me an example?


I am interested in developing my own "adjust" for the phase and eacc cavity.,i.e "ADJUST #elem -3 0 -5 5 1
" and "ADJUST #elem -6 0 0 1.2 0.025".

Best regards,

Bruce
User avatar
FranceDidier
Administrator
Administrator
Posts: 975
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Develop its own diagnostic

Post by FranceDidier »

Dear Bruce,

ADJUST' is not an element, but a command. It is not possible to redefine it, it is only possible for elements or diag which is also a special element.

Regards,

Didier
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

Thanks for the information.

About the "adjust" command, like there are "ADJUST_STEERER", "ADJUST_STEERER_BX", etc. I was wondering If I can create my own command for the compensation?

I was working on my own diagnostic for energy compensation and phase one similar to "Denergy" and "Dphase". The reason is that I want to add more conditions for the compensation.

Following the early discussion. I created my own diagnostic.
main.cpp
(4.94 KiB) Downloaded 215 times
I used Bcent[4] for Z centroid and Bcent[5] for Deltap/ps.
Script.png
Script.png (22.97 KiB) Viewed 4125 times
For Case 5, I asked to compensate Z and Delta p. And for Case6, I computed the corresponding phase and energy.

In these two cases, I compared with the diagnostic "Denergy" and "Dphase" (Called case 4).

The energy compensation results are:
Compensation.png
Compensation.png (70.61 KiB) Viewed 4125 times
As you see the Case 4(default diagnostic in TraceWin) and Case 5 produce similar results. But, Case 6 has a poor performance.
The results of the diagnostic are different for the 3 cases.
Diagnostic2.png
Diagnostic2.png (48.37 KiB) Viewed 4125 times


I include the project for reference.
TEST6.zip
(11.12 KiB) Downloaded 195 times
I believe that I have some problems with the energy conversion. However, I used the same equation that is in the example program.

Could you tell me what is missing in Case 6 to reproduce the results of the two previous cases?

Thanks for the help and support.

Bruce
User avatar
FranceDidier
Administrator
Administrator
Posts: 975
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Develop its own diagnostic

Post by FranceDidier »

Dear Bruce,

Ok I got exactly your results. Good point
But, something seems strange for me considering your syntax.

Code: Select all

MY_DIAG (d_ene_pha) 20 0 0  ;  That means: parm[1]=0  &  parm[2]=0
MY_DIAG (d_ene_pha) 20 1 0 ;   That means: parm[1]=1  &  parm[2]=0
You never use your dp/p or energy criteria but you change your target either to 1 or to 0 on the Z or phase

Regards,

Didier
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

Thanks for pointing out my silly mistake.
For the record, I am able to get the same results.
Results5.png
Results5.png (291.29 KiB) Viewed 4116 times
Best regards,

Bruce
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

Sorry for the abuse of your kindness,
I hope that you can help with the next doubts:

1) Could you tell me how to implement multiple target values in my diagnostic similar to "DIAG_SIZEP" AND "DIAG_SIZE"?

2) Because this diagnostic is focused on error cases, I want to see if there's is way to access the perfect linac to use that ideal value for the target and to compute new variables.
I guess that is the second step in the diagnostic matching?
Diagnostic.png
Diagnostic.png (22.3 KiB) Viewed 4113 times

2.1) As an example, I want to access the phase advance for certain periods to ask for smoothness. Similar, in a certain way, to the "DIAG_DSIZE2" that asks the same size for certain points.

2.2) In the section "Cavity tunning" the code computes TOF. I would like to create a diagnostic that makes that.
I have in mind a diagnostic that computed the TOF between two associated points. I think that the diagnostic can access the output "tracewin.out".

Any advice is welcome.

Thanks again for your help and support.

Bruce
User avatar
FranceDidier
Administrator
Administrator
Posts: 975
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Develop its own diagnostic

Post by FranceDidier »

Dear Bruce,

1) Either you use several instances of your diag, like your example (the global criterion is the quadratic sum of the criteria of these diag), or you mix all your diag in one and it is up to you to make this sum.

2) Yes

2.1) & 2.2) JI have never done it, but it is indeed possible to read in your code the file "tracewin.out" to obtain the energy or the phase advance, but be careful this file is created on the fly and will not be able to contain data at the position of the diag, but in principle it is not a problem.

Regards,

Didier
JapanBruce Yee
Competent
Competent
Posts: 86
Joined: Tue 22 Dec 2020 03:47
Country:
Japan (jp)
Japan

Re: Develop its own diagnostic

Post by JapanBruce Yee »

Dear Didier,

Thanks for the advances,

About 1) I mentioned because in the diagnostic example, parameter[1]= target value. It makes the impression that only one target value at a time can be used. That was, I was wondering how do you implement several targets value. However, as you suggest I can use it several times.

About 2). How do you access the ideal lattice?

Finally, Do I need to have a diagnostic in each point of the lattice that I want to have to access the beam parameters (energy, size)? Or If it is possible to access the different points with respect to the diagnostic position (similar TUNE_CAVITY that I define position with respect to that location)?

Thanks for the help,

Bruce
User avatar
FranceDidier
Administrator
Administrator
Posts: 975
Joined: Wed 26 Aug 2020 14:40
Country:
France (fr)
France

Re: Develop its own diagnostic

Post by FranceDidier »

Dear Bruce,

"TraceWin.out" contain all data you need for your current simulation. So including effect due to errors. But you can make first a run wihout error, then save "TraceWin.out" to "TraceWin_idela.out" and by this way you would be able to pick-up at each position data for ideal and current machine.
Of course, you will have acces only data below diag position, that means probably you cannot do something similar to TUNE_CAV syntax and you have to put a diag at the rigth possition allowing you to have all position you need.

I think, probably all is possible is you're ready to write code.

Anothre file which could help you is "Transfer_matrix1.dat" containing the transfer matrix of each element withour error. Calculating the phase advance of the lattice from this is possible (a bit complex but feasible)

Regards,

Didier
Post Reply