WOLFRAM

Batch Process—Combine Physical Models with Statecharts

A batch process is a production method in which materials are handled in defined, finite quantities (batches), typically through multiple steps such as filling, heating, reacting, cooling and draining. Industries such as pharmaceuticals, chemicals and food processing, where precision, consistency and safety are critical, use this type of processing. This example combines models of physical processes—such as fluid flow and heat transfer—with statecharts to manage event-driven actions, effectively mimicking real-world industrial process automation.

To run this example, you'll need

The latest versions of System Modeler and Mathematica.

Please make a selection:

Get a
free trial
Continue
with download
Animation of the batch process.

Create the Fluid Model

We begin by designing a fluid system that replicates the behavior of our target process system. This setup will help us understand and test key process dynamics in a controlled environment. The system consists of three tanks: the reactant tank stores the reactant, the reaction tank is where the process takes place, and the product tank collects the final product. The reaction tank is equipped with a mechanism for heating or cooling, which is controlled via an external input.

A dynamic model of the batch reactor with thermal and fluid flow interactions.

Create State Diagram

We then define the event-driven behavior of the system, which starts in an idle state. After 5 seconds, the reaction tank begins filling with reactant. Once the reactant level reaches 9 meters, the heating process is initiated. Heating continues until the temperature inside the tank reaches 300 Kelvin, at which point cooling begins. Cooling proceeds until the temperature drops to 295 Kelvin, after which the reaction tank begins to drain.

A finite state machine representing the operational logic of the process.

Couple State Machine with Fluid Model

The state machine governs the behavior of system components by opening and closing valves, starting and stopping pumps and activating heaters. This hybrid setup of discrete control and physical models effectively replicates real-world industrial process automation.

Animation of the batch process.

Hybrid Modeling Made Easy

Build realistic, multidomain simulations by coupling logic-driven state machines with physical models in System Modeler.