LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Are NI CLD examples unnecessarily complex?

I was guiding my collegue for CLD exam. i just browsed through Traffic light example  and i found it too complex for its scope. here is the code which we designed.

it does not use state machine or any other standard architecture. but i think for such a small code it is not at all required. what do you say?

 

 

Certified LabVIEW Developer (CLD) Sample Exam - Traffic Light: http://zone.ni.com/devzone/cda/epd/p/id/1665

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 1 of 6
(4,904 Views)

Here is a screenshot of your code:

 

A few things are notable:

The Array constant is not labelled

There is no indication what the contents of the array constant should be, a bug inside this constant is quite hard to track

 The sub-vis are not documented.

 

The code  doesn't look scalable. Scalability is one of the major points of rating.

 

And the CLD is an advanced, showing off some of your advanced skills always helps.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 6
(4,889 Views)

lets keep documenatation aside for moment...

but regarding scalability i humbly disagree with you. maybe you have not gone through the code provided by NI or maybe my defination of scalability doesnt matches with you.

complex things doesnt mean that they are scalable

e.g. just look at two things

1. assume that you have to change yellow period to 1 sec and green period to 2 secs(instead of 2 and 4 respectively) then see at how many places you need to make change in NI example

2. assume that you have to reverse(or alter) the sequence then in NI example almost all code needs to be thrown away as all the states are hard coded, where as in my example it is just one table which needs to be modified

 

which features are not scalable in my code and are scalable in NI example?

 

can you see following features in my code

1. instead of two roads crossing if there are four roads crossing i have to do changes in lookuptable only (have 8 columns)  and not in code (except adding more indicators and refs)

2. the order of sequence can be changed only through changes in seq table constant without any changes in code

3. wating period can be changed by changing only one constant provided that ratio of green time and yellow time remains same(if it is not so i would better add timing field for each step in sequence)

4. if i have to deploy this system i can write the seq table to file and LO... i can change configuration of seq and its timing without doing any changes in code hence avoiding build and install process for each step.

 

do you think these things are possible with NI example code?

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 3 of 6
(4,877 Views)

>>>>And the CLD is an advanced, showing off some of your advanced skills always helps

partially I agree.  I know the importance of architectures, in our real life complex projects we heavily use suitable architectures.. But frankly I don't see any point in following some standard practice to make things complex, hard to understand  and LESS SCALABLE.

If NI really wants to check your architecture skills then they should provide a problem statement which is right for using that architecture.

just assume that you are an electronic design engineer and I ask you to design a system which will light a LED when a switch is pressed. Would you recommend me a FPGA based or some microcontroller based  real time system to show me your skills or would you draw a series combination of an LED and switch?

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 4 of 6
(4,866 Views)
Perhaps you may want to start reading this thread.
0 Kudos
Message 5 of 6
(4,828 Views)

I just gone through the thread you recommended. And it was good to go through it. But still I have some things unclear

 

Firstly I want to make it clear again that I am not against styles and architectures rather I support the use of PROPER architecture.

Secondly I also agree that the code which I have developed is inadequately documented. (the point I want to raise is not related to documentation)

 

as mentioned in thread recommended by you, there is no "one size fits all" architecture. Then does CLD tests that the user DO SELECT PROPER architecture? And that is more important to me. I would prefer a person who knows only few architectures but knows which one is to be used when and WHY(why is also critical), rather than a person who knows tons of architectures but doesn't know which one is to be used when and why.

e.g.. I will use a state machine architecture when I have to process "X data/algorithm"  when my system is in "A" state and process "Y data/algorithm" when system is in "B" state...

so is state machine is suitable for the traffic light example? For me its NO...

 

why?

 

because there is no process. My traffic light is just indicating a state and no further process is to be triggered on that state.

for  state >> "state indication" conversion I created a sub VI which uses state enumeration and control ref. (I think altenbach had similar thinking when he suggested use of XControl)

and now if I have to just maintain a list of state sequence I think I should focus more on making that seq alterable with least efforts.

 

using proper architecture can help you a lot... but using a wrong architecture can also harm you a lot. just go through traffic light example; observe it and think for a while. you will find that architecture itself has harmed it many a places.

 

 I would be keen to know what you guys think about my viewpoint, also I think its a good opportunity for us to brainstorm which architecture is to be used when and more importantly WHY. I believe some times not using architecture can be a best choice... What do you think?

 

 

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 6 of 6
(4,771 Views)