The COMSOL® Product Suite

Integrate COMSOL Multiphysics® into Simulink® with LiveLink™ for Simulink®

Cosimulations, Reduced-Order Modeling (ROM), and Control Design and Simulation

LiveLink™ for Simulink® connects COMSOL Multiphysics® to the Simulink® simulation environment, available as an add-on to the MATLAB® technical computing software. Using this functionality, you can perform cosimulation of COMSOL Multiphysics® models and Simulink® diagrams. Any time-dependent or static COMSOL Multiphysics® model can be used for cosimulation.

In addition to cosimulation, you can export reduced-order state-space representations of COMSOL Multiphysics® models. They facilitate control design and simulation using MATLAB® in combination with either Simulink® or the Control System Toolbox™.

With the cosimulation approach, the COMSOL Multiphysics® solvers are used to time-integrate dynamic models or solve static models. This means that large models that can be solved by the COMSOL Multiphysics® solvers can be used in cosimulations. You can use LiveLink™ for Simulink® for control system design involving any COMSOL Multiphysics® model using any combination of physics and equations.

What You Can Model with LiveLink™ for Simulink®

Temperature Control of a Battery Pack

LiveLink™ for Simulink® is useful for temperature control simulation, as demonstrated in the example model called Battery Pack Discharge Control with Thermal Analysis. Thermal management is important in battery modeling. The cosimulation computes the temperature distribution in a battery pack during discharge. The pack is modeled in COMSOL Multiphysics® and the Battery Design Module. This particular battery pack configuration is common in portable devices like skateboards, toys, drones, and medical equipment. The electric current of the 3D battery model is controlled in Simulink® to ensure constant power during usage.

Battery Charge Control

Perform charge and discharge control of a lithium-ion battery in a Simulink® and COMSOL Multiphysics® cosimulation, as demonstrated in the example called 1D Lithium-Ion Battery Model Charge Control. Charge controllers are useful for improving battery lifetime as they prevent overcharging and possible overvoltage. This model combines a detailed electrochemistry simulation, using COMSOL Multiphysics® and the Battery Design Module with a control system implemented in Simulink®. The control system adjusts the electric current during battery charging to prevent overvoltage. The electric current is also controlled during discharge to ensure constant power.

Multibody Dynamics Control

Control your rigid or flexible body COMSOL Multiphysics® models from Simulink®. This is demonstrated in the example titled Control of an Inverted Pendulum modeled with the Multibody Dynamics Module. In this example, a PID controller is used to control the base position of an inverted pendulum to keep its vertical position stable. An external balancing force is applied at the base position depending on the angle of the pendulum to prevent it from falling. Moreover, the position of the pendulum is constrained within a specified range.

Control of a Magnetic Brake

You can perform a cosimulation with LiveLink™ for Simulink® even if the COMSOL Multiphysics® model is static. This is demonstrated in the Magnetic Brake example. A magnetic brake in its simplest form consists of a disc of conductive material and a permanent magnet. The magnet generates a constant magnetic field in which the disc is rotating. When a conductor moves in a magnetic field, it induces currents and the Lorentz forces from the currents slow the disc. In this model, created using the AC/DC Module, the angular velocity is computed in Simulink® based on the induced torque and the disc moment of inertia. The induced torque is computed in COMSOL Multiphysics® as a 3D electromagnetic static study. In this example, Simulink® is used as a time-integrator, instead of COMSOL Multiphysics®, and integrates the angular acceleration to compute the angular velocity.

MEMS Actuation

LiveLink™ for Simulink® makes multiphysics cosimulation possible by using COMSOL Multiphysics® and any of the add-on products. This is illustrated by the example called On/Off Control of a Thermal Actuator. The model consists of a two-hot-arm thermal actuator made of polysilicon. The actuator is activated through thermal expansion. The temperature increase required to deform the two hot arms, and thus displace the actuator, is obtained through Joule heating. The greater expansion of the hot arms, compared to the single cold arm, causes a bending of the actuator and the model exemplifies a multiphysics combination of three types of physics: electric currents, heat transfer, and structural mechanics. The applied current is controlled so that the actuator deflection does not exceed a given value. The on/off controller is implemented in Simulink®.

Note that LiveLink™ for Simulink® is not supported for use with the Application Builder, COMSOL Compiler™, or COMSOL Server™.


Simulink, Control System Toolbox, and MATLAB are trademarks or registered trademarks of The MathWorks, Inc.

A LiveLink for Simulink cosimulation diagram and an inset of the COMSOL Multiphysics UI with a battery pack model in the Graphics window.

A cosimulation of a battery pack using COMSOL Multiphysics® and Simulink®.

A LiveLink for Simulink cosimulation diagram in the foreground and a 1D plot in the background. A multibody dynamics cosimulation using COMSOL Multiphysics® and Simulink®.
A LiveLink for Simulink cosimulation diagram and an inset of the COMSOL Multiphysics UI with a magnetic disc brake model in the Graphics window. Cosimulation of a magnetic brake using COMSOL Multiphysics® and Simulink®.
A LiveLink for Simulink cosimulation diagram and an inset of the COMSOL Multiphysics UI with a two-hot-arm thermal actuator model in the Graphics window. A multiphysics cosimulation of a MEMS actuator using COMSOL Multiphysics® and Simulink®.

Every business and every simulation need is different. In order to fully evaluate whether or not the COMSOL Multiphysics® software will meet your requirements, you need to contact us. By talking to one of our sales representatives, you will get personalized recommendations and fully documented examples to help you get the most out of your evaluation and guide you to choose the best license option to suit your needs.

Just click on the "Contact COMSOL" button, fill in your contact details and any specific comments or questions, and submit. You will receive a response from a sales representative within one business day.

Next Step:
Request a Software
Demonstration