3 /************************************************************************************/
5 void Consumer_init(DOLProcess * p)
9 p->local->channel_cntr = 0;
10 p->local->pulse_cntr = 0;
11 p->local->bin_cntr = 0;
12 p->local->n_iterations = 0;
14 p->local->excount = 0;
17 for (i=0; i<NUMBER_OF_DOPPLER_CHANNELS; i++)
19 for (j=0; j<NUMBER_OF_PULSES; j++)
21 for (k=0; k<NUMBER_OF_RANGE_BINS; k++)
23 (p->local->Channels[i][j][k]).real = 0.0;
24 (p->local->Channels[i][j][k]).imag = 0.0;
25 (p->local->Channels_Delayed[i][j][k]).real = 0.0;
26 (p->local->Channels_Delayed[i][j][k]).imag = 0.0;
31 p->local->out = fopen( "output.txt", "w" );
35 /************************************************************************************/
37 int Consumer_fire(DOLProcess * p)
39 CREATEPORTVAR(input_port);
40 CREATEPORTVAR(input_port_delayed);
46 for (chan_index = 0; chan_index < NUMBER_OF_DOPPLER_CHANNELS; chan_index++)
50 CREATEPORT(input_port, PORT_IN, 1, chan_index, NUMBER_OF_BEAMS);
51 // DOL_read((void*)input_port, &(p->local->Channels[chan_index][p->local->pulse_cntr][p->local->bin_cntr]), sizeof(ComplexNumber), p);
52 DOL_read((void*)input_port, &(p->local->Channels[chan_index][p->local->pulse_cntr][0]), NUMBER_OF_RANGE_BINS*sizeof(ComplexNumber), p);
54 CREATEPORT(input_port_delayed, PORT_IN_DELAYED, 1, chan_index, NUMBER_OF_BEAMS);
55 // DOL_read((void*)input_port_delayed, &(p->local->Channels_Delayed[chan_index][p->local->pulse_cntr][p->local->bin_cntr]), sizeof(ComplexNumber), p);
56 DOL_read((void*)input_port_delayed, &(p->local->Channels_Delayed[chan_index][p->local->pulse_cntr][0]), NUMBER_OF_RANGE_BINS*sizeof(ComplexNumber), p);
59 // p->local->bin_cntr = p->local->bin_cntr + 1;
60 // if (p->local->bin_cntr == NUMBER_OF_RANGE_BINS)
62 // p->local->bin_cntr = 0;
63 p->local->pulse_cntr = p->local->pulse_cntr + 1;
64 if (p->local->pulse_cntr == NUMBER_OF_PULSES)
66 p->local->pulse_cntr = 0;
67 p->local->n_iterations = p->local->n_iterations + 1;
71 if (p->local->n_iterations == NUMBER_OF_ITERATIONS) {
74 printf("\n\n:: Consumer process finished :\n\n");
75 // printf("\ttotal number of executions: %d",p->local->excount);
79 for (i=0; i<NUMBER_OF_DOPPLER_CHANNELS; i++)
81 fprintf(p->local->out, "\n------------------------\n", i);
82 fprintf(p->local->out, ":: Doppler channel %d ::\n", i);
83 fprintf(p->local->out, "------------------------\n", i);
84 for (j=0; j<NUMBER_OF_PULSES; j++)
86 fprintf(p->local->out, "\n:: Pulse %d, Range Bin 1 to %d ::\n", j, NUMBER_OF_RANGE_BINS);
87 for (k=0; k<NUMBER_OF_RANGE_BINS; k++)
89 fprintf(p->local->out, "[%f, %f] ", p->local->Channels[i][j][k].real, p->local->Channels[i][j][k].imag);
91 fprintf(p->local->out, "\n");
95 for (i=0; i<NUMBER_OF_DOPPLER_CHANNELS; i++)
97 fprintf(p->local->out, "\n--------------------------------\n", i);
98 fprintf(p->local->out, ":: Doppler channel delayed %d ::\n", i);
99 fprintf(p->local->out, "--------------------------------\n", i);
100 for (j=0; j<NUMBER_OF_PULSES; j++)
102 fprintf(p->local->out, "\n:: Pulse slot%d, Range Bin 0 to %d ::\n", j, NUMBER_OF_RANGE_BINS);
103 for (k=0; k<NUMBER_OF_RANGE_BINS; k++)
105 fprintf(p->local->out, "[%f, %f] ", p->local->Channels_Delayed[i][j][k].real, p->local->Channels_Delayed[i][j][k].imag);
107 fprintf(p->local->out, "\n");