09-06-2018 01:56 PM
Yes, these day "real benchmarkers" use "high resolution relative seconds", but for those still using tick count differences in a loop with a wait here's a tip to measure and verify the loop time (e.g. to ensure that the code can keep up!). The wait primitives give you a tick count output, no need for all that extra code!
(Nobody but me seems to ever use that! A similar tick output is also from the "time" event data node available in all (or most?) events. Useful!)
(see also)
09-06-2018 02:14 PM
I use feedback nodes so seldom compared to a shift register. But of the times I use a feedback node 90% of the time it is for simple timing like the example you gave.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-07-2018 01:25 AM
@altenbach wrote:
The wait primitives give you a tick count output, no need for all that extra code!
(Nobody but me seems to ever use that! A similar tick output is also from the "time" event data node available in all (or most?) events. Useful!)
(see also)
Awesome info!
09-07-2018 04:59 AM - edited 09-07-2018 05:11 AM
Of course there are build in functions for getting the derivative.
And it keeps working if the iteration time exceeds 49.7 days! ()
Btw. time to make those PtByPt's a .vim.
09-07-2018 10:41 AM - edited 09-07-2018 10:50 AM
wiebe@CARYA wrote:
Of course there are build in functions for getting the derivative.
Getting date/time is more expensive and if you look inside the ptbypt deriv, it's a bit ugly, containing an obsolete VI just to get error information on init (validity of dt and initial condition values). Then it has three shift registers. compared to one. 😄 It also does not follow modern guidelines on terminal placement, having some deep inside structures. All terminals belong on the toplevel diagram here. (e.g. "error" should be kept explicitly in a SR, not carried in a stale indicator. IMHO)
wiebe@CARYA wrote:
And it keeps working if the iteration time exceeds 49.7 days! ()
That's why I typically use "high resolution relative seconds" I think it's more lightweight, not sure. It also does not need that lossy conversion from timestamp (128bits) to DBL (64bits). 😉 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.
wiebe@CARYA wrote:
Btw. time to make those PtByPt's a .vim.
.Agreed. At the same time the code should be cleaned up a bit. 😄
09-07-2018 11:18 AM
In case you did not know how to create a simple 1D boolean array, here's one way I don't really recommend. 😄
09-07-2018 11:24 AM
Especially the conversions in the two case structures which (I think?) take a boolean, coerce it to dynamic data to then cast it to a boolean array, then back to dynamic data, merge it with other signals and back to a boolean array.
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.
09-07-2018 11:27 AM - edited 09-07-2018 11:30 AM
@altenbach wrote:
In case you did not know how to create a simple 1D boolean array, here's one way I don't really recommend. 😄
Prime example of why "Express VIs" shouldn't even be there and "Dynamic Data" should be introduced at a much higher level.
NI is doing a huge disservice to new programmers with their "Just take these Express VI's and connect them with Dynamic Data wires so you don't have to worry (or think) about data types, how to properly handle them, or what you are doing.", beginner tutorials.
09-07-2018 12:06 PM
@altenbach wrote:
In case you did not know how to create a simple 1D boolean array, here's one way I don't really recommend. 😄
I THINK There is a clue to the poster's thought process in the boolean control labels. We don't really need to ask, " What have you been smoking?" do we....
09-07-2018 12:09 PM
@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.