Jump to content

drjdpowell

Members
  • Posts

    1,973
  • Joined

  • Last visited

  • Days Won

    178

Everything posted by drjdpowell

  1. Funny, I use variant attributes for much the same thing, and asked about copies in this conversation. I also allow new subscribers to get a copy of the most recent message on subscription (though not always; I distinguish between “State” notifications (save the most recent message) and “Event” notifications (don’t save). I’ve long been meaning to improve the performance, but haven’t got round to it.
  2. Another idea is to keep all data in a single flat structure such as an array, with the index to that structure stored in the variant tree. Lookup the index then index the array in place. Then at least all the copying will be of small integers. Or one could try a tree containing DVR references. But if we are taking very large data sizes then mje’s ultimate solution of a database might be best. I’ve even considered using in-memory SQLite databases in place of variants for small data structures, just to have the increased flexibility of SQL, but the performance is significantly worse than variants when the data size is small.
  3. LVOOP objects are just a (nice) wrapper; you still need an underlying storage method.
  4. Oh yeah, duh. I’m working too hard. Liking my original suggestion better.
  5. I’m confused because I couldn’t get the IPE to work with a variant for the type input (LabVIEW 2011); I have to supply the actual type (which limits its applicability). Using a variant only works on variants inside variants (did you unknowingly do that? would reduce performance). BTW, the first “Get Attribute” that is copying an entire branch of your tree, so that’s also needs to be inplace (if you can get that solution to work).
  6. I believe attributes come out ordered, so name your content attribute a single zero byte (Hex 00) and it will always be the first element (which can be skipped at minimal cost with an array subset).
  7. Another thing to look into is the In-Place Structure’s Variant To/From Element structure, which does preserve attributes. But I think it allows one to change the type of the Element.
  8. Make sure you’ve kudoed "In Place Element Structure Support for Variant Attributes”. It’s the copy at the first “Get Attribute” that is killing you. One way around this is to not use the actual value of your storage variants at all; instead keep the "content" of that tree node as a “NodeContent” attribute. Then your above code becomes just a “Set Attribute”.
  9. An experiment in crude pseudo-UML using the IDE (for a selection of classes, and subset of methods, in my current project):
  10. Oh, I didn’t mean to cast doubt on the use of modeling; just noting the handicaps of using tools designed for languages with an X=F(A,B,..) syntax. It would be very nice if there where a UML tool that could interface with LabVIEW to present a class with all the methods as icons, with ctl-H bringing up the standard window showing terminals and descriptions. Modeling before coding might be slower, as you’d had to create shell VIs with terminals and rough-draft icons, but at least this will save you time when it comes to actually coding. And in return you get a much clearer visual diagram.
  11. Not used UML myself, but it seems to me that the terminals of a VI are much better specified in this way (not that available UML tools will support this ):
  12. You only have one subpanel, and a subpanel only holds one VI at a time (dropping the previous VI if you insert a new one). You also seem to be only creating one copy of your subVI (but you opened four separate references to it). If you want four copies (“clones”) of your SubVI, you need to use option 0x8 (Reentrant run) in the Open Reference, and you need four subpanels.
  13. Making a new “MoveStrategy” class tree is my first thought also, but another possibility is to create a HysteresisCapableAxis child class that by default has a Move method that just calls the parent method, but that can also enable hysteresis (via some “Enable” boolean). You can then enable or disable hysteresis without changing the class.
  14. You mean it is too slow when the reference is invalid? When it is valid then this method takes less time than testing for an invalid refnum and then using it.
  15. Even better than testing for an invalid refnum is actually trying to use the reference. Recreate it if you get an error. There is some post somewhere by AQ that points out the race condition in testing for refnum validity. Here’s an example of a “refnum created and maintained inside a non-reentrant VI” from one of my projects:
  16. A minor warning about that technique. A reference is destroyed if the top-level VI under which it is created goes idle. The “First Call” primitive is reset when the subVI it is contained stops being reserved for execution. If you are working with multiple top-level VIs (such as if using dynamically “launched” VIs) then it is possible to invalidate the reference without resetting the first call.
  17. It’s not a matter of “can be released”; all references owned by a top-level VI are required to be released as part of the process of going idle. This is a little-known but standard way LabVIEW treats all references. Changing this would break or introduce memory leaks into all sorts of old code. I use asynchronously launched VIs extensively and I actually find this feature very useful, though also quite complicating.
  18. Hi Neil, I don’t think that’s how it works. If you put a by-value object in a DVR, the data can’t disappear unless the DVR disappears. The DVR “owns” the object. Only if the DVR contains just a reference to something (another DVR, a queue, etc.) do you have to worry about its independent lifetime. The DVR, like other references in LabVIEW, is itself “owned” by the top-level VI of the subVI that created it (I think this might be called a “VI hierarchy”), and will become invalid if that VI hierarchy goes idle. This only matters if you are sharing the reference between multiple VI hierarchies (such as by asynchronously-called VIs).
  19. Check this conversation for info on the 2013 changes, and a subVI that can be used to fix the problem.
  20. Hi, I’m thinking of submitting my SQLite package in the CR to the tools network. Is “Team LAVA” still active? — James
  21. Oh dear, I think that paper must be badly written, at least when interpreted from your background (and the “copies on the wires” part isn’t strictly true). The whole point of by-value dataflow is NOT worrying about object lifetime.
  22. Yes, by-reference data allows one to be sure your not making copies. It can take a lot of experience before one starts to trust by-value data handling. Using in-place elements and always wiring straight through functions can give one confidence, even if those techniques are often unnecessary. But, a good by-value design can be at least as “copy-efficient”, if not more so, as a by-ref design even, while also having other advantages. Still says “queue”. Queue the data to the central analyzer and have it retain whatever info it needs to interpret further data (like the last battery voltage). — James
  23. You can’t have your cake and eat it too. If you want a low priority process to wait till later then you have to retain the data it needs. If you want no copies, then everybody else has to wait for that low priority process to finish with the data before overwriting it. “Passing wires” doesn’t make copies. Even branching wires doesn’t always make copies. Your app says “queues” to me, not “FGV” or “DVR". Queue all the measurements to a central analyzer. Queues are asynchronous, so can’t stall your acquisition loops. Access to a FGV or DVR is synchronous, so to avoid blocking acquisition you are forced to make a copy for lengthy analysis. Your description of the wide variety of measurements that can be produced definitely suggests LVOOP. A low-risk path would be to just start using classes in place of whatever type-def clusters you are using for measurements. That will force you to use the encapsulation that will allow you to extend using inheritance later on. To a copy. DVRs aren’t pointers; they have locking features that I don’t think could work for locks inside locks. Can you just use an array of DVRs to implement whatever it is your after?
×
×
  • Create New...

Important Information

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