scieee AI-readable full text Open interactive document viewer

Coarse-grained Localization of In-body Energy-harvesting Nanonodes

Brosa López, Arnau

Abstract

Dispositivos a escala nanométrica con capacidades de comunicación inalámbrica en Ter- ahertz (THz) aspiran a implementarse para aplicaciones de detección dentro del torrente sanguíneo humano. Estos dispositivos detectan biomarcadores, permiten la administración dirigida de medicamentos y mejoran el diagnóstico precoz. La introducción de la localización nanométrica guiada por flujo utiliza la comunicación basada en THz para establecer la comunicación entre nanonodos y anclas. Se espera que este enfoque localice con precisión las regiones donde ocurren los eventos mediante el tiempo de circulación del nanodispositivo en el torrente sanguíneo. Esto facilita la identificación precisa de biomarcadores de enfermedades, virus y bacterias, lo que permite una intervención dirigida y la detección temprana de diversas condiciones de salud. Para evitar los desafíos encontrados en la evaluación y estandarización de la localización tradicional, este trabajo presenta un flujo de trabajo para la evaluación del rendimiento estandarizado de la localización nanométrica guiada por flujo. El flujo de trabajo se implementa en forma de un simulador de código abierto, teniendo en cuenta la movilidad del nanodispositivo, la comunicación THz en el cuerpo con anclas externas y las restricciones relacionadas con la energía. El simulador puede generar datos que se pueden utilizar para optimizar diferentes soluciones de localización y establecer puntos de referencia de rendimiento estandarizados. La evaluación se realiza mediante una exploración del espacio de diseño. Los resultados indican que el flujo de trabajo propuesto y el simulador se pueden utilizar para capturar el rendimiento de los enfoques de localización guiados por flujo de manera que permita una comparación objetiva con otros enfoques, sentando así las bases para la evaluación estandarizada de soluciones futuras.

Full text

Coarse-grained Localization of In-body Energy-harvesting Nanonodes Degree Thesis submitted to the Faculty of Escola T`ecnica d’Enginyeria de Telecomunicaci´o de Barcelona Universitat Polit`ecnica de Catalunya by Arnau Brosa Lopez In partial fulfillment of the requirements for the degree in Telecommunications Technologies and Services Engineering Advisors : Sergi Abadal and Filip Lemic Barcelona, May 2023 Contents List of Figures 3 List of Tables 3 1 Introduction 9 1.1 ThesisStructure................................. 11 2 State of the Art of the Technology Used or Applied in this Thesis 12 2.1 RelatedWork.................................. 12 2.1.1 Performance Evaluation of THz Nanoscale Systems . . . . . . . . . 12 2.1.2 Evaluation Methodologies for Flow-guided Localization . . . . . . . 12 3 High Level Design 14 3.1 Flow Guided Localization Fundamentals . . . . . . . . . . . . . . . . . . . 14 3.2 Experimentation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4 Low Level Design 17 4.1 UtilizedTools.................................. 17 4.1.1 Blood-Voyager-s............................. 17 4.1.2 NS-3+TeraSim ............................. 18 4.2 SystemDesign ................................. 19 4.3 Workflow .................................... 24 5 Flow Guided Localization Solution 27 5.1 Flow-guided Localization Solution under Test . . . . . . . . . . . . . . . . 27 5.2 DesignSpace .................................. 29 5.3 Parametrization of Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.3.1 BaselineScenario............................ 31 6 Experiments and Results 33 6.1 Scaling with the Number of Nanonodes . . . . . . . . . . . . . . . . . . . 34 6.2 Scaling with Granularity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6.3 Scaling with the Event Threshold . . . . . . . . . . . . . . . . . . . . . . . 38 7 Conclusions and Future Work 40 8 Work Plan 42 8.1 GanttDiagram ................................. 44 References 45 2 List of Figures 1 Scope of the present work . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2 Externalstructure ............................... 17 3 Nodeinternalstructure............................. 19 4 Energy model simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5 Event detection consumption . . . . . . . . . . . . . . . . . . . . . . . . . 21 6 Simulatorstructure............................... 22 7 Nanonode reception power . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8 Simulationworkflow .............................. 26 9 Distribution of circulation time on anchor 0 for each region . . . . . . . . . 27 10 Rawdataoutput ................................ 29 11 Baselineevaluation ............................... 33 12 Localization performance as a function of the number of nanonodes . . . . 34 13 Localization performance as a function of temporal granularity . . . . . . . 36 14 Localization performance as a function of the event threshold . . . . . . . . 38 15 Ganttdiagram ................................. 44 List of Tables 1 Energy model parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2 RegionsID.................................... 28 3 Hyperparameters ................................ 30 4 Parametersrange................................ 31 5 Baselinescenario ................................ 32 6 Workpackage1................................. 42 7 Workpackage2................................. 42 8 Workpackage3................................. 43 9 Workpackage4................................. 43 10 Workpackage5................................. 43 3 Abstract Nanoscale devices with Terahertz (THz) wireless communication capabilities are envisioned for sensing and actuation-based applications within human bloodstreams. These devices detect biomarkers, enable targeted drug delivery, and improve precision diagnostics. The introduction of flow-guided nanoscale localization utilizes THz-based communication to establish communication between nanonodes and anchors. This approach is envisaged to accurately locate regions where events occur by using the nanodevice’s circulation duration in the bloodstream. This enables precise identification of disease biomarkers, viruses, and bacteria, facilitating targeted intervention and early detection of health conditions. To avoid the pitfalls encountered in benchmarking and standardizing traditional indoor localization, this work presents a workflow for standardized performance evaluation of flow-guided nanoscale localization. The workflow is implemented in the form of an open source simulator, considering nanodevice mobility, in-body THz communication with onbody anchors, and energy-related constraints. The simulator is able to generate raw data that can be used to streamline different flow-guided localization solutions and establish standardized performance benchmarks. The evaluation is performed in the form of a design space exploration. The results indicate that the proposed workflow and the simulator can be utilized for capturing the performance of flow-guided localization approaches in a way that allows objective comparison with other approaches serving as the foundation for standardized evaluation of future solutions. 4 Resumen Dispositivos a escala nanom´etrica con capacidades de comunicaci´on inal´ambrica en Terahertz (THz) aspiran a implementarse para aplicaciones de detecci´on dentro del torrente sangu´ıneo humano. Estos dispositivos detectan biomarcadores, permiten la administraci´on dirigida de medicamentos y mejoran el diagn´ostico precoz. La introducci´on de la localizaci´on nanom´etrica guiada por flujo utiliza la comunicaci´on basada en THz para establecer la comunicaci´on entre nanonodos y anclas. Se espera que este enfoque localice con precisi´on las regiones donde ocurren los eventos mediante el tiempo de circulaci´on del nanodispositivo en el torrente sangu´ıneo. Esto facilita la identificaci´on precisa de biomarcadores de enfermedades, virus y bacterias, lo que permite una intervenci´on dirigida y la detecci´on temprana de diversas condiciones de salud. Para evitar los desaf´ıos encontrados en la evaluaci´on y estandarizaci´on de la localizaci´on tradicional, este trabajo presenta un flujo de trabajo para la evaluaci´on del rendimiento estandarizado de la localizaci´on nanom´etrica guiada por flujo. El flujo de trabajo se implementa en forma de un simulador de c´odigo abierto, teniendo en cuenta la movilidad del nanodispositivo, la comunicaci´on THz en el cuerpo con anclas externas y las restricciones relacionadas con la energ´ıa. El simulador puede generar datos que se pueden utilizar para optimizar diferentes soluciones de localizaci´on y establecer puntos de referencia de rendimiento estandarizados. La evaluaci´on se realiza mediante una exploraci´on del espacio de dise˜no. Los resultados indican que el flujo de trabajo propuesto y el simulador se pueden utilizar para capturar el rendimiento de los enfoques de localizaci´on guiados por flujo de manera que permita una comparaci´on objetiva con otros enfoques, sentando as´ı las bases para la evaluaci´on estandarizada de soluciones futuras. 5 Resum Els dispositius a nanoescala amb capacitats de comunicaci´o sense fils en Terahertz (THz) aspiren a implementar-se en aplicacions basades en detecci´o i actuaci´o dins del torrent sanguini hum`a. Aquests dispositius detecten biomarcadors, permeten el lliurament prec´ıs de f`armacs i proporcionen un diagn`ostic preco¸c. La introducci´o de la localitzaci´o a nanoescala guiada per flux utilitza la comunicaci´o basada en THz per establir la comunicaci´o entre nanonodes i ancoratges. Aquest enfocament aspira a localitzar amb precisi´o les regions on es produeixen els esdeveniments utilitzant el temps de circulaci´o del nanodispositiu a cada una de les regions. Aix`o permet la identificaci´o precisa de biomarcadors de malalties, virus i bacteris, donant lloc a una intervenci´o dirigida i a la detecci´o preco¸c de diverses condicions de salut. Per evitar els inconvenients que sorgeixen en les primeres etapes d’investigaci´o, aquest treball presenta un flux de treball per a l’avaluaci´o estandarditzada del rendiment de la localitzaci´o a nanoescala guiada per flux. El flux de treball s’implementa en forma d’un simulador de codi obert, tenint en compte la mobilitat del nanodispositiu, la comunicaci´o THz dins del cos amb els ancoratges situats a la superf´ıcie del cos i les limitacions relacionades amb l’energia. El simulador ´es capa¸c de generar dades que despr´es de ser processades, ens permeten obtenir una avaluaci´o estandaritzada del sistema . L’avaluaci´o es va realitzar en forma d’exploraci´o espacial de disseny. Els resultats indiquen que el flux de treball proposat i el simulador es poden utilitzar per capturar el rendiment de la soluci´o implementada d’una manera que permet la comparaci´o objectiva amb altres enfocaments, servint d’aquesta manera com a base per a l’avaluaci´o estandarditzada de futures solucions. 6 Acknowledgements I would like to express my deepest gratitude to all the people who have contributed to the completion of this thesis. First and foremost, I would like to thank my thesis advisors, Filip Lemic and Sergi Abadal for their invaluable guidance and support throughout all the research process. His expertise and encouragement have been instrumental in shaping this work. My sincere appreciation goes to Esteban Municio from i2CAT, and Jakob Struye from IDLab research group (University of Antwerp), who provided technical support in the development of the open source framework. Furthermore, I am grateful to Gerard Calvo Bartra, from N3Cat for his assistance in the development of the localization machine learning model. I would like to acknowledge the support of other key members from i2CAT, IDLab and the Data Communications and Networking group at the School of Electrical Engineering and Computer Science, TU Berlin, who kindly shared their knowledge from previous research in this area. I would like to express my thanks to my family, friends, and colleagues for their unwavering support, understanding, and encouragement throughout my academic journey. Last but not least, I would like to thank the staff and faculty of Universitat Polit`ecnica de Catalunya, who have provided me with a stimulating and enriching academic environment that has fostered my intellectual growth and development. Thank you all for your contributions, support, and encouragement. 7 Revision history and approval record Revision Date Purpose 0 09/12/2022 Document creation 1 10/01/2023 Document revision 2 20/03/2023 Document revision 3 15/04/2023 Document revision 4 25/04/2023 Document revision 5 01/05/2023 Document revision 6 09/05/2023 Document revision DOCUMENT DISTRIBUTION LIST Name Arnau Brosa Lopez Filip Lemic Sergi Abadal Written by: Reviewed and approved by: Date 09/04/2023 Date 01/05/2023 Name Arnau Brosa Lopez Name Filip Lemic and Sergi Abadal Position Project Author Position Project Supervisor 8 1 Introduction During the last years, there have been many promising advancements in nanotechnology which can make a difference in the biomedical field. Specifically, nanotechnology is paving the way toward nanoscale devices with integrated sensing, computing, and data and energy storage capabilities. These devices are envisioned to be injected in the patients’ bloodstreams. As such, these nanodevices will have to abide to the environmental constraints limiting their physical size to the one of the red blood cells (smaller than 5 microns). Due to such constrained sizes, their sole powering option will be to scavenge environmental energy (from heartbeats or through ultrasound-based power transfer) utilizing nanoscale energy-harvesting entities such as Zinc-Oxide (ZnO) nanowires [1]. With such devices, on the one hand, will enable the development of atomically precise materials and structures with revolutionary electrical, optical and mechanical features. On the other hand, for the first time ever, such devices will enable an interaction with living systems, bio-markers, bacteria, viruses, cancerous tissue, etc, on the same scale as they naturally interact. This opens the door to a wide range of applications, like an early diagnostics for the patients, delivering readings from the inside of the body or commanding precise drug delivery [2] [3]. However, even such interaction is not enough for enabling the envisioned applications. One of the main reasons is the lack of communication capabilities at the nano device level. Nonetheless, the emergence of graphene points to a feasible future solution. Graphene naturally resonates at terahertz (THz) frequencies (0.1-10 THz), and as such can serve as a primer for the development of THz nanoscale transceivers [4]. Although graphene-based nanoantennas have been shown to efficiently operate in the sub-THz band, this is not the only reason why this material is so important. These nanodevices need high precision and sensitivity to detect bio markers and other biological analytes. The high electron transfer rates, high charge-carrier mobility and low electrical noise levels are of utmost importance are only some of the many properties that makes graphene one of the most suited materials to use for the nano devices. In the context of the above-discussed nanodevices, wireless communication capabilities will enable two-way communication between them and the outside world [5]. Fully integrated nanodevices with communication capabilities are paving the way toward sensingbased applications such as oxygen sensing within the bloodstream for detecting hypoxia (a biomarker for cancer diagnosis), as well as actuation-based ones such as non-invasive targeted drug delivery for cancer treatment. As recognized in recent literature, nanodevices with communication capabilities will also provide a primer for Flow Guided Localization in the bloodstream [3], [6]. Intuitively, such localization would enable associating the location of the nanodevice with a detected event, providing medical benefits along the lines of non invasiveness, early and precise diagnostics, and reduced costs [6]–[7]. Flow-guided localization is in an early research phase, with only a few works targeting the problem. The main challenges are the environment the nano devices are supposed to be deployed in. The bloodstream is a more hostile and complex environment, so the transmission is more difficult than in air or vacuum adding up the high mobility of the nanodevices within the bloodstream, with their speeds reaching 20 cm/sec, also the cen- 9 These sensing tasks are designed to detect events, such as biomarkers, which are hardcoded into the experiment. The locations of these events are varied in different scenarios to test the accuracy of the system in different parts of the body. The conditions for the nanonodes to detect events include: 1. The Euclidian distance between the actual nano node position and the event position is less than predefined threshold. 2. The nano node is turned on The communication between an anchor and a nanodevice involves passive reception of a beacon, followed by active transmission of a response packet from the nanodevice. This means that nanodevices do not spend energy on receiving, but they do for sending data to the anchors. Although we attempted to implement full back-scattering communication, the in-body attenuations were too high, preventing the packet from reaching the anchor. To resolve this issue, we established a passive reception of the beacon sent by the anchor and an active transmission of the response. This method allows the nanonodes to spend energy on sending a packet back to the anchor and sensing events. However, this type of communication leads to a large energy drain, which is why an energy harvesting model is crucial. The anchor transmits a constant beaconing frequency and power. Each beacon packet contains the anchor’s Medium Access Control (MAC) address and ID. In the backscattered packets, the nanodevices report their MAC addresses, the time elapsed since their last passage through the heart, and an event bit. These data points represent the raw data that can be used in a flow-guided localization approach to locate a target within the body. We process this raw data in evaluations to determine the target’s region and evaluate the system’s performance. Flow-guided localization of nanodevices in the bloodstream requires at least one anchor mounted on the patient’s body. With a single anchor strategically positioned near the heart, flow-guided localization approaches in [13] and [7] can be enabled because nanodevices are guaranteed to pass through the heart in each iteration through the bloodstream. In this thesis, we evaluate the performance of the system with just one anchor. Although the simulator supports additional anchors by specifying their positions in the configuration file. Each time a nanodevice passes through the heart, the time elapsed since the last passage is re-initialized to zero to prevent compounding multiple iterations. The event bit is a logical 1 if a target event is successfully detected and 0 otherwise. Similarly, the event bit is re-initialized to 0 in each passage through the heart. 16 4 Low Level Design In this chapter, we will delve into the technical aspects of our thesis, presenting a detailed low-level design of our flow-guided localization solution. First, we will provide an overview of the software tools used to develop our solution, their interactions with each other, and the results they produce. Next, we will define all the internal and external components that make up our simulator. To conclude, we will describe the workflow of our simulator in detail. 4.1 Utilized Tools In chapter 2, we discussed how our localization system integrates three different opensource software packages. The integration of these three software packages provides the research community with a powerful tool for realistic and objective assessments of flowguided localization. This tool will facilitate the evaluation of new algorithms, particularly in the early stages of research, and will enable many advancements in future research in this area. 4.1.1 Blood-Voyager-s The first step of our procedure involves utilizing the Blood-voyager-s software, which was introduced in section 2. This software provides a simplified model of the human cardiovascular system, allowing us to determine the global positions of the nanonodes within the system. We integrated this software into our NS-3 code and generated a csv file containing the positions of the nanonodes, which we will later use in our main simulation. To adapt the csv file to our specific needs, we developed a python script for processing the data. The resulting cardiovascular positioning map, used for simulating the global positions of the nanonodes, is displayed below. Figure 2: Blood-voyager-S positioning structure 17 Figure 2 shows the main vessels that provide local coverage and contain large organs and limbs. Overall there are 94 vessels and organs covered. The human body is threedimensional, the spatial direction from the front (anterior) to the back (posterior), the z-coordinate, is still lacking. The measurement of the organs from anterior to posterior on the skin is not possible and again there is no record of all relevant dimensions. Therefore, the spacial depth is established using as a guideline, the thickness of the kidney, which is between 3 and 5 cm, then in this simulations, all z distances are set at 4 cm, as explained in chapter 2. The simulator further assumes that the arteries and veins are set anterior and posterior, respectively. Transitions from the arteries to veins happen in the organs, limbs, and head. In the heart, the blood transitions from the veins to arteries. The flow rate is modeled through the relationship between pressure difference and flow resistance. This results in the average blood speeds of 20, 10, and 2–4 cm/sec in aorta, arteries, and veins, respectively. Transitions between the arteries and veins are simplified by utilizing the constant velocity of 1 cm/sec. To summarize this section, we have used Blood Voyager-S to obtain the global position of the nanonodes every second throughout the simulation. By doing this, we will be able to integrate these positions into our nanonodes in the simulator. 4.1.2 NS-3+TeraSim The main part of our develop solution has been made using NS-3 and TeraSim. NS-3 is an open source computer networks simulation environment that is based on discrete-event simulation. In such a simulator, each event is associated with its execution time, and the simulation proceeds by executing events in the temporal order of simulation time. It is designed for research use, thinking of the needs of the research community, and fosters a community-based collaboration model both to support the development of new modules and to perform validation or peer review activities across different groups. NS-3 is distributed under an open-source model and a free software paradigm. TeraSim is another open source code, compatible with NS-3, and it’s the first simulation platform for THz communication networks which captures the capabilities of THz devices and supports all the peculiarities of the THz communications, as the THz channel or the molecular loss absorption among other features [9]. Specifically, at the physical layer the simulator features pulsebased communications with an omnidirectional antenna over distances shorter than 1 m, assuming a single, almost 10 THz wide transmission window. At the link layer, TeraSim implements two well-known protocols, ALOHA and CSMA, while a common THz channel module implements a frequency selective channel model, assuming in-air wireless communication. We will utilize BloodVoyagerS and TeraSim as the starting point in the development of the envisioned simulator. With these two open source softwares we have managed to design a communication system between the nanonodes and the anchors simulating the environment inside the human body. This solution will integrate all the features and constraints discussed in chapter 1 and 3 necessary for both the nanonodes and the anchors to operate correctly within such a conflicting environment as the in-body is. 18 4.2 System Design In this section, we will provide a detailed explanation of the internal structure of our nanonodes in our simulator, which consists of various modules. We will delve into the main features and functionalities of each module. Additionally, we will describe the different external modules used to establish bilateral communication between the nanonodes and anchors. NET DEVICE THzMac THzPhy NODE INTERNAL STRUCTURE THzNetDevice THzSpectrum ValueFactory THzEnergyModel THzDirectional Antenna Figure 3: Nanonode structure Figure 3 depicts the internal structure of both the nanonodes and the anchors. The design includes a physical and link layer, as well as several assisting modules such as an energy model that addresses the constraints discussed in previous chapters. Additionally, there are other modules that we will now describe in greater detail. 1. THzNetDevice: THzNetDevice is derived from the base class NetDevice provided by ns-3 to create new MAC protocols. It performs as the joint point which connects the THzChannel module, THzPhy module, THzMac module and the assistant modules such as the THzDirectionalAntenna and THzEnergyModel together. 2. THzMAC: At the link layer there is a MAC protocol implemented. When a packet is enqueued in the THzMacNano, if the node is turned on then it passes the packet over the physichal layer for 0-way (ALOHA) handshake protocol. A node receives 19 the packet then. The desired receiver then sends an acknowledgement (ACK) packet to the sender. 3. THzPhy: The physical layer for the nanoscale transmit by using TSOOK, a modulation scheme based on the transmission of one-hundred-femtosecond-long pulses by following a non-off keying modulation spread in time. 4. THzDirectionalAntenna: The THzDirectionalAntenna module based on CosineAntennaModule, which is provided in the NS-3 platform. The antenna gain of the cosine model We as we are doing simulations at a nanoscale level so we are using an omnidirectional antenna. 5. THzEnergyModel: The nanonodes use an energy model, unlike the anchors which are assumed to have enough energy for transmitting. This energy model uses passive reception, which means that there is no energy consumption for receiving a packet. However, there is energy consumption for sending back the packets to the anchors and for performing sensing tasks. To manage energy usage, we have implemented an ON/OFF threshold. The nano nodes begin the simulations with a maximum storage capacity of 800 pJ. When the energy of a nano node is depleted to 0 pJ, the node is put into an OFF mode, where it is unable to send or perform sensing tasks. The nanonodes will recharge over time, and once they reach or exceed the ON threshold, which we have defined as 10 pJ, the nanonode will return to the ON state. Regarding our energy harvesting model, the nanonode will harvest energy exponentially at a constant time. Our energy harvesting model is designed to be highly efficient. The nanonodes operate on an exponential harvesting curve, meaning that the amount of energy harvested will increase rapidly when their actual energy is at the lowest levels and increase slower as their energy storage is being fulfilled. Additionally, this harvesting process occurs at a constant rate, allowing for reliable and consistent energy generation. The harvested energy can be specified with the duration of the harvesting cycle tcycle and the harvested charge per cycle △Q. Capacitor charging through energy harvesting can be accurately modeled as an exponential process, accounting for the total capacitance Ccof the nanonode, i.e., Ccdepends on the maximum energy storage capacity Emax and the generator voltage Vg. In the modeling, it is required to know in which harvesting cycle ncycle the nanonode is, given its current energy level Encycle ncycle = (Vg∗Cc)/△Q∗ln(1 −q2Encycle/Cc∗V2 g) (1) Encycle+1 = (Cc∗V2 g)/2∗(1 −exp −(△Q∗(ncycle+1))/Vg∗Cc)2(2) Where Ccis: Cc= 2 ∗Emax/V g2(3) 20 Figure 4: Energy model simulation Figure 4 provides a detailed overview of the behavior of our energy model. Specifically, the nanonode operates on a constant harvesting interval of 20ms, leveraging the exponential formula described earlier. The figure demonstrates that the nano node is capable of harvesting more energy when the available energy is lower, and that it continues to harvest energy until it reaches its storage capacity limit. Once the nano node sends a packet back to the anchor, its energy level begins to decrease, as illustrated in the figure. Figure 5: Event detection consumption Figure 5 above illustrates the energy consumption required for event detection. To demonstrate this performance, we employed a granularity of 1000 samples per second. Specifically, we utilized an energy consumption rate of 0.1pJ per event detection. As depicted in the figure, we observe that the nanonode consumes 0.1pJ for each sensing task. Table 1 shows the values predefined in our simulations for the following parameters defined in the formulas above. 21 Variable Value Harvesting cycle duration 20ms Harvested charge per cycle (△Q) 6pC Generator voltage(Vg) 0.42V Turn OFF threshold 0pJ Turn ON threshold 10pJ Maximum energy storage capacity (Emax) 800 pJ Table 1: Energy model parameters Having outlined the modules at the nanonode level, we will now provide an overview of the external modules that enable bilateral communication between the nanonodes and anchors. EXTERNAL STRUCTURE Nanonode X ANCHOR THzChannel THzSpectrum PropagationLoss Node-Applic Anchor-Applic Custom-Data- Tag-Anchor Custom-Data- Tag-Node Figure 6: Simulator structure Figure 6 illustrates the various modules that interact with both the nanonodes and anchors to enable effective communication between both. 1. Node-Applic: This module acts as the application and transport layer of the nanonodes, because it manages the behavior of the nanonodes and also generates the packets that will be sent to the anchors. The main functionalities of this module are: (a) Receiving the beacons from the anchors and substract their addresses and IDs. (b) Checking it there is enough energy for continue sensing new events. 22 (c) Estimating the euclidean distance between the actual nanonode position and the event position which is hardcoded. The threshold that determines whether the event will be detected or not will vary depending on the scenarios but we will establish as a base value that if the Euclidean distance is equal to or less than one, then the event will be detected. We used the following equation to estimate the Euclidean distance: d(p, q) = q(px−qx)2+ (py−qy)2+ (pz−qz)2(4) p,q being the actual position of the BNS and the event position respectively. (d) Sending the response back to the beacons with all the raw data necessary for later use that data to locate in which region of the body the target was, and obtain the performance of our system. 2. Anchor-Applic: It has the same functionality as the one explained before, but this is applied for the anchors. It manages the behavior of the anchors and also generates and prepares the packets that will be sent to the nanonodes. The anchors will generate beacons every 100ms and send it to their surroundings waiting for nanonodes to enter its communication range and receive the packets. This beacons are sending the anchors’ ID and their addresses, so that the nanonodes can know where they have to send back the response. It is also the responsible to receive the response packets of the nanonodes with all the raw data. 3. THzChannel: The THz channel takes into account waveforms with realistic bandwidth and applies the frequency selective propagation behavior of the THz channel. When the waveform generated by THzSpectrumValueFactory is passed down to the channel, THzChannel first obtains the antenna gains of the transmitter and receiver from the THzDirectionalAntenna module Then it passes the waveform, total antenna gain and the mobility model to THzSpectrumPropagationLoss and finally passes the packet along with the received power to the physical layers of the receiver to simulate the wireless broadcast channel. 4. THzSpectrumPropagationLoss: This module together with the Inbody-loss module, model and recreate the attenuation of the environment of in body. The propagation at THz band is mainly affected by molecular absorption which results in both molecular absorption loss and molecular absorption noise. We calculated the path loss of the vessels, tissues and skin, based on certain parameters that we are explaining now. The total path loss for an in-body transmission/reception is: TotalPathLoss =V esselPathLoss +TissuePathLoss +SkinPathLoss (5) To calculate each path loss for each part is: PathLoss =SpreadingLoss ∗AbsorptionLoss (6) The necessary variables for getting those path loss are: (a) The carrier frequency which we established in our simulations as 10THz 23 (b) The distance between the anchor and the nanonode (c) Different constants like the thickness of the skin, vessels, tissues or the speed of light Figure 7: Nanonode reception power Figure 7 shows the performance of the receive power according to the distance between the nanonode and the anchor. It is reflected how the received power decrease a lot in only a few centimeters due to all the attenuation the in-body communication have. The communication range is around 0.4/0.5 cm. 5. Tag Classes: The both tag classes (Custom-Data-Tag-Node and Custom-Data- Tag-anchor) encapsulates the information that we want to sent in NS-3 objects called Tags and that will be used by the application layer to generate the packets. Custom-Data-Tag-Node encapsulates the raw data needed to send to the anchor and Custom-Data-Tag-anchor encapsulates the data needed to send to the nanonodes, the receivers in the application level are the ones in charge of untag that packets. 4.3 Workflow The architecture of the simulator follows a well-established ns-3 layered model, as depicted in Figure 8. The Anchor-Application module implements continuous beaconing with a predefined period (nb., with 100 ms being a default value) to broadcast with their address and ID. Each beacon packet is forwarded to the THzNetDevice module. At the THzNetDevice the packet calls the enqueue method from the THzMac, in the MAC protocol a header is included, after that it passes the packet to the physical layer, THzPhy 24 creates its own data structure for the packet and adds it to the list of ongoing transmissions. If a new transmission or reception comes while a transmission is going on, THzPhy will use the information to interleave and check for collision. The link and physical layers implement the ALOHA protocol and TS-OOK modulation, respectively. Then the packet is passed to the THzChannel by calling the SendPacket() method of the channel through the handle (pointer to THzChannel).The THz channel is modeled by calculating the receive power for each communicating pair of devices and scheduling the invocation of the ReceivePacket() method accounting for the corresponding propagation time. The channel model entails in-body path-loss and Doppler term. The path loss is calculated using the attenuation and thickness parameters of the vessel, tissue, and skin. The Doppler term is accounted for by evaluating the change in relative positions between the nanodevices and anchors with time.The ReceivePacket() method of the channel invokes the RecivePacket() method of the THzPhy using the pointer to it. The ReceivePacket() method of the THzPhy checks for the collision and calculates the SINR every time there is a new interfering signal. Then it marks the packet as collided if the SINR value is less than the predefined threshold for detection, otherwise it marks the packet as not collided. The ReceivePacketDone() of the PHY then checks the completely received packet to see if it was collided i.e., the SINR was less than the threshold at some point during reception. If it did collide, the packet is dropped. Otherwise, the packet is passed to the MAC layer. The MAC layer first checks if it is the intended receiver of the packet by looking into the destination address. If it is the intended receiver and the packet is received correctly it passes the packet to the upper layer. Finally at the application layer the receiver (anchor) untag all the information that was at the packet. At the nanodevice level, the receive power of the beacon is used for setting up the transmission power of the packet to be backscattered. This is followed by backscattering the response packet from the nanodevice toward the anchor by utilizing the same procedure as for the transmission of the beacon. The anchors are assumed to be static entities and feature sufficient energy for continuous operation. The nanodevices are assumed to be energy-harvesting entities that are mobile within the bloodstream. To model their mobility, we have integrated BloodVoyagerS in our simulator. Invoking a BloodVoyagerS execution results in generating csv file that specifies the locations of the nanodevices in the bloodstream. The positions generated in these simulations are generated with a frequency of 1 Hz. Since ns-3 is an event-driven simulator, at each BloodVoyagerS-originating location of a nanodevice, the nanodevice is assumed to carry out a sensing/actuation task. Given that for certain applications carrying out such tasks could be required more frequently, we provide an upsampler for BloodVoyagerS-originating locations sampled at 1 Hz. As the vessels in BloodVoyagerS are modeled using straight lines, the upsampling is based on linear interpolation with a small random component drawn from a zero-mean Gaussian distribution, representing vortex flow of blood and minor changes in the diameters of veins, arteries, etc. At each new location, the nanodevice is expected to carry out a task for detecting an event of interest. Finally, once the communication system between the nodes and the anchors has been 25 Variable Total Number of BNS 64 Number of anchors 1 at heart Granularity 1/3 s Event threshold detection 1cm Table 5: Baseline scenario To ensure meaningful and dependable results, we have carefully selected 64 nanonodes for deployment in our simulations. This number strikes a balance between avoiding insignificance and unreliability that a smaller sample size may produce, while also steering clear of an excessively high number. Our primary objective in this initial stage is to validate the proper functioning of our system and investigate its behavior. As for the number of anchors, we begin with the minimum requirement, as previously mentioned, which involves placing an anchor in the heart/thorax region. Additionally, we will initiate the simulations with a sampling rate of 3 samples per second and a 1cm event threshold for detection. 32 6 Experiments and Results Each evaluation scenario within a set will present a figure comprising three types of graphs. Firstly, we include a graph that assesses accuracy in relation to simulation time, this graphs represents the accuracy (positive detection/total detection) versus the time. Secondly, we provide a graph displaying the point accuracy, which is the error in distance for each region. This graph allows us to observe the average error in distance for predictions, as well as identify any outlier values. To best represent this data, we have chosen to utilize a boxplot, as it offers a clear visualization of the desired results. Lastly, the third graph illustrates the most frequently predicted region, which can also be interpreted as a measure of accuracy. However, instead of calculating this for each simulation time, we have employed the mode to determine the most predicted region. We gathered all the predictions for each simulated region and calculated the mode to identify the region with the highest frequency of predictions. Subsequently, we compared this most predicted region against the actual region. A value of 1 indicates a match between the most predicted and actual regions, while a value of 0 indicates a mismatch. Figure 11: Baseline evaluation Firstly, we will present the base scenario that was previously discussed. The figure above showcases the three graphs mentioned earlier. In the first graph, we observe that the accuracy remains below 10% throughout the simulation period. Moving on to the second graph, we can observe the variation in distance errors across different regions. It is evident that only regions 51 and 56 have a mean error of 0, indicating accurate predictions. However, it is important to note that most regions exhibit outlier values, which is a 33 common occurrence in simulations of this nature due to communication interference and insufficient energy for reliable data transmission. Lastly, the third graph demonstrates that when we consider the mode of predicted regions for each actual region instead of analyzing individual samples, only 6 out of the 25 regions align with the original regions. 6.1 Scaling with the Number of Nanonodes (a) 32 nanonodes evaluation (b) 128 nanonodes evaluation (c) 250 nanonodes evaluation Figure 12: Localization performance as a function of the number of nanonodes 34 In this set of scenarios, we assessed the behavior of our system by manipulating the number of nanonodes within the body. It is evident that as we increase the number of nanonodes, there is a slight decrease in accuracy, as depicted in the first graph. Moving on to the second graph, we observe a slight decrease in error distance; however, it is accompanied by an increase in the number of outlier values. Finally, in the third graph, we can see a rise in the most predicted value per region. Consequently, we observe a greater number of regions where the mode (most frequently occurring value) aligns with the correct region, reaching a maximum of 8 regions. The results depicted in the first graph may appear somewhat counterintuitive at first, but it is logical that the accuracy experiences a slight decline when the number of nanonodes increases. This can be attributed to the initial implementation of our ML model, which tends to produce more incorrect predictions than correct ones. Consequently, while we may also generate more true positives, the number of negatives increases even more, resulting in a decrease in overall accuracy. However, upon examining the third graph, we observe the advantages and improved outcomes of calculating accuracy using the mode. This approach allows us to predict regions more accurately, leading to better results overall. In conclusion, increasing the number of nanonodes leads to improvements in the number of predicted regions which allow to predict two more regions correctly in contrast with the baseline scenario and it also reduces the error in distance. However, it results in a decrease in accuracy in relation to the simulation time, as we have more samples miss predicted. 35 6.2 Scaling with Granularity (a) 1 sample/s evaluation (b) 2 samples/s evaluation (c) 5 samples/s evaluation (d) 10 samples/s evaluation Figure 13: Localization performance as a function of temporal granularity In this series of simulations, we have examined the behavior of our system by manipulating the frequency of upsampling. Notably, we have observed a decrease in accuracy as the 36 frequency increases. Furthermore, an interesting observation is that the most predicted region tends to decrease as the frequency is raised. Initially, during the evaluations, there was an expectation that increasing the number of samples per second would result in a higher number of regions being predicted correctly. However, upon conducting the evaluations, it became evident that this assumption did not hold true. The reason behind this lies in the behavior of our system. While an increase in the number of samples does generate more positive predictions, it also introduces an elevated number of negative predictions due to noise and reduced precision in certain regions. As a result, both the precision in relation to circulation time and the number of correctly predicted regions decrease when the frequency is increased. 37 6.3 Scaling with the Event Threshold (a) 0.5 cm event threshold (b) 2 cm event threshold (c) 3 cm event threshold Figure 14: Localization performance as a function of the event threshold In this set of scenarios, we examined the behavior of our system by manipulating the threshold of detection for each event within the body. The first graph illustrates the accuracy, which experiences a slight decrease as the threshold is increased. Notably, the best performance in terms of accuracy versus time is observed when the threshold is set at 38 0.5cm, maintaining a consistent 10%. As we further increase the threshold, the accuracy continues to decrease, gradually. Moving on to the second graph, we observe a decrease in the mean error in distance for certain regions as the threshold is adjusted. This indicates an improvement in prediction accuracy for those specific regions. Lastly, the third graph highlights the relationship between the threshold and the number of correctly predicted regions. Lowering the threshold results in a higher number of regions being predicted correctly. Conversely, as the threshold is increased, the number of correctly predicted regions decreases. In theory, one might expect that increasing the threshold would lead to the detection of more events, thereby improving the overall accuracy. However, as observed in graph 3, the number of correctly predicted regions actually decreases as the threshold is raised. This unexpected outcome can be explained by the fact that, as we previously mentioned, the events in the evaluations were randomly located within the region rather than being centralized. Consequently, when the threshold is increased, an event may be detected even if the corresponding nanonode is not in the same region as the event itself. This discrepancy results in a higher number of erroneous predictions, contributing to the decline in accurate region predictions. These results serve as a valuable reminder of the significance of the assumptions we make before conducting evaluations. As demonstrated in this set of simulations, our assumptions can have a substantial impact on the anticipated outcomes. Therefore, it is crucial to carefully consider and validate our assumptions to ensure the reliability and relevance of the expected results. 39 7 Conclusions and Future Work As you have seen throughout this thesis, our work offers a model that serves as the foundation for standardized evaluation of future solutions. This allows all researchers to work hand-in-hand, with a correct and solid foundation to start from, and continue advancing in this area that has so many benefits to offer us. Building upon our successful development of a highly accurate simulator for replicating the internal environment of the human body, we have achieved a significant milestone by establishing stable and reliable two-way communication between nanonodes and anchors. This achievement has paved the way for a standardized model that facilitates event-based communications within the human body, effectively transcending the inherent constraints imposed by both the human body and the nanonodes. This breakthrough brings us closer to unlocking a deeper understanding of communication dynamics within the human body and opens up exciting possibilities for advancements in healthcare technologies and remote monitoring. In addition to the successful development of the simulator, we have also implemented a carefully designed standardized evaluation methodology for the flow guided localization solution under consideration. The purpose of this methodology is twofold: to validate the accurate functioning of the simulator and to gain valuable insights into the operation of our system. These crucial initial steps provide us with a solid foundation for future enhancements and advancements in our research and development endeavors. The results indicate that the proposed workflow and the simulator can be utilized for capturing the performance of flow-guided localization approaches in a way that allows objective comparison with other approaches. Our results reveal relatively improvable accuracy of the different evaluated scenarios.This is due to unreliable THz communication between in-body nanonodes and on-body anchors and intermittent operation of the nanonodes due to energy-harvesting. It has also been shown in the evaluations how some regions are never detected, this is because the circulations times in some regions, most of them on the upper body (right and left heart, thorax, intestine, hips) their circulations times are too close between them, and some minimum delay in the transmission, makes miss the prediction, also the lack of data make also hard the training of some regions. There is other problems regarding the predictions in some regions for example when trying to distinguish between a region of the body and its pair region (for example between left and right hand), for our actual system it is very hard to distinguish between them if their circulation times are similar or equal. We can observe that the accuracy obtained is relatively low, which is our most important limitation that we must focus on. We also have limitations in terms of scalability, requiring further code and system structure modifications. Another limitation, although it is more a problem, would be the disparity of data obtained in different simulations, which hinders the training of our ML model and directly affects the reliability and accuracy of our results. As we mentioned in the previous paragraph, our priority for the future is to improve the levels of accuracy we have obtained in this thesis. Clearly, much higher values are needed 40 to consider them reliable, so this must be the main focus in the future. Modifications will need to be made to both the programming and structure of the designed system to achieve greater scalability in the future. Furthermore we will need to continue improving the proposed ML model. As we have mentioned, it will need better tools to facilitate/improve its training, with that we should be able to predict some regions that now are not predicted well due to their similarities in their simulation times, and with that obtain better results. It is also important to make some improvements for solve the prediction problems between the regions that has two pairs equally located (for example right and left hand). Finally, there is also a need to evaluate this system with more than one anchor as explained in chapter 5 due to for some bugs regarding the ML algorithm the evaluations could not be done, although our simulator is prepared to work with more than one anchor. Part of the work presented in this thesis has been submitted as a paper to the IEEE Communication Standards magazine. Specifically, the section on the development of the simulator and evaluation of it has been selected for publication. This paper [15] provides a detailed description of the fundamentals, design, and testing of the proposed flow guided localization solution, as well as the performance evaluation. The paper also includes a discussion of the potential applications of these devices in the detection of health problems and drug delivery. The possible acceptance of this paper for publication in the IEEE magazine is a significant accomplishment and highlights the contribution of this work to the field of nanotechnology and wireless communication. 41