{"id":20643,"date":"2025-08-28T16:52:52","date_gmt":"2025-08-28T08:52:52","guid":{"rendered":"https:\/\/www.tosunai.com\/?p=20643"},"modified":"2025-08-28T18:12:35","modified_gmt":"2025-08-28T10:12:35","slug":"tsmaster-mbd-module-explained","status":"publish","type":"post","link":"https:\/\/www.tosunai.com\/en\/tsmaster-mbd-module-explained\/","title":{"rendered":"Sharing | TSMaster MBD Module Explained: From Model Building to Automation Testing in Practice"},"content":{"rendered":"
In automotive MBD development, TSMaster MBD module is deeply integrated with TSMaster's advanced bus analysis, simulation and test platform, aiming to provide engineers with a set of end-to-end seamless solutions from automatic model compilation, code integration to automated test. In this article, we will teach you how to build a project from scratch and build an efficient test process, providing a practical guide to optimize the development workflow.<\/p>\n\n\n\n
<\/p>\n\n\n\n
Keywords:TSMaster, MBD<\/strong><\/strong><\/strong><\/strong><\/strong><\/p>\n\n\n\n Some of the styles and symbols used in this article can be found in the following table descriptions.<\/p>\n\n\n 2.1 Application scenarios<\/strong><\/p>\n\n\n\n Model Block Diagrams (also known as MBDs) are used to model, simulate and analyze dynamic systems.<\/strong><\/em>It uses a graphical programming environment based on block diagrams, which is particularly suitable for the simulation and design of complex systems (e.g., control systems, signal processing, communication systems, etc.).<\/p>\n\n\n\n The model block diagrams in TSMaster use a block diagram representation to build a system model by dragging and dropping modules and connecting signal lines, and support discrete-time as well as hybrid system simulations, where parameters can be adjusted during simulation and results can be seen immediately.<\/p>\n\n\n\n The model block diagram advantages are as follows:<\/p>\n\n\n\n 2.2 <\/strong>model block diagram<\/strong><\/p>\n\n\n\n The Model Block Diagram module toolbar mainly contains common engineering operations such as undo, redo, open from outside, save current file, create new model, export svg, clear run results, generate applet library, run model, step and stop.<\/p>\n\n\n\n 2.2.1 Toolbar<\/p>\n\n\n\n <\/p>\n\n\n\n The functional buttons in the Model Block Diagram toolbar are described as follows: (Table 1: Model Block Diagram Toolbar Description)<\/p>\n\n\n\n <\/p>\n\n\n\n New SubItem details: (Table 2: New SubItem description)<\/p>\n\n\n\n <\/p>\n\n\n\n 2.2.2 Model Block Diagram Configuration<\/p>\n\n\n\n 2.2.2.1 Model Block Diagram Setup<\/p>\n\n\n\n The model block diagram settings allow you to set the simulation start time, simulation end time, fixed step size, and simulation mode settings.<\/strong><\/em>The solver in TSMaster is a fixed-step solver, which maintains a fixed time step to advance the simulation, and will not be adjusted due to the dynamic changes of the system, and is suitable for real-time simulation.<\/p>\n\n\n\n <\/p>\n\n\n\n The data types in the model block diagram settings are categorized into double (double-precision floating-point) and single (single-precision floating-point); most of the modules in the model block diagram use the double type by default, which is suitable for high-precision scientific calculations, and very large or very small quantities of arithmetic operations; the single type is not the default type, and needs to be explicitly specified, and it is mostly used for real-time simulation to accelerate the speed of calculations (see Figure 4). After binding the added data warehouse in the settings of the model block diagram, you can use the variables and data types in the data warehouse.<\/p>\n\n\n\n <\/p>\n\n\n\n The debugging part of the model block diagram setup, the model debugging process, sets the simulation to pause at a specific point in time, and after the pause the simulation is carried out by stepping. (See Figure 5.)<\/p>\n\n\n\n <\/p>\n\n\n\n 2.3 <\/strong>Model Manager<\/strong><\/p>\n\n\n\n The Model Manager interface includes three modules: Model List, Data Warehouse and Global Settings.<\/em><\/strong>. There are two main functions in the toolbar: open all and close all.<\/p>\n\n\n\n <\/p>\n\n\n\n The model list displays information about all model block diagrams loaded in the current TSMaster project, the package block name, type, version, last modification, status and file path (see 2.2 for a detailed description of model block diagrams).<\/p>\n\n\n\n <\/p>\n\n\n\n The data warehouse displays information about all the data warehouses added in the current TSMaster project, the package block name, type, version, last modification, status and file path (see 2.4 for a detailed description of the data warehouse).<\/p>\n\n\n\n <\/p>\n\n\n\n Add a path (or add a cascade path) to the \"Model Search Path\" in the global settings. After adding the environment variable Path path, the reference a model depends on b, c, and d. After adding the paths of b c d, you can open a model with a b c d in its entirety.<\/p>\n\n\n\n <\/p>\n\n\n\n 2.4 <\/strong>data warehouse<\/strong><\/p>\n\n\n\n A data warehouse is a persistent repository for storing model-related data. It can store design data that defines parameters and signals, and can also include data that defines model behavior.<\/strong><\/em>The Data Warehouse does not store simulation data, i.e., inputs or outputs to and from the Inport and Outport modules during model simulation. The entries in the data warehouse are persistent.<\/p>\n\n\n\n The data warehouse consists of three modules: variables, data types, and attributes.<\/strong><\/p>\n\n\n\n The configuration is saved in the data warehouse as a JSON file, which defines the name of the data warehouse, the last modifier, the added data types and information about the variables, and you can also add variables, data types and other information by importing the originally saved JSON file.<\/p>\n\n\n\n <\/p>\n\n\n\n 2.4.1 Variables<\/p>\n\n\n\n Signals and parameters can be added to the Variable module in the Data Warehouse. You can export the Variable module to C code, and then import the C code into a C applet, and all the variables added to the Variable module can be used in the C applet.<\/p>\n\n\n\n <\/p>\n\n\n\n The Variables module of the Data Warehouse can import Simulink data dictionaries. The type of the added variable data can be modified to other types, such as: double, single, int8, uint8, int16, uint16, int32, uint32, int64, uint64, and boolean, or it can be the type added in the data type (see 2.4.2 for more details on data types), such as: Enum :EnumType, Bus:BusType, Value:ValueType, Numeric:NumericType, etc.; the initial value, type, array size, maximum value, minimum value, unit and description in the variable can be modified.<\/p>\n\n\n\n <\/p>\n\n\n\n Association of variables in the data warehouse with the model block diagram: Add a component to the model block diagram (DataStoreRead, for example) and bind the data type to the added data warehouse (e.g. DataRepo) in the settings. At this point, the datastore in the DataStoreRead can select the variables added to the data warehouse, and the Constant component can read the parameters (e.g. Para) added to the variables in the data warehouse. This is shown in the following figure:<\/p>\n\n\n\n <\/p>\n\n\n\n 2.4.2 Data types<\/p>\n\n\n\n The data type module in the data warehouse can add variable types, bus types, enumeration types, alias types, and numeric types; the data added in the data types can be exported as C header files, and all types in the data types can be used in C applets by importing the header files in the C applet; load the .h file under the libs\\common path, and the global definition of the reference to the header file, you can use the data types in the calling header file.<\/p>\n\n\n\n <\/p>\n\n\n\n The enumeration type of the data types in the data warehouse allows you to add enumeration data, modify default values and storage types, while the other data types support modifying names and descriptions.<\/p>\n\n\n\n <\/p>\n\n\n\n The data types in the data warehouse are linked to the model block diagram: add components to the model block diagram (take Constant as an example), bind the data warehouse in the data types in the settings to the data warehouse that has been added (take DataRepo as an example), and the output data types in Constant can be selected from the data types that have been added to the data warehouse, as in the following figure:<\/p>\n\n\n\n <\/p>\n\n\n\n 2.4.3 Properties<\/p>\n\n\n\n The Properties module in the Data Warehouse allows you to add created data warehouses, remove data warehouses, and open data warehouses. When a data warehouse (in the case of DataRepo, hereafter referred to as DataRepo) references another data warehouse (in the case of DataRepo1, hereafter referred to as DataRepo1), DataRepo's variable and data type tables are free to associate DataRepo1's data types with it, but the variable table does not explicitly DataRepo1 variables in DataRepo1.<\/p>\n\n\n\n 3.1 Basic functions<\/strong><\/p>\n\n\n\n 3.1.1 Shortcut operation<\/p>\n\n\n <\/p>\n\n\n\n 3.1.2 Block operations<\/p>\n\n\n <\/p>\n\n\n\n 4.1 Component Functions<\/strong><\/p>\n\n\n 5.1 <\/strong>Simulink model<\/strong><\/p>\n\n\n\n Download the RollAxisAutopilot.slx (URL 1) and RollAxisAutopilotHarness.slx (URL 2) files from the MATLAB website<\/p>\n\n\n\n URL 1:<\/p>\n\n\n\n https:\/\/ww2.mathworks.cn\/help\/ecoder\/gs\/getting-started-with-embedded-coder.html<\/a><\/a><\/p>\n\n\n\n <\/p>\n\n\n\n URL 2:<\/p>\n\n\n\n1<\/strong>. <\/strong>Description of symbols<\/strong><\/h2>\n\n\n\n
\n\n\n\n<\/figure><\/div>\n\n
<\/figure><\/div>\n\n\n
2. MBD Description<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/h2>\n\n\n\n
\n\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n
<\/figcaption><\/figure>\n\n\n\n3. MBD Basic Function Introduction<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/h2>\n\n\n\n
\n\n\n\n<\/figure><\/div>\n\n\n
<\/figure><\/div>\n\n\n
4. Block Description<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/h2>\n\n\n\n
\n\n\n\n<\/figure><\/div>\n\n\n
5. MBD model<\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/strong><\/h2>\n\n\n\n
\n\n\n\n