Commit 376619ba authored by Navid Nikaein's avatar Navid Nikaein

* update for the UE localization functions


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6502 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 5f3e2652
......@@ -487,7 +487,8 @@ typedef struct {
/// aggregate physical states every n millisecond
int32_t aggregation_period_ms;
/// a set of lists used for localization
struct list loc_rss_list, loc_rssi_list, loc_subcarrier_rss_list, loc_timing_advance_list, loc_timing_update_list;
struct list loc_rss_list[10], loc_rssi_list[10], loc_subcarrier_rss_list[10], loc_timing_advance_list[10], loc_timing_update_list[10];
struct list tot_loc_rss_list, tot_loc_rssi_list, tot_loc_subcarrier_rss_list, tot_loc_timing_advance_list, tot_loc_timing_update_list;
#endif
} LTE_eNB_ULSCH_t;
......
This diff is collapsed.
......@@ -27,8 +27,8 @@
*******************************************************************************/
/*! \file eNB_scheduler_primitives.c
* \brief primitives used by eNB for BCH, RACH, ULSCH, DLSCH scheduling
/*! \file eNB_scheduler_RAs.c
* \brief primitives used for random access
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email: navid.nikaein@eurecom.fr
......
......@@ -1144,6 +1144,10 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf
num_sdus = 0;
}
// if the RLC AM is used, then RLC will only provide 2 bytes for ACK
// in this case, we sould add bsr
// DCCH1
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) {
......
......@@ -48,6 +48,10 @@
#include "asn1_msg.h"
#include "pdcp.h"
#ifdef LOCALIZATION
#include <sys/time.h>
#endif
#define DEBUG_RRC 1
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
......
......@@ -304,10 +304,11 @@ del(struct list* z) {
struct node* cur;
struct node* x = z->head;
while(x) {
while((x != NULL) && (z->size > 0)) {
cur = x;
x = x->next;
free(cur);
z->size--;
}
z->head = NULL;
......@@ -410,14 +411,16 @@ int compare (const void * a, const void * b)
*/
int32_t calculate_median(struct list *loc_list) {
int32_t median = 0;
double* table = (double*) malloc(loc_list->size * sizeof(double));
totable(table, loc_list);
/// sort the table in ascending way
qsort (table, loc_list->size, sizeof(double), &compare);
/// median is the value at middle the sorted table
/// Q1 is the value at 1/4 the sorted table
/// Q3 is the value at 3/4 the sorted table
median = table[loc_list->size/2];
free(table);
if (loc_list->size > 0) {
double* table = (double*) malloc(loc_list->size * sizeof(double));
totable(table, loc_list);
/// sort the table in ascending way
qsort (table, loc_list->size, sizeof(double), &compare);
/// median is the value at middle the sorted table
/// Q1 is the value at 1/4 the sorted table
/// Q3 is the value at 3/4 the sorted table
median = table[loc_list->size/2];
free(table);
}
return median;
}
......@@ -45,6 +45,8 @@ ifeq ($(DEBUG),1)
CFLAGS += -g -ggdb
#CFLAGS += -DRRC_MSG_PRINT
#CFLAGS += -DPDCP_MSG_PRINT
else
CFLAGS += -O2
endif
ifdef ($(MSG_PRINT),1)
......@@ -58,6 +60,14 @@ ifndef RTAI
RTAI=1
endif
ifeq ($(LOCALIZATION), 1)
CFLAGS += -DLOCALIZATION
endif
ifeq ($(LINUX_LIST), 1)
CFLAGS += -DLINUX_LIST
endif
ifeq ($(RTAI),1)
CFLAGS += -DENABLE_RTAI_CLOCK
CFLAGS += -DCONFIG_RTAI_LXRT_INLINE #remend the RTAI warning
......
......@@ -3406,6 +3406,10 @@ int main(int argc, char **argv) {
set_comp_log(OSA, osa_log_level, osa_log_verbosity, 1);
#endif
#endif
#ifdef LOCALIZATION
set_comp_log(LOCALIZE, LOG_DEBUG, LOG_LOW, 1);
set_component_filelog(LOCALIZE);
#endif
set_comp_log(ENB_APP, LOG_INFO, LOG_HIGH, 1);
set_comp_log(OTG, LOG_INFO, LOG_HIGH, 1);
if (online_log_messages == 1) {
......
......@@ -33,6 +33,7 @@
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include "init_lte.h"
......@@ -98,11 +99,19 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
struct timeval ts;
gettimeofday(&ts, NULL);
PHY_vars_eNB->ulsch_eNB[1+i]->reference_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rss_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rssi_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_subcarrier_rss_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_advance_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_update_list);
int j;
for (j=0; j<10; j++) {
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_rssi_list[j]);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_subcarrier_rss_list[j]);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_advance_list[j]);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->loc_timing_update_list[j]);
}
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->tot_loc_rss_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->tot_loc_rssi_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->tot_loc_subcarrier_rss_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->tot_loc_timing_advance_list);
initialize(&PHY_vars_eNB->ulsch_eNB[1+i]->tot_loc_timing_update_list);
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment