LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Forumla Node Problem

Hi,
I am having some troubles with the values that are returned by my formula node. I was hoping someone could glance at my code and offer some assistance. Note the VI will not run b/c it requires the FP module and hardware.
 
In my attached VI, I have the following in the ROOM1 - Cool Down Formula node:

int GTMP; int STEP;

float32 CGTMP; float32 CGTMPLO; float32 CGTMPHI;

int HTM; int ETM;

float32 TTMPLO; float32 TTMPHI;

HTM = 60/ROC;

GTMP=STTMP - TTMP;

TTMPHI = TTMP + 1;

TTMPLO = TTMP - 1;

if (STEP == 0)

{CGTMP = STTMP - 1; STEP = 1;}

CGTMPLO = CGTMP - 1;

CGTMPHI = CGTMP + 1;

if (STEP == 1)

{ ETM++;}

if (HTM == ETM/2)

{ ETM = 0; CGTMP = CGTMP - 1; }

if (CTTMP < CGTMPLO)

{ HTROn = 1; }

if (CTTMP > CGTMPHI)

{ HTROn = 0; }

if (CTTMP > CGTMPLO && CTTMP < CGTMPHI)

{ HTROn =0; }

if (CTTMP > TTMPLO && CTTMP < TTMPHI)

{ TTReach = 1; HTROn = 0; }

The problems are that if I want to do this:

CGTMPLO = CGTMP - 0.5;

CGTMPHI = CGTMP + 0.5;

I still get a whole number and not a decimal. I thought since my variables are defined as floating point I would have no problem but I was wrong. Also, line of code ETM++ does not incrment each time this code is executed. I tried to put in a conditional statement so I know that it would execute that line of code under certain conditions and the indicator does not note show that the ETM value has increased. Am I correct in assuming that each time this code is ran the variables displayed on the indicators should refresh? I understand that a lot of this could be re-written using LV but I am close to being done and am under some time constraints. If I can get my two problems fixed I would be good to go.

Thanks for the help.

0 Kudos
Message 1 of 11
(4,394 Views)
The formula node is working correctly but your data types are being coerced to integers when they are written to the indicators. You can see when a value is being coerced because it appears as a red dot. Right click on your indicator on the front panel or block diagram and choose representation -> The float32 variable indicators should be SGL representation(single precision floating point).
_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
0 Kudos
Message 2 of 11
(4,388 Views)
Karissa,
Thanks I realized that after playing around with the For loops for a little bit. So now I have the indicators properly displaying the values but I can not get the ETM to "refresh". ETM is supposed to increase by one each time the code executes but it jsut reads one the whole time. THe way mode code is set up it should excute every thiry seconds. Thus each thirty seconds ETM should increase by one. But it does not it just stays at one. ANy reasoning behind this?
0 Kudos
Message 3 of 11
(4,385 Views)
Yes, the formula node values are re-initialised every time the formula node is run, I think you may need to put the ETM output as an input as well if you want it to increment each time the node is run. But maybe I'm not understanding what you want to do.

Like this



_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
0 Kudos
Message 4 of 11
(4,382 Views)

Karissa,

Thanks that makes sense to me. I will give it a try and let you know what happens. Do you think I should do that for any items that I want to be refreshed in the Formula nodes (CGTMP, CGTMPHI, CGTMPLO)?

0 Kudos
Message 5 of 11
(4,375 Views)
You may wind up with serious dataflow problems.  There is no need for most (perhaps 90%?) of the local variables you have in your code.  If you write a value to an indicator, there is no need to write to the local variable of the same indicator.
 
Reading from a local variable and writing to its indicator, or vice versa, reading from a control and writing to its local variable is also a pointless operation.
0 Kudos
Message 6 of 11
(4,374 Views)
If you want to store a value between iterations, use a feedback node or shift register (see image).
 
 
 
In any case, you are completely misunderstanding local variables. You can delete all the ones that are wired to their own terminal, and nothing will change except better performance. 🙂
 
Here is just a small section showing the problem:
 
 
 


Message Edited by altenbach on 12-12-2007 06:10 PM
Download All
0 Kudos
Message 7 of 11
(4,371 Views)
"Localitis" 
 
That is a good one. Smiley Very Happy  Basically an inflammation of locals.
 
Do you prescribe "localcillin" to take care of that problem.


Message Edited by Ravens Fan on 12-12-2007 09:30 PM
Message 8 of 11
(4,359 Views)

Ravens Fan wrote:
Do you prescribe "localcillin" to take care of that problem.

There are some even more serious issues that may need a combination of treatments.
 
For example:  localilits-sequenceitis 😄
Message 9 of 11
(4,291 Views)


altenbach wrote:

Ravens Fan wrote:
Do you prescribe "localcillin" to take care of that problem.

There are some even more serious issues that may need a combination of treatments.
 
For example:  localilits-sequenceitis 😄


I've heard the only cure for that is a memory transplant.  Take 2 sticks of RAM and call me in the morning.Smiley Very Happy
Message 10 of 11
(4,275 Views)