Genentech Uses MATLAB and Industrial Communication Toolbox to Build a Supervisory Control Algorithm Development Platform for Bioreactors

“By partnering with MathWorks Consulting, we developed a robust platform for supervisory control with MATLAB and transitioned our pilot plant to a modern automation control system. This enabled our researchers to rapidly take algorithms from idea to implementation, simulation, and deployment.”


Accelerate the development of control algorithms for microbial fermentations


Use MATLAB and Industrial Communication Toolbox™ to develop a continuous-uptime supervisory control platform that enables rapid development, debugging, and verification of algorithms


  • Algorithm development time cut from months to weeks
  • Flexible, reliable infrastructure deployed
  • Potential errors identified in minutes
A Genentech microbial pilot plant bioreactor.

Before moving a new drug into full-scale production, biopharmaceutical companies optimize the fermentation process to maximize the amount of therapeutic drug produced. Operation of these microbial fermentations involves controlling process set points, including temperature, nutrient feeds, oxygen transfer rates, and pH, in a bioreactor over several days. Developing the sophisticated control algorithms to manage these set points requires biochemical expertise. Subsequent implementation in a distributed control system can takes months, even for an experienced automation engineer.

Genentech, with assistance from MathWorks Consulting Services, has developed a MATLAB® based supervisory control platform that enables researchers to rapidly develop, simulate, and implement control algorithms. “When we lose a fermentation due to a control or algorithm problem, we feel that very keenly as a delay to our timeline,” says Dr. Ryan Hamilton, process researcher at Genentech. “MATLAB has accelerated algorithm development and provided a huge efficiency gain by enabling us to debug scripts step by step and run simulations against a bioprocess model.”


To reduce downtime, Genentech adopted a distributed control system (DCS). While the DCS was significantly more reliable and provided better data monitoring than Genentech’s previous system, it initially made control algorithm development much more difficult. “The switch to the DCS addressed the downtime issues we were having, but it slowed development of control strategies,” says Hamilton. “Reimplementing an existing algorithm took six months, and developing new algorithms required a fulltime automation engineer support partner, which was not sustainable.”

In addition to restoring their ability to rapidly develop control algorithms, Genentech researchers wanted to improve the algorithm debugging and verification process. “Using the DCS, we had no way to step through our algorithms and no way to simulate them with a process model,” Hamilton says. “Simple errors that could have been found during this process were instead found during fermentations, which cost thousands of dollars and consumed valuable days of experimentation time.”


Genentech engaged consultants from MathWorks to develop and deploy the External Control Algorithms (ECALS) supervisory control algorithm development platform.

Together, the team developed a control engine that runs recipes, or sets of control algorithms, on a single bioreactor. Built using the object-oriented programming capabilities of MATLAB, the control engine communicates with the DCS via an OPC DA interface implemented using Industrial Communication Toolbox™.

Researchers then used MATLAB to develop control algorithms and recipes. The recipes monitor bioreactor sensor inputs, including pH, dissolved oxygen levels, and other environmental conditions, as well as controller set points and outputs such as nutrient flow rates. Controller set points are adjusted as necessary based on algorithm function.

To simplify recipe setup, the team developed a graphical interface with MATLAB that enables researchers to select algorithms, define parameter values, and save parameterized algorithms for reuse.

To verify their control algorithms, they developed a MATLAB model of the environment inside the bioreactor tanks. Comprising a set of differential equations, this bioprocess model enabled the team to debug and test the algorithms via simulation before running them in the pilot plant.

After verifying the core functionality of the engine, the team added several features to support continuous uptime in a production environment, including monitoring, logging, automatic restarts, and algorithm version control.

As a final verification step, they simulated the process on an empty tank to test the plant interfaces and show technicians how the process would run. To enable this verification step, they wrapped the bioprocess model within an ECALS recipe that simulated a fermentation in the tank by sending generated sensor output via OPC tags.

Once a fermentation has been completed, the team post-processes the logged data in MATLAB and uses the results for process development and optimization.

Genentech has deployed ECALS in its pilot plant, where it performs supervisory control for bioreactors ranging from 10 to 1000 liters. To date, more than 800 fermentations have been successfully executed under the control of ECALS.


  • Algorithm development time cut from months to weeks. “With our previous system, it took two researchers and one automation engineer six months to write and debug an algorithm that we already knew,” says Hamilton. “When we switched to MATLAB, I reimplemented the same algorithm by myself in just two weeks, and that included simulation and testing.”

  • Flexible, reliable infrastructure deployed. “For more than a year, the MATLAB based ECALS system has been operating reliably and conducting days-long experiments,” notes Hamilton. “The only downtime we’ve experienced was due to network outages. And, because we implemented the communication layer using Industrial Communication Toolbox, ECALS has the flexibility to use any OPC-compatible automation network.”

  • Potential errors identified in minutes. “Using MATLAB and the bioprocess model that we developed, we can debug an algorithm and verify that it will work before we run it on a bioreactor,” says Hamilton. “In a few minutes we can run a simulation and identify potential errors that would otherwise result in days of wasted experimentation.”