diff --git a/matlab/cycling_data_sensors.mat b/matlab/cycling_data_sensors.mat
index 82941620e0adc1e3265302ee16728a1c1ab6d629..1858b548d8c686eb9da67f7c9242133bb6da878f 100644
Binary files a/matlab/cycling_data_sensors.mat and b/matlab/cycling_data_sensors.mat differ
diff --git a/matlab/manipulate_cycling_data.m b/matlab/manipulate_cycling_data.m
index b62baae3694c6870518dfdcdc80ce75ed7344032..b214551b5b6c9571cd214ed9458f986a1ade5199 100644
--- a/matlab/manipulate_cycling_data.m
+++ b/matlab/manipulate_cycling_data.m
@@ -1,51 +1,94 @@
+%% split betwen different sensors
+% load('cycling_data')
+% 
+% % %trying to figure out the unit of measure of the time stamps
+% % %total_time=time_stamps(length(time_stamps))-time_stamps(1) ;
+% % %real_total_time=(6*60+15)*60;  %about 6 hours and 15 min expressed in seconds
+% % %time_unit=real_total_time/total_time
+% 
+% time_stamps=(time_stamps-time_stamps(1))/1.0;
+% 
+% acc=[0,0,0,0];
+% gyr=[0,0,0,0];
+% gps=[0,0,0,0];
+% 
+% for k=1:length(time_stamps)
+% 
+%     if strcmp(sensor(k),'ACC')
+%         acc=[acc;
+%              time_stamps(k),a(k),b(k),c(k)];
+%     end
+%     
+%     if strcmp(sensor(k),'GYR')
+%         gyr=[gyr;
+%              time_stamps(k),a(k),b(k),c(k)];
+%     end
+% 
+%     if strcmp(sensor(k),'GPS')
+%         gps=[gps;
+%              time_stamps(k),a(k),b(k),c(k)];
+%     end
+%     
+% end
+% 
+% acc=acc(2:length(acc),:);
+% gyr=gyr(2:length(gyr),:);
+% gps=gps(2:length(gps),:);
 
-load('cycling_data')
+%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-% %trying to figure out the unit of measure of the time stamps
-% %total_time=time_stamps(length(time_stamps))-time_stamps(1) ;
-% %real_total_time=(6*60+15)*60;  %about 6 hours and 15 min expressed in seconds
-% %time_unit=real_total_time/total_time
-
-time_stamps=(time_stamps-time_stamps(1))/1.0;
+% load('cycling_data_sensors')
+% Input struct:
+% in_data.GNSS.pos_ned      GNSS-receiver position estimates in NED
+%                           coordinates [m]
+% in_data.GNSS.t            Time of GNSS measurements [s]
+% (in_data.GNSS.HDOP        GNSS Horizontal Dilution of Precision [-]) 
+% (in_data.GNSS.VDOP        GNSS Vertical Dilution of Precision [-]) 
+% in_data.IMU.acc           Accelerometer measurements [m/s^2]
+% in_data.IMU.gyro          Gyroscope measurements [rad/s]
+% in_data.IMU.t             Time of IMU measurements [s]
 
-acc=[0,0,0,0];
-gyr=[0,0,0,0];
-gps=[0,0,0,0];
+%from geodetic to cartesian GPS coordinates
+% spheroid = referenceEllipsoid('GRS 80')
+% [xNorth,yEast,zDown] = geodetic2ned(gps(5:length(gps),2),gps(5:length(gps),3),gps(5:length(gps),4),gps(4,2),gps(4,3),gps(4,4),spheroid)
 
-for k=1:length(time_stamps)
+% in_data.GNSS.pos_ned = [xNorth,yEast,zDown];
+% in_data.GNSS.t=gps(5:length(gps),1)
 
-    if strcmp(sensor(k),'ACC')
-        acc=[acc;
-             time_stamps(k),a(k),b(k),c(k)];
+%synchronize accelerometer and gyro data
+Gyr=gyr(1,2:4);
+Acc=acc(1,2:4);
+t=0;
+j=1; % to cycle over the gyro
+for i=1:length(acc) %cycle over the accelerometer
+    while gyr(j,1)<=acc(i,1)
+        %if the data are available and synchr then store them (with time)
+        if gyr(j,1)==acc(i,1)
+            Gyr=[Gyr;
+                 gyr(j,2:4)];
+            Acc=[Acc;
+                 acc(i,2:4)];
+            t=[t;gyr(j,1)];
+        end
+        j=j+1;
     end
     
-    if strcmp(sensor(k),'GYR')
-        gyr=[gyr;
-             time_stamps(k),a(k),b(k),c(k)];
-    end
-
-    if strcmp(sensor(k),'GPS')
-        gps=[gps;
-             time_stamps(k),a(k),b(k),c(k)];
+    %checkpoint for verifying progress
+    if ~mod(i,100000)
+        %display('sono arrivato al tempo:')
+        %t(j-1)
+        display('sono alla seguente riga delle accelerazioni(totale di 1901808):')
+        i
     end
-    
 end
+%in_data.IMU.acc
+%in_data.IMU.gyro
+%in_data.IMU.t
+
+
 
-acc=acc(2:length(acc),:);
-gyr=gyr(2:length(gyr),:);
-gps=gps(2:length(gps),:);
 
-%sum(acc(:,1)-gyr(:,1))
 
 
-% Input struct:
-% in_data.GNSS.pos_ned      GNSS-receiver position estimates in NED
-%                           coordinates [m]
-% in_data.GNSS.t            Time of GNSS measurements [s]
-% (in_data.GNSS.HDOP        GNSS Horizontal Dilution of Precision [-]) 
-% (in_data.GNSS.VDOP        GNSS Vertical Dilution of Precision [-]) 
-% in_data.IMU.acc           Accelerometer measurements [m/s^2]
-% in_data.IMU.gyro          Gyroscope measurements [rad/s]
-% in_data.IMU.t             Time of IMU measurements [s]
 
 
diff --git a/paper/main.tex b/paper/main.tex
index 1e37ab9346ade7cbeeac8ffe4ec5b1909dfc0f51..cae76d127036bdb71b3ad255356d73469a2bfec1 100644
--- a/paper/main.tex
+++ b/paper/main.tex
@@ -147,7 +147,7 @@ Abstract.
   sensors and shows how the GPS can enhance the accuracy of the
   provided data; (3) it develops an open-loop control strategy to
   manage the GPS receiver and evaluates its potential battery savings.
-  \textcolor{red}{We should point out also that the modeling is independent from the specific sensor from the specific brand, it only relies on the technological choices that are used to implement it.}
+  \textcolor{red}{We should point out also that the modeling is independent from the specific sensor from the specific brand, it only relies on the technological choices that are used to implement it.(il problema si presta ad un approccio adattativo)}
 
 \end{itemize}
 
diff --git a/paper/sections/02-related-work.tex b/paper/sections/02-related-work.tex
index 2649c1b32fd4d088597018e7a96eaae2eedd8a65..a7409f6fbdba7382d4d0ae66041f708fab1e21d8 100644
--- a/paper/sections/02-related-work.tex
+++ b/paper/sections/02-related-work.tex
@@ -1,19 +1,28 @@
-\begin{itemize}
-	\item many works discuss the problem of power consumption in GPS devices from different points of view. those are:  
-	\item --------------
-	\item improving of computation efficiency(?): either not using all the satellites (with was meaningful for harware based gps receivers, now I don't see what you could gain in sw based receivers), 'outsourcing' the computations transferring them to servers~\cite{bib:computation-offloading},tracking only a subset of the visible satllites~\cite{bib:selective-tracking}(modeling of how the different components of the sensor consume power(not dynamic, just linear model wrt to time), try to reduce connsumpion tracking less satellites)
-	\item improving speed of signal acquisition~\cite{bib:microsoft-leap}(also has experiments showing constant power consumption when on),~\cite{bib:sparse-fourier}(faster furies transform to improve speed of signa acquisiiton),
-	\item shifting other positioning techniques like wifi trilateration or network cells trilateration called GSM(which is necessary when in comes to indoor applications)~\cite{bib:enloc-smartphones}(euristics for chosing the right positioning sensor according to some energy-accuracy traqde off. also has experiments that show that the GPs consumes power constant when turned on which is around 400mW)~\cite{bib:virtualGPS}(eneesimo lavor su come scegliere quale sensore usare per il posizionamento su uno smartphone, ottimizzazioni inter diverse applicazioni),~\cite{bib:accuracy-adaptation}(chose the right sensor according to required accuracy),
-	\item sensor fusion techniques
-	\item duty cycling~\cite{bib:feasibility-duty-cycling}(studio di fattibilità del downsampling per ricostruire la traiettoria)~\cite{bib:traffic-delay}(traffic jam detection, different smpling policies for energy saving),~\cite{bib:entracked-datadriven-modeling}sampling triggered with some form of optimization trigered by a a data driven model, or imu-triggered sampling~\cite{bib:senseLess}(accelerometer to detect movement and therefore trigger the usage of GPS),~\cite{bib:framework-for-energy-efficiency}(usage of various sensor foruser state recognition and triggering of different positioning sensors)
-	\item usage of specific design principles when designing location based applications~\cite{bib:desing-principles-for-energy-efficiency}
-	\item --------------
-	\item https://www.developerfusion.com/article/4652/writing-your-own-gps-applications-part-2/2/ the number of satellites can improve accuracy, see also~\cite{bib:accuracy-adaptation}
-	\item few works present modeling of how GPS sensors consume power~\cite{bib:entracked-datadriven-modeling}, none of them dynamical
-	\item where is this work placed with respect to the others -- no dynamical modeling of it has ever been done before, it would be useful for understainding why and how the sensr consumes power (sometimes deelays are encoutnered but no one discusses where those deelays come from) 
-	\item one other possible application of this model is: tracking of animals~\cite{bib:application-zoo}
-	\item work that show the complexity of modeling the accuracy~\cite{bib:space-weather-ionospheric}
-\end{itemize}
+The problems related with battery drain due to the usage of GPS sensors in small devices are well known and both the number and variety of the works adressing this problem also tesify it. Previous works mostly apply to smartphones and propose different methodologies: some that work on the GPS stack itself and some that try to reduce its usage.
+
+In the first class we find~\cite{bib:computation-offloading} that aims at outsourcing the computation from the device to some server via network connnection. \cite{bib:selective-tracking} instead improves power-efficiency of computation though selecting only a subset of visible satellites to be tracked. Other works aim at improving the speed of acquisition of the signal either using information from previous acquisitions~\cite{bib:microsoft-leap} or using different algorithms for signal decoding~\cite{bib:sparse-fourier}.
+
+In the second class of works we find many attemps~\cite{bib:enloc-smartphones}~\cite{bib:virtualGPS}~\cite{bib:accuracy-adaptation} of building an \emph{adaptation} layer that controls the device usage of positioning sensors and reduces the usage of GPS antenna (always evaluated to be the most power-consuming). These usually try to implement a trade-off controller betwen accuracy and energy consumption. In the same class we can include works~\cite{bib:feasibility-duty-cycling}~\cite{bib:traffic-delay}~\cite{bib:entracked-datadriven-modeling}~\cite{bib:senseLess}~\cite{bib:framework-for-energy-efficiency} that exploit other sensors to detect when the state of the user and automatically try to minimize the usage of GPS antenna by turning it on only when needed. Last in this class we mention~\cite{bib:desing-principles-for-energy-efficiency} that proposes a set of design principles for smartphone applications to make them more power-efficient.
+
+This work poses itself in a complementary role with respect to the cited ones. We propose a modeling approach based only on how the GPS system is designed and that therefore is transversal to the implementation of the specific sensor. We argue that with this model better and optimal implementations of the proposed solutions can be studied. Effort in the direction of modeling GPS sensors has been done before~\cite{bib:selective-tracking}~\cite{bib:entracked-datadriven-modeling}. Such efforts are been mainly data-driven, making it valid only for the specific case, and most importantly, not dynamic, i.e. not having any notion of state. Since the  GPS sensors can behave differently to the same inputs according to their state a dynamic approach when modeling those devices provide better insights on what can be achieved.
+
+
+%\begin{itemize}
+%	\item many works discuss the problem of power consumption in GPS devices from different points of view. those are:  
+%	\item --------------
+%	\item improving of computation efficiency(?): either not using all the satellites (with was meaningful for harware based gps receivers, now I don't see what you could gain in sw based receivers), 'outsourcing' the computations transferring them to servers~\cite{bib:computation-offloading},tracking only a subset of the visible satllites~\cite{bib:selective-tracking}(modeling of how the different components of the sensor consume power(not dynamic, just linear model wrt to time), try to reduce connsumpion tracking less satellites)
+%	\item improving speed of signal acquisition~\cite{bib:microsoft-leap}(also has experiments showing constant power consumption when on),~\cite{bib:sparse-fourier}(faster furies transform to improve speed of signa acquisiiton),
+%	\item shifting other positioning techniques like wifi trilateration or network cells trilateration called GSM(which is necessary when in comes to indoor applications)~\cite{bib:enloc-smartphones}(euristics for chosing the right positioning sensor according to some energy-accuracy traqde off. also has experiments that show that the GPs consumes power constant when turned on which is around 400mW)~\cite{bib:virtualGPS}(eneesimo lavor su come scegliere quale sensore usare per il posizionamento su uno smartphone, ottimizzazioni inter diverse applicazioni),~\cite{bib:accuracy-adaptation}(chose the right sensor according to required accuracy),
+%	\item sensor fusion techniques
+%	\item duty cycling~\cite{bib:feasibility-duty-cycling}(studio di fattibilità del downsampling per ricostruire la traiettoria)~\cite{bib:traffic-delay}(traffic jam detection, different smpling policies for energy saving),~\cite{bib:entracked-datadriven-modeling}sampling triggered with some form of optimization trigered by a a data driven model, or imu-triggered sampling~\cite{bib:senseLess}(accelerometer to detect movement and therefore trigger the usage of GPS),~\cite{bib:framework-for-energy-efficiency}(usage of various sensor foruser state recognition and triggering of different positioning sensors)
+%	\item usage of specific design principles when designing location based applications~\cite{bib:desing-principles-for-energy-efficiency}
+%	\item --------------
+%	\item https://www.developerfusion.com/article/4652/writing-your-own-gps-applications-part-2/2/ the number of satellites can improve accuracy, see also~\cite{bib:accuracy-adaptation}
+%	\item few works present modeling of how GPS sensors consume power~\cite{bib:entracked-datadriven-modeling}, none of them dynamical
+%	\item where is this work placed with respect to the others -- no dynamical modeling of it has ever been done before, it would be useful for understainding why and how the sensr consumes power (sometimes deelays are encoutnered but no one discusses where those deelays come from) 
+%	\item one other possible application of this model is: tracking of animals~\cite{bib:application-zoo}
+%	\item work that show the complexity of modeling the accuracy~\cite{bib:space-weather-ionospheric}
+%\end{itemize}
 
 
 
diff --git a/paper/sections/03-model.tex b/paper/sections/03-model.tex
index 5b18e01a25d9723e1a378078bb53ca8b846dd8a5..232d4da714e55676497c6b9e9e84549019b8d207 100644
--- a/paper/sections/03-model.tex
+++ b/paper/sections/03-model.tex
@@ -238,7 +238,7 @@ Detecing data from more than 4 satellites improves the positioning
 accuracy. As for power consumption, the receiver always consumes a
 (negligible) idle power. On top of that, the sensor consumes
 additional power when its radio is turned on, which is precisely the
-cause of battery draining. Our model needs to capture whether:
+cause of battery draining. \textcolor{red}{This power has been experimentally shown to be constant in time~\cite{bib:enloc-smartphones}~\cite{bib:microsoft-leap} and usually around 400mW.}. Our model needs to capture whether:
 \begin{enumerate}
   \item \emph{ephemeris data} are available or not;
   \item \emph{ranging data} are available or not;
@@ -284,7 +284,7 @@ fetched. We refer to this transition as
 causes: (i) the antenna is turned off (transition \texttt{turn\_off}),
 (ii) the number of visible satellites is less than the required
 one\footnote{Generally 4. Different applications may require a higher
-  number of satellites to improve positioning accuracy.} (transition
+  number of satellites to improve positioning accuracy (\textcolor{red}{https://www.developerfusion.com/article/4652/writing-your-own-gps-applications-part-2/2/}).} (transition
 \texttt{lose\_visibility}). Lastly the antenna's state is controlled
 by the user with the events \texttt{turn\_on} and \texttt{turn\_off}.