MATLAB: Do I get a data-dependency violation when using triggered subsystems inside the model in Simulink 7.2 (R2008b)

buschart;datadependencyeventfunction callloopnon-virtualsimulinkstateflowviolationvirtual

I have a Stateflow chart and a function-call subsystem in a loop inside my model (see attached model test_02.mdl). I understand that this may cause data-dependency violation as shown in documentation examples such as sl_subsys_fcncallerr4.mdl. However in my model, I am only using bus creator and bus-selector blocks in the loop. I would like to know why I get a data-dependency violation when simulating this model.
Please load the attached mat file, structForSim.mat and simulate the model.

Best Answer

The issue with this model is that the Bus Creator block is trying to combine a non-virtual bus and the function-call signal into a single bus. To accomplish this bus hierarchy, the bus-creator has to convert the non-virtual bus to a virtual bus by inserting a hidden Signal Conversion block. This operation causes Simulink to fail to resolve the data dependency in the loop, an issue similar to the one observed with the model sl_subsys_fcncallerr4.mdl.
The workaround for model test2.mdl is implemented in attached model test4.mdl and consists in avoiding signal operations between the Stateflow Chart and the Triggered Subsystem. This means the two following modifications:
1. Keep the non-virtual bus and the function-call event as separate lines in the model. These signals are not meant to be combined.
2. Place the Bus Selector block inside the Triggered subsystem, for the reasons explained in demo model sl_subsys_fcncallerr4.mdl.