02-04-2009 02:17 PM
hi jdpowell,
thank you for you continuous support on this.
you are right about not putting "main vi diagram fitting on one screen, but I wouldn't make that a goal."
the reason for redoing this because i want to get out of the stacked sequence and with advices from alot of people in this forum, i try to avoid using local variables as possible.
Due to race conditions if it is used improbably.
my previous co-worker loves local variables and everything is done in that form. and i want to break away from that.
cleaning up the mess i had before helps me do more things in the future. i know exactly where things should go and where to modify things if i have to.
a previous friend from india had a code like that and i saw him bundle things together and that's the only way i KINDA learned how to do it.
but someone suggested that i should change my whole structure to "state machine", then to "producer/consumer"...
i have a working program now..Rev B...
but i am trying to learn different ways of implementing what i have...
does it make any sense?
02-04-2009 03:44 PM
I'm tempted to ask you to post your whole code including the 160 subVI's, but this is more the fascination of watching a car crash than any expectation that I could really help you. The program you inherited looks like the worst code I've ever seen. Minimal comments, unintelligible variable names, parts of the code with lines running right to left instead of left to right, etc. I can't even figure out what it is doing. Sorry,
-- James
02-04-2009 04:44 PM
hahaha, wow, its that bad?
you should have seen the version before that..
please tell me that what i have done is better than this version, because if its not, i should stop doing it now..
02-04-2009 07:27 PM
Well, you've done no worse.
But your mostly just rearranging poorly written, hard to read code.
It's not really a noticable improvement. A better plan might be to try
and get the gritty details into subVI's. For example, get all the
weird details of reading pressure (asserting a global called
"lock_press_read", calling "pressure_query.vi" with several inputs,
then deasserting "lock_press_read") into a simple subVI "read
pressure.vi".
-- James
02-05-2009 09:10 AM
02-05-2009 09:40 AM
02-05-2009 09:59 AM
Wiebe has some good comments.
I looked at the large "Cycling" loop. In about an hour I eliminated all the local variables which were linked to indicators in "input cluster." I changed the stacked sequences to flat ones and wired the input cluster and the error cluster through anything which used them. There are still a few locals for things which were not in the cluster. Some of what I did probably creates errors because I do not have the subVIs or know what some of these things do, but this may give you an idea of how to approach this kind of change. I would make a typedef of the input cluster so that when you change it, and you will, the change will propagate though all the subVIs which use it. Make it a non-strict typedef so you can change the size on most subVI panels where it does not need to be seen.
It appears that the Press_dir.vi uses a different input cluster. The broken wire help shows clusters with differing numbers of elements. The typedef will prevent this.
Lynn
02-05-2009 01:29 PM
" would make a typedef of the input cluster so that when you change it, and you will, the change will propagate though all the subVIs which use it. Make it a non-strict typedef so you can change the size on most subVI panels where it does not need to be seen."
yes, i always run into that problem..
when i have a new value or whatever, i have to change all the subvis as well..
"typedef?"..i think thats something i have to move forward to..i have to look into that..
let me go and take a look at Rev C_1 and see..
02-05-2009 01:42 PM
I did not put a typedef in the VI I posted.
To create a typedef select the control (or indicator) and then from the Edit menu choose Customize Control...
Any large cluster used in more than one place, any cluster you will be likely to change, and enums used as state controls or commands to subVIs are all things to make into typedefs. Typedefs will save you a lot of time and programming errors.
Lynn
02-05-2009 03:12 PM - edited 02-05-2009 03:12 PM
johnsold,
i was going through the code during lunch and i noticed that you bundled the ADV control in the code.?
why?
what happened if you press on it? the wire carried over will not work if the value of ADV is changed?
this is where i place problems because if the value change in the control, the wire that we transfer from one end to another will not be carry over when the value is change..