From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


@RTSLVU wrote:

Prime example of why "Express VIs" shouldn't even be there and "Dynamic Data" should be introduced at a much higher level.


No, DDT should not even exist!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2011 of 2,571
(10,194 Views)

@altenbach wrote:

wiebe@CARYA I don't think you need the "=0" because it inits unconditionally on first call anyway.

 

 


Might be required in situations like when this VI gets called from within multiple/different VIs across the project that is being executed from TestStand. First Call would be valid only when it gets called from TS for the very first time, unlike when it is getting called from different VIs when executed from LV!

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 2012 of 2,571
(10,194 Views)

@crossrulz wrote:

@RTSLVU wrote:

Prime example of why "Express VIs" shouldn't even be there and "Dynamic Data" should be introduced at a much higher level.


No, DDT should not even exist!


Agreed.

 

Actually for me it basically does not exist, as I have never found a use for it.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2013 of 2,571
(10,187 Views)

@parthabe wrote:
 First Call would be valid only when it gets called from TS for the very first time, unlike when it is getting called from different VIs when executed from LV!

When called from different VIs, each instance has it's own initialization whenever it is called for the first time because most (if not all) ptbypt VIs are fully reentrant. Sorry, I don't know anything about teststand and how that deals with ptbypt VIs.

 

 

0 Kudos
Message 2014 of 2,571
(10,176 Views)

@JÞB wrote:

@Jacobson-ni wrote:

....

I also strongly dislike dynamic data because what even is the expected output of a double casted to dynamic data then casted to a boolean array.


My office is temporarily offline for movies but,  aren't the block diagrams unlocked.  WARNING: some content my offend some viewers.  Discretion is advised. 


Sure, but for the most part you just make everything a waveform and then have a subVI that looks way to much like a primitive that converts the waveform to dynamic data which is just a subVI with waveform input connected to DDT output.

Matt J | National Instruments | CLA
0 Kudos
Message 2015 of 2,571
(10,167 Views)

@altenbach wrote:

@parthabe wrote:
 First Call would be valid only when it gets called from TS for the very first time, unlike when it is getting called from different VIs when executed from LV!

When called from different VIs, each instance has it's own initialization whenever it is called for the first time because most (if not all) ptbypt VIs are fully reentrant. Sorry, I don't know anything about teststand and how that deals with ptbypt VIs.

 

 


It might be an interesting exercise for TestStand training to:

A. Create a vi with First call wired to an indicator.

B Copy that vi and make it reenterant.

C. Add both to the lvproj you created before step A

 

Open Teststand and call the 2 vis as pass fail tests repeatedly changing the load unload options and context (calling through the project context or the default TSproxy caller) 

The steps will pass on only specific conditions.  The non reenterant vi should output true when first loaded in each context and after any time that context's copy has been unloaded for each execution socket.

 

The reenterant vi output should also depend on the above, shared/pre allocated setting,  and if it has been inlined into a calling vi.  

 

Using the vi hierarchy view from teststand showing the proxy callers will help visualize the reasoning for the outcomes. 

 

Sounds like a great white paper for someone to write.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2016 of 2,571
(10,155 Views)

 

I didn't get any useful time of that code improvement before I changed it to this:

Timing.png

0 Kudos
Message 2017 of 2,571
(10,103 Views)

@altenbach wrote:
I don't think you need the "=0" because it inits unconditionally on first call anyway. You also need to wire the time to the initial condition, else you get garbage values for the first two iterations. 

What if the VI is called multiple times? Surely you don't want the dT between the first new iteration and the last time it run?

 

Pretty much agree on all the other things. If the PtByPt was a .vim, the to dbl conversion wouldn't be needed. Obviously we count on NI to keep those (all) VIs as lean and mean as possible (/S).

0 Kudos
Message 2018 of 2,571
(10,102 Views)

wiebe@CARYA wrote:

@altenbach wrote:
I don't think you need the "=0" because it inits unconditionally on first call anyway. You also need to wire the time to the initial condition, else you get garbage values for the first two iterations. 

What if the VI is called multiple times? Surely you don't want the dT between the first new iteration and the last time it run?


As already mentioned by Partha. Never mind. Monday morning...

0 Kudos
Message 2019 of 2,571
(10,075 Views)

@altenbach wrote:

@parthabe wrote:
 First Call would be valid only when it gets called from TS for the very first time, unlike when it is getting called from different VIs when executed from LV!

When called from different VIs, each instance has it's own initialization whenever it is called for the first time because most (if not all) ptbypt VIs are fully reentrant. Sorry, I don't know anything about teststand and how that deals with ptbypt VIs. 


But even when it's called multiple times from the same VI, I would expect the dT to be 0 for the first iteration of that call. Not in all use cases, but definitely in some.

0 Kudos
Message 2020 of 2,571
(10,073 Views)