Introduction
BeamNG.tech Support for MATLAB and Simulink is a MATLAB toolbox that allows you to connect MathWorks products with BeamNG.tech. It comes with two components:
MATLAB Bridge
MATLAB Bridge allows you to control BeamNG from MATLAB scripts, for example to set up scenarios or to query vehicle information. This uses BeamNGpy leveraging MATLAB’s ability to call Python libraries under the hood.
graph LR; ml(MATLAB)<-->py(BeamNGpy)<-->bng(BeamNG.tech);
Simulink Bridge
Simulink Bridge allows you to set up a co-simulation between a Simulink model and a BeamNG vehicle. It comes with 2 options:
S-function block: Uses Simulink’s S-function mechanism to communicate to BeamNG via the UDP protocol.
graph LR; sl(Simulink)<-->sf(S-function)<-->|UDP|bng(BeamNG.tech);
FMU block according to the FMI Standard: Uses Simulink’s FMU block with an exported FMU by BeamNG to communicate to BeamNG via the UDP protocol. Both FMI 2.0 and FMI 3.0 versions are available.
graph LR; sl(Simulink)<-->fmu(FMU)<-->|UDP|bng(BeamNG.tech);
The MATLAB Bridge and the Simulink Bridge can be used independently from each other and have different scopes. However, they can be also used together, see Combined Example.