From 2550c4350e1c5f5cda591abc1faf8c557dbb7720 Mon Sep 17 00:00:00 2001 From: zhang <zhang@9a6e40ed-f3a0-4838-9b4a-bf418f78e88d> Date: Fri, 8 Apr 2011 16:52:48 +0000 Subject: [PATCH] 08/04/2011 Fix the bug of paramters definition in Setbnr( ) --- tracy/tracy/src/physlib.cc | 95 +++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 21 deletions(-) diff --git a/tracy/tracy/src/physlib.cc b/tracy/tracy/src/physlib.cc index 94187e0..b3105a8 100644 --- a/tracy/tracy/src/physlib.cc +++ b/tracy/tracy/src/physlib.cc @@ -6,9 +6,9 @@ L. Nadolski SOLEIL 2002 Link to NAFF, Radia field maps J. Bengtsson NSLS-II, BNL 2004 - */ -/* Current revision $Revision: 1.16 $ +/* Current revision $Revision: 1.17 $ On branch $Name: not supported by cvs2svn $ - Latest change by $Author: nadolski $ + Latest change by $Author: zhang $ */ /**************************/ @@ -1115,27 +1115,30 @@ void getcsAscr(void) { printf(" *** Ascr is singular\n"); } -/****************************************************************************/ -/* void dynap(double r, double delta, double eps, int npoint, int nturn, - double x[], double y[], bool floqs, bool print) +/**************************************************************************** + void dynap(FILE *fp, double r, const double delta, const double eps, + const int npoint, const int nturn, double x[], double y[], + const bool floqs, const bool print) Purpose: Determine the dynamical aperture by tracking using polar coordinates, and sampling in phase. Assumes mid-plane symmetry - + Write the dynamic aperture to file "fp" + Input: r initial guess - delta off momentum energy - eps precision for binary search - npoint sample number for phase coordinate - nturn number of turn for computing da - floqs true means Floquet space - print true means Print out to the screen + delta off momentum energy + eps precision for binary search + npoint sample number for phase coordinate + nturn number of turn for computing da + x[] horizontal dynamics aperture + y[] vertical dynamics aperture + floqs true means Floquet space + print true means Print out to the screen Output: - x[] horizontal dynamics aperture - y[] vertical dynamics aperture + Return: none @@ -2025,6 +2028,24 @@ void SetdKLpar(int Fnum, int Knum, int Order, double dkL) { Mpole_SetPB(Fnum, Knum, Order); } +/************************************************************* + void SetdKrpar(int Fnum, int Knum, int Order, double dkrel) + + Purpose: + Increase or reduce the strength of element by a certain scale. + + Input: + Fnum family number + Knum kid number + order field strength order to be modified + bnr scale of the field strength with order "order" + + Output: + + Comments: + + +**************************************************************/ void SetdKrpar(int Fnum, int Knum, int Order, double dkrel) { long int loc; @@ -2067,7 +2088,28 @@ void SetdbnL(int Fnum, int order, double dbnL) { } } -void Setbnr(int Fnum, long order, double bnr) { +/************************************************************* + void Setbnr(int Fnum, int order, double bnr) + + Purpose: + Increase or reduce the strength of element family by a certain + scale. + + Input: + Fnum family number + order field strength order to be modified + bnr scale of the field strength with order "order" + + Output: + + Comments: + Jianfeng Zhang 07/04/2011 + Fix the bug in the type definition of the function parameter 'order' + from 'long' to 'int'. + +**************************************************************/ +//void Setbnr(int Fnum, long order, double bnr) { +void Setbnr(int Fnum, int order, double bnr) { int i; for (i = 1; i <= GetnKid(Fnum); i++) @@ -2245,11 +2287,22 @@ void SetBpmdS(int Fnum, double dxrms, double dyrms) { } } -/****************************************/ -/* Routines for closed orbit correction */ -/****************************************/ +/****************************************************************************** +void codstat(double *mean, double *sigma, double *xmax, long lastpos, bool all) -/****************************************************************************/ + Purpose: + Routines for closed orbit correction + Return the mean orbit, rms orbit and maximum orbit, based on the orbits at + all lattice elements or all bpm postion. + + Input: + mean mean value of the orbit, horizontal or vertical + sigma rms value of the orbit, horizontal or vertical + xmax maximum value of the orbit, horizontal or vertical + lastpos last element index in the lattice + all true, then do statistics on the orbit at all elements + false, ...............................at all bpm +****************************************************************************/ void codstat(double *mean, double *sigma, double *xmax, long lastpos, bool all) { long i, j, n; Vector2 sum, sum2; @@ -2262,7 +2315,7 @@ void codstat(double *mean, double *sigma, double *xmax, long lastpos, bool all) xmax[j] = 0.0; } for (i = 0; i <= lastpos; i++) { - if (all || Cell[i].Fnum == globval.bpm) { + if (all || Cell[i].Fnum == globval.bpm) {//get the sum and max orbit at all elements or all bpm n++; for (j = 1; j <= 2; j++) { sum[j - 1] += Cell[i].BeamPos[j * 2 - 2]; @@ -2275,7 +2328,7 @@ void codstat(double *mean, double *sigma, double *xmax, long lastpos, bool all) } for (j = 0; j <= 1; j++) { if (n != 0) - mean[j] = sum[j] / n; + mean[j] = sum[j] / n; //mean value of the orbit else mean[j] = 0.0; if (n != 0 && n != 1) { -- GitLab