このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
Data Transfer Representation and Processing
What Is a Data Transfer?
A data transfer occurs between blocks that represent callable functions and are connected by and exchange data over a signal line. How a data transfer is represented in a model depends on whether the model is a rate-based or export-function model and, if the model is rate based, whether the connected blocks use the same sample rate. Single-rate data transfers and data transfers between exported functions are represented as a signal line that connects the functions.
This figure shows a single-rate data transfer between function-call subsystems. Both function-call subsystems are configured to use a sample rate of 1.0 second.
Multirate data transfers are data transfers between function blocks that are configured to use different sample rates. They are represented by a Rate Transition block that Simulink® inserts for you or that you insert manually on the signal line that connects the function blocks.
This figure shows a multirate data transfer between function-call subsystems. One function-call subsystem is configured to use a sample rate of 1.0 second and the other function-call subsystem is configured to use a sample rate of 2.0 seconds.
Data Transfer Considerations
When designing a multirate model, for each data transfer consider the importance of:
Data integrity
Determinism
Latency
Memory usage
Data Integrity
The data integrity of a data transfer concerns the accuracy, consistency, and completeness of data during transfer and processing. Data integrity can be problematic when the input to a block changes during the execution of that block and when preemption occurs.
Consider this sample scenario:
A faster block supplies input to a slower block.
The slower block reads an input value V1 from the faster block and begins computations using that value.
Another execution of the faster block preempts the computations of the slower block and computes a new output value.
A data integrity problem arises when the slower block resumes execution. The slower block continues its computations, using the new input value V2.
This type of data transfer is unprotected. Fast-to-Slow Periodic Rate Transitions During Generated Code Execution shows an unprotected data transfer.
For a protected data transfer, the output V1 of the faster block is held until the slower block finishes executing.
Determinism
A data transfer is deterministic if the timing of the transfer is completely predictable given the:
Availability of data
Sample rates of the connected blocks
Time at which the output signal destination block of the data transfer begins execution relative to when the input signal source block of the data transfer ends execution.
Latency
Latency of a data transfer is the time delay for the data being transferred to reach the receiving block. Depending on your application requirements, you might need to favor minimizing data transfer latency over data integrity and determinism.
Memory Usage
Memory usage is another consideration that you might need to trade off for data transfers that involve rate transitions. Depending on your application requirements, you might need to favor minimizing memory usage for data transfers over data integrity and determinism.
Code Generation Data Transfer Assumptions
When producing code for data transfers between tasks, the code generator makes these assumptions:
Data transfers occur between a single reading task and a single writing task.
A read or write of a byte-sized variable is atomic.
When two tasks interact through a data transfer, only one of them can preempt the other. If you deploy the tasks to a multicore target system, the two tasks can execute concurrently.
For periodic tasks, the faster rate task has higher priority than the slower rate task and preempts the slower rate task.
Tasks run on a single processor. Time slicing is not allowed.
Processes do not crash or restart (especially while data is transferred between tasks).
Make sure that your model, code, and target environment align with these assumptions.
Data Transfer Limitations
Rate Transition blocks are not supported in export-function models that are configured to use a service code interface.
The code generator does not separate the code and data for Rate Transition blocks that connect to variable-size signals or are inside of a For Each Subsystem block.