Applications of microwaves in pharmaceutical processes Development of a monitor for fluid bed- & continuous flow pro- cesses, an electroporation protocol, and a device for charac- terisation of chemical samples. Master’s thesis in Biomedical Engineering Robin Nilsson DEPARTMENT OF ELECTRICAL ENGINEERING CHALMERS UNIVERSITY OF TECHNOLOGY Gothenburg, Sweden 2024 www.chalmers.se ii www.chalmers.se Master’s thesis 2024 Applications of microwaves in pharmaceutical processes Development of a monitor for fluid bed- & continuous flow processes, an electroporation protocol, and a device for characterisation of chemical samples. Robin Nilsson Department of Electrical Engineering Division of Biomedical Engineering Chalmers University of Technology Gothenburg, Sweden 2024 Department of Oral Product Development (OPD) AstraZeneca, Gothenburg Gothenburg, Sweden 2024 Applications of microwaves in pharmaceutical processes Development of a monitor for fluid bed- & continuous flow processes, an electro- poration protocol, and a device for characterisation of chemical samples. Robin Nilsson © Robin Nilsson, 2024. Supervisors: Gustaf Hulthe Astra Zeneca Mats Josefson Astra Zeneca Helena Rodilla Department of Microtechnology and Nanoscience Examiner: Hana Dobsicek Trefna Department of Electrical Engineering Master’s Thesis 2024 Department of Electrical Engineering Division of Biomedical Engineering Chalmers University of Technology SE-412 96 Gothenburg Telephone +46 31 772 1000 Cover: Microwave monitoring of a fluidised bed. Typeset in LATEX, template by Kyriaki Antoniadou-Plytaria Printed by Chalmers Reproservice Gothenburg, Sweden 2024 v Abstract Microwaves, electromagnetic waves within the frequency range of 0.3-300 GHz, have been subject to many studies and research within the pharmaceutical industry. The attractiveness of microwaves typically lies in their non-invasive, non-destructive na- ture while local areas within samples may still be accessed or studied. From pro- cesses in early development phases to late processes in production, records of devices exploiting these characteristics of microwaves can be found dating back half a cen- tury. Still, research investigating new possibilities utilising microwaves continuously emerges, suggesting the overall usability is still much unexplored. The current the- sis aims to investigate in-early-phase research of microwaves that may be useful for various purposes in the pharmaceutical industry but have yet to find wide recog- nition. The study will not be limited to literature research, but in contrast, will implement aspiring research using available tools and discuss the implementations from a practical viewpoint. Improvements in each case will be provided and to some degree implemented. Specifically, four cases are presented where two cases attempt to develop a monitor for two different industrial processes: continuous flow through a pipe (case I) and batch sample particle coating in a fluid bed dryer (case II). In case III the attempt is instead to develop an electroporation device to open cell membranes to accelerate drug discovery, and finally, in case IV we attempt to de- velop a method for characterising samples in an easy-to-use, non-destructive way. Access to a vector network analyser (VNA) and a software-defined radio (SDR) was given, where a framework for using the VNA was developed in the open-source pro- gramming language Python. To analyse the retrieved data, extensions to normal regression methods (ordinary least square, principal component regression, and par- tial least square regression) dealing with so-called improper complex signals were de- rived and used, where the widely linear transform was utilised. The free, open-source multiphysics software ElmerFEM (with complementing software) was investigated and used to attain numerical results, were previous research relied on commercial tools such as COMSOL or HFSS. The results of the thesis suggest that the current implementation of a monitor for the fluid bed (case II) leaves much to be desired, as the used antennas are greatly affected by process environmental changes which produce undesired deviations in measurements. The origin of the problem lies in that the antennas need to be placed inside the fluid bed process. In contrast, in case I the antennas can be placed slightly outside of the process and are as such protected against the flow and envi- ronmental changes enabling easier analysis of the data. Nevertheless, the potential of both implementations was observed. For both cases III and IV, the developed theoretical frameworks suggest great potential for quick, easy-to-use processes that may accelerate research within the corresponding fields. Unfortunately, experiments were concluded early, and the practical benefits are still mostly unexplored. In conclusion, the potential of microwaves in the pharmaceutical industry was con- sidered and found in all four studied cases. Still, much is left to discover, and vi improvements are of the essence before the projects can be considered in real pro- cesses. The potential of using the same methods as the ones derived in the thesis for several other projects is noted, and as such the current thesis may lay as a foun- dation for subsequent research. Keywords: Microwaves, fluid bed dryer, continuous flow chemistry, electropora- tion, cavity resonator, microstrip resonator, process monitor, complex signal pro- cessing, improper signals, widely linear transformation. vii Acknowledgements From start to finish, there have been many people involved for various reasons which have contributed to the final product of this thesis. And in my most sincere way, I direct my thankfulness to all. As such, I would first and foremost like to express my thanks to my supervisors in AstraZeneca, Gustaf and Mats as they have had considerable effect on the thesis directions and choice of implementations. Gustaf Hulthe with his keen sight for practical implementation and development of hardware and Mats Josefson expertise in computers and data analysis has been the ultimate combination for the thesis and my time staying here. They have both a great sense of mentorship and pedagogy. Similarly, my examiner Hana Dobsicek Trefna and my supervisor Helena Rodilla with both their expertise in the studied area have had a big impact on the thesis and realisations of the project, while only meeting on a few occasions. Both have been extremely kind and helpful, and now after the thesis I regret not borrowing their expertise more than I did. Several other people in AstraZeneca have also had a great impact on the general direction of the thesis, for instance by providing discussions on possible researched processes and projects that have been previously conducted on the site. As such I would like to express my thanks to Lubomir Gradinarsky, who provided data and insight on previous attempts on the fluid bed, and later Anders Holmgren who pro- vided even more insight on the previous fluid bed projects. It was thanks to the conversations I had with them that the largest project, the fluid bed (Case II) was considered realistically. Subsequently, the methods developed for the continuous flow (case I) was also based on the ideas that were originally developed for the fluid bed. The conversation with Anders also led me to Mats Johansson, who very kindly gave me an introduction to the fluid bed and helped me set up Spiritus (the fluid bed used in the thesis), as well as perform initial experiments. I would also like to express my thanks to Johan Hjärtsam who provided me with sample granules and for intel on how to design some of my experiments. In the case of the fluid bed, the team of CBRE helped in fixing Spiritus so it could be operated, and the experiments could not be conducted without them, and have my sincere gratitude. For case III, I would like to direct my thanks to Hagvall Sepideh and Susanna Abra- hamsen for considering the electroporation project, and the initial meeting where important specifications of electroporation were discussed. I apologise for the early conclusion of the project but hope that my work may be a start for someone else. Special thanks to Johan Forsgard of AstraZeneca and my older brother Eddie Nils- son for helping me 3D print materials and different construct, which helped me greatly in the early days of the thesis when I developed my preliminary ideas for the T-resonator (case IV). For the modelling, the team behind Elmer has helped a lot in regard to hints and ix explanations of the software, but also by updating and patching the software when there was a need for it. Without their help, there wouldn’t be any numerical results except the analytical, in which they have my gratitude. Thank you to all the people who have read and provided insight and improvements to the report, in which the only so far not mentioned is my dear mother, Annette Nilsson. Equivalently, I thank my dear father Roy Nilson for helping with various ideas I had at the beginning, which he supported with the precise cutting of various objects. Lastly, a thank you to my partner Helene Rodelius who helped me in the midst of confusion and supported me from behind the scenes. Robin Nilsson, Gothenburg, 6/ 2024 List of Acronyms Below is the list of acronyms that have been used throughout this thesis listed in alphabetical order: VNA Vector Network Analyser SDR Software Defined Radio TM Tranverse magnetic TE Tramnverse electric TEM Tranverse electromagnetic MUT Material under test OLS Ordinary least squares PCR Principal component regression PLS partial least squares xi xii Nomenclature Below is the nomenclature of indices, sets, parameters, and variables that have been used throughout this thesis. More may be introduced for the specific projects, but will carefully be explained. Indices i,j Indices for various sets Sets R/C real/complex set Variables E⃗ electric field (V/m) H⃗ magnetic field (A/m) B⃗ magnetic flux density (Wb/m2) D⃗ electric flux density (C/m2) M⃗ magnetic current density (V/m2) J⃗ electric current density (A/m2) Z, Z complex vectors Zr, Zi, ZRe real vectors X (with under- scores) spectrum Y similar as Θ (see parameters) Γ, Γ, ΓRe covariance C pseudo-covariance xiii Z0 characteristic impedance Parameters ϵ, ϵ0, ϵr, ϵ′ r, ϵ′′ r , ϵeff permittivity of various kinds µ, µ0, µr, µ′ r, µ′′ r permeability of various kinds ρ electric charge density f frequency ω angular frequency tan δ tangent loss S11, S12, S21, S22 scatter parameters Θ, β parameters to estimate ε white noise, possibly complex Vcyl, Vs volumes cylinder, volume sample xiv Contents List of Acronyms xi Nomenclature xi List of Figures xix List of Tables xxiii 1 Introduction 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Studied cases in the thesis . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Layout of the report . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 Theory 7 2.1 Fundamentals of microwaves . . . . . . . . . . . . . . . . . . . . . . . 7 2.1.1 Microwave resonance . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Microwave cavities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 Perturbations of resonant cavity . . . . . . . . . . . . . . . . . 12 2.2.2 Excitation antenna and field-measurement probes . . . . . . . 13 2.3 Vector network analyser and software-defined radios . . . . . . . . . . 15 2.4 Complex signal processing and regression methodologies . . . . . . . 15 2.4.1 Complex random vectors . . . . . . . . . . . . . . . . . . . . . 16 2.4.2 Complex multivariate Gaussian distribution . . . . . . . . . . 16 2.4.3 Statistical tests for impropriety . . . . . . . . . . . . . . . . . 17 2.4.4 Complex signal processing and system estimation by regression 18 2.4.4.1 Linear systems . . . . . . . . . . . . . . . . . . . . . 18 2.4.4.2 Extension into the complex space . . . . . . . . . . . 19 3 Data analysis for cases I, II, and IV 21 3.1 Construction of the problem . . . . . . . . . . . . . . . . . . . . . . . 21 3.2 Physical interpretation of dSMUT (s) np . . . . . . . . . . . . . . . . . . . 23 3.2.1 Full continuous flow . . . . . . . . . . . . . . . . . . . . . . . 23 3.2.2 Stochastic flow . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.3 Derivation of complex linear regression models . . . . . . . . . . . . . 24 3.3.1 Ordinary least square (OLS) . . . . . . . . . . . . . . . . . . . 25 3.3.1.1 Circular-Symmetric OLS . . . . . . . . . . . . . . . . 25 xv Contents 3.3.1.2 Widely Linear OLS . . . . . . . . . . . . . . . . . . . 25 3.3.2 Principal component analysis regression (PCR) . . . . . . . . 26 3.3.2.1 Circular-Symmetric PCR . . . . . . . . . . . . . . . 26 3.3.2.2 Widely Linear PCR . . . . . . . . . . . . . . . . . . 26 3.3.3 Partial least squares (PLS) regression . . . . . . . . . . . . . . 27 3.3.3.1 Circular-Symmetric PLS . . . . . . . . . . . . . . . . 27 3.3.3.2 Widely Linear PLS . . . . . . . . . . . . . . . . . . . 28 3.3.4 Kernel extensions . . . . . . . . . . . . . . . . . . . . . . . . . 29 4 Case I: Particle flow in pipe 31 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.2 Particle flow set-up and aim . . . . . . . . . . . . . . . . . . . . . . . 32 4.3 Method and design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 4.3.1 Experiments and data . . . . . . . . . . . . . . . . . . . . . . 33 4.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.4.1 Numerical results . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.4.2 Analysis of acquired data . . . . . . . . . . . . . . . . . . . . . 34 4.4.3 Regression analysis of the acquired data . . . . . . . . . . . . 35 4.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5 Case II: Fluidized bed dryer monitor 41 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 5.1.1 Fluidized bed dryer and Spiritus - theory, and use . . . . . . . 42 5.1.2 Problem statement and previous work . . . . . . . . . . . . . 44 5.2 Methods and data analysis . . . . . . . . . . . . . . . . . . . . . . . . 45 5.2.1 Parameters under study . . . . . . . . . . . . . . . . . . . . . 46 5.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5.3.1 Numerical results . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.3.2 Analysis of acquired data . . . . . . . . . . . . . . . . . . . . . 48 5.3.3 Regression analysis of the fluid bed data . . . . . . . . . . . . 55 5.3.3.1 Estimation of Θ = XBΘ . . . . . . . . . . . . . . . . 55 5.3.3.2 Estimation of X = ΘBX . . . . . . . . . . . . . . . . 61 5.4 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 6 Case III: Electroporation of cells 69 6.1 Electroporation using microwaves . . . . . . . . . . . . . . . . . . . . 69 6.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 6.1.2 Electroporation theory . . . . . . . . . . . . . . . . . . . . . . 70 6.1.3 Considerations and important factors for successful electropo- ration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 6.1.4 Electroporation using microwaves; two cases . . . . . . . . . . 73 6.1.5 Method and results . . . . . . . . . . . . . . . . . . . . . . . . 74 6.1.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 7 Case IV: Characterisation of chemical sample properties 79 xvi Contents 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 7.1.1 Aim of project . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 7.2 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 7.3 Previous work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 7.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 7.4.1 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 7.6 Discussion and conclusion . . . . . . . . . . . . . . . . . . . . . . . . 85 8 General discussion and Conclusion 87 Bibliography 89 A PDEs and general derivations I A.1 Time-harmonic Maxwell’s equations . . . . . . . . . . . . . . . . . . . I A.1.1 Helmholtz equation . . . . . . . . . . . . . . . . . . . . . . . . II B Extended theory III B.1 Coupling probe and antennas extended theory . . . . . . . . . . . . . III C Cylinder cavity resonator VII C.1 Setup and equations . . . . . . . . . . . . . . . . . . . . . . . . . . . VII C.1.1 Field distributions and coupling loop . . . . . . . . . . . . . . IX D Implementation details XIII D.1 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIII D.2 Antennas and hardware . . . . . . . . . . . . . . . . . . . . . . . . . XIII D.3 Data Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XIV E Regression analysis XVII E.1 Non-linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . XVII E.2 Widely Linear Partial Least squares . . . . . . . . . . . . . . . . . . . XVIII F Numerical Results XXI F.1 Elmer EM solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XXII F.1.1 Eigensolutions to microwave cavities simulations . . . . . . . . XXII F.1.2 Probe excitation’s simulations . . . . . . . . . . . . . . . . . . XXIII F.2 Results: Fluid bed dryer . . . . . . . . . . . . . . . . . . . . . . . . . XXVII F.2.1 Eigensolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . XXVII F.2.2 Probe simulations . . . . . . . . . . . . . . . . . . . . . . . . . XXVII F.3 Elmer sif code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XXIX F.3.1 Eigensolver sif code . . . . . . . . . . . . . . . . . . . . . . . . XXIX F.3.2 H-probe sif code . . . . . . . . . . . . . . . . . . . . . . . . . . XXX xvii Contents xviii List of Figures 1.1 Illustrative CAD models of the two cases, a) Case I, and b) Case II. Both models have two antennas attached, one horizontal, and one vertical aligned. Models were created using the FreeCAD CAD program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 Example of a microwave cavity, (a) simulated fields, and (b) spectrum from a real cavity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 Histogram of the first 7440 resonant frequencies of the cavity cylinder in figure 2.1. Here TM and TE modes are separated. . . . . . . . . . 11 2.3 Perturbations of the cavity. In (a) the empty cavity is shown, in (b) the cavity with added material and in (c) changes in the cavity shape. 12 2.4 Antenna construction in the fluid bed dryer. Left images (a and b) shows electric (left) and magnetic (right) fields for two different modes. The right image (c) is a CAD model of the fluid bed dryer. The Elmer software was used for the numerical results in the left images. 14 4.1 Simulated system of particle flow, sketch (a) and cad model (b). In (a) the flow of the granules may be seen. . . . . . . . . . . . . . . . 32 4.2 Microwave simulated cavity with a radius of 60 mm, height of 170 mm, (a) Elmer simulation results and (b) analytical results. . . . . . 35 4.3 Experiment one: Free fall of paracetamol. We note that samples with more mass were sampled first. . . . . . . . . . . . . . . . . . . . . . 36 4.4 Experiment two: Free fall of multiple samples. . . . . . . . . . . . . . 37 4.5 Experiment three: Free fall of MCC of various densities occupying same space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.6 Experiment three: OLS predictions with real values. . . . . . . . . . . 39 5.1 Fluidized bed dryer device, sketch (a) and real (b). In (a) the flow of the granules, or particles as well as the coating process can be seen. . 42 5.2 Parameters for quality management of the fluid bed process (36). Here the GQP defines the end product and suffices as a final quality check sample. The list is non-exhaustive. . . . . . . . . . . . . . . . 43 5.3 Studied subsets in the thesis. Only the magnitude of the data is shown. 46 5.4 Eigenvalue solution of the fluid bed with the corresponding eigenfre- quency. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 5.5 Sensitivity analysis of the fluid bed and the VNA measurements. . . 49 xix List of Figures 5.6 Results from the fifth experiment, were FF, AF, and Tin were altered. Here an empty fluid bed is studied. . . . . . . . . . . . . . . . . . . . 50 5.7 Results of the second experiment where the AF parameter was al- tered. Here an empty fluid bed is studied. The y-axis label is shown as a legend in the plot. . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.8 Results of the second experiment where the AF parameter was al- tered. Prior to the experiment, the fluid bed was partially filled with MCC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.9 Results of the 12th experiment, where FF, AF, Tin and SP were tested. Prior to the experiment, the fluid bed was partially filled with MCC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 5.10 Two observed issues; in a) particles stuck on the antenna and in b) system collapse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.11 PCR regression (five components) results from the first experiment. Both the real and complex values are shown. Time (seconds) is on the x-axis, and flow [Nm3/h] is on the y-axis. . . . . . . . . . . . . . 56 5.12 First experiment studying FF regression results. L1 norm scaled to fit the data for comparison. For PCR and PLS five components were used. Only the real values of each prediction are shown. . . . . . . . 56 5.13 Regression results of the fourth experiment. L1 norm scaled to fit the data for comparison. For PCR and PLS five components were used. Only the real values of each prediction are shown. . . . . . . . . . . . 57 5.14 Regression results of the fourth experiment. L1 norm scaled to fit the data for comparison. For PCR and PLS 20 components were used. Only the real values of each prediction are shown. . . . . . . . . . . . 58 5.15 Regression results of the fourth experiment, but with T6 instead of Tin. L1 norm scaled to fit the data for comparison. For PCR and PLS 20 components were used. Only the real values of each prediction are shown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 5.16 Regression results of the fifth experiment. Regression was performed with Y = {FF, AF, Tin, T1-T6}. L1 norm scaled to fit the data for comparison. For PCR and PLS five components were used. Only the real values of each prediction are shown. . . . . . . . . . . . . . . . . 60 5.17 Predictions of S21 of the first experiment using the interval subset. For PCR and PLS five components were used. . . . . . . . . . . . . . 61 5.18 Predictions of S21 of the first experiment using the variance subset. For PCR and PLS five components were used. . . . . . . . . . . . . . 62 5.19 Predictions of S21 of the fourth experiment using the interval subset. For PCR and PLS five components were used. . . . . . . . . . . . . . 63 5.20 Predictions of S21 of the fifth experiment with Y = {FF, AF, Tin, T1- T6} and using the interval subset. For PCR and PLS five components were used. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5.21 Predictions of S21 of the fifth experiment with Y = {FF, AF, Tin, T1-T6} and using the variance subset. For PCR and PLS five com- ponents were used. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 xx List of Figures 6.1 GNURadio file for electroporation, with the resulting wave. The sam- ple rate was set to a low value for reassurance that the plot would not update, and the pulse length was made long for illustrative purposes. 75 6.2 Electroporation experiment setup. In a) the schema, and in b) the ’system’/ electroporation constructs. . . . . . . . . . . . . . . . . . . 76 6.3 a) Measured amplitude of S11 with two theoretical values for resonant frequencies TM311 and TM420 shown, and b) E field solutions of TM311 (left) and TM420 (right). . . . . . . . . . . . . . . . . . . . . 77 7.1 The general design of a microstrip T-resonator. . . . . . . . . . . . . 79 7.2 T resonator with overlay. . . . . . . . . . . . . . . . . . . . . . . . . 81 7.3 Realisation of one of the T-resonators. The operation frequency is at 4.8 GHz. Covering the T-resonator is a 3D-printed ’shell’ to add stability to the construction. . . . . . . . . . . . . . . . . . . . . . . 83 7.4 S21 parameter of the 2.47 GHz resonator. The measured resonant frequency was found at 2.87 GHz. . . . . . . . . . . . . . . . . . . . . 84 B.1 Equivalent circuit of a H-Loop coupled to cavity resonator. . . . . . III C.1 Cylinder cavity, skiss (a) and real (b). . . . . . . . . . . . . . . . . . VII C.2 TE modes 022, 121, 011, 212, 111, 222. Here normalised H fields are shown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IX C.3 TM 210, 220 and TE 021, 122, 012, 221, 211, 112. Here normalised H fields are shown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . X C.4 TM modes 021, 120, 122, 010, 012, 110, 221, 211. Here normalised H fields are shown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X C.5 TM modes 112, 020, 022, 121, 011, 212, 111, 222. Here normalised H fields are shown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XI D.1 The data acquiring procedure for the fluid bed project. Image created using the free online tool https://app.diagrams.net/. . . . . . . . XV F.1 Microwave simulated cavity with a radius of 60 mm, height of 170 mm, (a) Elmer simulation results and (b) analytical results. . . . . . XXIV F.2 Microwave simulated cavity with a radius of 141 mm, height of 480 mm, (a) Elmer simulation results with probe and (b) analytical results without probe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XXVI F.3 First four eigensolutions for the fluid bed dryer found by Elmer. Also the corresponding first four in Nohlert’s dissertation(5). . . . . . . . . XXVIII F.4 Additional eigensolutions. . . . . . . . . . . . . . . . . . . . . . . . . XXVIII F.5 Excitation from a H-probe (half-torus) into the fluid bed cavity. The probe can be seen in the top left of the cylinder, and is cut into one half. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XXIX xxi https://app.diagrams.net/ List of Figures xxii List of Tables 4.1 Mean (five runs) goodness of prediction / predictive power, Q2. Five components were used for PCR and PLS. . . . . . . . . . . . . . . . . 39 5.1 Conducted fluid bed dryer experiments. . . . . . . . . . . . . . . . . . 47 xxiii List of Tables xxiv 1 Introduction 1.1 Introduction Within the pharmaceutical industry, microwaves, electromagnetic waves within the 0.3-300GHz frequency range, have since long been an interesting case of study for a wide range of different applications. Records of using microwaves for process optimisation in pharmaceutical processes may be found in early development phases to late production phases (1–4). The attractiveness of microwaves typically lies in their non-ionising nature, in which the photon energy it provides to a system is inadequate to release electrons from atoms as compared to e.g. X-rays (1). The provided energy can instead result in the heating of radiated materials, which can be utilised in specific heating of, for instance, continuous flows (1; 2). While well established, emerging research utilising these characteristics of microwaves suggests that the full capabilities of microwaves may still be unexplored (5–9). The present thesis aims at exploring possibilities of using microwaves in a pharma- ceutical setting. As the application area is wide, the study was limited to a few special cases. Specifically, the thesis investigated possibilities in the development of a process analytical technology (PAT) tool for monitoring two different pharmaceu- tical processes (case I and II), construction of a microwave electroporation protocol (case III), and characterisation of pharmaceutical drugs molecular properties (case IV). The thesis was made from both a theoretical and practical standpoint. The strengths and weaknesses of previous implementations found in the literature were examined, both theoretically and practically, and improvements were suggested and implemented. Additionally, open-source software tools were considered in order to improve accessibility, flexibility, and ability to reproduce results in academic or project start-up situations when funding for commercial software may be limited. 1.2 Aim The overall aim of the report was to investigate a few cases of practical imple- mentation of microwaves in pharmaceutical processes, following a theoretical base. Limitations in current research will be discussed, and possible improvements are both suggested and attempted. Access to a vector network analyser (VNA) and two types of software-defined radios (SDR) was given and was used to excite and mea- sure microwaves of specified frequency and power. The two first cases were deemed 1 1. Introduction more practically implementable and were thus progressed further while the others were concluded early. A description of the four different cases (labeled Case I - IV) studied in this report will be provided in section 1.3. For Case I and II, the aim was to develop a process monitor tool from theory to prac- tical implementation based on the work conducted by Johan Nohlert (5) and Livia Cerullo (6). Limitations, strength and possible improvements for both cases will be discussed, as well as attempt at revising and improving previous accomplishments. As such, an aim is to provide and improve • a theoretical framework setting up the problems, • numerical simulations of the given systems, • practical implementation and acquisition of data describing the systems, and • a data analysis framework for the acquired data. The derivation of analytical regression methods for the data analysis framework will be of importance, which is partly explained in chapter 3. For case III, we will attempt at developing a microwave device for electroporation of cells, where Schmidt et al. (7) and Ahortor et al. (8) have partially been influential. In Case IV the problem of characterisation of molecular and pharmaceutical particle (e.g., drugs) properties using a so-called T-resonator is considered. The idea is to explore capabilities of resonators as complements to current tools, in characterising specific properties of molecules and particles, such as porosity. For case III and IV, the projects were con- cluded prematurely after some initial experiments and idea suggestions due to time limitations. Possible progress directions utilising the same equipment as provided in this thesis will be discussed. Another aim of the project was to exploit free open-source software and common objects typically easy to attain, to a reasonable degree. The ambition is to construct an easily reproducible project, utilising available tools independent of external limi- tations. As much previous work was accomplished by using commercialised software, we thus explore and re-implement their research using alternative free open-source software. 1.3 Studied cases in the thesis Four cases are presented and will be referred to as; Case I: Particle flow in pipe, Case II: Fluidized bed, Case III: Electroporation of cells, and finally case IV: Characterisation of chemical sample properties. A short description accompanied with the general method used is provided here and is extended in corresponding chapters (4 - 7). Case I: Particle flow in pipe The case studies microwave microscopy as a means to monitor a continuous flow 2 1. Introduction (a) Case I: Plastic pipe through the middle of a metal cylinder with two antennas connected on the left side of the walls. (b) Case II: A fluidized bed dryer with nozzle and Wurster tube (bottom), two windows (rectangles), one inlet hole (tube at the side of the wall), and two antennas connected to the upper- right wall. Figure 1.1: Illustrative CAD models of the two cases, a) Case I, and b) Case II. Both models have two antennas attached, one horizontal, and one vertical aligned. Models were created using the FreeCAD CAD program. 3 1. Introduction of particles through a pipe. The overall aim is to characterise the properties of the particles (such as density and humidity) by first determining the electrical properties (permittivity) of the particles. Thereafter, the physical properties may be calculated by relating the permittivity to the corresponding property, or by means of statistical regression analysis. To accomplish this, a so-called microwave cavity resonator was constructed and fastened around the pipe where the particles flow and studied. In figure 1.1a) an illustrative model is shown of the system. The particles pass through a pipe in the middle of a metallic cylinder (cavity resonator) and are measured by the two antennas located at the left wall of the cylinder. Case II: Fluidized bed dryer The main objective of case II is essentially the same as for case I, but the system to monitor is now a so-called fluidised bed where the particles are studied in batches over longer sequences of time. The same principles may be used for case I, in which the fluid bed is considered as the cavity resonator, and the permittivity is calculated to later determine physical properties. The essential difference between case I and II is the effect the fluid bed process parameters have on the measurements, whereas such pre-processing of the data is required before determining particle properties. In figure 1.1b) an illustrative model of the fluid bed is shown. There, particles in the fluid bed are contained inside the metallic walls and extracted by dissembling parts of the walls after conducting experiments. During experiments, heated air flows in from the bottom of the cylinder, subsequently elevating the particles while they are sprayed with a substance (e.g., water or ethanol), which effectively coats the particles while drying due to the hot air. Case III: Electroporation of cells Electroporation refers to the process of the effect an electromagnetic field has on cells. Specifically, if a sufficiently strong electromagnetic field is applied to a cellular body, a pore (or hole) is formed in the cell membrane (shell). If the electromagnetic field is too strong, the pore will be large and the cell will burst, effectively killing the cell. Commonly, this is referred to as irreversible electroporation. If instead the strength is controlled at sufficient low intensity, the cell will not burst and after treatment, it may reverse to its original state. This is referred to as reversible electroporation. In either case, electroporation occurs in milliseconds and is a rapid process. Reversible electroporation may be of special interest to cellular biologists, as it can assist diffusion and osmosis transfers (i.e., transfection) across the cell membrane. Irreversible electroporation could instead be used to kill specific areas of cells, such as tumours. Again the cavity resonator is considered for reversible electroporation in case III. Case IV: Characterisation of Particle properties using a T-resonator Particle properties, for instance, porosity, humidity, and dielectric properties are of great interest both in early pharmaceutical processes, but also in later. In early processes, knowing the properties of particles under test may assist in developing hypotheses or explaining attained results from other experiments. Later, it can be utilised as a quality analysis tool. The microwave T-resonator has been successfully 4 1. Introduction used for determining dielectric properties of materials in other industries, and could possibly be applicable for our purposes. As in cases I and II, we can then either derive a relation between the particle properties and the dielectric properties or by means of inferential statistical methodologies. 1.4 Layout of the report Due to multiple cases/projects, where some fundamental theories coincide, the lay- out of the thesis will not follow the standard protocols (e.g., introduction-theory- method-results-discussion). The thesis will be divided into several chapters, where each case will be presented in an independent chapter (chapters 4 - 6) with cor- responding applicable theory. Each such chapter will thus describe the process, the problem, previous and influential projects, methodology, results, and finally a discussion of the studied case. As several fundamental theories coincide within the projects, we dedicate one chapter of theory (chapter 2) covering common frameworks between the cases. Not all theories will be applicable for all cases though, and for clarity, the cases with respective associated applicable theories are described here: • Section 2.1 provides general information about microwaves and is applicable to all cases. • Section 2.2 provides a description of the so-called microwave cavity resonator, which is used for Case I - III. • Section 2.4 provides fundamental theories of complex signal processing and regression analysis, used in Cases I and II. Additionally, as Case I - II will be using a similar data analysis framework we will dedicate the reasoning and derivation of relevant theories to its own chapter, chapter 3. We note that this chapter should be considered as a result of the current thesis, as previous such derivations have not been provided to the author’s best knowledge. The thesis will conclude with a general discussion of the projects, and some remarks on other possibilities using microwaves in the pharmaceutical industry. 5 1. Introduction 6 2 Theory The current chapter aims to provide the fundamental theoretical frameworks which this thesis builds upon. Each later chapter which considers one of the four cases will provide additional theory corresponding to the specific case. A special important concept to memorise is the so-called microwave cavity resonator, as it will be used by three of four projects in this thesis, and could likewise be used for the last project. A good way to visualise a cavity resonator is to imagine a microwave oven, as it essentially is the same. We will divide the current chapter into essentially three parts: 1) Fundamentals of microwaves, which will provide some background on microwaves and how they are affected by materials. 2) Microwave cavities, how they principally work but also how they will be implemented in the thesis. 3) Complex signal processing and regression methodology, as it will be used in cases I, II, and IV. 2.1 Fundamentals of microwaves Microwaves, which are a type of electromagnetic wave limited to 0.3 - 300 GHz frequencies, or 1 m - 1 mm wavelength, consist of both an electric and magnetic field, as explained by Maxwell’s equations (10), ∇⃗ × E⃗ = −∂B⃗ ∂t − M⃗, ∇⃗ · D⃗ = ρ (2.1) ∇⃗ × H⃗ = ∂D⃗ ∂t + J⃗ , ∇⃗ · B⃗ = 0 (2.2) D⃗ = ϵE⃗, J⃗ = σE⃗, B⃗ = µH⃗. (2.3) Here E⃗ is the electric field (V/m), D⃗ the electric flux density (Coul/m2), H⃗ the magnetic field (A/m), B⃗ the magnetic flux density (Wb/m2), J the electrical cur- rent density (A/m2), M⃗ the magnetic current density (V/m2) and ρ the electric charge density (C/m3). ϵ and µ are the permittivity and permeability, respectively. Generally, ϵ and µ can both be considered as complex and dependent on the angular 7 2. Theory frequency ω = 2πf (f is the frequency). Typically, we assume that our vector fields (E⃗, B⃗ etc.) are time-harmonic, i.e. A⃗(x⃗, t) = A⃗(x⃗)ejωt for A⃗ = E⃗, H⃗, M⃗ , J⃗ which provides several simplifications which we discover later.(10) When an external electric field is applied to a media of polar molecules, the dipole moments of the molecules tend to align themselves in the same direction as the electric field, effectively polarising the molecules (10). In other words, the molecules rotate to align with the field, but since the field varies the molecules continue to rotate instead of going back to the original state. Therefore, microwave spectroscopy often also is referred to as rotational spectroscopy. During rotation - due to friction caused by the inertia of charged molecules - energy loss occurs and typically results in the heating of the material. (10) This phenomenon is often modelled using so-called complex permittivity, and relates to Maxwell’s equations through, ϵ = ϵ0ϵr, ϵr = ϵ′ r − jϵ′′ r , j = √ −1 (2.4) where ϵr is the relative permittivity or dielectric constant of the material and ϵ′ r, ϵ′′ r is the real and imaginary part of the relative permittivity, respectively. ϵ0 = 8.854 × 10−12F/m is the permittivity in vacuum. Here, ϵ′ r describes how polarisable a material is while ϵ′′ r describes the phase shift between the polarisation and the electromagnetic field (10). A usual representation found in literature is also the loss tangent, tan δ = ϵ′′ r ϵ′ r (2.5) and measures the power loss in the media. The permittivity is typically dependent on the frequency, and a way to extend current formulations is by the Debye relaxation equation found in (10). Similarly, a material can be described by how its ability to magnetisation is, which typically is measured with the property permeability (with µ, µ0, µr = µ′ r − jµ′′ r similar as above). In the current thesis, we assume µr = 1 and may thus be neglected. A direct effect of the permittivity and permeability of a material on microwaves is its effect on the propagating wave. The wavelength (or equal velocity), is then related to the frequency by (10), λ = v f = c √ µrϵr 1 f (2.6) where c is the speed of light. 2.1.1 Microwave resonance For case I, II, and IV the overall specific aim is to accurately and effectively determine the permittivity of samples and subsequently use it to determine other properties. 8 2. Theory As such we wish to utilise and develop methods that are sensitive to changes in the material of the samples. A common approach is to use microwave resonance in which the system is constructed to optimally operate on specific frequencies, and deviations/perturbations occur if properties in the material change. The recorded perturbation is then used to determine the permittivity of the sample under test. There are several different types of microwave resonance constructs, and in this re- port, two were chosen for further study: microstrip resonators and cavity resonators. Both have been well studied in the literature (see (10) for a general introduction and discussion) and several variations have already been developed for various purposes (8; 9; 36; 57). In the subsequent section, we provide an introduction to the cavity resonator, while the microstrip T-resonator will be introduced in chapter 7. 2.2 Microwave cavities A cavity, in the electromagnetic sense, is a closed chamber with well-conducting walls such that the microwaves are contained within the chamber. For the ideal theoretical case, the inner material of the cavity is source-free (J⃗ = M⃗ = 0⃗, σ = ρ = 0), isotropic (ϵ, µ scalars) and homogeneous (ϵ, µ constant). For the surface of the cavity, we assume well-conducting walls, and thus n̂ × E⃗ = n̂ × H⃗ = 0 and hence n̂ × ∇⃗ × H⃗ = n̂ × ∇⃗ × E⃗ = 0 were n̂ is the normal of the surface. We can then easily derive the Helmholtz version of the equations, ∇2E⃗ + w2ϵµE⃗ = 0 ∇2H⃗ + w2ϵµH⃗ = 0. (2.7) In appendix A.1 a detailed derivation can be found. With slightly more derivations, the Helmholtz equations give an interesting form of the equations, namely they provide an eigenvalue problem with eigenvalues ω and eigenvectors E⃗ and H⃗. In such cases, we aim to find eigenvectors Hm, Em, and eigenvalues wm that solve 2.7, and we note that there are almost infinitely many such solutions. Another way to describe the eigen solutions, which possibly are more common, is by denoting that the fields experience resonance. Consequently, we find both high electric energy dense areas, as well as high magnetic energy dense areas when the cavity is at resonance. Note! Henceforth, we will use the designation eigen solution(s) and resonant in- terchangeably to describe the eigenvectors (E⃗m and H⃗m) of Helmholtz equations outlined above, and thus refer to the electromagnetic fields (example in figure 2.1). Similarly, eigenfrequency(ies) and resonant frequency will be used to describe the angular frequency wm. The only contradiction of this is in chapter 3, where we will use eigen solutions to derive data analysis methods. For a given eigenvalue, wm, a cylinder cavity may look like the one shown in figure 2.1a), where the high electric density areas are shown to the left, and corresponding magnetic fields to the right. We note that if a specific area is dense in electric energy, 9 2. Theory (a) Simulated cylinder cavity E⃗ and H⃗ fields with theoretical eigenvalue wm = 2.1GHz. Here TM011 is shown. (b) Spectrum of a real cylinder with same height and radius as simulated. Upper: Full spectrum. Lower: spectrum around the resonant frequency given in fig (a) from empty cylinder (blue) and cylinder with introduced dielectric inside (orange). Figure 2.1: Example of a microwave cavity, (a) simulated fields, and (b) spectrum from a real cavity. 10 2. Theory Figure 2.2: Histogram of the first 7440 resonant frequencies of the cavity cylinder in figure 2.1. Here TM and TE modes are separated. it is not magnetic energy dense, and vice versa. This will prove to be an important fact in the construction of the antennas later. For simple shape cavities, such as cylinders and cuboids, the solutions may be derived analytically and the resonant frequency equations take on a specific form usually described by three parameters denoted by m, n, and p. The analytical solutions of a cylinder can be found in appendix C. Additionally, by inspecting Maxwell’s equations 2.1, we may note that either Hz = EZ = 0, or only one is zero, and the other must be non-zero. This leads to the so-called Transverse Electric (TE) mode (Ez = 0, Hz ̸= 0), Transverse Magnetic (TM) mode (Hz = 0, Ez ̸= 0) or the Transverse electromagnetic (TEM) modes (Hz = EZ = 0). Thus, for cylinders or cuboids, the typical way to refer to such eigensolutions is to combine the mode with m, n, and p to get TMmnp or TEmnp. While for other more complex cavities, the notion of m, n and p is non-existent, but may still obtain ’look-alike’ solutions and are referenced as either TMmnp or TEmnp modes anyway (e.g., see (5)). In 2.1 b) a measured spectrum (S11) of a cylinder with the dimensions close to the cylinder in figure 2.1 a) can be found. We note that the measured resonant frequency (lower image: "Empty") for the analytical solution in 2.1 a) was found to 11 2. Theory Figure 2.3: Perturbations of the cavity. In (a) the empty cavity is shown, in (b) the cavity with added material and in (c) changes in the cavity shape. be around 6.95 as compared to the theoretical value 6.94 GHz, corresponding to the mode TM432. In figure 2.2 the histogram of approximately the 7500 first resonant frequencies for the cylinder in figure 2.1 is shown. The plot gives detailed information about the complexity of the system for different frequency ranges and will provide theoretical and practical importance in the data analysis section. In general, we note that the density of resonant frequencies is lower for lower-frequency areas, and increases as the frequency increases, up to a certain point. For cylinders and shapes resembling cylinders, in general, the histogram will be similar only shifting in frequency e.g., where the slope starts. In a range where the density is low the resonant frequencies are well separated and easier to analyse, as compared to high-density areas where there may even exist overlapping resonant frequencies. As a direct consequence, in most published work, their research is typically limited to only include low-frequency areas where the resonant frequencies are well separated and easier to analyse, as well as to compare to physical interpretations. 2.2.1 Perturbations of resonant cavity Typically, there are two considered perturbations within a resonant cavity (10), shape and material perturbations. An illustration based on (10) is shown in figure 2.3, and the equations describing the shift in resonant frequency by these perturba- 12 2. Theory tions are, w − wm wm = ∫ V ∆ϵE⃗∗ m · E⃗s + ∆µH⃗∗ m · H⃗sdv∫ V ϵE⃗∗ 0 · E⃗s + µH⃗∗ 0 · H⃗sdv ∆ϵ,∆µ small ≈ ∫ V ∆ϵ|E⃗∗ m|2 + ∆µ|H⃗∗ m|2dv∫ V ϵ|E⃗∗ m|2 + µ|H⃗∗ m|2dv , material perturbation, w − wm wm = 1 ωm −j ∫ ∆Γ E⃗∗ m × H⃗sdγ∫ V ϵE⃗∗ m · E⃗s + µH⃗∗ m · H⃗sdv ∆V small≈ ∫ ∆V µ|H⃗∗ m|2 − ϵ|E⃗∗ m|2dv∫ V ϵ|E⃗∗ m|2 + µ|H⃗∗ m|2dv , shape perturbation. (2.8) In equation 2.8 we have assumed Γ to be the surface of the volume V , and for the shape perturbation ∆Γ the ’removed’ surface of the ’removed’ volume ∆V of V . We have made two assumptions; the homogeneity of the inner material remains after introducing a new material in the material perturbation, and second that we have added a volume to the inner part of the cavity, and not removed it. Nevertheless, they provide important insight into how the system works, where for instance the shape perturbation method could be utilised to accommodate for added screws. While not stated, an important assumption of these equations is that the resonant frequencies are well separated. Thus for the example cylinder in figure 2.1, the above equations lose the validity around > 5GHz as seen in the histogram in figure 2.2. The equations in 2.8 tells foremost one important piece of information, namely that each eigenfrequency is affected by the whole cavity fields. While this may not come as a surprise, it affects for instance positional estimations procedures greatly. Figure 2.1a) illustrates this perfectly, as it has two electric energy-dense areas and an introduction of dielectric material in any of these would result in more or less the same change in spectrum. As a direct result of this, several resonant frequencies must be used in combination to understand the process, while more resonant frequencies require more complex data analysis methods. 2.2.2 Excitation antenna and field-measurement probes We present here a truncated explanation of the coupling probe used in the thesis and provide a more in-depth explanation and reasoning in appendix D. In short, we have essentially two choices of antennas that we can use for our purposes, either a so-called E-probe or a so-called H-probe. Of course, other versions exist (11; 12), but they are either unfit for the processes or require reformulation of several theories which would be time-consuming. The E-probe is a straight antenna directly pointing into the cavity and measures changes in the electric field (thus the ’E’). The H-probe is instead bent and short-circuited into the walls of the cavity and measures changes in the magnetic field (thus the ’H’). Optimal places to put the E-probe would thus be in an electric energy-dense area, and vice versa for the H-probe. As we intend to measure the changes in electric energy-dense areas, it is undesired to put an antenna there as it may affect the process, which is especially true for the fluid bed. Similarly, in the case of the fluid bed we are restricted to putting the antennas along the side 13 2. Theory (a) TM010 found at 0.93GHz. (b) TE112 found at 0.90GHz. (c) Cad model, antennas at top right. Figure 2.4: Antenna construction in the fluid bed dryer. Left images (a and b) shows electric (left) and magnetic (right) fields for two different modes. The right image (c) is a CAD model of the fluid bed dryer. The Elmer software was used for the numerical results in the left images. walls, and as such to measure frequencies similar to the TM011 mode (see figure 2.2), the E-probe would need to be very long. Thus, the H-probe seems to be a better fit. Since the H-probe is short-circuited to the walls, we also provide the mechanism with protection towards static voltages which may occur due to triboelectric charging of granules (5). For the monitoring cases, cases I and II, we will make one last addition: two H- probes connected to the walls will be used. One will be rotated with its face normally directed horizontally, and as such it will measure TE modes, while the other will be rotated vertically and measure TM modes. This is illustrated for the fluid bed in figure 2.4, where the upper antenna measures TM modes, and the lower measures TE modes. For TM010, the upper antenna is placed in the upper-top right where the magnetic field is the strongest, rotated with its face normally vertically aligned, and the dielectric object passing through the top-middle of the fluid bed (where the electric field is the strongest) is ideally measured. Similar reasoning applies to the lower antenna, where if we wish to couple to the TE112 mode it should be placed slightly lower than the upper antenna, and may ideally measure from two regions in the middle of the fluid bed. 14 2. Theory 2.3 Vector network analyser and software-defined radios To excite microwaves, the antennas will be coupled to either a vector network anal- yser (VNA; Keysight P5005A USB VNA, 26.5 GHz) or a software-defined radio (SDR; national instruments USRP N320, 6 GHz). While an SDR may be viewed as a radio, sending information with a set frequency and amplitude (13), the VNA works a bit differently where it sweeps over a wide range of frequencies and mea- sures the response by either transmittance or reflection. The VNA is thus ideal for analysing linear electrical systems, where finding specific frequencies (such as resonance frequencies) is the objective (14). In the current thesis, a two-port VNA (ports 1 and 2) was used, and thus there is a total of four different combinations of measurement parameters; S11 and S22 which measure reflection in the system of port 1 respectively 2. S12 and S21 which measures transmittance of the ports from port 1 to port 2 (S12), and vice versa from port 2 to 1 (S21). S11, S22, S12, and S22 are commonly labelled as scattering parameters and sometimes jointly as snp values, while the 4 × 4-matrix with elements Sij is commonly referred to as the scattering matrix (14). For clarity, in all forthcoming texts, we denote a spectrum, which may include one or more scatter parameters, as a measurement of the VNA containing multiple frequencies. Typically, we will use X to represent several spectrum samples by the VNA. We note that a spectrum is a complex vector containing both amplitude and phase of the data, and processing of such should be in accordance to complex signal processing. The equations relating the scattering parameters to a cavity resonator are outlined in appendix B. 2.4 Complex signal processing and regression method- ologies In this section, relevant data analysis and statistics will be provided. In particular, complex signal theory will be covered including complex Gaussian distributions and assumptions that simplify analysis greatly, and how to deal with cases where such assumptions are invalid. For the complex signals, we will assume that the sent signals, Z, is a complex- valued vector transferred through a system of unknown characteristics, but which add complex Gaussian noise. As such it is of interest to study a complex-valued random vector sampled from a complex Gaussian distribution. We will note that complex normal vectors are in general more difficult to deal with than real-valued random vectors, mainly due to the so-called characteristic impropriety of the data. We will provide a simple test for checking the impropriety of the data, and present a transformation typically used to treat improper data, commonly called the widely linear transform. Assuming the system is linear, we will describe extensions of normal linear regression which accommodates complex-valued vectors and helps to 15 2. Theory approximate the systems. 2.4.1 Complex random vectors Formally, let Z = [Zi]i=1,2,...,n be a complex random vector of n independent complex random variables on a probability space (Ω, F , P ), such that Z : Ω → Cn, and [Real(Zi), Imag(Zi)]i=1,2,...,n is a real random vector on (Ω, F , P ). For a complex random vector, we define the complex expectation, covariance, and pseudo-covariance as µ = E[Z] = [E[Zi]]i=1,2,..,n, expectation (2.9) Γ = Cov[Z, Z] = E[(Z − µ)(Z − µ)H ] covariance (2.10) C = Cov[Z, Z∗] = E[(Z − µ)(Z − µ)T ] pseudo-covariance. (2.11) Here E[Zi] = E[Real(Zi)] + jE[Imag(Zi)], (.)∗ denotes conjugate, and (.)H = (.)∗T denotes the Hermitian transpose. An important property of Γ is that it is Hermitian, i.e., KH ZZ = KZZ , and positive semi-definite, i.e., aHΓa = 0 ∀a ∈ Cn. The pseudo- covariance C is simply symmetric, i.e., CT = C. An important concept for complex vectors is if the vector is so-called circular sym- metric or proper, as this simplifies analysis greatly. Definition 2.4.1 (Circular-Symmetric) A zero-mean (or undefined mean) com- plex random vector Z is called circular-symmetric if the distribution of Z and ejϕZ is the same for any ϕ ∈ [−π, π). By definition of covariance for ejϕZ, we have cov[ejϕZ, ejϕZ] = E[ejϕZe−jϕZZH ] = E[ZZH ] = cov[Z, Z], but for pseudo-covariance, cov[ejϕZ, e−jϕZ∗] = E[ejϕZejϕZZT ] = ej2ϕE[ZZT ] = ej2ϕcov[Z, Z∗]. Thus for Z to be circular-symmetric, C = 0. Proper- ness of a complex random vector has a similar definition, with the addition that the variance of all random variables of Z, Zi, i = 1, 2, ..., n is defined (i.e., Zi < ∞). It is easy to derive that if a complex vector is circular-symmetric or proper, it means that the real and complex values are uncorrelated (15), and their covariances are equal (due to C = 0). 2.4.2 Complex multivariate Gaussian distribution A typical case of study in signal processing is the Complex Gaussian (normal) dis- tribution. In this case we say that Z is a complex Gaussian random vector if ZRe = (ZrT , ZiT )T := (Real(Z)T , Imag(Z)T )T is a random Gaussian vector, and we write Z ∼ CN(µ, Γ, C). 16 2. Theory The pdf of a complex Gaussian distribution is f(z) = 1 πn √ det(Γ) det(P ) exp −1 2 ( (z − µ)H , (z − µ)⊺ )(Γ C C Γ )−1( z − µ z − µ ) (2.12) where P = Γ − CHΓ−1C. The important property of the Complex Gaussian dis- tribution is that it is completely described by its expected value, covariance, and pseudo-covariance. Here it will be evident why a circular-symmetric complex vector is an interesting case of study in which Z ∼ CN(0, Γ, 0). Z can thus be completely described by the covariance matrix and helps analysis as only the covariance matrix needs to be studied. In the slightly more general form, when Z ∼ CN(0, Γ, C), the covariance of the so-called augmented form of z, Z = [ZT , ZH ]T , called the augmented covariance matrix, E[Z ZH ], instead completely explains the data (16). Writing the augmented covariance matrix out, we get Γ = E[Z ZH ] = E [ Z Z∗ ] [ZH , ZT ] = [ E[ZZH ] E[Z∗ZH ] E[ZZT ] E[Z∗ZT ] ] = [ E[ZZH ] E[ZZT ]∗ E[ZZT ] E[ZZH ]∗ ] = [ Γ C∗ C Γ∗ ] ∈ C2N×2N which proves that the augmented covariance matrix contains the complete informa- tion of the system. Similarly, we have the real-valued covariance ΓRe = E[ZReZ T Re] = 1 2 [ Real(Γ + C) Imag(Γ + C) Imag(−Γ + C) Real(Γ − C) ] = 1 2 ([ Real(Γ) Imag(Γ) −Imag(Γ) Real(Γ) ] + [ Real(C) Imag(C) Imag(C) −Real(C) ]) ∈ R2N×2N . and thus also contain all information to describe Z. The advantage of using the real composite covariance matrix, ΓRe, instead of the augmented covariance matrix E[ZReZ T Re], is that arithmetic operations are faster using real numbers as compared to complex. 2.4.3 Statistical tests for impropriety Many different statistical tests have been derived to check for impropriety or if the circular-symmetric assumptions hold (17; 18) of a signal X. Essentially, most boil down to the simple observation that the proper signals maximise the entropy of the 17 2. Theory signal: Himproper = 1 2 log[(πe)2ndet(Γ)] = log[(πe)2ndet(Γ)]︸ ︷︷ ︸ Hproper −I(X; X∗) (2.13) where Himproper is the entropy and I(X; X∗) ≥ 0 is the mutual information between X and X∗. Here we can estimate I(X; X∗) without loss of information by (17) I(X; X∗) = 1 2 log(1 + ρ1), ρ1 = 1 − det Γ det2 Γ . (2.14) It is evident that Himporper is maximised when ρ1 is zero. 2.4.4 Complex signal processing and system estimation by regression Informally, we assume a signal X is sent over a system f and retrieved as the response Y where noise in the system may occur. Formally, assume we have an independent variable X ∈ Ω ⊂ Cn and a dependent variable Y ∈ ΩY ⊂ Cm, such that X and Y are known, and that the map f : Ω → ΩY : Y = f(X ; θ) + ε (2.15) is unknown. Similarly ϵ here represents a random noise such that ε ∼ CN(0, Γθ, Cθ) for some Γθ, Cθ. θ is a set of scalar parameters generally unknown and to be esti- mated for a given assumed map f . The problem is then to find the true f and β such that equation 2.15 holds. Of course, finding the true solution is nearly impos- sible, and different methodologies to estimate f have been developed, typically by assuming a certain form of f . As such, if we note the assumed form of f by f̂ , we estimate θ with θ̂ by regressing X to Y : Y = f̂(X ; θ̂). 2.4.4.1 Linear systems Let us first present the real case, and in the next section extend the theory to the complex space. Thus, we assume a linear relationship between the now real vectors X and Y , and the aim is to estimate1 β with β̂: min||Y − Ŷ ||22, Ŷ = Xβ̂, and (2.16) Y = Xβ + ε with X and Y known. Linear regression models, such as ordinary least squares (OLS), principal component regression (PCR), or partial least squares (PLS) regression in these cases are then 1The equations used are of the least-square notation, but others also exist. For instance see (17). 18 2. Theory often subject to study, as the underlying process is mathematically fully understood. In each of the mentioned methods, the covariance or cross-covariance matrix is fundamentally what is studied. In chapter 3 implementation of these is discussed for complex signals. Extension from linear to non-linear versions, i.e. by using kernels, as well as iterative versions will be discussed in appendix E. An iterative extension may be needed if either the data is sampled continuously, or if the size is too large to handle at once. 2.4.4.2 Extension into the complex space As we noted before, the covariance of an improper signal does not explain the data completely, and this fact is what essentially separates the versions below. Let us begin with the simpler case; let us assume the error, ε in 2.15 to be circular- symmetric complex normally distributed such that ε ∼ CN(0, Γ, 0). This case is almost analogous to the real space regression analysis, except when using transpose, (.)T , the Hermitian transpose, (.)H , should be used instead. Thus, rewriting exist- ing regression methods to a corresponding circular-symmetric version is typically straightforward. As mentioned previously, in the improper case where ε ∼ CN(0, Γ, C), C ̸= 0, we need to extend the analysis methodology to accommodate the pseudo-covariance. In this case, we utilise the results from section 2.4.2, and note that both the augmented contain Γ and C. Using the augmented form of X = [XT , XH ]T , we extend equation 2.16 as, Y = Xβ0 + X∗β1 + ε <=> Y = X β + ε (2.17) and attempts at approximating both β0 and β1. The common name of this extension is the widely linear transform, as it tries to solve the linear problem both in X and X∗. The lower equation in 2.17 is the augmented form of the widely linear transform, and we should quickly note here that β ̸= [β0, β1] which is a common mistake, but rather β = [ β0 β∗ 1 β1 β∗ 0 ] . The lower part of β may seem redundant, as it essentially is only the conjugate of the upper part, but for instance, gives a square form of β if β is square itself, which can provide simplifications in various analysis steps. Another important matrix in widely linear transformations is the so-called linear transformation matrix, or real- to-complex matrix which can be used to transform the augmented vector to the real composite vector. If we let Im be the m × m identity matrix were m is the number of variables in X, the linear transformation matrix of X is then Tm = [ Im Im −jIm jIm ] 19 2. Theory and with Xre = [Real(X)T , Imag(X)T ]T , it can be used as 2XT Re = XT Tm (2.18) XT = XT ReT H m . (2.19) The next chapter will derive both circular-symmetric and widely linear versions of the regression methods OLS, PCR, and PLS applying the above-mentioned tech- niques. 20 3 Data analysis for cases I, II, and IV We will dedicate this chapter to explaining the data analysis developed and used for cases I, II, and IV which relates perturbations to properties. For case III such analysis is not explicitly required. 3.1 Construction of the problem In Cases I, II, and IV we wish to utilise perturbations in microwave resonant devices to accurately determine the dielectric properties of materials under test (MUT). As such, a simple way to view each recorded spectrum (scatter parameter), Snp, is as the spectrum recorded in its initial state without any material present, S0 np, added to the perturbations, dSP erturbation np . Depending on the construction used, we may later extend the theory and analysis of dSP erturbation np to determine the effect the MUT(s) have on the measurements and subsequently the present dielectric property. Common between the analysis methods is that several resonant frequencies will be observed in conjunction. Case I: Assuming there is no external disturbances, the only difference is a result of the change of dielectric materials flowing through the pipe. As such, we may view the measured spectrum as Snp = S0 np + dSMUT (s) np + ε (3.1) where ε ∼ CN(0, Γ, C) is complex-valued Gaussian noise and dSMUT (s) np = dSP erturbations np . The changes by the material(s) under test, dSMUT (s) np , alter depending on the po- sition of MUT(s) and different material properties such as humidity, porosity, and the substance molecular structure. Due to positional relevance, fast sampling of the spectrum is desired (5). During sampling, we may not know where a MUT is located; if it is at the top of the cylinder cavity, in the middle, or at the bottom; we may neither determine geometrical transformation or the quantity of MUT(s). Thus, previous attempts adopting the Maxwell-Garnett mixing model to estimate permittivity may fall short as the sampling process would retrieve inconsistent sam- ples for same-valued MUT(s). The proposed method of the thesis is instead to 21 3. Data analysis for cases I, II, and IV use inferential statistics such as regression and correlation of a number of experi- ments of known properties. In section 3.2 a relation between permittivity - where Maxwell-Garnett formula may be adopted - and desired substance properties is pro- vided while in section 3.3 derivation of complex-valued linear regression methods is instead offered. Finally, a way to simplify the above analysis is based on assuming sufficient separa- tion between the resonant frequencies, in which we may write the scatter parameters as a series of poles (5) Snp(w) = ∑ m αm w − wm . In the close proximity of one of the poles, the equation simplifies to only one part of the sum in which it is possible to rewrite and simplify the expression as a Möbius Transform. This may assist analysis as we can apply common transformations to simplify the complex-valued analysis (5). Case II: In case II, airflow, temperature, etc. effects measurements in a non-trivial way, thus the addition of an environmental variable is required; Snp = S0 np + dSEnvironment np + dSMUT (s) np + ε. (3.2) While dSEnvironment np could be used to certify correct mechanical configurations, it is inherently undesired. We thus seek to either mitigate or estimate the environmental effect such that we are left with a similar problem as in case I. Mitigation can only be accomplished by physical changes to the antenna and system, and may only partially mitigate dSEnvironment np . Instead, we seek ways to properly estimate it. Again, we accomplish this by considering inferential statistics by first removing MUT(s) (i.e. dSMUT (s) np = 0) and studying the system parameters separately, to later use the known parameters to estimate the dSEnvironment np . As such, let S ′ np = Snp| dS MUT (s) np =0 while Θ and Θ′ = Θ| dS MUT (s) np =0 be known specified mechanical parameters (such as temperature or airflow). In essence, the following simple steps enable subsequent steps to be of the same characteristics as for case I. 1. measuring dS0 np, dS ′ np separately, 2. estimate B : BΘ′ = S ′ np, and 3. estimating dSEnvironment np = BΘ − S0 np. Here, we use the developed regression methods in section 3.3 as a means to estimate B. Case IV: In case IV we will only consider one substance, and as opposed to case I and II the resonant frequencies are simply manifolds of the natural frequency. Thus it may serve as a means to calculate mean changes in the frequency shifts. Yet again 22 3. Data analysis for cases I, II, and IV MUT properties may either be determined using the methods of section 3.2 or by statistical inference. 3.2 Physical interpretation of dSMUT (s) np If Snp and dSMUT (s) np can be successfully separated from dXE, the next step is to derive a physical interpretation of the acquired data. Ultimately, we will consider two different cases; full continuous flow (continuous arrival of samples) and partial impulse flow (stochastic arrival of samples) which may be used depending on the situation. The first mentioned is useful if the sample occupies the whole sample holder, and the cavity is a cylinder. Thus, depending on how an experiment is performed it may be useful for case I. The second solutions are more general and can be used for both case I and II. 3.2.1 Full continuous flow Dielectric properties inside the pipe can be calculated for the fundamental frequency mode, TM010, by (19) ϵ′ = 1 + 0.539Vcyl(f0 − fsample) Vsamplef0 ϵ′′ = 0.269Vcyl Vs ( 1 Qsample − 1 Q0 ). Here Vcyl is the resonant cavity’s volume, Vsample the volume of the sample (+ holder, in this case, the pipe), f0 is TM010 resonant frequency, fsample the measured resonant frequency after the sample is introduced. This formula is valid when the sample volume is relatively small to the cavity volume, and the sample material is approximately homogeneous. Thus, using a small pipe and considering a full-flow scenario where the material in the pipe should be consistent, this model could e.g., possibly detect undesired samples inside the pipe. 3.2.2 Stochastic flow Here we propose a similar, but slightly extended methodology as the one provided by Nohlert (5) and Lvivia (6), in which the Maxwell-Garnett mixing formula combined with the Debye formula was used for different regions within the cavity. For each eigenfrequency wm, equation 2.8 (material perturbation) may be approximated by (6) w − wm wm ≈ ∫ V ∆ϵ|E⃗∗ m|2dv∫ V 2ϵ′|E⃗∗ m|2dv . (3.3) An additional, but often quite wrong, assumption would be a homogeneous material over the cavity, and as such, w − wm wm ≈ ∆ϵ 2ϵ . (3.4) 23 3. Data analysis for cases I, II, and IV While wrong, it provides an easy way to analyse the data in relation to the physics. Instead, a good approximation of the integrals can be accomplished by proper mod- elling and numerical results of the system. Another possible way to accommodate for the last approximation could be to regress values of w and wm to ϵ for some known values of ϵ and measured values of w and wm. We note here that by the Maxwell-Wagner effect, we can approximate ϵ by the effective permittivity, in which the Maxwell-Garnett mixing formula or Debye’s formula can be used, similar to what Nohlert (5) and Lvivia (6) accomplished. Both these versions may adapt extensions or be reformulated to better relate to the sought physical properties. For instance, in (20) equations of resonant cavity dielectric measurements were extended to accommodate for both impurities and porosity. E.g. for the fractional porosity, P , we have, ϵ′ r = ϵ′ eff ( 1 − 3P (ϵ′ eff − 1) 2ϵ′ eff + 1 − P + Pϵ′ eff ) (3.5) tanδ = (1 − P )tanδ0 + AP ( P 1 − P )2/3 (3.6) where tanδ is as eq. 2.5, and δ0 and A are fitted towards relevant data. Several more of these derivations may be found in the literature for other characteristics, such as humidity (21), but as a first step only an implementation of porosity was attempted. 3.3 Derivation of complex linear regression mod- els In this section, we will provide details on the OLS, PCR, and PLS regression methods used later in the report. Thus, we attempt at solving the linear systems, Y = XB circular-symmetric (3.7) Y = XB1 + X∗B2 widely linear (3.8) were Y ∈ CN×p and X ∈ CN×m are assumed complex. For each case the real, circular-symmetric, and widely linear versions are provided. In the derivations sin- gular value decomposition (SVD) or eigenvalue decomposition (EVD) of the covari- ance matrix will be used and may be reviewed in e.g. (17). Several articles have suggested widely linear re-formulations of standard data pro- cessing methods, for either theoretical or practical use. In the current thesis, we especially recognize (17; 22; 23), where (22) especially developed kernel-based sta- tistical complex component analysis methods, such as Linear Discriminant Analy- sis (LDA), Canonical Correlation Analysis (CCA), Locality Preserving Projections (LPP) and Principal Component Analysis (PCA) in its corresponding widely linear 24 3. Data analysis for cases I, II, and IV re-formulation. In the current thesis, we are more interested in regression-based al- gorithms, but the algorithms can be reused to derive results and formulate them to their corresponding regression version. In article (23), widely linear complex partial least squares (WL-CPLS) regression was derived, which can be directly used. The article though contains several mistakes in the widely linear formulation, and some parts need to be re-derived. The book Statistical Signal Processing of Complex- Valued data by Peter J.S. and Louis L.S (17) contains plenty of proper, well derived statistical analysis which can be utilised in practical applications or as building blocks of new algorithms. In the current case, Ordinary Least Squares (OLS), Prin- cipal Component Regression (PCR), and Partial Least Squares (PLS) will be derived and evaluated for the current problem. To measure the quality of predictions, we will use the Goodness of Prediction metric Predictive power, or Q2, defined by Q2 = 1 − ∑ |xreal − xpred|∑ |xpred − xpred| . (3.9) 3.3.1 Ordinary least square (OLS) Solving 3.7 using OLS in the real case, we simply multiply each side with XT and the inverse of the covariance matrix, (XT X)−1, to get the approximation, B = (XT X)−1XT Y. (3.10) Essentially, it is the cross-covariance between X and Y , times the inverse of the covariance of X. 3.3.1.1 Circular-Symmetric OLS The circular-symmetric version is analogous to the real version, where the only difference lies in the cross-covariance and the covariance which uses the Hermitian transpose instead of the normal transpose. We get the approximation, B = (XHX)−1XHY. (3.11) 3.3.1.2 Widely Linear OLS We note that, Y = XB1 + X∗B2 = [X, X∗] [ B1 B2 ] = X [ B1 B2 ] and thus Y = X [ B1 B2 B∗ 1 B∗ 2 ] = XB. We regress as before and retrieve the approximation, B = (XHX)−1XY , (3.12) and extract B1 and B2 from the matrix above. 25 3. Data analysis for cases I, II, and IV 3.3.2 Principal component analysis regression (PCR) We will use either the SVD or EVD versions of the PCA for the PCR derivation. The idea of PCR is to project X into a subspace of the original data that still explains most of the variance of the data, before regressing it to Y . We use SVD to decompose X as, X = UΣV T and let T = UΣ to get X = TV T . Here Σ is a diagonal matrix with descending values, thus the first columns describe the variance more so than the latter. By truncating T and V by only keeping a subset of the first columns we essentially project the original data to a lower subspace, and get Xtruncated = TtruncatedV T truncated. Let X̃ = Xtruncated and we get B from the OLS approximation from eq. 3.10, B = (X̃T X̃)−1X̃T Y. (3.13) 3.3.2.1 Circular-Symmetric PCR The circular-symmetric version yet again only deviates from the real case by the substitution of Hermitian transpose instead of the normal transpose. By definition of the SVD, we have X = UΣV H and by truncating as we did in the real case, we use the OLS approximation from eq. 3.11, B = (X̃HX̃)−1X̃HY. (3.14) 3.3.2.2 Widely Linear PCR We first note that from the SVD above, we get in the augmented form, X = [X, X∗] = [UΣV H , U∗Σ∗V T ] = [UΣ, (UΣ)∗] [ V H 0 0 V T ] = [T, T ∗] [ V H 0 0 V T ] = T [ V 0 0 V ∗ ]H . Due to the non-uniqueness of the SVD, this is not necessarily equal to what the SVD applied directly to the augmented vector will provide. Thus, we reformulate from the SVD to the EVD, first noting that the augmented covariance matrix can be written as, Γ = XHX = (XReT H m )HXReT H m = TmXT ReXReT H m = TmΓReT H m (3.15) 26 3. Data analysis for cases I, II, and IV where Tm is defined as in eq. 2.18. Following the standard eigenvalue decomposition procedure, we minimize the Rayleigh quotient (eq. E.1 in complex form) to find the eigenvectors VRe. Thus, we wish to find the critical points of V T ReΓReVRe subject to the constraint V T ReVRe = I. We retrieve V from VRe using eq. 3.15 in the the EVD (i.e. V = 1 2TmVReT H m ), noting that V is of the form V = [ V1 V2 V ∗ 2 V ∗ 1 ] (3.16) and project into the latent space by the widely linear transform, T = XV1 + X∗V2, and truncate both T, V1 and V2 and get T̃ , Ṽ1 and Ṽ2. We note that V1 and V2 are orthogonal matrices, to both themselves and each other, enforcing the composite augmented matrix V also to be orthogonal. With Ṽ H = Ṽ −1, we thus get X̃ = T̃ Ṽ H (3.17) in which we perform the widely linear OLS approximation eq. 3.12 with X̃ to retrieve B1 and B2. 3.3.3 Partial least squares (PLS) regression The principle of PLS regression is almost the same as for PCR, although both X and Y is decomposed jointly. Following the same reasoning which leads to the kernel eigenvalue problem in eq. E.3, we use the EVD to find eigenvectors, T , which is the critical points of T T XXT Y Y T T subject to T T T = I. The eigenvectors, T , is a descriptor for both X and Y , and we can approximate the loading matrices P and C for X respectively Y using, P = XT T C = Y T T. Both T, P and C is then truncated as with T and V before, to finally get T̃ , P̃ and C̃ and the approximations, X̃ = T̃ P̃ T (3.18) Ỹ = T̃ C̃T (3.19) (3.20) and we use the OLS approximation of eq. 3.10 with X̃ and Ỹ to retrieve B. 3.3.3.1 Circular-Symmetric PLS As before, the only change in the circular-symmetric PLS version is that the Her- mitian transpose is used instead of the normal transpose. This holds true for the EVD as well. 27 3. Data analysis for cases I, II, and IV 3.3.3.2 Widely Linear PLS The widely linear PLS version is a bit more complex than previous derivations. In (23), an attempt to derive the widely linear transform of the Nipals PLS algorithm was attempted. Unfortunately, the authors provide several mistakes regarding the augmented forms, both in the EVD but also in the loading projection steps. Never- theless, the majority of the report is rigorously derived and provides a good reference. Additionally, if we wish to rewrite into the kernel version eq. E.3 (not accomplished in (23)), we wish to use the XXH and Y Y H form. We derive, XXH = XReT H m (XReT H m )H = XReT H m TmXT Re = XReX T Re (3.21) with similar results for Y . Essentially this means that the latent matrix T has the property T = TRe. While the result is not surprising (since XXH ∈ RN×N per definition), it is worrisome since we essentially lose the imaginary part. Several implementations of widely linear PLS have been attempted, although we only provide the description of one here, and refer to appendix E for the others. While the other implementations offer a simple truncation of the matrices to perform the dimension reduction, the one proposed here uses an iterative method. The reason for this change lies in numerical stability. Additionally, we will not provide a kernel- based version and instead of using the EVD, we will use the SVD again. Using the SVD, we extract the eigenvectors for X and Y by decomposing the cross- covariance matrix XHY = W Σ CH , (3.22) and only keep the eigenvectors, w, c, corresponding to the highest eigenvalues, i.e., the first columns of W and C. Following the next step as described in (17), we extract the inner representations (latent vectors) using, t = X w, t = [t, t∗] u = Y c, u = [u, u∗]. The loading matrices, p and q, are then calculated by the widely linear OLS approx- imation eq. 3.12, p = ((tH t)−1tH X)H , q = ((uH u)−1uH Y )H , and the matrices X and Y are projected (or so-called deflated) into the new space by X = X − t p, Y = Y − u q. Each vector w, c, t, u, p, and q is stored as columns as matrices W, C, T, U, P , respec- tively Q and the process is repeated from eq. 3.22 using the deflated matrices for the desired number of components. 28 3. Data analysis for cases I, II, and IV 3.3.4 Kernel extensions The kernel-based version can quite easily be implemented for OLS, PCR, and the circular symmetric PLS simply by changing the XHX → KXX (for OLS, PCR, and PLS), and Y HY → KY Y (only for PLS). 29 3. Data analysis for cases I, II, and IV 30 4 Case I: Particle flow in pipe The current chapter will provide an attempt at developing a fluid bed process mon- itor. The fundamentals of the project were first presented in the dissertations of Johan Nohlerts (5), and the aim is to examine and continue his work. In the subsequent section, a brief introduction will be provided, followed by the specific aim of the project. In section 4.3 the analysis methods are discussed and related to the developed data analysis algorithms derived in chapter 3. Relevant parameters of the study are discussed, and the conducted experiments are presented. We finally present the results and conclude the chapter with a section containing a discussion of results and future work. 4.1 Introduction Continuous flow chemistry in the pharmaceutical industry, where the aim is to pro- duce desired chemicals continuously in tubes rather than in batches, has gained recent attraction (24). Possible benefits of continuous flow instead of e.g. the tradi- tional batch stirred solutions, range from a more environmentally friendly production to product quality enhancements (24; 25). Typically, the process occurs in narrow channels where lower volumes can be used and better control of temperatures and other parameters can be obtained. Hence, improved control of selectivity, ratio, and mixing of chemicals can be used with carefully selected environmental parameters to enhance desired yield in chemical reactions (24; 25). In contrast, clogging in the channels may occur under certain circumstances, and is undesired as it will prevent or halt the flow within the channel. (24; 25) Thus, monitoring of the flow to deter- mine the state - chemicals component ratios, humidity level, porosity, mass, volume, etc. - is desired to optimize compositions and chemical reactions as well as to detect anomalies early. Prior work on flow monitoring using microwaves is exhaustive, and several working principles exist that can be implemented. Most versions can be truncated to mi- crowave imaging using microwave tomography (26; 27), where several antennas are placed in a circle, or an E-probe which is inserted into the flow (28). Both methods offer quality analysis possibilities, but the tomography version is hard to implement and requires multiple transceivers and receivers to cooperate to function properly 31 4. Case I: Particle flow in pipe (e.g. 12 antennas were used in (26)), and the E-probe only provides near-field infor- mation limited to one spot. Another method using cavity resonators only requiring one or two antennas was studied in (5), where a metallic cylinder was attached over a plastic pipe and two H-probes were attached to the inner walls of the cylinder. Using the resonant modes of the cylinder combined with hypothesis testing, they provided a method to detect anomalies in the system based on sampled spectrum. 4.2 Particle flow set-up and aim In figure 4.1 the system used for simulating particles/granules flowing through a pipe is shown. As such, a plastic pipe is fastened in the middle of a metallic cylinder (used as the resonator), where the particles flow. (a) Fluid bed dryer concept sketch. (b) The simulated particle flow set-up used for the experiment. CAD model. Figure 4.1: Simulated system of particle flow, sketch (a) and cad model (b). In (a) the flow of the granules may be seen. 32 4. Case I: Particle flow in pipe The aim of the project is to review the possibilities of using the cavity resonator to monitor the flow in a plastic pipe. Instead of the hypothesis formulation used in (5), we will analyse the data using the regression methods derived in chapter 3, but also attempting to incorporate the physical interpretation models. We thus aim to investigate if different levels of density/porosity, humidity, and substances can be differentiated by the cavity resonator. 4.3 Method and design The flow process was analysed using a VNA collecting samples from a frequency range of 1 - 5 GHz, where the antennas are found at the top right and middle left of the cavity walls. The number of frequencies collected was set to 500, and each spectrum will be represented at each time-point, t, using the L1 norm between a reference spectrum and the current retrieved spectrum: L1(t) = ||x⃗(t) − x⃗ref ||1 = ∑ n |x(n; t) − xref (n)|. The L1 norm was chosen as it reflects changes within the system. While other norms, such as the L2 norm, would possibly follow more standard practices, the noise of the VNA may at resonant frequencies be larger than one, and thus the plot would be considerably fluctuating. The reference spectrum was retrieved from an empty cavity and as such for noiseless systems simply reduces to the sum of changes by the particles, L1(t) = ∑ n |dS21MUT (s)|. For simplicity, efficiency, and overall better representation the scatter parameter S21 was chosen. Values representing the samples, Y , for regression were manually added. We note that this formulation may be insufficient for various problems, for instance in a con- tinuous flow of substances where above y may be ill-defined. Thus, an improvement using the physical interpretations models in chapter 3 could be made. As such the Y matrix is loaded with values derived from the physics-related equations. 4.3.1 Experiments and data Essentially, three experiments were conducted. The aim of the experiments was to determine the sensitivity of the monitor from various characterisation parameters of the samples falling through the pipe. Specifically, the size (experiment one), dielectric constant/change of material (experiment two), and porosity/density (ex- periment three) were examined. Before any experiment with pharmaceuticals in the form of tablets (paracetamol, MCC) was conducted, the tablets were exposed to room temperature and moisture for an hour. In the first experiment, a tablet of paracetamol (500 mg) was dropped through the pipe 10-11 times while the monitor retrieved the spectra and then was cut in half before the experiment was repeated. The experiment was repeated twice. In the second experiment, 0.5 ml sample holders were filled with one of several dif- ferent materials (paracetamol, MCC, ethanol 95%, water (tap), water (distilled)), and as in experiment one dropped through the pipe multiple times. First, an empty 33 4. Case I: Particle flow in pipe sample holder for comparison was dropped through the pipe for comparison. Lastly, in experiment three, four 0.5 ml sample holders were filled with MCC powder. To increase the density, the sample in three holders where subjected to increasing pressure as more sample content was added. The weights of the samples in the holders were recorded to be 240, 260, 300, resp. 320 µg and the holders were then dropped as in experiments one and two repeated five times. 4.4 Results We first provide a short section of numerical results, followed by a section containing an analysis of the process where the aim was to examine the process using the L1 norm. Subsequently, we perform the data analysis described in chapter 3 and attempt at estimating Y given the retrieved spectrum. 4.4.1 Numerical results Due to the then-current difficulties of meshing and receiving coincident nodes, the model was simplified to a cylinder where both solutions using Elmer and analytical solutions could be derived, and an example is provided in figure 4.2. Other numerical results using an antenna are presented in the chapter (in appendix) F, with full explanation and code. 4.4.2 Analysis of acquired data From figure 4.3 we note that using the simple L1 norm as a separator a clear change between 500 mg compared to 250 and 125 mg of paracetamol can be seen. The magnitude seems to have a higher difference in mean, but instead, the variance of the experiments seems to increase for larger particles. This presumably indicates that the unevenness of the sample passing through the pipe matters, as the smaller samples were much more uniform in shape. The error bars show a clear difference in amplitude, especially so for the magnitude, but also for the phase. Similarly, in figure 4.4 we note that materials can be differentiated using the L1 norm. Especially, we note that tap water and distilled water have different means with distilled water being slightly higher. This is to be expected since water molecules have a higher dielectric constant than impurities in the water. Lower dielectric samples, such as paracetamol and MCC, could also to some degree be differentiated. Lastly, an increase in the L1 norm for higher porosity samples was noted, where the results are shown in figure 4.5. Unfortunately, the variance between the experiments is high, resulting in overlapping intensities increases and difficulties in separating the obtained results using the simple L1 norm. This though makes it an interesting case to analyse using regression. 34 4. Case I: Particle flow in pipe (a) Eigensolution with eigenfrequency 2.1GHz. (b) Analytically derived fields for the TM011 mode. Figure 4.2: Microwave simulated cavity with a radius of 60 mm, height of 170 mm, (a) Elmer simulation results and (b) analytical results. 4.4.3 Regression analysis of the acquired data The dependent variable, Y , was set to the weights of the samples for experiments one and three, and the L1 norm for experiment two. For experiment three, an effort was put into turning the stochastic flow method mentioned in section 4.3 using the simplified approach (assuming homogeneous material distribution), to derive porosity values from several resonant frequencies which then could be used for the dependent variable Y . The attempt failed and provided extremely off-values for the porosity (values of magnitude ∼ 106) and as such results are omitted. Reasons for this could be plenty, where simple mistakes such as bugs in codes or more complex 35 4. Case I: Particle flow in pipe (a) Free falling paracetamol of in total four sizes (approximately weights: 125, 250, and 500 mg). The experiment for each weight was repeated 10-11 times. (b) Error bars of L1 norm for each sample (peaks in previous plots). Max, min, and average (dot) shown. Figure 4.3: Experiment one: Free fall of paracetamol. We note that samples with more mass were sampled first. 36 4. Case I: Particle flow in pipe (a) Free falling sample holder (0.5 ml) with different samples (empty, paracetamol, MCC, ethanol 95 %, water, water distilled). The experiment for each sample was repeated 10 times. (b) Error bars of L1 norm for each sample (peaks in previous plots). Max, min, and average (dot) shown. Figure 4.4: Experiment two: Free fall of multiple samples. issues such as invalid approximations could be at fault. 37 4. Case I: Particle flow in pipe (a) Free falling sample holder (0.5 ml) completely filled with MCC of different densities (weights: 0.24, 0.26, 0.30, 0.32 gram). The experiment for each sample was repeated five times. (b) Error bars of L1 norm for each sample (peaks in previous plots). Max, min, and average (dot) shown. Figure 4.5: Experiment three: Free fall of MCC of various densities occupying same space. 38 4. Case I: Particle flow in pipe Figure 4.6: Experiment three: OLS predictions with real values. Exp. 1 Exp. 2 Exp. 3 CS OLS 0.93 0.93 0.94 CS PCR 0.87 0.89 0.88 CS PLS 0.93 0.93 0.91 WL OLS 0.96 0.97 0.98 WL PCR 0.89 0.90 0.87 WL PLS 0.90 0.90 0.87 Table 4.1: Mean (five runs) goodness of prediction / predictive power, Q2. Five components were used for PCR and PLS. Prediction results of the three experiments is shown in table 4.1. We note that the OLS prediction typically provides the highest predictive power of the three and that the widely linear approximation more often decreased the predictive power. Still, the highest predictive score was attained with the widely linear OLS model. Only one prediction using the derived regression methodologies (chapter 3) is presented with figures, as most showed similar results and as such do not provide any interesting discussion point. The result is shown in figure 4.6. Typically, it seems that the prediction of non-zero dependent values is often over-estimated, which is a typical problem for all models. A quick analysis shows that the predictive power for only Y > 0 is below 0.5, indicating that most correct predictions are of Y = 0. A possible remedy is to make the dataset more balanced by removing the spectrum representing an empty cavity. By doing so an increase in predictive power for all was around 2 %. 39 4. Case I: Particle flow in pipe 4.5 Discussion From the results of section 4.4.2, we note several parameters can be differentiated and characterised by the falling samples. Depending on the flow, the device should though quite easily notice clogging or high changes in density, mass, and moisture levels. For more specific information, both more experiments as well as more so- phisticated models should be adapted as the current regression results have high uncertainty in the case of the desired values. A possible way to improve predictions could be to adapt the physics-related methods presented in section 4.3, but as noted the simplified approach of the stochastic version failed. As such, one way to accommodate for the electric field inside the cavity is to add numerical results into the equation and assume the position of the sample using the first high rise of the L1 norm and subsequently estimate the position with the gravitational constant, or by putting lasers at the top and bottom and interpolating. A slight attempt to realise this using the results attained from Elmer was initialised, but as it required too much effort timewise the attempt was concluded. Specifically, the models used in the Elmer simulations were heavily simplified due to the lack of understanding of the specific operations of the software. 4.6 Conclusion An attempt at monitoring pharmaceuticals flowing through a pipe was conducted, and improvements in some areas as compared to previous works have been accom- plished. What the current thesis though fails at was the incorporation of physical interpretation models into the analysis. Improvements to current results in the the- sis have been proposed, and we note that what the project needs most of realistic, high quantity of experiments. 40 5 Case II: Fluidized bed dryer monitor The current chapter aims at developing a fluid bed process monitor. The funda- mentals of the project were first presented in the dissertations of Johan Nohlerts (5) and Lvivia Cerullo (6), and the aim is to examine and continue their work. In the subsequent section, a brief introduction will be provided, followed by a de- scription of the fluid bed process as a whole and the previous attempt at global monitoring by Nohlert and Lvivia. In section 5.2 the analysis methods are discussed and related to the developed data analysis algorithms derived in chapter 3. Relevant parameters of the study are discussed, and the conducted experiments are presented. We finally present the results and conclude the chapter with a section containing a discussion of the results and future work. 5.1 Introduction Coating of pharmaceuticals using a fluid bed dryer is the process of encapsulating granules with a material to enhance the quality attributes of the finishing product. Qualities could be such as stability of an active pharmaceutical ingredient (29), granule hardness, dissolution behaviours, morphology, and mass uniformity of the coating (30; 31). High variability of coating material may lead to poor product quality and deviations in anticipated results during subsequent processing steps (31). As such, monitoring of the coating process may be seen as an important activity to ensure quality of the coated granules. While monitoring could be accomplished by extracting granules during the coating process (off-line monitoring), more desirable would be in-line, real-time monitoring during the process run. For instance, if the monitoring indicates abnormal process conditions, the process can be stopped while the issues are resolved, then the process could be continued. Several attempts have been made to construct in-line, real-time monitoring devices for fluidized beds utilising microwave spectroscopy, including local monitoring using a novel ring-resonator (29; 31–33), local monitoring using tomographic sensors (34), but also global monitoring using magnetic field probes as sensors and the fluid bed dryer as cavity (5; 6). While the solutions provide different advantages and 41 5. Case II: Fluidized bed dryer monitor disadvantages, global monitoring seems especially promising due to the possibility of extracting information from any part of the fluid bed, while only providing minimally invasive measurements. Process parameters such as flows and temperature, and also particle properties can be monitored to some degree. Such parameters appear to be less accessible for measurements using local monitor sensor approaches. On the other hand, global monitoring may fall