Skip to content

DaveCacci/B.Twin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Author: Davide Carecci
Initial commit: 15.01.2026
⚠️ This repo uses Git LFS - do not download as ZIP (see Notes section of this README). ⚠️ The general_utils library contains also a user manual to setup VSCode/Python for non-expert users and the list of the required standard Python libraries (download it from the GitHub repository).


BIOGoAlS.Twin contains all the objects needed to create a digital twin of a real digester, and to control it via advanced optimal techniques such as nonlinear model predictive control (NMPC). With a reduced-order and control-oriented (i.e., fully observable) model (the AM2HN.${obs}$), it allows the real-time predictive monitoring of the plant via Bayesian estimation of non-online-measurable state quantities via extended Kalman filtering (EKF). In parallel, a AM2HN${obs}$-based NMPC allows to recursively determine the optimal closed-loop sequence of control actions to enhence the plant performance (e.g., following a given biomethane production setpoint in an optimal way) while explicitely handling constraints (e.g., sufficiently safe opertions). Since parameter uncertainty and disturbances are generally present, a inherently robust tube-based version of the NMPC was developed too. The tool is used primarily to:

  • train/identify the parameters of a redued-order model of the process;
  • design the parameters of the EKF and validate its performance over previously-collected real digester data;
  • perform closed-loop predictive monitoring and optimal control of a digester, following the setpoits derived, for example, with the Biogoals.agri-AcoDM tool;

The tool (with the tube-based formulation of the NMPC) has undergone one experimental validation campaign (03.2025–07.2025) conducted at BioTA Lab (Universidad Técnica Federico Santa María, Valparaíso, Chile) using a hand-made, Raspberry-Pi-driven control architecture.


Documentation


Inside the /EKF_tuning folder:

  • Jupyter notebook to run multiple simulations and design the EKF.
  • Example of inputs required to run the Jupyter notebook.
  • Example of outputs of the Jupyter notebook.

Inside the /Parameter_estimation folder:

  • Jupyter notebook to run the (first-stage) parameter estimation of the AM2HN$_{obs}$ model on a synthetic data generated with the agri-AcoDM model.
  • Jupyter notebook to run a preliminary parameter estimation of the hydrolysis constants for the AM2HN$_{obs}$ model on data from standard BMP tests with simple models (e.g., first-order process).
  • Example of notebook's output.

Inside the /Test_closedloop folder:

  • Example of inputs required to run the test_Chile_closedloop.ipynb notebook.
  • Example of outputs of the test_Chile_closedloop.ipynb notebook.

Inside the /Data folder:

  • Example of process data required to run the notebooks.

Notes

  • Markdown links (./folder/file) are used for proper GitHub rendering.

  • Python 3.10+ is required.

  • Extensive use of the custom functions present inside the general_utils library (download it from GitHub repository).

  • For further details, please refer also to the PhD thesis of the author (visit POLItesi or request a copy to davide.carecci@polimi.it).

  • ⚠️ Important: Git LFS Required This repository uses Git LFS (Large File Storage). ❌ Do NOT download the project using "Download ZIP" — files will be incomplete. ✅ Instead, clone the repository:

    git clone <repo-url> cd <repo> git lfs pull


© 2026 Davide Carecci — All rights reserved.

About

Codes for implementing the BIOGoAlS.Twin tool. Digitial twin based on a AM2HN-like model for the optimal control of anaerebic co-digestion

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors