LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/Consumer-QSM

 

Hi,

 

This VI performs a instrument control. Some parameters need to be adjusted while VI is running.

Producer/Comsumer design pattern is used to implement it. The producer catches the events of

value change of parameters. The comsumer goes to corresponding state to deal with the change.

VI has been attached please give any your comments, suggestions, and advices. THANK YOU.

 

Guoguang Qian

Message 1 of 20
(4,044 Views)

I have not looked at your code from a functionality point of view (plus I did not run it).

 

However, I must say that it is among the cleanest, well organized code that I have read on this forum.  Great job.

Your code is readable, scalable and maintainable.  3 important attributes.

 

You are relatively new on this forum.  How long have you been coding?  Very nice code.

 

There is only one minor thing that I might change.  Not important, really...

Instead of reading the entire cluster, I would simply read the needed values in the states where they are needed.

If your code grows, you may need that real-estate in the future.

Nevertheless, it is a minor point.  I still like the way you wrote your code.

 

Message 2 of 20
(4,026 Views)

Thank you for your feedback. I am sorry you can can run it to check its functionality.

I shoud use simulated code so you can run it without any instruments.

I familiarized with LabVIEW for long time but I am only CLAD. I am studying to persue

CLD certification. How about you? Thank you.

 

Guoguang

0 Kudos
Message 3 of 20
(4,005 Views)

I agree with Ray that you have solid coding style.  I would say you're ready for the CLD test if you want the certification.  One thing I would suggest is to make your diagram a little smaller so that it could be edited easily on a smaller monitor.  I believe the rule used to be it should fit in 800x600 but that may be too stringent now with all the nice, cheap BIG flat screens out there.

 

Anyway, nice job overall.  Are you looking for feedback on anything specific?  Have you used the VI profiling tools to analyze your code?

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 4 of 20
(3,953 Views)

Thank you for your suggestions and for your encourging.

I am still hesitate to take CLD. But it is my goal in near future.

This code is for my test project that uesd to be data flow style.

Now I try to use design pattern to modify it. The goal is that while

test is running VI can handle UI events like START, RECONFIGHURE,

and STOP. At the beginning I use SSM to do it couldn't work. So I then

try P/C-QSM pattern. I made serveral modifications.

But I am not sure if the code is consistent with the standard way to

do the test. So I post it here. Hope someone can review it and give some

ideas to improve it.

 

Thank You!

Message 5 of 20
(3,946 Views)

Very Clean style! Lacks VI documentation and a meaningful icon but.  Well organized scalable and readable.  Nicely done!

 

A couple of issues with the exact implementation that you could use to improve performance.

 

1: there is a potential race condition that you don't see now (see #2) I would read "parameters" in the val change event and pass them in the queue.

 

2: in the val change event the "initialize" command should have priority over the rest of the queued up operations. since every case generates a queue cmd each time the val change event fires the length of the queue increases by 1 and this will get undesireable.  Flush the QUEUE in the initialize case and in the val change case enqueue at opposite end. 

 

Very nice work


"Should be" isn't "Is" -Jay
Message 6 of 20
(3,936 Views)

Hi,

 

your style is good, but I'd like to highlight the fact that you used express VIs in a sub VI (I know I'm mean)

 

Some wires may be cleaned in some sub VIs (best for the reader)

 

Anyway your coding style is good, maybe a few improvements (documentation, wires) will make your code better.

 

Regards

Rodéric L
Certified LabVIEW Architect
Message 7 of 20
(3,924 Views)

Good code.  For your CLD, I recommand using the simplest approach.  Usually, a regular state machine will do the job.  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 8 of 20
(3,916 Views)

Jeff,

 

Thank you for your comments and suggestions.

Based on your feedback I have modified the code and attached it.

Please review it and check if I have made something wrong.

 

Thank you!

 

Guoguang

 

 

 

Message 9 of 20
(3,907 Views)

JYang,

 

Thank you for your suggestions

 

Guoguang

 

 

0 Kudos
Message 10 of 20
(3,904 Views)