What is Simulink?
Simulink is a model-based design tool created by the MathWorks which provides a block-diagram development environment where system models can be created, documented, and tested. Simulink is tightly integrated with the MathWorks popular MATLAB computing environment. A Simulink model can be run standalone on a development PC or be converted to C code that can be run in a real-time environment, as is the case when used with the ADEPT Framework.
Integrating Simulink Models into the ADEPT Framework
Integrating a Simulink model into the ADEPT Framework is a quick, easy process thanks to ADEPT’s open-architecture, framework-based design. In 4 steps, users can have their Simulink model built and ready to run on an ADI Industrial Real-Time Linux Server.
- Import Simulink Model into ADEPT-DE
The first step is to import the Simulink model into an ADEPT-DE framework as a Simulink assembly. This consists of simply providing ADEPT-DE the path to the Simulink .slx model file (or .mdl legacy model file). Note that this process, as with most any manual process in the ADEPT Framework, can be automated via Python script. Once ADEPT-DE has successfully imported the Simulink model, ADEPT-DE will automatically open the model for further configuration, discussed in the following step.
- TLC Configuration
The Simulink Target Language Compiler (TLC) file allows for customization of the Simulink build process which converts the Simulink block diagram into C code. These customizations allow for the many nuances required for real-time optimization to be addressed. The ADI Simulink Toolbox provides users with a TLC file tailored for each type of ADI industrial server. Once the Simulink model is opened from ADEPT-DE, the user is automatically prompted to select the TLC file appropriate for their hardware. Additional model configuration, such as the execution step time, is also set up by the user at this point.
- Simulink Coder Build
The Simulink Coder build is the process that converts the block diagram into machine-runnable C code. The build begins by user-input via drop-down menu or keyboard shortcut. Depending on the size and complexity of the models, this can often be the most time-expensive step in the integration process. Once complete, the Simulink assembly will be ready for complete integration into the ADEPT-DE framework.
The Simulink build process creates several artifacts critical to the ADEPT-DE environment, outside of the C model source. Chief amongst these is the model’s data dictionary file. The data dictionary file contains all of the model inputs and outputs and their properties (name, datatype, dimension, etc) in a model-independent format that can be used by ADEPT-DE. Data dictionary items, and subsequently Model Ports, are created for every Inport, Outport, Scope, ToWorkspace, and DataStoreMemory block in the model. These Model Ports allow users to easily make connections from the Simulink model to other models of any supported type (C, Simulink, FMU/FMI, etc), running on the same server or completely different hardware in a distributed setup. Additionally, connections can be made to hardware I/O, allowing Simulink model to drive, or be driven by, signals from hardware. Integration with hardware I/O will be discussed further in subsequent sections.
- ADEPT-DE Project Build
The ADEPT-DE build takes all of the model source files specified in the framework (from Simulink or otherwise) and creates the real-time executable that will be uploaded to and run on the ADI server. This complex operation is accomplished with only a click of a button from the user.
Simulink Model Interaction at Runtime
The ADEPT-VI runtime application allows users to run and interact with projects in an immersive, feature-rich environment. In the case of a Simulink-based project, additional capabilities have been built in to allow interaction at deep levels of the model. Model signals, bus signals, block and model parameters can all be designated to be accessible at run-time in the ADEPT-VI Data Browser. This allows users powerful, on-the-fly capabilities, such as changing a gain parameter or overwriting a signal without having to rebuild the model.
The ADEPT framework supports a wide variety of discrete, analog, and complex communications I/O. Setting up a Simulink model to communicate with vastly different I/O has been fine-tuned to a streamlined, common process, so no matter what type of I/O the user is dealing with, the I/O can be connected to the Simulink model quickly and easily.
- Add Logical Device to ADEPT-DE Project
A logical device is an interface layer within the ADEPT-DE environment. Logical devices are provided by ADI for all supported I/O board types to provide an easy way to configure I/O and connect to user models without requiring additional user code or effort. A logical device is added to an ADEPT-DE project via simple drag-and-drop.
- Generate Simulink I/O Boards for Logical Device
ADEPT-DE generates a Simulink block for each logical devices that contains the appropriate ports that can be connected to the model. The user commands ADEPT-DE to create a MATLAB M-script file, which is then run in the MATLAB environment to create the I/O block library.
- Add and Connect I/O Blocks to Simulink Model
The final step is to copy the I/O blocks from the library into the appropriate location of the Simulink model, and make connections to the desired signals. After this is completed, the user will perform Simulink Coder build of the model, and ADEPT-DE build, and then will be up and running with the Simulink model driving or being driven by physical hardware.
Supported Features & Toolboxes
The ADEPT framework supports a variety of popular, powerful Simulink toolboxes and advanced features that greatly expand user modeling capabilities.
Stateflow is a MathWorks graphical environment used to model reactive systems via state machines. Stateflow models utilize state transition diagrams, transition tables and truth tables. A Stateflow model can be developed and then brought into a Simulink model as a block. The model is then built and integrated into the ADEPT environment as normal.
Simscape is a Simulink toolbox which provides advanced capabilities for modeling physical systems within the Simulink environment. Simscape contains subsets including SimHydraulics, SimMechanics, and SimElectronics that contain common blocks that can be utilized to rapidly develop physical system models.
- Model Referencing
Model referencing is a popular, widely used Simulink feature which allows separate Simulink models to be brought into a parent model as a model block. Using model referencing provides many benefits – ease of parallel model development, simplified configuration management, and the ability to incrementally build referenced models as opposed to a time intensive top-level Simulink Coder build.
- Simulink Version Support
The Mathworks releases a Simulink update biannually and ADI provides support for these releases on a rolling basis. ADI engineers evaluate the newest Simulink features with an eye towards real-time suitability and rigorously test for compatibility with the ADEPT framework. Please visit the ADI Software Releases page for up-to-date information on the latest supported Simulink version.
Example Integration Applications
The open framework architecture of ADEPT allows not only fast integration between Simulink and ADEPT, but also many of the latest modeling applications, protocols and standards.
- Simulink with PLCs
A Programmable Logic Controller (PLC) is an industrial digital computing device designed especially for rugged, harsh environment deployment. PLCs have grown increasingly popular for use in industrial automation tasks. In the ADEPT environment, communication with a PLC is accomplished via logical device, as with other hardware communications. PLC packet definition is defined in ADEPT-DB, the ADI communications protocol management tool. Once defined, signals from the PLC can be associated with inputs and outputs from the Simulink model. ADEPT-DB will automatically create a time-deterministic schedule which allows the Simulink model port to drive or be driven by the PLC signal. To learn more about PLC integration into the ADEPT framework, please see this article.
- Simulink with FMI
The Functional Mockup Interface(FMI) is an open standard for model interfacing providing a well-defined methodology for exchanging simulations and models of subsystems for integration with other simulations and models. ADEPT has support for both FMI Co-simulation and FMI Model Exchange. In the ADEPT-DE environment, an FMI model is brought in as an Assembly, in the same manner a Simulink model would. Connections between a Simulink Assembly and FMI Assembly can be made easily, as each model’s input and output ports are defined in a common manner in the data dictionaries. To learn more about FMI integration into the ADEPT framework, please see this article.
- Simulink with EtherCAT
EtherCAT is a fieldbus system based on Ethernet, standardized in IEC 61158, which uses standard Ethernet hardware. EtherCAT is used primarily in machine control and measurement applications, where data integrity, data security, and synchronicity requirements are paramount. In the ADEPT environment, communication over EtherCAT is accomplished with a logical device. The input and output message definitions are provided by a user-defined csv initialization file. These signals can then be mapped to Simulink input and output ports.
The ADEPT Framework provides a stream-lined process to integrate Simulink models into a powerful, real-time optimized, industrial computing environment. The ADEPT framework open architecture allows for easy communication with various cutting-edge hardware, software, and communications technologies utilized widely by industry leaders that continue to invest in, and realize the benefits of, model-based systems engineering. With the ADEPT Framework, users can get the most out of their Simulink model assets in a robust, full-featured, real-time environment.
How can the ADEPT Framework supercharge your workflow? Contact your local ADI representative today to see how the ADEPT Framework can improve the quality and efficiency of your cyberphysical product development activities.