04-21-2009 03:36 PM
Hi RayR and Ravens Fan
Thanks a lot for posting the sample code Ray. But do you think by using this strategy I can manage everything in just one loop?
I am now looking at the tutorial links given by you.
Meanwhile, if you have any further suggestion to enhance my code, incase you can open the file, please send me.
Will be back with further queries.
Thanks.
04-21-2009 05:21 PM
Vaibhav wrote:But do you think by using this strategy I can manage everything in just one loop?
You only need one consumer loop.
With the Event Structure loop, that gives you 2 loops 😉
There are ways of doing it all within 1 single loop but let's not get into that.. 😄
I will look at the last code that you posted and provide any additional comments or advice.
R
08-08-2009 03:41 PM
Hi Guys!
I am back after a detailed study of LabVIEW programming using a book and the documentation, which gave me insight of many useful stuff. Basically I was challenged by that Producer-Consumer structure, because I had never heard of the state machine, or finite state machine before. Ok, now I have the idea about how it works, but I still need a lot of practice before I can implement my complex system using the state machine.
Ray.R wrote:
Vaibhav wrote:But do you think by using this strategy I can manage everything in just one loop?
You only need one consumer loop.
With the Event Structure loop, that gives you 2 loops 😉
Yes, I was referring to one consumer loop. And yes, everything CAN be done in a single loop, like in the sample StandardStateMachine.zip attached here.
And after learning the state machine and queued message structure, I am still puzzled whether I can implement my system in that or not. Perhaps, it's possible, but the complexity (and the work related to implement) would be far more than the gains. And now I have lost a lot of time during my learning process, so the deadline is almost on my head.
:mansad:
Ok, I am putting my case. You may refer to the VI that I uploaded before. I would mention the steps (or rather specifications in brief) and can you please guide me what can be implemented using the state machine, and whether I need a finite state machine or a queued message structure?
the event flow should be like this
- startup screen/tab
- if the user clicks "Start" then following events
- check internet/datasocket connection with remote server
- show "connect to remote server" screen
- upon selection, show logon screen and eventually the user controls
upto this, can be implemented with the state machine, however, there is another parallel process (which begins ONLY after the "connect to remote server" was selected) and this parallel process runs till the end of the program, in parallel with all the controls (which can be handled in the same way as the above mentioned 5 steps, using the state machine's producer-consumer architecture).
This "another parallel process" is actually analyzing the incoming messges using "Datasocket read" and this messages are handled to provide dat to the remote server, or to communicate with the remote server. And, of course, this process is independent of what controls are manipulated by the user.
I hope till now, things are clear.
So, in order to implement this, I had a Flat Sequence Structure which ensured that in the first place, the network connections are checked and then, after this sequence finishes successfully (without connection failure, or user selecting Exit option), the dataflow goes to a case structure (to check if the connection and exit buttons didn't stop program), in which there are two "while loops" - 1) for tracking the user generated events and 2) for tracing the incoming messages.
I understand that the above mentioned activities inside the Flat Sequence and the "user controls events while loop" inside the case structure, could be implemented in a State Machine. But How Do I Manage Those Incoming Messages (read on a datasocket node parallel to everything)? How Can I Run A Parallel Loop (independent of the State Machine loops)? Can I?
(@Ray.R : that question regarding "everything in one loop" was referring to this situation, i.e., including the tracing of messages activity also in the state machine loop).
Sorry, once again I am with a longggg message. :mantongue: But I needed to explain the whole situation. I hope I could finally do that.
Thanks for your time and efforts.
08-25-2009 05:55 PM
Hi there,
I have been reading past threads for producer consumer (PC) model's discussion and it seems there are a lot of issues in queuing and dequeuing.
do you think the standard state machine (SSM) is more appropriate?
I started this thread for a solution to the problem of "how to see/read the live/updated/current control value inside an event block?"
Any words for this issue? Or this isn't an issue at all?
But from my code the discussion turned into changing the code. I am starting a new thread for the PC and SSM discussion, here.
Kindly give your suggestions.
08-26-2009 06:29 AM
Vaibhav wrote:
I am not very much fluent with LabVIEW to play as I want, because either something is a limitation of my knowledge or something is LabVIEW's limitation.
I came to this discussion from one of the links you have mentioned in another thread.
IMO, Sky is the limit for LabVIEW.
To be precise, LV is equally good for Remote & SCADA kind of applications, apart from its supremacy in T&M and ATE applications.
08-26-2009 06:42 AM
Vaibhav wrote:
I started this thread for a solution to the problem of "how to see/read the live/updated/current control value inside an event block?"
Normally, when you configure the event case for a Ctl, you can see/read the live/updated/current control value from the New Value node that you can see on the left side of the ES border.
Hope it solves Ur query...
08-26-2009 07:02 AM - edited 08-26-2009 07:10 AM
Ray.R wrote:
There are ways of doing it all within 1 single loop but let's not get into that.. 😄
I was about to mention this Ray, before I read your this reply.
Hi Vaibhav,
A single while loop with a single CS driven by Str/Enum selector, with many cases representing the various states, with the Idle case having the ES polling for the UI Ctls & forming the state queue will do the job cleaner & crisper.
This was the template for my previous project. Since it IS confidential, I cant post it here. Sorry for that...
One more suggestion from the pic you posted in your first post...
Replace all you Value property nodes with their respective locals, it ll be a bit faster.
Then, if possible, replace your locals with SR, which WILL BE much faster.
08-26-2009 03:01 PM - edited 08-26-2009 03:08 PM
parthabe wrote:I came to this discussion from one of the links you have mentioned in another thread.
Yes, and for the discussion turned towards the design approach, the new thread for PC-SSM discussion is here.
To be precise, LV is equally good for Remote & SCADA kind of applications, apart from its supremacy in T&M and ATE applications.
Yes, that's why I have selected LabVIEW, because of Remote application controls, easy Datasocket interface and most importantly, parallel processing, which I need a lot and that's why these discussions.
parthabe wrote:Normally, when you configure the event case for a Ctl, you can see/read the live/updated/current control value from the New Value node that you can see on the left side of the ES border.
Hope it solves Ur query...
Yes, Partha, this node I saw while I systematically started learning LabVIEW, but this is not of my help in the given case. Because, I am trying to check the value of a third control/indicator (not the one whose event we are running). I have used local variable, but that doesn't show the updated value. Is it supposed to be like that or something's wrong. I appreciated though that you have referred to my original query.
By the way, you might be interested in the query of this thread, where I cannot manage the colors of waveform graph's panels, programmatically. I mean, only the first channel's color is changed. Please see my last post in the thread.
parthabe wrote:
A single while loop with a single CS driven by Str/Enum selector, with many cases representing the various states, with the Idle case having the ES polling for the UI Ctls & forming the state queue will do the job cleaner & crisper.
This was the template for my previous project. Since it IS confidential, I cant post it here. Sorry for that...
I think you're referring to the template I have already posted in reply to Ray's post, on 08-08-2009 I posted in this thread. Are you referring to that? That template, I have moulded into my application's requirements, and put for discussion, if you can see "SSMDesign-2.vi" (and the two TypeDef control files) in the (PC vs SSM) thread I mentioned earlier in this post. I would appreciate your comments in that thread too. Last night I had a good conversation with RavensFan there.
One more suggestion from the pic you posted in your first post...
Replace all you Value property nodes with their respective locals, it ll be a bit faster.
This suggestion is highly appreciated. Kudos for this. I am looking for such suggestions indeed, as I have learned LabVIEW mostly on my own or in books/forums. I prefer a more systematic learning.
Then, if possible, replace your locals with SR, which WILL BE much faster.
What is SR? Too much acronym for me I guess.
![]()
Kudos to everyone so far in this discussion and everywhere else. I am learning and this is always a great thing!
08-26-2009 11:38 PM
Vaibhav wrote:What is SR?
This is SR.
08-26-2009 11:50 PM
Vaibhav wrote:I think you're referring to the template I have already posted in reply to Ray's post, on 08-08-2009 I posted in this thread. Are you referring to that?
No.
I didnt refer to it. My pewv proj template was the one developed mainly by our client with major suggestions from our team. Thats why I said that it is confidential.