关于TargetLink的更多信息

TargetLink可直接从MathWorks® Simulink®/Stateflow®生成高效的C代码。自动生成代码也意味着,如果您所做的更改影响了多行代码,TargetLink会自动更新所有行的代码。因此,您现在可以专注于实际应用。通过内置仿真和测试进行早期验证可缩短周转时间并降低成本。

高质量的产品级代码生成

代码质量的重要性

当测试新观点的时候,对于快速控制原型中使用的代码,开发人员拥有很大的自由度,但是在汽车、飞机和其他实际工业应用中测试电子控件的产品级代码时则需要在质量方面满足非常严格的要求。例如,开发人员必须确保代码是高度优化的,可以与其他软件轻松集成,并且在当下和未来都能保证可读性,持续可维护,同时需求,模型和代码之间的所有连接均清晰易懂,而且代码符合相关标准。总之:要求最高标准的可靠性、效率、安全性、可维护性、可追溯性以及再现性(针对于生成过程,即相同的模型具有相同的代码)。

通过TargetLink获得 高质量产品级代码

产品级代码生成器dSPACE TargetLink是一个非常强大的软件系统,可以确保您的代码获得最佳质量,并能让您考虑单独的要求和相关标准。尽管TargetLink有众多特点,其产品级代码的典型生成步骤还是容易实施的,并有很多方法使得此过程能够适用于您自己的操作环境。典型的步骤包括控制设计,迭代验证和基于仿真的验证以及ECU上的代码集成。此外,TargetLink可以与dSPACE的其他工具以及其他厂商的工具进行顺利交互,共同形成Targetlink生态系统。

Control and Software Design

通过TargetLink设计控制器模型

Simulink®模块库提供了所有必要的规格特点,能够有效处理仿真任务。然而,每个模块都需要更多的信息以进行代码生成。例如,在定点仿真时,模块需要额外的功能。因此,TargetLink自带TargetLink Block Library,其为每个支持的Simulink模块提供模块。

TargetLink模块对话框可用于录入用于实现的特定信息,如:数据类型,变量名,缩放数据等等。

TargetLink模块极大地提高了所支持Simulink模块的功能,并具有一个扩展的会话框,能让您输入特定于实现的信息,其在代码生成中必不可少。每个模块也提供了数据记录和溢出检测方法。通过将Simulink模块升级至TargetLink模块,一个专门的程序能够利用TargetLink使得Simulink模型为代码生成做好准备。因此,该模型可用于产品级代码生成以及面向目标旁路。

如果您需要改变一个大型模型的属性,TargetLink的图形化工具Property Manager能够帮助您手动更改模块会话框中的属性。它显示您的模型中TargetLink模块和Stateflow对象的属性,并能让您同时查看,过滤,调整数个属性。

Built-In Verification and Validation Support

测试的三种仿真模式

虽然代码生成器产生的结果几乎完美,但是与手动编程相比,生成的代码和基础规格仍然需要进行测试。TargetLink提供了功能强大而简单易用的方法来验证所生成的代码。执行代码测试的开发环境与指定基础仿真模型所处的开发环境相同。当仿真结果相匹配的时候可获得功能上的一致性。Targetlink提供三步验证过程,只需按下按钮即可显示规格(模型)和实现(生成的代码)的功能是否相同。

模型在环仿真 记录下的数据可以作为仿真模型的参考依据。所选模块和状态变量的信号由TargetLink自动记录。
模型在环仿真捕获模型的特定行为,随后使用C代码实现该行为。记录下的信号图将作为后续验证步骤的参考。
模型在环仿真也可以用于检测整型变量的溢出,获得的结果可用于基于仿真的自动缩放。
软件在环仿真 代码生成之后可替代仿真模型中的控制器模块(例如相同的被控对象和激励信号)。TargetLink能够在背景中自动执行这些任务。
您仍然可以看到控制器模块,虽然它是在上位机上执行的代码。信号图应该与模型在环仿真的结果大致相仿。若出现并不相仿的情况,则需对它们进行分析,了解产生偏差的原因并调整定点设置。
处理器在环仿真 生成的代码在嵌入式处理器上运行,但是即使在上位机上正确运行的代码也会出现问题,所以必须进行进一步观察。
将一个现成的评估板卡连接到上位机上,通过目标编译器对生成的代码进行编译,并下载到评估板卡上。
Targetlink对上位机与评估板卡之间的通信进行管理。所有这些活动都是自动化的,无需用户介入。只需两次点击即可在评估板卡上进行仿真。
TargetLink执行三种不同的仿真模式时,没有对模型或生成的代码进行任何更改。TargetLink能够在背景中自动执行这些任务。

仿真概念的特点和优势

特点 描述 优势
只需点击一下按钮,即可进行MIL/SIL/PIL仿真 只需点击一下,即可从MIL切换到SIL或PIL仿真 强大的仿真环境
不需要单独的测试模型、生成S函数或手动插入到测试工具模型中
集成数据记录 为所有仿真模式提供内置数据记录和结果绘制 无需修改模型
可用于所有仿真模式
直接比较MIL/SIL/PIL结果 自动在相同的绘图窗口绘制所有仿真结果 直接显示不同模式下的仿真结果并分析偏差
直接反馈代码是否匹配模型仿真
详细的信号分析和偏差绘图 缩放信号以可视化直接检查偏差、显示限制(例如,指定范围)、使用光标浏览信号历史记录、以数字方式显示信号值或绘制信号偏差 获取信号行为的清晰图像
对于从浮点转换为定点起了很大作用
集成数据记录和绘图 内置的TargetLink模块自带综合数据记录功能。您可以在模块对话框中指定是否记录模块输出信号。
用于分析代码的运行时间分析 也可以使用处理器在环 (PIL) 仿真来分析生成的代码。在PIL仿真期间,TargetLink直接在目标处理器上自动测量执行时间和堆栈消耗。
代码覆盖率分析 您可以使用代码覆盖率分析来评估测试的全面程度。TargetLink提供C0和C1覆盖率分析,也称为语句覆盖率和判定覆盖率。
模型代码可追溯性 为了提高可追溯性和简化代码审查,可选择以HTML格式生成代码文件,并使用超链接在模型导航和代码之间进行导航。

Excellent Code Properties

High Code Efficiency


Regardless of the application type (fixed-point or floating point), TargetLink generates highly efficient production code for your embedded system. Multiple scaling properties give ample choices to fine-tune fixed-point code to the conflicting requirements of low execution time, high computational precision, and overflow avoidance. If an overflow occurs, TargetLink’s overflow detection shows the exact location in the block diagram. The problem can be corrected right away.  

Dialogs to carry out automatic scaling.

Scaling Variables


To shorten the time-consuming and error-prone manual scaling process, TargetLink provides an Autoscaling Tool. It supports you in finding suitable ranges and calculating appropriate scaling parameters. A scaling task that took days and weeks in the past can now be done in minutes and hours. 

As a scaling method, TargetLink offers the two-coefficient linear scaling, which is widely used in embedded control applications. The properties for specifying fixed-point scalings in TargetLink are:

  • Data type
  • Power-of-two scaling factor or arbitrary scaling factor
  • Offset value
  • Constraint values
  • Bit safety margins
  • Saturation options


While fixed-point scaling can be done manually by a software engineer, in most instances it is left to TargetLink’s autoscaling tools. Two autoscaling procedures are available:

  • Simulation-based autoscaling – benefit from maximum computational precision
  • Worst-case autoscaling – no plant model required and overflows automatically prevented
     

Moreover, TargetLink also supports scaling with scaling formulas and type definitions.

Powerful Code Optimization


TargetLink generates highly optimized ANSI C code that is just as efficient as optimized handwritten code. This is achieved by various optimization techniques, such as standard optimization techniques that are also used by modern C compilers. TargetLink’s interblock optimization gives the generated code a human touch, because it combines code in a very similar way to what a skilled software engineer would do. For more complex blocks, TargetLink uses code from an internal code pattern library during the code generation process, ensuring that the code for complex blocks is also highly efficient.  

TargetLink的更多验证特点

Feature Description
  • Integrated data logging and plotting
  • Built-in TargetLink blocks come with an integrated data logging functionality. In the block dialogs, you can specify whether to log the block output signals.
  • Run-time analysis for profiling the code
  • Processor-in-the-loop (PIL) simulation can also be used to profile the generated code. During PIL simulation, TargetLink automatically measures execution time and stack consumption directly on the target processor.
  • Code coverage analysis
  • You can assess how comprehensive tests are by using code coverage analysis. TargetLink offers C0 and C1 coverage analysis, also called statement coverage and decision coverage.
  • Model-code traceability
  • For improved traceability and simplified code reviews, code files can optionally be generated in HTML format, with hyperlinks for navigation from model to code and vice versa.

关于TargetLink的更多信息

推动创新进程。我们始终在技术开发的最前沿。

欢迎订阅我们简讯,了解我们的专业技术以及产品。希望我们的成功案例能够对您有所帮助。快速了解仿真和验证的最新信息。欢迎订阅/管理dSPACE简讯和dSPACE航空速报。

Enable form call

At this point, an input form from Click Dimensions is integrated. This enables us to process your newsletter subscription. The form is currently hidden due to your privacy settings for our website.

External input form

By activating the input form, you consent to personal data being transmitted to Click Dimensions within the EU, in the USA, Canada or Australia. More on this in our privacy policy.