Cedric Posted November 15, 2006 Report Share Posted November 15, 2006 I created a theoretical transfer function 5/(s Quote Link to comment
Cedric Posted November 16, 2006 Author Report Share Posted November 16, 2006 I tested my program again and found that the problem is a timing issue. When I change the loop delay to 10ms and the dt of H(s) to 10ms (instead of 100ms), the results are very close to those of Simulink. The problem is that these values are impossible to work with on a PIII 900MHz as everything goes in slow motion. Are there solutions to improve speed or a more effective way to make my program behave correctly without having to decrease the loop time? Thanks in advance! Quote Link to comment
ned Posted November 16, 2006 Report Share Posted November 16, 2006 In your VI, the loop time is irrelevant; the reason that your LabVIEW results don't match your Simulink results is because the dt input to H(s) is too large. You are supplying the dt input to H(s) so you'll always get the same results regardless of how fast the loop runs. If your loop time matches your dt, then your code executes in "real time" - at the same rate as an equivalent physical system. However, you probably want to simulate faster than that (as Simulink does), so if you were to make your loop time 1ms, but leave your dt input at 10ms, you'd get your results 10 times as fast as real life. A better approach, though, might be to put your processing into a for loop inside your while loop, as shown in this diagram: Quote Link to comment
Cedric Posted November 16, 2006 Author Report Share Posted November 16, 2006 Your solution is just perfect! The system has to run in "real-time" as it is meant to be a didactic simulation. The problem was that I coupled my precision with my looptime! When I increased my precision, I also decreased my looptime so everything had to run fast. In your solution, only the relay has to run fast while the drawing can run at the standard 100ms rate. Now I can view the system in real-time with a CPU load of 50% Thank you very much for your help! Greetings, Cedric. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.