LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

new folder

I am sorry.
my program is connect to a machine wth TCP/IP at the beginning so it can't run with connection.I Just design my program step by step and I have made it very large.

KIM

0 Kudos
Message 11 of 30
(1,315 Views)
All that can be done is to provide general suggestions like:
  • Doing things in parallel.
  • Don't open/close connections continuously. Open them at the beginning, and close them at the end.
  • Don't open/close files all the time. Either open them at the beginning, and close them at the end, or write data out in large chunks.
  • Don't create DAQ tasks each time you loop.
What's your code do in these "cycles"? Are you talking to instruments? Are you communicating with other computers? Are you talking to DAQ cards? If so, are you collecting sample by sample?

As you can see, we can't really provide detailed help if we don't see some code. We're not mind-readers, after all. Smiley Wink
0 Kudos
Message 12 of 30
(1,308 Views)
Thank's your suggestions.
 
By your mention, What is the meaning of "Do things in parallel"? do you mean that Labview can run two or above orders intead of step by step at the same time?

Maybe i send you my file but It cannot run without connect now.

Please give me some opinions later. Thank you.

KIM
0 Kudos
Message 13 of 30
(1,298 Views)
Wow. Not sure where to begin. Well, it's clear you are suffering from the afflictions we commonly know as "sequenceitis" and "localitis". The former having symptops of using sequence frames everywhere, and in some cases for no reason whatsoever. The latter having symptops os using local variables when a plain wire will do exactly the same job. Your code suffers from both, as well as a few other issues.
  • From your excessive use of sequence frames it's clear you don't seem to understand the concept of dataflow, otherwise you'd see that virtually none of your sequence frames are required. If you must enforce a sequence then the error clusters are a natural and preferred way to do it. In fact, you're already doing this, but using sequence frames to boot, which is redundant.
  • You have the delays just flowing in mid-air, so the time when they execute may not be what you think. For example, the delay that you have in the frame where you're getting the Y scale is not wired to anything. Dataflow operation means that this node will execute either before or after the TCP/IP Write. My guess is that you wanted it to execute after, but since it's not connected to anything, it could just as well execute before the TCP/IP Write.
  • You use local variables when a wire will work just as well. For example, you're using 4 instances of the "No. of Warming Occured" indicator. Two of these can be eliminated and replaced with a wire with no change in functionality. All of the local variables can be eliminated if you use a shift register.
  • Scrolling ad infinitum. I just kept scrolling and scrolling and scrolling horizontally. I felt like I was on the neverending road. Diagrams should be kept so they fit within a window so they're easy to read, easy to code, easy to debug, and easy to change.
  • Lack of use of subVIs. Much of your code can be subVI-ized. For example, the communication functions should be subVIs. Createa  subVI for each function, like getting the Y scale, or getting the number of points. Having these as subVIs will make your code much easier to read and maintain.
I would also strongly recommend using some sort of event structure mechanism and/or state machine architecture.


Message Edited by smercurio_fc on 01-18-2008 12:23 PM
Message 14 of 30
(1,284 Views)
Thank you for your suggestions and opinions.

I will try to improve my Program. There is a good point which I agree with you. It is so difficult to debug/read. I have just learnt to use Labview 3 month ago so I still have many concept which are not too clear.

The "Time Delay" use to give time for the feedback of the machine. If there is not time delay, the result s incorrect. By my learning, Must the "time delay" connect to the command? or Just put inside the squence frame is OK?

In my Program, There is a part which let me feel so trouble. It is "Temporary Wanring Save" of Save section. With my basic design,  woul like to save a format with Array Which follow like that in file :
1.   XXXX XXXX
2 .  XXXX XXXX
3.   XXXX XXXX

Unfortunately, The result are:
1. XXXX XXXX 2. XXXX XXXX 3. XXXX XXXX

I don't know how to correct it......

THANK YOU!

KIM
0 Kudos
Message 15 of 30
(1,273 Views)
Hi Kim,

does your university have the State Diagram Editor. That would be a good product to use, you already do  some of the things achieved by a State Diagram.
You already have some init code before the while loop.
To study StateMachines, the first few slides of this webcast are very interesting


Then I see a '50' value connected to??? that is very bad programming a hidden indicator (I think)
I think it would be easier to store COEFF A and COEFF B as numeric, so you have to do the conversion only once instead of every movement.

The time delay should be connected between sending and receiving of the command.

What is the use of the for-loop with the seuence 'dB values Convection & Calculation' inside it? There is nothing done their that needs to be in a for loop. The auto-indexed array of doubles will be filled with the same value over and over.

Here's an example of the localites mentioned:

What should be done here, is that the controls should be connected directly to the 'Greater?' and 'Smaller' structures.

A few additional pointers:
The sections Webcam section, Reset Warming Section, Clear Data section can run at any given point EVEN BEFORE THE FOR-LOOP, these will run in parallel.
What part of your code is too slow?

Ton









Message Edited by TonP on 01-19-2008 10:12 AM
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 16 of 30
(1,267 Views)
Thank you Tonp's opinions.Let me reply your questions^^!!

@I think it would be easier to store COEFF A and COEFF B as numeric, so you have to do the conversion only once instead of every movement.
Yes. Coeff A & Coeff B is easy to store because they are constant.However, I just need to convert only once.
My program is a REAL TIME monitoring system so there are some coefficient are constant and some are changing every second. I need to convert then with while/for loop.
@What is the use of the for-loop with the seuence 'dB values Convection & Calculation' inside it?
I think that I must use for loop in here. In my design, when I send a order to the connected machine, the machine will give me back a large mount of code (Example. 16bits values  "56EF27EF19EF12EF"). I need to divided and convert them with 4 bits each of code and check it within limit or not (The limit is upper db and lower db)
For example..
Code : 0011000101111111 (HEX)
After conversion : "17" "1" "273" "4369" (DEC)
Upper db = 500
Lower db = 100
and the warning will turn on >500 or <100
However, I used a for loop to convert and calculate each converted value 

@The sections Webcam section, Reset Warming Section, Clear Data section can run at any given point EVEN BEFORE THE FOR-LOOP, these will run in parallel.
Do you mean that if the Webcam section, Reset Warming Section, Clear Data section set before the for loop, they can run parallel with for loop in synchronism??
 
@What part of your code is too slow?
In my opinion, the webcam take the image too slow per cyclic

KIM. 
0 Kudos
Message 17 of 30
(1,259 Views)
OK,
but your for loop runs in less than 1 ms. That means there most likely won't be a change so the array is an array of constants while you do the calculation several times=wasted CPU time.

Yes I mean the section run in parellel however to secure synchronization you need other mechnisms.

Could you give a comment on the code snippet I posted?

Because writing a value to itself is useless, secondly you use a local to read the same value again most likely at the very same moment.
Try read up on data-flow

About the camera I don't have that many experience with Imaq USB but if I recall it wasn't that fast, but you should optimize that in a seperate VI and later implement it in the main VI.

Ton



Message Edited by TonP on 01-19-2008 04:41 PM
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 18 of 30
(1,253 Views)

Ton,

With the code snippet you posted, It is unless and It just for GOOD LOOK. ^^!!
It was developed on last month and i have just learnt Laview for two month ago.At last month, i did not know that it could affect my porogram running time. I will correct it later.

Thanks for your suggections^^!

KIM

0 Kudos
Message 19 of 30
(1,250 Views)
kim515 said

The "Time Delay" use to give time for the feedback of the machine. If there is not time delay, the result s incorrect. By my learning, Must the "time delay" connect to the command? or Just put inside the squence frame is OK?
As Ton indicated, "the time delay should be connected between sending and receiving of the command". This means you have to use the error cluster to enforce execution order. This, again, stems from a lack of understanding dataflow. Take the following cases:

In case 1, there is no connection between the TCP Write and the Time Delay. This means you cannot predict which one will execute first. This is how you've coded it up. In case 2, the TCP Write cannot execute until it has received data on the error wire, which comes from the Time Delay. This means the TCP Write will execute after the Time Delay. In case 3 the Time Delay cannot execute until it has received data on the error wire, which comes from the TCP Write. This means the Time Delay will execute after the TCP Write. This is the case you want.

kim515 said

Yes. Coeff A & Coeff B is easy to store because they are constant.However, I just need to convert only once.
My program is a REAL TIME monitoring system so there are some coefficient are constant and some are changing every second. I need to convert then with while/for loop.

You are actually converting them from a string to a number each time in the loop, which is Ton's point. Also, they don't change after you've read them, so there's no point in reading the value through a local variable, because the value doesn't change until the next time you perform a TCP Write.

Ton's question regarding the 'dB values Convection & Calculation' loop is valid. This loop makes no sense, especially since it has a while loop inside it! The conversion itself does not require a for-loop. Also, your explanation of how you're doing the conversion is confusing.

kim515 said

With the code snippet you posted, It is unless and It just for GOOD LOOK. ^^!!

All jokes aside, Ton's point is an important one, as it reiterates the point about understanding dataflow, which is clear you do not.

kim515 said

I will correct it later.

If I had a nickel for everytime I heard that, and it actually happened, I would be retired and living in luxury already.

 


Message Edited by smercurio_fc on 01-21-2008 10:06 AM
0 Kudos
Message 20 of 30
(1,217 Views)