I have a ramp program using NI9178 chassis and ni9263(VO), ni9265(CO) and ni 9481(relay). I have done similar with state machines and envent structure. When I use the AMC to control program flow, the speed of the program seems to suffer. I can't get it to repeat step any faster than about 4 seconds. Any ideas? This is just a ramp that repeats two steps over and over if a zero is entered in the repeat control or it will repeat a certain number of times. It ramps up voltage and current and turns on and off up to four relays.
Solved! Go to Solution.
As far as I can tell, your code seems to be all right, with the exception of your message dequeue VI which seems to have a coersion dot. I'm not sure if that comes from the fact that I do not seem to have the same AMC VIs that you have (I downloaded the first installer here: http://zone.ni.com/devzone/cda/epd/p/id/6091 ), or if there is some sort of real difference, but it is worth noting. My recommendation would be to go through and benchmark the different portions of your code. That is, make sure that the event loop functions at 200 ms, make sure that the main body of your code is executing at the desired rate (defaulting to 3*1000ms/100steps=30 ms), that sort of thing. You can do that with this simple structure:
It would also be a good idea to watch your code with highlight execution, especially that dequeue VI which accepts the messages from the event loop. You might also create a copy of your code, delete all of the code in the middle (all of the actual DAQ I/O) and benchmark that code, comparing results with the version that has your DAQ code.
On the same front, would you mind explaining in more detail the problem you are seeing, as I do not understand what is not happening within the desired time frame. Could you walk us through step by step on what you would do to see the results you are seeing? This would help pinpoint where we need to look to see the problem.
With the simple timing structure I was able to find out that the slow down was in this.
Where the wait was outside the case structure. I moved it inside and the code is now the slow down, but I can deal with that. Not sure why this wasn't working. Anyway thanks for the tip about time each part to figure out the problem.