01-31-2016 05:08 AM - edited 01-31-2016 05:34 AM
Hello, I've created a program which gets one row of 20 elements per second ( it's just a part of the bigger program ). I want to fill the array up to 20 rows ( 20 rows = 20 seconds, it works like timer ) and then make the program to overwrite this array, starting from the beginning. When it overwrites the row, it also subtracts the new elements of the row from the old row which gets overwritten. The thing is it works fine while in a loop with a shift register. My bigger program got one loop already so I cannot put the second loop in the main one. That means also that I can't implement the shift register because i got no second loop, and making this register on the main one doesn't really do the trick.
Should I use the producer/consumer structure ? I tried but I cannot get this working.
I attach the vi, the core is inside the loop, the rest is just for simulation purpose.
Kind regards
01-31-2016 06:18 AM
I just change a bit your code test if it is what you want
01-31-2016 06:21 AM
You can have a single sub-vi with a "one cycle only" while loop or a for-loop with a N of 1.
This Subvi has the shiftregister un-initializes ( not connected on the left side ) but does have a 1d array input.
Each call to this vi you add / replace a block of data, and the only place that has the large memory allocated is this subvi.
01-31-2016 09:59 AM - edited 01-31-2016 10:11 AM
Hi
@Hatef : Thanks for improving this code but I don't see the difference in working 😞
@mr_builder : I don't get that correctly, I tried making a subvi but it still prevents the main loop from working. Is there a special option to create a type of subvi that you mentioned ?
I hope that you still got it in mind that it's just a part of the big program.
01-31-2016 11:28 AM
@Galjuntur wrote:My bigger program got one loop already so I cannot put the second loop in the main one. That means also that I can't implement the shift register because i got no second loop, and making this register on the main one doesn't really do the trick.
Then show us the bigger code. We don't want to solve a problem that does not apply to the given example.
Is there any reason your code is polluted with dynamic data for no good reason at all? This is plain silly! You apparently use it to get one element of the size(s) array. All you need is use "index array" before quotient&remainder and do the rest of the operations on scalars.
If you have an outer loop, you can place the shift register it the outer loop instead, right?
And I agree that this should get wrapped into a subVI with an uninitialized shift regsiter or feedback node. Have a look inside the ptbypt VIs for some ideas.
01-31-2016 11:54 AM - edited 01-31-2016 12:03 PM
As you said, I attached the whole vi code. Part of the program was created by sprzysta.
The only good reason for pollution with ddt is that I'm not experienced so I make my code in the simplest way. I noticed that I cannot put a block of write to a measurement file at the output array.
I tried to make a shift register on the outter loop but then I got the feedback node. Even though, the program still doesn't work properly.
Regards
Gal
BTW I guess that if I got cjc constant ( room 20 degC ) then I apply to a thermoocuple conversion block a constant block with the vlue of 20, right ?
01-31-2016 12:16 PM
@Galjuntur wrote:
The only good reason for pollution with ddt is that I'm not experienced so I make my code in the simplest way.
Dynamic data never makes anything simpler. (see also here)
I'll have a look at your new attachment....
01-31-2016 01:21 PM - edited 01-31-2016 01:21 PM
Here's a quick draft. I assume that each row contains 20 elements and that there are 3600 rows.
(I took the liberty to simplify a few other things. Modify as needed).
Let me know if you have any questions.
01-31-2016 01:49 PM - edited 01-31-2016 01:54 PM
Right, this looks a lot cleaner than it used to. I got only three questions but they don't apply to the program mechanics which is clear. I hope you won't mind answering them.
1) As I asked before, if I want to put a stable constant temperature of for example 20 degC, should I add a constant with that value to the conversion block or should I convert somehow this temperature to get a voltage value and then add it ?
2) As you noticed, I got two graphs (charts). Which one in your opinion shows more accurate values ? Because the data presented is a bit different from each other.
3) iIs there an option which will allow me to see only the currently changing row ? To see the actual values and not all.
Big Thanks for helping with getting rid of ddt.
01-31-2016 02:14 PM