Jump to content

UnlikelyNomad

Members
  • Posts

    31
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by UnlikelyNomad

  1. 15 hours ago, smithd said:

    Never heard of this, but makes sense. I do the same (using variants of course) when it comes to static VI refs (eg 'call and forget') because any change to a type def in the connector pane breaks controls/indicators -- type prop doesn't update them. So I have my create reference in one subVI that spits out a variant and then everywhere I want to launch an instance I just have another copy of the static ref and a variant-to-data function which casts it back. Avoids annoying labview bugs that way.

    Ohhhh I gotcha now. This I do see. I'd say this isn't a bug and is consistent behavior. Change the data type feeding into a string indicator and you get a broken wire instead of a new indicator. Type defs are the only thing that propagate updates so without a type def to update you would break data types to controls/indicators.

  2. Several times I find myself having to copy the content of my post, refreshing the page, and pasting the post and submitting it again because the post won't submit initially. Not sure if there's some issue with how long I take writing a reply, or it's something with chrome where I'm going to other tabs and then coming back but pretty regularly, and on different PCs, I have to refresh the paste and redo the post for the submit button to actually work.

    Fun fact: I'm about to copy/paste this because it's doing it on this fresh topic as well.

  3. 17 minutes ago, smithd said:

    Never heard of this, but makes sense. I do the same (using variants of course) when it comes to static VI refs (eg 'call and forget') because any change to a type def in the connector pane breaks controls/indicators -- type prop doesn't update them. So I have my create reference in one subVI that spits out a variant and then everywhere I want to launch an instance I just have another copy of the static ref and a variant-to-data function which casts it back. Avoids annoying labview bugs that way.

     

    Any chance you have an example of this? Not sure I've ever run into something like this before. I update typedefs all the time and haven't had my start async calls get boogered up. Though I do currently have NI pursuing a bug where a typedef isn't getting namespaced properly when compiling to a PPL and thus breaks all the calls once compiled because the static ref still specified SomeLib.lvlib:SomeClass.lvclass:SomeType.ctl instead of SomeLib.lvlibP:SomeClass.lvclass:SomeType.ctl which of course I can't recreate in dependent components. As long as I'm testing the uncompiled component with the static ref, everything updates as expected for me.

  4. Francois, thanks for the elucidation! I don't use frameworks like AF so I haven't run into too much hierarchy bloat and I tend to compile lower level libraries into PPLs to be used by higher levels; I'm thinking that limits how much LabVIEW can check for during type propagation since I only have one editable component open at one point.

    Since I'm doing ByRef I often do have to break type safety and store some relationships as base objects and then always cast them when pulling them out of the DVR for use (since you can't have a DVR reference another DVR that references the first) so this may also cause a similar optimization. IE: a server keeping a list of open connections and those connections keeping a reference to their originating server.

  5. 1 hour ago, planet581g said:

    Can you show me how to make LabVIEW crash by doing this? I created and destroyed 1 million DVRs that were cast to integer and cast back to DVR and couldn't get LabVIEW to crash. Attached VI made with LabVIEW 2013.

     

    DVR to integer.png

    DVR to integer_2013.vi

    Still unsure why this is a thing though. Duck typing? Union like tricks? Seems like this should be used in very specialized instances and not to transport data around. Even in C++ pointers have type and this completely erases type safety.

  6. I could convert this to a Tools item. Make it an either/or. I definitely like the ability to interact with the item itself. I've come back to this first paragraph several times to take out reasons why I'm less favorable to the tools menu; maybe that'll be next week's side project.

    What I am avoiding is conditional menus based on current state of an item; you use it right or you don't. The actions to check compatibility but it's after you select it and not while you're waiting to see if LabVIEW is going to render the popup menu correctly. I was toying with the idea of storing state in the class (user tags) or assessing the state but I'd like to maintain portability (no deps or conditional/extra class state) and everything in native LabVIEW. The tools menu does seem to be context sensitive based on project selection but that feels like a weak link to me. I think if I did a tools menu entry I'd want a UI to confirm class selection, and then I might was well make different actions available from that UI, and then suddenly GOOP or AF.

    I'm avoiding DVR wrapped classes (versus my DVR wrapped in a class) because unless I'm missing something... dynamic dispatch doesn't work with that mechanism. I'd much rather either continue doing this manually or create some tooling to significantly cut down on the bootstrapping effort.

  7. 34 minutes ago, planet581g said:

    There's this reference design framework, but as far as I know it doesn't have scripting to create accessor methods.

    https://github.com/JKISoftware/JKI-State-Machine-Objects

    I rarely use state machines in my applications so I've never been inclined to look into that.  After seeing that readme I'm definitely going to take a look at it and see what all it does though. [Mass compiling now in VIPM]

    I suffer from being very picky in my ability to be flexible and tend to avoid [heavier] frameworks when I can. The main idea of this is that it isn't a framework; it is IDE tooling to more easily develop ByRef designs

  8. INB4 Demo Video: YubTub Linky

    Monday of this week I finally saw NI's Center of Excellence and after not being at NIWeek for a few years I was blown away at how far the technical sessions have come. I saw the LV Hooks presentation and of course had to try getting back into the rusty nails that I started trying to play with a year ago. I previously tried creating XNodes that could replace getters and setters for data hidden behind DVRs however I hit a road black when trying to access DVRs that were private to a class. I have finally gotten around to implementing my next approach, and it works!

    This is the first of a set of features to help me speed up development when I'm creating ByRef classes. My ByRef architecture involves creating a DVR and usually having that be the only data member of the class private data cluster. This allows me to branch the class wire while still accessing the same DVR contents in multiple locations. This allows me to avoid having to use additional frameworks and patterns like QMH or AF to easily support parallel tasks. This design lets you choose between synchronous and asynchronous actions and most importantly: inheritance and dynamic dispatch are still fully supported! Want to use a queue? Do it! Want to use a bool to shutdown a background loop? Sure thing! Want to use events! Go right ahead! Want to mix ByRef and ByValue classes? Okay! I know there are already project provides that try to automate some ByRef implementation details however I don't like the idea of functionality being hidden in some "core" and wanting to do something slightly differently this time. The basic idea of everything that will come of this provider is that it automates creating the VIs you would use directly, and only those VIs. Everything is visible and available and you can use the provider to scaffold the common starting points and then move on from there.

     

    I'm curious what y'all think! Does anyone do similar ByRef designs? Anyone have ideas or suggestions? Once I get the DVR member accessor scripting implemented I'll uploading this to GitHub for public critique consumption.

  9. I was testing a buffer I wrote for an application some months ago and pushed nearly 2 gigs of data into it 200 rows at a time and then read back the row count. LabVIEW's memory never went above 350megs. Definitely tricky to benchmark in LabVIEW sometimes. LabVIEW is great because it does a lot of stuff for you. LabVIEW sucks because it does a lot of stuff for you.

  10. 18 hours ago, infinitenothing said:

    Maybe VIM could help?

     

    Read DVR example.png

    Read DVR.png

    I use a lot of reference applications for things like buffers, etc. where pulling out everything everytime would become prohibitive. (As others have stated about my unbundle being inside the IPE). Perhaps the compiler would see the other items aren't pulled out and not copy everything, but if it copied my two gigs of full rate 50khz data when all I wanted was the current data size: boom. Memory fault.

    Ultimately this XNode is going to become part of a palette of functionality that aids in development of by-reference designs that go beyond just type matching and maybe even someday others start using these and I never have to inherit code where a class instance stores state data in a FG, especially when that FG isn't part of the class. Preview of other coming attractions: Generics in LabVIEW. (With type restrictions!) All of these features will build on what I learn getting this "simple" introduction to XNodes working.

  11. Yes, XNode heh.

    Thanks smithd and DT, I'm going to work on those and give it a shot!

    I don't need to open the subvi in the context, I can just use open VI, take the Results.lvclass from the variant, add ":Results.ctl" and open it using the OwningVI's OwningApp property!

    Thanks for the push. I had tried to find something about getting the other app context but glanced right by it and missed it.

  12. It seems to me that you'd be more interested in a VI scripting topic to accomplish some automatic code generation but in general OOP itself wouldn't fit this. At the highest level there is knowledge of what the output type should be and therefore should be able to make assumptions about the code it should run to get that data. There are ways I can picture accomplishing this within OOP code but it would break nearly every prescribed design paradigm, be extremely complicated (lots of VIs), and difficult to debug.

    Or use variants everywhere and some type of data reflection which will be a lot of extra code and completely break type safety.

    I'm currently exploring some XNode implementations to simplify some boiler plate code for by-reference architectures but have hit a few road blocks on doing type reflection on the class from within the XNode; turns out different execution contexts makes it difficult to get references to classes from the project on top of XNodes already being difficult.

  13. I may have gone a bit overboard with an example but this demonstrates several things: 

    1. Call Asynchronous cannot use a polymorphic member reference. To get around this the TaskMgr class has a static member that takes in a Task Instance and can then call the polymorphic task while it runs asynchronously.
      1. The Start Task.vi demonstrates setting up the static vi reference properly to use the call async node.
    2. The base Task class (and TaskMgr) follow my by-reference design to allow parallel operations. The key note here is that the reference is contained within the class data, as opposed to a reference of the class itself, which allows polymorphism to work correctly.
    3. Two example tasks are provided:
      1. BgTask is implemented as a by-reference design and demonstrates reading its "progress" in a parallel loop.
        1. Note that it only dereferences the class data when it needs to update a value, instead of keeping the reference locked for the entire execution of the task.
      2. SlowTask is by-value, though the Task base class it inherits from is still by-reference for control signalling and status tracking.

    TaskMgr.zip

    TaskMgr.zip

  14. I'm receiving a class instance in a variant that I'm trying to enumerate types contained for. The attached screenie works great when run normally but it's being executed in a different context and the get class default from name is returning an error.

    1. Is there a way to access other contexts via VI Server?

    2. Is there a simpler way to get the private data control cluster default value?

    ClassTypeFromVar.png

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.