aesa: make "make clean" also remove output.txt
[jump.git] / aesa / src / Data_Generator.c
1 #include <stdio.h>
2 #include "Data_Generator.h"
3
4 /************************************************************************************/
5
6 void Data_Generator_init(DOLProcess * p)
7 {
8         int i,j,k;
9         
10         // p->local->antenna_cntr = 0;                  
11         p->local->pulse_cntr = 0;
12         p->local->bin_cntr = 0;
13         p->local->n_firings = 0;
14
15         p->local->excount = 0;
16         
17         for (i=0; i<NUMBER_OF_PULSES; i++)  
18         {
19                 for (j=0; j<NUMBER_OF_RANGE_BINS; j++) 
20                 {
21                         for (k=0; k<NUMBER_OF_ANTENNA_ELEMENTS; k++) 
22                         {
23                                 (p->local->Samples[i][j][k]).real = 1.0;
24                                 (p->local->Samples[i][j][k]).imag = 0.0;
25                         }
26                 }
27         }
28 }
29
30 /************************************************************************************/
31
32 int Data_Generator_fire(DOLProcess * p)
33 {       
34         int beam_index;
35         p->local->excount++;
36     // printf("\tgenerator  executions:  %d\n",p->local->excount);      
37
38
39         // printf("\n Data Gen \n \t range: %d \n\t pulse: %d", p->local->bin_cntr, p->local->pulse_cntr);
40         
41         CREATEPORTVAR(output_port);  
42         for (beam_index = 0; beam_index < NUMBER_OF_BEAMS; beam_index++) 
43         {
44                 CREATEPORT(output_port, PORT_OUT, 1, beam_index, NUMBER_OF_BEAMS);
45                 DOL_write((void*)output_port, &(p->local->Samples[p->local->pulse_cntr][p->local->bin_cntr][0])
46                                                                         , NUMBER_OF_ANTENNA_ELEMENTS*sizeof(ComplexNumber), p);
47         }
48         
49         //p->local->antenna_cntr = p->local->antenna_cntr + 1;
50         
51         // if (p->local->antenna_cntr == NUMBER_OF_ANTENNA_ELEMENTS) 
52         // {
53    //  p->local->antenna_cntr = 0;
54                 
55                 p->local->bin_cntr = p->local->bin_cntr + 1;        
56                 if (p->local->bin_cntr == NUMBER_OF_RANGE_BINS)     
57                 {
58                         p->local->bin_cntr = 0;
59                         // Increase pulse index
60                         p->local->pulse_cntr =  p->local->pulse_cntr + 1; 
61                         if (p->local->pulse_cntr == NUMBER_OF_PULSES)     
62                         {
63                                 p->local->pulse_cntr = 0; 
64                                 p->local->n_firings = p->local->n_firings + 1; 
65                         }
66                 }
67         // }
68         
69         if (p->local->n_firings == NUMBER_OF_ITERATIONS)      
70     {
71     printf("\n\n:: Data generator process finished ::\n\n");    
72     // printf("\ttotal number of executions:  %d",p->local->excount);   
73     DOL_detach(p);
74         }
75         return 0;
76 }