Variant subystems with mixed discrete/continuous?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to use a variant subsystem to switch between a continuous block and a discrete block - a derivative block and a difference block, respectively. When the variant is set to the derivative block, the diagram will be used to run a simulation directly. When the variant is set to the difference block, the diagram will be used to generate code.
In principle, this should work, since only one variant is active at a time. When I generate code, I want the continuous variant to be left out completely, as it will be inactive. However, when I try to generate code, it complains that there are continuous states, so it can't (presumably because the derivative block is still there, even though it is inactive.) Is there some way that I can configure it to completely ignore non-active blocks, depending on how my variants are set?
2 Kommentare
Azzi Abdelmalek
am 11 Aug. 2012
Bearbeitet: Azzi Abdelmalek
am 11 Aug. 2012
what do you mean to generate code?
Antworten (2)
Guy Rouleau
am 13 Aug. 2012
I would be surprised if this is because of the derivative block. Usually, inactive variant should completely disappear.
- Ensure the option "Generate preprocessor conditional" is disabled. Otherwise both variants will be present... this is the only reason I know for 2 variants to be present.
- Use sample time colors or Simulink.BlockDiagram.getInitialState to identify which block has continuous state in your model.
Siehe auch
Kategorien
Mehr zu Subsystems finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!