01-04-2021 10:04 AM
I am trying to implement a state-space model with feedback. The model has no direct feed-through component, so it works fine, at first. However, when I try to move some blocks to a subVI, all of a sudden it detects a cycle, and won't run.
Below, you can see that the single state-space on its own works fine, but the subVI containing an identical block doesn't:
Contents of ss.vi:
Is there no way to avoid this? (other than just keeping everything in one VI, obviously).
01-04-2021 12:38 PM
I've not used control and simulation loops before, nor state-space models, but typically in LabVIEW if you want to do this you either use a feedback node or shift registers. Can you try one of those?
01-04-2021 06:34 PM
Hi Kyle,
Yes, adding a feedback node removes the error, but it also changes the behavior of the VI. The controller that I'm implementing is designed to be run without a delay in the feedback loop.
As far as I'm aware, the Control & Simulation loop does not support shift registers, but I believe the same problem would arise, anyway.
01-05-2021 11:34 AM - edited 01-05-2021 11:35 AM
Put a loop inside of your vi. Add a shift register to that loop. Do not initialize the shift register and it should act like you want. You could then add the ability to reinitialize the vi and make it more complicated. Make the loop execute one time then exit
01-05-2021 04:26 PM
Hi Tim,
Something like this?
I wasn't aware that shift registers worked like that. I thought it stored the value from the previous loop iteration. I'll have to investigate further.
Thanks.
01-06-2021 07:47 AM
I would put the loop inside of your vi. but that is the right thought. Here are some examples of what I am talking about. You can see how we progress from simple to more advanced as I move through the examples. You choose the version you want then you add the terminals to the vi and save it. From there you place this vi where you need to use it.