aesa: make "make clean" also remove output.txt
[jump.git] / aesa / src / Weight_Generator.c
1 #include "Weight_Generator.h"
2
3 /************************************************************************************/
4
5 void Weight_Generator_init(DOLProcess * p)
6 {
7         int i,j;
8
9         //p->local->weight_counter = 0;             
10         p->local->pulse_counter = 0;
11         p->local->n_firings = 0;
12         
13         
14         
15         for (i=0; i<NUMBER_OF_BEAMS; i++) 
16   {
17                 for (j=0; j<NUMBER_OF_ANTENNA_ELEMENTS; j++) 
18     {
19                         (p->local->Weights[i][j]).real = 1.0;
20                         (p->local->Weights[i][j]).imag = 0.0;
21                 }
22         }
23
24         p->local->excount = 0;
25
26 }
27
28 /************************************************************************************/
29
30 int Weight_Generator_fire(DOLProcess * p)
31 {
32   int beam_index;
33         p->local->excount++;
34   
35   // printf("\n  \t\t weight gen \t %d \n",   p->local->pulse_counter);
36         
37         CREATEPORTVAR(output_port);
38         for (beam_index = 0; beam_index < NUMBER_OF_BEAMS; beam_index++) 
39     {
40                 CREATEPORT(output_port, PORT_OUT, 1, beam_index, NUMBER_OF_BEAMS);
41                 DOL_write((void*)output_port, &(p->local->Weights[beam_index][0]), NUMBER_OF_ANTENNA_ELEMENTS*sizeof(ComplexNumber), p);
42         }
43
44         //p->local->weight_counter = p->local->weight_counter + 1; 
45
46         // if (p->local->weight_counter == NUMBER_OF_ANTENNA_ELEMENTS)
47         // {
48         //      p->local->weight_counter = 0;
49                 p->local->pulse_counter = p->local->pulse_counter + 1;
50                 if (p->local->pulse_counter == (NUMBER_OF_RANGE_BINS * NUMBER_OF_PULSES)) 
51         {
52                         p->local->pulse_counter = 0;
53                         p->local->n_firings = p->local->n_firings + 1;
54                 }
55         //}
56         
57         if (p->local->n_firings == NUMBER_OF_ITERATIONS) 
58     {
59     printf("\n\n:: Weight generator finished ::\n\n");
60     // printf("\ttotal number of executions:  %d",p->local->excount);   
61     
62                 DOL_detach(p);
63         }
64         
65         return 0;
66 }