Changeset 3165 in Sophya for trunk/Cosmo/RadioBeam/treccyl.cc


Ignore:
Timestamp:
Feb 1, 2007, 3:15:16 PM (19 years ago)
Author:
ansari
Message:

petites ameliorations + reglage parametres -> version +/- utilisable , Reza 01/02/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/RadioBeam/treccyl.cc

    r3164 r3165  
    2121#include "mbeamcyl.h"
    2222
     23/*
     24   Projet BAORadio / HSHS
     25   Programme de simulation pour reconstruction de lobe radio.
     26   programme principal de test
     27
     28   R. Ansari - LAL      Jan 2007
     29
     30*/
    2331
    2432// Declaration des fonctions de ce fichier
    2533static int test1cyl(string& ppfname);
    26 static int testmulticyl(string& ppfname);
     34static int testmulticyl(string& ppfname, int ncyl=5);
    2735
    2836//-----------------------------------------------------------
     
    3341static double freq0 = 2.;  // frequence de base
    3442static double da = 0.25;     // pas des antennes le long du cylindre
     43// ATTENTION : les parametres suivants sont relies a MR/da
     44static double maxangX = M_PI/3.; // angle max en X ( +/- )
     45static double maxangY = M_PI/60.; // angle max en Y ( +/- )
     46static int nsrcmax = 50;  // Nb total de sources - en un plan
     47
    3548static double snoise = 1.0;  // sigma du bruit
    3649static double tjit = 0.05;   // sigma du jitter en temps
     
    5669string ppfname = "treccyl.ppf";
    5770int act = 1;
     71int ncyl = 5;
    5872if (narg < 3) {
    5973  cout << "Usage: treccyl act ppfname [PrtLev=0] \n"
    60        << "  act= X ou XY  , ppfname=  treccyl.ppf par defaut" << endl;
     74       << " -act= X ou XY5 ou XY12  (5 ou 12 cylindres) \n"
     75       << " -ppfname=  treccyl.ppf par defaut" << endl;
    6176  return 1;
    6277}
    63 if (strcmp(arg[1],"XY") == 0) act = 2;
     78if (strcmp(arg[1],"XY5") == 0) { act = 2;  ncyl = 5; }
     79else if (strcmp(arg[1],"XY12") == 0) { act = 2;  ncyl = 12; }
    6480if (narg > 2)  ppfname = arg[2];
    6581if (narg > 3)  prtlevel = atoi(arg[3]);
    6682
    6783int rc = 0;
     84cout << ">>>> treccyl : " << arg[1] << " PPFName=" << ppfname << endl;
    6885try {
    69   if (act == 2) rc = testmulticyl(ppfname);
     86  if (act == 2) rc = testmulticyl(ppfname, ncyl);
    7087  else rc = test1cyl(ppfname);
    71   cout << "treccy/Info - FIN  " << endl;
    7288}
    7389  catch (PThrowable& exc) {
     
    85101  }
    86102
    87  return rc;
     103cout << ">>>> treccyl ------- FIN ----------- Rc=" << rc << endl;
     104return rc;
    88105}
    89106
     
    95112  // BRSourceGen sg;
    96113  int nsrc = 60;
    97   BRSourceGen sg(nsrc);
     114  BRSourceGen sg(nsrcmax, maxangX, 0.);
    98115  //  sg.WritePPF(string("brsrc1.ppf"));
    99116
     
    119136  cout << "treccy/test1cyl:  signal vectors OK " << endl;
    120137  PrtTim("test1cyl:[1] ");
     138 
     139  cout << "--- treccy/test1cyl: Saving to PPF file " << ppfname << endl;
    121140
    122141  POutPersist po(ppfname);
     
    145164
    146165//--- Fonction de test : reconstruction cube AngX-AngY-Frequence (multi-cylindre)
    147 int testmulticyl(string& ppfname)
     166int testmulticyl(string& ppfname, int ncyl)
    148167{
     168
     169  if ((ncyl != 5) && (ncyl != 12)) ncyl = 5;
    149170
    150171  // BRSourceGen sg;
     
    156177 
    157178 
    158   cout << "treccy/testmulticyl: BRSourceGen sg([frq=0.1,0.27,0.38], " << nsf << ")" << endl;
    159   BRSourceGen sg(frq, nsf, M_PI/3, M_PI/60);
    160   /*
     179  cout << "testmulticyl: BRSourceGen sg([frq=0.1,0.27,0.38], " << nsf
     180       << "," << maxangX << "," << maxangY << ")" << endl;
     181  BRSourceGen sg(frq, nsf, maxangX, maxangY);
     182 
    161183  int is;
    162   for(is=0; is<nsf; is++)     sg.angY(is) = 0.;
    163   for(is=nsf; is<2*nsf; is++)     sg.angY(is) = M_PI/30.;
    164   for(is=2*nsf; is<3*nsf; is++)     sg.angY(is) = -M_PI/30.;
    165   */
     184  double fay[6] = {-0.7,-0.5,0.,0.,0.5,0.7};
     185  for(is=0; is<3*nsf; is++) {
     186    int ism = is%nsf;
     187    sg.angX(is) = maxangX*(ism-2.5)/3.;
     188    sg.angY(is) = maxangY*fay[ism];
     189  }
    166190  // sg.WritePPF(string("brsrcm.ppf"));
    167191  // BRSourceGen  sg(string("brsrcm.ppf"));
    168   cout << "=== testmulticyl: BRSourceGen NbSrc= " << sg.NbSources()
    169        << " NbRecep=" << MR << " NSamples=" << NE << endl;
     192  cout << "=== testmulticyl: NbSrc= " << sg.NbSources()
     193       << " NbRecep=" << MR << " NSamples=" << NE << " NCyl=" << ncyl << endl;
    170194  if (prtlevel > 1)  sg.Print(cout);
    171195 
     
    179203  mcyl.SetGains(gmean, gsig, nantgz);
    180204
    181   /*
    182   for(int kkc=0; kkc<12; kkc++)
    183     mcyl.AddCylinder(5.*kkc);
    184   */
    185  
    186   mcyl.AddCylinder(0.);
    187   mcyl.AddCylinder(5.);
    188   mcyl.AddCylinder(15.);
    189   mcyl.AddCylinder(35.);
    190   mcyl.AddCylinder(65.);
    191  
     205  if (ncyl == 12) {
     206    cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... " << (ncyl-1)*5.
     207         << " (EqualSpacing)" << endl;
     208    for(int kkc=0; kkc<12; kkc++) {
     209      cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << 5.*kkc << " )" << endl;
     210      mcyl.AddCylinder(5.*kkc);
     211    }
     212  }
     213  else {
     214    cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... 55 (IrregularSpacing)" << endl;
     215    double posyc[5] = {0.,5.,15.,35.,55.};
     216    for(int kkc=0; kkc<5; kkc++) {
     217      cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << posyc[kkc] << " )" << endl;
     218      mcyl.AddCylinder(posyc[kkc]);
     219    }
     220  }
     221
    192222  mcyl.SetSources(sg);
    193223 
     
    195225
    196226  //  mcyl.ReconstructCylinderPlaneS(true);
    197   mcyl.ReconstructSourceBox(10, M_PI/600.);
    198 
     227  mcyl.ReconstructSourceBox(10, maxangY/10.);
     228
     229  cout << "--- treccy/testmulticyl: Saving to PPF file " << ppfname << endl;
    199230  POutPersist po(ppfname);
    200231
Note: See TracChangeset for help on using the changeset viewer.