Why do I receive sample time error when assigning bus element in a constant virtual bus, when trying to compile an FMU?
3 次查看(过去 30 天)
显示 更早的评论
I am getting a sample time error when trying to compile a FMU from a simulink model in which I assign signals in a bus (inf sample time) with signals from other sample times.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610136/image.png)
Above is the rough setup I would like to use (typically part of a proper, larger model). I have used this pattern in previous projects for the last two years and this error never occured. I looked at the past projects, but didn't find any obvious differences which should produce this error now.
I figured that setting all inputs to the bus assignment block resolves the issue:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610141/image.png)
However this is very inconvenient, as our bus structures get pretty big, and taking care of all sample times for all Constant signals assigned is quite some extra work (especially since it successfully worked before without matching all sample times).
Setting only one of the constants to the proper sample times does not work either:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610146/image.png)
Especially in this case, where the bus has the "correc" sample time, I would expect simulink to be fine with it.
Note: I have tried the 3 different settings for "Automatically handle rate transition for data transfer" and they do not chang the results of this.
But there is an easy "fix" for this problem:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610151/image.png)
If I connect an outport block to the not-rate-trasitioned-signal, it works again and gets compiled.
In fact, this works in the bigger model as well, but obviously I do not want to output an unnecessary amount of large bus structures.
Can someone explain me what the underlying issue is here and why it is solved by adding the output port?
Furthermore: How can I keep my original pattern (first picture, with no sample times set in the constant blocks)? This would make development a lot easier, than setting the sample times in all the constant blocks.
2 个评论
回答(1 个)
Lucian
2024-5-15
I had a similar problem.
In my case the fix was to change the sample time of the constant blocks from inf to -1
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dependency Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!