控制器可执行的规范模型。
Exported Function-Calls Scheduler controls execution timing of application Subsystems:
执行应用调度时序子系统导出函数调度控制
In general, execution of a Function-Call Subsystem is controlled by a Function-Call Generator or a Stateflow Event. Especially, Stateflow allows users to design a complex scheduler system. In ECRobot NXT, an alternative approach is introduced to control the execution timing using Function-Call Subsystems.
在一般情况下,执行函数调用子系统控制由函数调用发生器或Stateflow事件控制。尤其是,Stateflow允许用户设计复杂的调度系统。在ECRobot NXT,另一种方法是介绍使用函数调用子系统控制的执行时机。
Exported Function-Calls Scheduler block is a C MEX S-Function based custom block. It provides a Block Parameters dialog to specify the necessary information for controlling the execution timing of Function-Call Subsystems. Since R2006a, Simulink and Real-Time Workshop Embedded Coder have provided an „Exporting Function-Call Subsystem code generation‟ feature that enables one to generate highly efficient void-void C functions from Function-Call Subsystems.
导出的函数调用调度模块是C MEX S函数的自定义块。它提供了模块的参数“对话框,指定必要的参数信息完成控制函数调用子系统的执行时机。自R2006a,Simulink和Real-Time嵌入式编码器提供了“导出函数调用子系统的代码生成”功能,从而可以由函数调用子系统产生高效void-void模型的C函数。
Inter Function-Call Subsystems communication via Data Store Read/Write blocks:
Function-Call Subsystem is a unique feature in terms of Simulink modeling semantics. In general, execution order of each block in Simulink model is determined by its context (i.e. connection of signal lines). However, Function-Call Subsystem itself has no context for execution timing and the execution is always controlled by its caller (i.e. Stateflow Event). These characteristics sometimes lead to difficulty regarding data transfers between Function-Call Subsystems. For more detailed information, please type the following command in MATLAB command window.
>>sl_subsys_semantics
In the ECRobot NXT demo, inter Function-Call Subsystems communication has to be done by Data Store Read/Write blocks. ECRobot device blocks like Light Sensor Interface/Light Sensor Read blocks are actually masked Data Store Read/Write blocks and the block identifiers are resolved by custom NXT Signal Objects during model update. Use of Data Store Read/Write blocks solves potential issues laid down on Function-Call Subsystems communication. However, there is one thing to be reminded when using Data Store Read/Write block. Data Store Read/Write blocks cut off signal flow between the blocks; therefore, Simulink may determine an unexpected execution order for the blocks, thus users may need to explicitly specify the execution priority for each Data Store Read/Write block in block property dialog.
函数间调用子系统通过数据存储的通信读/写模块:
函数调用子系统是在Simulink建模语义方面的独特功能。一般情况下,在Simulink模型中的每个块的执行顺序取决于它的上下文(即信号线连接)。但是,函数调用子系统本身有没有执行定时的上下文和执行始终是控制它的调用者(即Stateflow的事件)。这些特点,有时会导致函数调用子系统之间的数据传输困难。如需详细资讯,请在MATLAB命令窗口中键入下面的命令。
>> sl_subsys_semantics
在ECRobot NXT的演示,函数调用间子系统通信需要通过数据存储读/写模块完成。实际上封装好的ECRobot例如光传感器接口/光传感器读取的模块设备的模块数据存储读/写模块和模块标识符由NXT的信号对象的模型在更新过程中解决。使用的数据存储读/写模块解决了函数调用子系统通信的潜在问题。然而,数据存储读/写模块保存仅仅是其中一件事情。数据存储读/写模块切断信号在模块之间的流动,因此,可确定的Simulink可以确定模块意想不到的执行顺序,因此,用户可能需要在属性对话框明确指定执行每个数据存储读/写模块优先级。
nxtconfig API for setting configuration parameters:
nxtconfig API is an M function and this API sets all necessary configuration parameters for the ECRobot NXT controller model. This kind of automation is also a significant factor for large scale Model-Based Design process, especially for Production Code Generation use cases using Real-Time Workshop Embedded Coder.
nxtconfig API用于设置配置参数:
nxtconfig API是M函数,这个API集的包含所有ECRobot NXT控制器模型的必要的配置参数。这种自动化技术也是大型的基于模型的设计过程的重要因素,特别是在使用Real-Time的嵌入式编码器作为产品开发的代码生成情况下。
Since the initial release of ECRobot NXT demo, a lot of feedbacks have been received and most of users are in academic area and academic users may want to use more variety types of blocks and floating-point data types. Therefore, ECRobot NXT V3.03 supports not only fixed-point/integer code generation, but also floating-point code generation (both of single and double). nxtconfig API turns off support of „floating-point numbers‟ in Real-Time Workshop option pane, therefore, user needs to turn on this option manually when doing floating-point code generation. TestFloatingPoint.mdl in samples directory is an example of floating-point code generation.
由于ECRobot NXT的最初演示版本,已收到了很多用户反馈,这些用户大多数在学术领域和学术应用的用户可能想使用多种类型的模块和浮点数据类型。因此,ECRobot NXT的V3.03不仅支持定点数据类型/整数的代码生成,而且支持浮点代码生成(single 和double数据类型)。nxtconfig的API不支持Real-Time Workshop选项窗格的“浮点数”的支持,因此,用户需要实现浮点代码生成时需要手动开启这个选项。 TestFloatingPoint.mdl范例目录是浮点代码生成的例子。
ATMEL AT91SAM7S256 (ARM7 CPU core) in the NXT does not have Floating Point Unit and some math function blocks require C math library in the generated code, therefore please remind that floating-point code generation consumes more memory and has less performance compared to fixed-point/integer code generation.
ATMEL公司的AT91SAM7S256在NXT(ARM7 CPU核心)不具备浮点单元,在生成的代码时,部分数学函数功能处理需要C函数库文件支持,因此提醒生成浮点数的代码同定点/整数代码相比较需要消耗更多的内存和更低的性能。