Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Swerve VI based on the 2011 paper & excel by Ether (http://www.chiefdelphi.com/forums/showthread.php?t=131178)

Greg McKaskle 20-11-2014 09:24

Re: Swerve VI based on the 2011 paper & excel by Ether
 
Quote:

Originally Posted by jman4747 (Post 1409290)
Also do formula nodes execute faster than the equivalent code on the block diagram?

They will generally be the same, however some operation such as arrays may actually take longer in the formula.

The formula and the nodes both feed into the same compiler, but with different front ends. By comparison, FPGA VIs start with the same front end and finish with different back ends.

The front end may need to parse text in order to identify types and operations. Or for nodes, it simply visits the nodes since this is already determined in the editor. The generator will then produce intermediate code for the representations, and then it will send the intermediate code through the LLVM back end.

I did a quick measure averaging random numbers and saw that the scalars were almost the same. The formula for accessing elements of four different arrays and storing in a fifth was about 50% more expensive in the formula node. I personally wouldn't read too much into that, since I was using the indexing tunnels on the LV diagram, so that probably gave the diagram simpler code to generate.

Generally, I try to write code that is the most understandable. I measure performance quite often, but I try to achieve it by using the proper algorithms, understanding what the major operations are in the algorithm, then make minimal edits or data structure changes in order to gain performance. Sometimes the more understandable code is a formula, sometimes not.

Greg McKaskle

Alan Anderson 20-11-2014 09:44

Re: Swerve VI based on the 2011 paper & excel by Ether
 
Quote:

Originally Posted by jman4747 (Post 1409290)
The sequencing changes (going to all wires) didn't change any output values which is why I was confused.

Now that I look more carefully at what you're doing, I see you are running this in a loop. After two (or three, in your original code) iterations, all the values are guaranteed to have settled down. But if you were watching closely, or logging values each time through the loop, you might have noticed a glitch in the output whenever you changed input values.

I thought this was a subVI that you were calling in an actual robot program. If that had been the case, the glitchy output values could have shown up as undesired operation of the robot.


All times are GMT -5. The time now is 22:08.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi