- The "Pulse type" is set to "Sample based" and the sample time for the block is set to the fundamental rate of the system (in the case of "multirateExampleUpdated.mdl", this is 0.1 seconds).
- The pulse width is set to 1, so that the pulse is only active on the first sample time when the data is fresh.
- The "period" is set to:
How can I tell which blocks in my multirate model have been updated at the current time step in the generated code?
I have a model with various subsystems operating at different sample times. After generating code, I see that all outport data, regardless of sample period, is assigned to the one "ExtY_multirateExample_T" structure:
// External outputs (root outports fed by signals with default storage)
struct ExtY_multirateExample_T {
real_T LoRateOutport; // '<Root>/LoRateOutport'
real_T HighRateOutport; // '<Root>/HighRateOutport'
real_T BaseRateOutport; // '<Root>/BaseRateOutport'
real_T output_1hz; // '<Root>/output_1hz'
};
We have not yet finalized the sample times in our model, so we would like a flexible way for our test harness to know when to read new data.
1) Is there a recommended strategy to add some sort of flag/pulse in the generated code that would indicate when a certain subsystem's data is fresh (not stale)? This would indicate when a subrate's data (and its associated subsystem) gets fresh information written to it at that model step.
2) Is there a way to assign outport data of different sample periods to separate output data structures?
Risposta accettata
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!