\section{Introduction}
\label{sec:intro}

Setting up a localization solution for a building is a challenging and time-consuming task, especially in environments that are not built with localization in mind or do not provide any wireless infrastructure or even both. 
Such scenarios are of special interest when old or historical buildings serve a new purpose such as museums, shopping malls or retirement homes.
In terms of European architecture, the problems emanating from these buildings worsen over time.

In the scope of this work, we deployed an indoor localization system to a 13th century building.
The first 300 years, the building was initially used as a convent, and, after that, had different functions ranging from a granary to an office for Bavarian officials. 
Over time, the building underwent major construction measures and was extended several times.
Since 1936, the \SI{2500}{\square\meter} building acts as a museum of the medieval town Rothenburg ob der Tauber \cite{Rothenburg}, Germany.

\todo{Bild vom Museum?}

Such buildings are often full of nooks and crannies, what makes it hard for dynamical models using any kind of pedestrian dead reckoning (PDR). Here, the error accumulates not only over time, but also with the number of turns and steps made \cite{Ebner-15}. 
There is also a higher chance of detecting false or misplaced turns, what can cause the position estimation to lose track or getting stuck within a demarcated area. 
Thus, this paper presents a very robust but realistic movement model using a three-dimensional navigation mesh based on triangles.
%In addition, this allows for very small map sizes, consuming little storage space.

In localization systems using a sample based density representation, like particle filters, aforementioned problems can further lead to more advanced problems like sample impoverishment \cite{Fetzer-17} or multimodalities \cite{Fetzer-16}.
Sample impoverishment refers to a situation, in which the filter is unable to sample enough particles into proper regions of the building, caused by a high concentration of misplaced particles. 
Within this work we present a simple yet efficient method that enables a particle filter to fully recover from sample impoverishment. 
We also use a novel approach for finding an exact estimation of the pedestrian's current position by using a rapid computation scheme of the kernel density estimation.

Many historical buildings, especially bigger ones like castles, monasteries or churches, are built of massive stone walls and have annexes from different historical periods out of different construction materials.
This leads to problems for methods using received signal strengths (RSS) from \docWIFI{} or Bluetooth, due to a high signal attenuation between different rooms. 
Many unknown quantities like the walls definitive material or thickness make it expensive to determine important parameters, \eg{} the signal's depletion  over distance. 
Additionally, most wireless approaches require a line-of-sight assumption. 
Thus, the performance will be even more limited due to the irregularly shaped spatial structure of such buildings. 
Our approach tries to avoid those problems. 
We distribute a small number of simple and cheap \docWIFI{} beacons over the whole building and instead of measuring their position, we use an optimization scheme based on some reference measurements.

An optimization scheme also avoids inaccuracies like wrongly positioned access points or fingerprints caused by outdated or inaccurate building plans. 
It is obvious, that this could be solved by re-measuring the building, however this is a very time-consuming process requiring specialized hardware and a surveying engineer. 
However, this is contrary to most costumers expectations of a fast to deploy and low-cost solution.
In addition, this is not only a question of costs incurred, but also for buildings under monumental protection, what does not allow for larger construction measures. 

To sum up, this work presents a smartphone-based localization system using a particle filter to incorporate different probabilistic models.
We omit time-consuming approaches like classic fingerprinting or measuring the exact positions of access-points.
Instead we use a simple optimization scheme based on reference measurements to estimate a corresponding Wi-Fi model.
The pedestrian's movement is modeled realistically using a navigation mesh, based on the building's floorplan.
A barometer based activity recognition enables going into the third dimension and problems occurring from multimodalities and impoverishment are taken into account. 

The goal of this work is to propose a fast to deploy and low-cost localization solution, that provides reasonable results in a high variety of situations.
Consequently, we believe that by utilizing our localization approach to such a challenging scenario, it is possible to prove those characteristics. 
Finally, it should be mentioned that the here presented work is an highly updated version of the winner of the smartphone-based competition at IPIN 2016 \cite{Ebner-15}. 

