# Simulation Framework for Electrical Impedance Tomography Systems

This repository contains the code and data associated with the publication:

**"Simulation framework for electrical impedance tomography systems"**  
*Published in: Measurement: Sensors, Volume 38, 2025.*  
**Authors:** Moritz Hollenberg, Tom Liebing, Thorsten Alexander Kern, and Dennis Kähler  
**DOI:** [10.1016/j.measen.2024.101416)](https://doi.org/10.1016/j.measen.2024.101416)

## Funding Acknowledgement
This work was generated as part of the DFG-funded project **CRC 1615: SMART Reactors for Future Process Engineering** (DFG Project Number: 503850735).

---

## 1. General Information
The data set provides a hybrid simulation framework that combines Finite Element Method (FEM) modeling of a physical domain (using COMSOL) with electronic circuit simulation (using LTspice) to create a "digital twin" of an Electrical Impedance Tomography (EIT) system. This allows for realistic simulation of measurement signals including hardware noise and component tolerances.

**Keywords:** Electrical Impedance Tomography (EIT), COMSOL, LTspice, Sensor Simulation, Digital Twin, SMART Reactors.

---

## 2. Methodological Information
The framework follows a multi-step approach:
1. **Physical Modeling:** Resistance matrices are calculated for different tank configurations (empty vs. with objects) using COMSOL Multiphysics and MATLAB.
2. **Circuit Simulation:** The resulting resistances are integrated into an LTspice schematic (`signal_path_ltspice.asc`) that models the measurement electronics (excitation, multiplexers, amplifiers, ADCs).
3. **Python Integration:** Python scripts automate the simulation of all electrode combinations and handle the data processing, allowing for a direct comparison with real-world measurements.

---

## 3. Data and File Overview

### Repository Structure
```
.
├── data/
│   ├── measurement_results/      # Experimental data from the physical EIT setup (.mat)
│   └── simulation_results/       # Results generated by the simulation framework (.csv)
└── src/
    ├── matlab_comsol_handle/     # COMSOL models and MATLAB Live scripts for resistance calculation
    └── python/
        ├── circuit_fit/          # Scripts for data processing and fitting algorithms
        └── spice/                # LTspice simulation wrapper, schematics, and electrode models
```

### Key Files
- `src/python/spice/run_simulation.py`: Main script to execute the LTspice simulations for all electrode combinations.
- `src/python/spice/signal_path_ltspice.asc`: The LTspice schematic representing the electronic hardware.
- `src/matlab_comsol_handle/resistance_calc.mph`: COMSOL model for the 3D tank resistance calculation.
- `src/python/spice/models/electrode_models.txt`: JSON file containing fitted RC-models for the electrodes.

---

## 4. Reproducibility and Software Dependencies

### Required Software
- **Python 3.11+**
- **LTspice** (accessible via command line)
- **COMSOL Multiphysics** (with MATLAB Livelink)
- **MATLAB**

### Python Dependencies
Install required packages via pip:
```bash
pip install PyLTSpice scipy numpy matplotlib
```

### Execution Steps
1. **Resistance Generation:** Use the scripts in `src/matlab_comsol_handle/` to generate `.tank` files from the COMSOL models.
2. **Circuit Simulation:** Run `src/python/spice/run_simulation.py` to perform the automated LTspice measurements.
3. **Validation:** Use the utilities in `src/python/circuit_fit/` to compare the simulated results with the data in `data/measurement_results/`.

---

## 5. License
Code, schematics, models and accompanying files are licensed under the MIT License.
Data contained in data/ are made available under CC BY 4.0.

## 6. Contact Information
**Corresponding Author:**  
Moritz Hollenberg  
Hamburg University of Technology (TUHH)  
Institute for Mechatronics in Mechanics  
Email: [moritz.hollenberg@tuhh.de]  
ORCID: [0009-0008-0595-2736]

Project Website: [https://www.tuhh.de/sfb1615/](https://www.tuhh.de/sfb1615/)