Skip to content
Snippets Groups Projects
Commit 8151d564 authored by zhang's avatar zhang
Browse files

20/10/2010

1)  Add the interface to read multipole error from a file, set and read RF voltage, read FMAPdp.
parent e22a14dc
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ extern bool freq_map;
read_script(argv[1], true);}
else{
fprintf(stdout, "Not enough parameters\nSyntax is program parameterfile\n");
return 1;
exit_(1);
}
......@@ -62,6 +62,15 @@ extern bool freq_map;
// Flag factory
//set RF voltage
if (RFvoltageFlag == true){
printf("\nSetting RF voltage:\n");
printf(" Old RF voltage is: %lf [MV]\n",get_RFVoltage(ElemIndex("cav"))/1e6);
set_RFVoltage(ElemIndex("cav"), RFvolt);
printf(" New RF voltage is: %lf [MV]\n",get_RFVoltage(ElemIndex("cav"))/1e6);
}
// Chamber factory
if (ChamberFlag == false)
ChamberOff(); // turn off vacuum chamber setting, use the default one
......@@ -95,15 +104,15 @@ extern bool freq_map;
if (FitTuneFlag == true){
fprintf(stdout, "\n Fitting tunes\n");
FitTune(ElemIndex("qp7"),ElemIndex("qp9"), targetnux, targetnuz);
fprintf(stdout, "\n Fitting tunes: %s %s, targetnux = %f, targetnuz = %f \n",qm1,qm2,targetnux,targetnuz);
FitTune(ElemIndex(qm1),ElemIndex(qm2), targetnux, targetnuz);
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob(); /* print parameter list */
}
if (FitChromFlag == true){
fprintf(stdout, "\n Fitting chromaticities\n");
FitChrom(ElemIndex("sx9"),ElemIndex("sx10"), targetksix, targetksiz);
fprintf(stdout, "\n Fitting chromaticities: %s %s, targetksix = %f, targetksiz = %f\n",sxm1,sxm2,targetksix,targetksiz);
FitChrom(ElemIndex(sxm1),ElemIndex(sxm2), targetksix, targetksiz);
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printglob(); /* print parameter list */
}
......@@ -119,7 +128,7 @@ extern bool freq_map;
// add coupling by random rotating of the quadrupoles
if (ErrorCouplingFlag == true){
SetErr();
SetErr(err_seed,err_rms);
Ring_GetTwiss(chroma=true, 0.0); /* Compute and get Twiss parameters */
printlatt(); /* dump linear lattice functions into "linlat.dat" */
Coupling_Edwards_Teng();
......@@ -129,6 +138,12 @@ extern bool freq_map;
// WARNING Fit tunes and chromaticities before applying errors !!!!
//set multipoles in all magnets
// read multipole error from a file
if (ReadMultipoleFlag == true){
fprintf(stdout, "\n Read Multipoles file for lattice with thick sextupoles \n");
ReadFieldErr(multipole_file);
}
if (MultipoleFlag == true ){
if (ThinsextFlag ==true){
fprintf(stdout, "\n Setting Multipoles for lattice with thin sextupoles \n");
......@@ -144,12 +159,16 @@ extern bool freq_map;
}
}
//first print the full lattice with error as a flat file
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
printlatt(); /* SOLEIL print out lattice functions */
printglob();
/******************************************************************************************/
// COMPUTATION PART after setting the model
/******************************************************************************************/
//first print the full lattice with error as a flat file
prtmfile("flat_file_error.dat"); // writes flat file /* very important file for debug*/
// computes TuneShift with amplitudes
if (AmplitudeTuneShiftFlag == true){
......@@ -179,31 +198,19 @@ extern bool freq_map;
// Computes FMA
if (FmapFlag == true){
if (ChamberFlag == true ){
if (ExperimentFMAFlag == true)
fmap( _FmapFlag_nxpoint, _FmapFlag_nypoint,
_FmapFlag_nturn, _FmapFlag_xmax, _FmapFlag_ymax,
_FmapFlag_delta, _FmapFlag_diffusion);
//fmap(40,12,258,-20e-3,5e-3,0.0,true); // for experimental
if (DetailedFMAFlag == true)
fmap( _FmapFlag_nxpoint, _FmapFlag_nypoint,
_FmapFlag_nturn, _FmapFlag_xmax, _FmapFlag_ymax,
_FmapFlag_delta, _FmapFlag_diffusion);
// fmap(100,50,1026,20e-3,5e-3,0.0,true);
}
else{ // Utility
if (ExperimentFMAFlag == true)
fmap( _FmapFlag_nxpoint, _FmapFlag_nypoint,
_FmapFlag_nturn, _FmapFlag_xmax, _FmapFlag_ymax,
_FmapFlag_delta, _FmapFlag_diffusion);
if (DetailedFMAFlag == true)
fmap( _FmapFlag_nxpoint, _FmapFlag_nypoint,
_FmapFlag_nturn, _FmapFlag_xmax, _FmapFlag_ymax,
_FmapFlag_delta, _FmapFlag_diffusion);
// fmap(200,100,1026,32e-3,7e-3,0.0,true);
}
// Compute FMA dp
if (FmapdpFlag == true){
fmapdp( _FmapdpFlag_nxpoint, _FmapdpFlag_nepoint,
_FmapdpFlag_nturn, _FmapdpFlag_xmax, _FmapdpFlag_emax,
_FmapdpFlag_z, _FmapdpFlag_diffusion);
}
if (CodeComparaisonFlag){
fmap(200,100,1026,-32e-3,7e-3,0.0,true);
}
......@@ -214,7 +221,6 @@ extern bool freq_map;
_MomentumAccFlag_istart, _MomentumAccFlag_istop,
_MomentumAccFlag_deltaminp, _MomentumAccFlag_deltamaxp, _MomentumAccFlag_nstepp,
_MomentumAccFlag_deltaminn, _MomentumAccFlag_deltamaxn, _MomentumAccFlag_nstepn);
// MomentumAcceptance(1L, 108L, 0.01, 0.05, 100L, -0.01, -0.05, 100L);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment