LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Math Script with Formula Node

Solved!
Go to solution

Hi, 

Good people. I am new in LabView. I wrote a program using the Mathscript node but the iteration time is 200ms. I need something faster than this. My understanding formula node will be faster than the Mathscript node. Here I am attaching my VI.  I tried this to convert the formula node but faile. Can anyone help me to convert this VI to formula node?

Thanks.

0 Kudos
Message 1 of 6
(3,191 Views)

Wow -- someone who hasn't learned the First Principle of LabVIEW, the Principle of Data Flow.  Who doesn't know about Shift Registers and who hasn't learned (as many beginners, even myself, when I started learning (about) LabVIEW didn't realize) that one should almost never use Local Variables, particularly when inside a Loop (where Shift Registers make so much more sense).

 

One also wonders if you know how to use parentheses to make expressions like "K=m^2*m" unambiguous.  I don't know if you intend for the exponent to be 2 or 2m -- I also am not 100% certain I could predict how the MathScript interpreter (I'm assuming it is interpreted) will parse it, and whether its rules are the same as what you intend.

 

Here are some suggestions:

  1. Start with the "assignment", where (I presume) the equations are clearly written down.
  2. LabVIEW functions (Add, Subtract, Multiply, Divide) are very fast.  Exponentiation requires dipping into the Mathematics Palette ("Elementary") and knowing a little high school algebra.
  3. I'm wondering if there's supposed to be some "calculus" here, derivative or integration.  Can't tell, as I can't say I have any confidence that the MathScript code accurately reflects the "real question" (or real equation).

Since I don't know what to make of the attached file (and why I would need to see "the real questions", as outlined above, to be able to suggest what to do), I'm not going to suggest anything more than "Please explain, without using LabVIEW, MatLab, or any other coding language -- just use Math.

 

Bob Schor

0 Kudos
Message 2 of 6
(3,162 Views)

@Moni98ce wrote:

Hi, 

Good people. I am new in LabView. I wrote a program using the Mathscript node but the iteration time is 200ms. I need something faster than this. My understanding formula node will be faster than the Mathscript node. Here I am attaching my VI.  I tried this to convert the formula node but faile. Can anyone help me to convert this VI to formula node?

Thanks.


I don't have the mathscript toolkit installed, so I can't run your .vi

moreover, I can't copy and paste your script from your mathscript node

 

1# run your vi, then hit the "edit>make values default" , then save your .vi and  post it here

2# copy and paste your script here as text

 

then I will have a look

Download All
0 Kudos
Message 3 of 6
(3,142 Views)

Hi,

Thank you very much. Previously I uploaded a wrong VI. Now I am also uploading the corrected VI.  

Download All
0 Kudos
Message 4 of 6
(3,136 Views)
Solution
Accepted by topic author Moni98ce

@Moni98ce wrote:

Hi, 

 I wrote a program using the Mathscript node but the iteration time is 200ms...

 

 

You have set the iteration time of the while loop to 200 ms each iteration here:

timestep-whileloop.PNG

 

decrease this value e.g. to 1 ms, and see what happens next...

 

 

 

 

in the mean time, your mathscript node can be re-written as:

(test4_formula-node.vi)

re-write.PNG

 

personally, I would use more parenthesizes, as bob already suggested, like this:

 K = w**(2*m); not: K = w**2*m;

 

 

 

without the mathescript-node, I can run the test4.vi and this is what I get on the frontpanel: (test4_no-mathscript.vi)

 

frontpanel.PNG

 

 

 

 

Download All
Message 5 of 6
(3,124 Views)

other people solve sudokus...

compare.png

 

 

0 Kudos
Message 6 of 6
(3,073 Views)