Hi i've been working on a large project for a few month now. The program is going to read 16 analog inputs and 7 digital inputs from a cRIO 9012 a . TPC 2512 touchscreen will be used to interface with the cRIO. As soon as the program starts it records 1 sample a second from each input and stores each in a separate array. When a user specified threshold is crossed from any of the inputs it takes the previous array and appends each to a different array. Now I need it to collect at least 100 samples/sec but i am only getting around 30. The program has become quite large and the processor on the touchpanel cannot handle collecting all of that data that fast. I am trying to make the program more efficient by only executing certain things when they are needed but its not enough. I was wondering if I took all the separate arrays and made 1 2D array would be any faster.
Solved! Go to Solution.
Could you re-post in 2009?
I have a feeling that this might be something to do with the way you are building and handling your arrays, without seeing the code i cannot be sure. go here. If you follow the link it will take you to a post where the handling of arrays became very slow due to how they where being built. After modifying the code the speed was made 1.5 Million times faster! Might be similar to the issue you are seeing.
Are you using 'Build Array' function when building your arrays? If you are there may be a more efficient way of doing it.
I will have to repost it tomorrow morning because I don't have access to my work computer at the moment but I am using the insert into array function for everything. I will repost early tomorrow
but I am using the insert into array function for everything
That will be your problem, everytime you do this you are re-sizing your array, this is very inefficient and will slow down your app the larger the array gets. If you can it is better to calculate the maximum array size you will need, use 'Initialise Array', to build an array of this size and then use 'Replace array subset'. This way you are creating an array once and writing to it, the way you are doing it you are basically creating a new array with every write.
Here is my project resaved for 2009. It is under the pumpmonitoringdevice folder. The project is the same name. The VI I am having troubles with is Analog Input (Host)clean. Before you say anything I know the diagram is huge and I am working on that too haha.
Its still in 2010, i have this problem a lot too. You need to make sure that you dont make any adjustments to the converted files. If you save then they will save back to your version.
Ok, now recieved. Is late at night here where i live. Will take a look tomorrow.
Ok I will start changing everything to replace subset and tomorrow you can let me know your thoughts. Thanks for your help
Ok well I started porting over replace array subset instead of insert into array but I am having trouble getting the program to insert into the right indexes. When a input triger is crossed it adds the previous 10 samples for each input only once then adds a sample every 10 ms to the array. How do I update the index that fast without adding another loop which will slow the program down?