Skip to content
Snippets Groups Projects
README.md 16.26 KiB

Model Predictive Control for Extrusion Additive Manufacturing

Originally published to https://github.com/jakeread/mpc-for-additive-extrusion on March 10th, 2025

Mirrored to https://gitlab.cba.mit.edu/jakeread/mpc-for-additive-extrusion on March 13th, 2025

I hereby dedicate the contents of this disclosure to the public domain so that it may serve as prior art.

One of the key challenges when controlling extrusion based additive manufacturing equipment is to generate precise flowrates the nozzle, so that the width of the extruded track is geometrically accurate. This is especially challenging when a machine is changing speed and direction rapidly, because material flows have dynamical properties: filament in Fused Filament Fabrication (FFF) machines compress before they exit the nozzle, as do melt flows in pellet extruder, and gels and clays in syringe extruders. Without compensation for these effects, machines tend to under-extrude when they accelerate and over-extrude when they slow down. It is also difficult to know how fast a material can be extruded under different process parameters: when nozzle geometries, temperatures, or material compositions change, all of the extrudate's dynamic and static properties change along with it, presenting a challenge to machine builders and users.

shnozz

A diagram of an FFF printer's basic phenomena. Filament between the drive gear and nozzle is compressible, leading to some nasty extrusion dynamics. Extrusion is further complicated by nonlinear shear thinning of materials, die swell of extrudate processed at high pressures, and many more parameters. While this disclosure largely discusses FFF printing, the principles can be easily applied to pellet extruders, syringe extruders, pump extruders, etc - just about anything where a flow can be modelled and controlled.

lin-advance

Poorly understood filament dynamics can lead to extrusion errors when machines turn corners or slow down and speed up. A common heuristic remedy for this problem is known as 'linear advance,' but it is difficult to tune and misses nonlinear properties of extrudate flow dynamics. via the Prusa Knowledge Base

Lots of work is being done to model these processes and dynamics, and I have included some references to that work in the references section of this document. These predictive models allow us to simulate a virtual extruder over a given time span using a set of control inputs to the system (and an initial state), to generate a simulated time-series of resulting flowrates.

steady-model

Above is a steady-state model of melt flow generated for an FFF machine, using instrumentation on the machine. This is from my own prior work here pdf. Models like this do not contain dynamics information, but they can be incorporated into dynamical models.

Predictive models make way for predictive controllers; Model Predictive Control (MPC) is a strategy common in robotics but seldom applied in manufacturing equipment. I will not go into detail on MPC in this disclosure since it is very well understood in the controls community... in brief, MPC does what people do when doing dynamics: continually predict outcomes of a set of candidate actions, optimizes those actions so that the outcome is 'the best,' then issues the first of those actions, and begins the process again.

MPC is computationally intensive, because for each iteration we need to run the simulation through multiple time steps, and we typically need to take many iterations of possible control values to converge to an optimal solution.

schema time

Classic MPC Formulations
Brunton, Steven L, and J Nathan Kutz. 2022a. “Chapter 10: Data Driven Control.” In Data-Driven Science and Engineering: Machine Learning, Dynamical Systems, and Control, 389-408. Cambridge, United Kingdom: Cambridge University Press.

In additive manufacturing, controllers face the challenge of depositing extrudate precisely while also moving the machine carefully along a path. The process is limited by the machines' motion dynamics as well as dynamics of the extrudate flow, but both can be modeled and simulated. Indeed, models for motion given input motor torques or voltages are the most commonly deployed in MPC literature.

It is possible to formulate a cost function for extrusion machines: probably we want to print quickly (minimizing time) and also accurately (minimizing geometric error). However, cost functions can be authored to express many desired outcomes, and can be tuned to bias particular properties (like speed) trading off for others (like precision). For this reason, MPC controllers will allow additive machines to express more human-friendly interfaces for parameter tuning.

If we can bring enough compute power to our machine controllers for additive, MPC becomes an obvious solution. With recent advances in flexible compute libraries for optimization, and availability of high power computing at both high- and low levels, this is now becoming the case. I have been working on this for approximately the last six months, aided especially by a handful of hugely performant open software packages that have made it easier to assemble and run MPC.

solver-video
solver