LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High speed independent event loops?


@altenbach wrote:

Mystogan wrote:

But I need more information from you guys with more experiences.

I would like to generate signals continuously using NI PXI cards, analog and digital signals (starting together at the same time, snychronized).

And then I would like to acquire signals using another NI PXI card (anytime I want, when I click "ACQUIRE" button).

I could generate and acquire signals using 2 vi's (not joined into 1 vi). 

 

And I now need to put them together into 1 vi.

Can I use these 2 event loops which running parallel to achieve my goal?

I'm generating 40 MHz sample clock and need to acquire with 40MS/s speed, saving into TDMS file, would it be problematic?



OK, this is not clear at all. Obviously, the "continuously" part does not need an event structure, because it runs always.

That leave the "acquire" command by the user. Why do you need two VIs for that?

*At the beginning I used 2 VI's to generate and acquire, where the user generates the signal when he click RUN the Signal Generation vi, and then acquires the signal when he click RUN the Signal Acquisition (Fetch Forever vi). But now, I need them to be able to run in 1 VI only, thats why I came up to the idea of using Parallel events.  
 

What kind of disk hardware do you have?

 

*Like I said in my earlier post, normal Harddisk 😞 (I'll ask to get SSD harddisk later).


@Mystogan wrote:

I tried to put them together without event structure, but doesn't work.


In what way doesn't it work without the event structure? Such a statement needs mouch more detail, because there are millions of possible ways to "not work".

 

*Maybe I have said it in earlier reply to Norbert or the other reply, when the signal continuously generated in while loop of signal generation (where the "Is Task Done?" take place), the while loop of Fetch Forever running only 1x (I'm not sure how to connect the error lines, I put them parallel in 1 vi). 


Best regards,

Yan.

0 Kudos
Message 11 of 43
(1,048 Views)

@altenbach wrote:

@Mark_Yedinak wrote:

IEven though there were very few shared events I got strange behaviour. If you do need to use multiple event structure I recommend that you limit them to one per VI. I had no problems calling multiple subVIs in parallel, each containing an event structure, from a single top level VI.



Can you define "strange behavior". I've never run into any problems.


I'm assuming, running multiple events in 1 VI should be okay?

 

Best regards,

Yan.

0 Kudos
Message 12 of 43
(1,047 Views)

Any tut/example code to start 2 events using another 1 event?

I've implemented 2 events:

- generating digital signals

- generating analog signals

and I need an event where I can start them both at the same time (but still have the freedom to start them individually).

 

Regards,

Yan.

0 Kudos
Message 13 of 43
(1,046 Views)

Yan,

 

the error you mention in your first paragraph does not refer to the speed of the disk. It just tells you that the buffer in virtual memory is overflowing, hence you have to

- fetch more data per iteration

- reduce cycle time for fetching.

 

Regarding that 16bit per value: The device samples with 12bits, but 12 bits do not compute on modern CPU architecture. Therefore, it must be more (8bits would lose resolution!), but more than 16 does not make sense, does it?

 

Steps for further autodidactic training:

1. Run an example for continuous streaming of NI Scope data to HD. Configure it for the desired parameters and run it as long as your measurements have to run in the future.

2. If step 1. works out fine: Search for a DO example. If this runs fine as well, run both examples in parallel.

3. Open and run an example for AO. Perform as step 2.

You should still have three different VIs!

4. If all works fine, create a VI above those three VIs to call them all. Still, it should work fine.

5. Train yourself for synchronizing those devices (scope, HSDIO, AO) regarding trigger/clock.

6. Implement what you learned. It should still work. 

7. Rework the caller of the examples to be a producer consumer. The consumer has to make sure that the three "devices" are handled properly for starting and stopping. You will require advanced communication techniques for being successfull here. Nothing for LV newcomers! 

 

Because of this, i would rather suggest you to consult your supervisor and talk about your difficulties. You have some serious gaps in required knowledge, which must be filled before you can develop/implement a professional solution. Training this autodidactic is a very hard thing and i know only few being capable of this.

So if you have no one in your company able to train you, you/your supervisor should contact the local NI branch and ask for a training. This will cost you a bit, but probable less than a half baked, half working solution.....

 

Dont get me wrong: you have a good approach to use examples and ask the community here for help. But it seems to me that a detailed training on the basics of AI, AO and DO would enable you to create a solution on your own, maybe even at a faster pace than by asking again and again in this forum....

 

Norbert 

 

EDIT: If you find any errors during my suggested steps for training coming from the system, it might indicate that the system is not capable of solving the requirements. But it could also indicate wrong/insufficient programming. Helping you in this forum will be very hard, because we don't see the behavior of the system.... 

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 14 of 43
(1,041 Views)

Yes, lots of different events in a single event structure in a VI is no problem. I only had problems when I had three event structures in a single VI with a couple of events that were shared. It appears that the event processing only keeps track of events for a VI, not each event structure. If there was a shared event, such as an Exit event, only one, and rarely two, of the events structures would fire. Put th elops into a subVI (no other code changes) and all of the event structures would get the event.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 15 of 43
(1,025 Views)

Yan, you don't need the frame structure. Let data flow control the execution order. From what can be seen in the picture you have data dependencies and the order of execution will be correct. Also, you can eliminate the endless nested case structures. Take all of your conditions and build them into a Boolean array. Turn th earray into a number and then use that to select your desired case. It is much easier to expand this and tends to be easier to see what is happening. Array[0] will be bit 1 of the number.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 16 of 43
(1,023 Views)

hi Norbert,

thanks alot for your great comments to my thread.

 

Responding to those comments, I'd like to share my condition here.

I'm doing my project in university, and I can say, that my supervisor doesnt help me much with my programming in Labview, since he didnt learn much about Labview. (at the beginning he told me, it wouldn't be complicated)

I'm pretty much doing this project with Trial&Error steps, where I should do this and that, and asking forum or emailing the local branch about some basic programming problems.

I've seen much examples in Labview and example codes in this forum. But still, without a decent help from the expert, I would say, I often feel like I'm running into my destination without knowing where I am right know, and what should I do next to reach my destination. I dont get paid here for this project, thus I dont think they would give me training by local NI branch. Thats why I often asking some pretty basic question that I dont find the answer anywhere.

 

I've asked few times through emails the local NI branch about my problems, some of them would be nice answered, some of them not. I know, its hard to help someone like me with little knowledge about Labview. Sometimes I feel like an elementary school student, asking the NI engineer something big, then they came up with idea to give me another basic example for me to learn. Thats why, I think the best help I got this far is through this forum.  

 

But I dont think its time for me to give up (I had those feeling few times). I'd just keep asking and asking the forum and engineer. I'm doing your steps (1st-3rd) alot, but not the 4-5th steps.


Norbert_B wrote:

Yan,

 

the error you mention in your first paragraph does not refer to the speed of the disk. It just tells you that the buffer in virtual memory is overflowing, hence you have to

- fetch more data per iteration

- reduce cycle time for fetching.

 

Regarding that 16bit per value: The device samples with 12bits, but 12 bits do not compute on modern CPU architecture. Therefore, it must be more (8bits would lose resolution!), but more than 16 does not make sense, does it?

 

Steps for further autodidactic training:

1. Run an example for continuous streaming of NI Scope data to HD. Configure it for the desired parameters and run it as long as your measurements have to run in the future.

2. If step 1. works out fine: Search for a DO example. If this runs fine as well, run both examples in parallel.

3. Open and run an example for AO. Perform as step 2.

You should still have three different VIs!

4. If all works fine, create a VI above those three VIs to call them all. Still, it should work fine.

5. Train yourself for synchronizing those devices (scope, HSDIO, AO) regarding trigger/clock.

6. Implement what you learned. It should still work. 

7. Rework the caller of the examples to be a producer consumer. The consumer has to make sure that the three "devices" are handled properly for starting and stopping. You will require advanced communication techniques for being successfull here. Nothing for LV newcomers! 

 

Because of this, i would rather suggest you to consult your supervisor and talk about your difficulties. You have some serious gaps in required knowledge, which must be filled before you can develop/implement a professional solution. Training this autodidactic is a very hard thing and i know only few being capable of this.

So if you have no one in your company able to train you, you/your supervisor should contact the local NI branch and ask for a training. This will cost you a bit, but probable less than a half baked, half working solution.....

 

Dont get me wrong: you have a good approach to use examples and ask the community here for help. But it seems to me that a detailed training on the basics of AI, AO and DO would enable you to create a solution on your own, maybe even at a faster pace than by asking again and again in this forum....

 

Norbert 

 

EDIT: If you find any errors during my suggested steps for training coming from the system, it might indicate that the system is not capable of solving the requirements. But it could also indicate wrong/insufficient programming. Helping you in this forum will be very hard, because we don't see the behavior of the system.... 

 

*yeah, the biggest thing I couldnt understand until now: PXI 5105 is a 12Bit, 60MS/s Digitizer. But somehow I couldnt use these basic examples:

- niScope EX Fetch Forever

- niScope EX Stream to Disk

for sampling speed more than 30MS/s. I've asked someone (another student) who finished his project already (we are using the same cards, but hes not using 6544) and he told me that he couldnt sample more than 30MS/s either.


Above all, thanks alot for your awesome answers.

 

Regards,

Yan.

0 Kudos
Message 17 of 43
(993 Views)

Yan,

 

i dont understand why fetch forever does have the same limitation as the streaming example since it would indicate, that it is not the HD which is the bottleneck.

Nevertheless, it doesnt surprise me that you are running into some kind of bottleneck...

 

Main question for now is:

Is 30MS/s sufficient for the requirements or not?

 

If it is, you should proceed looking into the other examples and running them in parallel. If not, there is maybe little room for improvement, but still you will run from bottleneck to bottleneck..... 

 

Depending on the university you are working for, it is possible that there is some kind of academic program in place with NI. This could result in a good discount for professional services and educational stuff.

You should contact your local NI branch and try to talk to persons in the "Academic team" there. Possibly they can work out a deal with you, your university and NI to make you successfull. 

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 18 of 43
(991 Views)

@Norbert_B wrote:

Yan,

 

i dont understand why fetch forever does have the same limitation as the streaming example since it would indicate, that it is not the HD which is the bottleneck.

Nevertheless, it doesnt surprise me that you are running into some kind of bottleneck...

*I could use the testpanel of PXI 5105 in MAX and sampling signals there with 60MS/s sample rate. But testing with those 2 programs (without any edit) would give me the same error over and over again. Is there any possibility anywhere to see the code for Testpanel in MAX?  

 

Main question for now is:

Is 30MS/s sufficient for the requirements or not?

* Nope, my supervisor wants me to sample the signals with 40MS/s.

 

If it is, you should proceed looking into the other examples and running them in parallel. If not, there is maybe little room for improvement, but still you will run from bottleneck to bottleneck..... 

 

Depending on the university you are working for, it is possible that there is some kind of academic program in place with NI. This could result in a good discount for professional services and educational stuff.

You should contact your local NI branch and try to talk to persons in the "Academic team" there. Possibly they can work out a deal with you, your university and NI to make you successfull. 

*I could see there is a lecture about Labview basic here 1x in winter. And I've found there is a small cooperation between my Uni and NI. I think I'll go asking the person in my Uni later.

 

Norbert 


Regards,

Yan.

0 Kudos
Message 19 of 43
(988 Views)

Yan,

 

no, the sources for the MAX testpanel is not published. But one thing you should check:

Are there any settings different for the testpanel and your example?

 

If increasing the acquisition rate: What kind of error do you get?

If it's buffer overflow, you have to modify the example to split up acquisition and display because it's the read function, which is called too infrequently for keeping the buffer at a decent level....

 

Keyword would be "producer/consumer" for a possible modification.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 20 of 43
(984 Views)