Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66855

local variable and control & simulation loop, variable updates

$
0
0

Hi,

 

I am using local variable in my discrete system( creating a while loop ouside the control & simulation loop, as shown in the attachment). I use the  control & simulation loop to simulate my state space model and set output(k) as local variable and use it in the while loop.

 

I am trying to do following: excute the state space model at instant k and send the output(k) to while loop, by some logic part, I get the decision from this while loop, and finally feed the decision back to the orginal control & simulation loop.

 

My problem is, I don't know how to get these variables update properly. For example, in my program, when I run it first time, it shows bad result, however, when I run it a second time, it shows the favorable result(as in the attachment). That result is extremely weird. It seems there is something left in the memory after first running.

 

I tried to do following: assign different processors to these two loops so they can run parallel; and try to add some offset to the while loop (because it seems that the simulation loop is more demanding). However, my problem is not solved. Does anyone know where did I go wrong? Appreciate any kind help.


Viewing all articles
Browse latest Browse all 66855

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>