Jump to content

drjdpowell

Members
  • Posts

    1,969
  • Joined

  • Last visited

  • Days Won

    172

Posts posted by drjdpowell

  1. If it makes you feel any better, in the build environment generally these unused dependencies are removed. 

    True, but how do I identify real dependancies from all the fake ones?  

    Unless VIPM is involved, I Use LLBs instead.

    LLBs don’t seem to be equivalent (though I never really used them).  No namespacing, no Private scope.

  2. I’ve used a single 2D picture control for similar work (no drag’n'drop, but I have full mouse-click logic including insert, delete, cut and paste, as well as “settings†and “disable†buttons built into the picture).  It’s not that hard once you have made a “what is the mouse over†subVI that accepts mouse coordinates (you’ll need a cluster/class to hold the known coordinates of your icons).

     

    post-18176-0-21902800-1416922045.png

     

    I would suspect that the VI server route would be harder.

     

     

     

    • Like 1
  3. Something I did not appreciate till today:

     

    If I have an LVLIB library in which I use one of its VIs, then any LVCLASS class referred to by ANY of the LVLIB’s members will be loaded into memory (along with all their dependancies).

     

    In addition, the fact that all library members show up under “dependanciesâ€, even if only a few are actual used, makes it difficult to get useful information about real dependancies. 

     

    So, should I ditch the use of LVLIBs altogether as a hopelessly-flawed tool? 

     

    — James

     

    Added later: Must be getting old, as I forgot that I already knew this.  But the question remains of what to do about it.

  4.  It actually only escapes the bare minimum which does not include / despite there being an escape character, so both are valid JSON, just not comparable.

    I had never noticed that JSON allows, but does not require, / to be escaped as \/.   Googling suggests this is due to some use of JSON embedded in other formats such as HTML that do use / as a control character.  I believe our library as it stands should accept both versions.   But what should it do on output?

  5. I would say putting common logic in the parent is desirable behavior.   And I don’t mind if some children will want to override the default parent behavior.  For example, I have a project at the moment that uses cameras and “lockinâ€, the extraction of a periodic signal in the image.  Most concrete camera types just override the "Get Image" method, and the parent’s "Get Lockin Image†method uses "Get Imageâ€.  But  one camera model has a built-in lockin mode, so I override “Get Lockin Image†in that case.

    • Like 1
  6. I've been scratching my head thinking "is it me who doesn't see it because I'm fresh to OO, or" for a while... But there may also be design reasons for me to keep things like this (and fit to my competence level) for the time being.

    It’s worth breaking through whatever conceptual block you have, because the code you have shown is considerably more complicated (and will require a higher level of competence to execute correctly) than the OOP solutions shoneil and I are talking about.  And there are no advantages I can see to the way you are doing things.

  7.  I therefore poll at intervals its output for changes, and live with that output being a variant. 

     

    You can still push the details into the subClass.  Your generic code only needs a "Show Configuration UI in subpanel" method and a "Poll Configuration UI" method.  You'll be able to write vastly simpler code in the subClass itself (no Variants, no Open VI ref, no Property nodes).

  8. Indeed, "Set Rate formula" was for an example, I'm going to “Show Device Configuration UIâ€.

    All Devices can implement “Show Device Configuration UIâ€, so you do not have any problem.

     

     

    In fact I need. My problems with clustering all children are that I don't know how to retrieve programmatically a cluster i-th element, save to replace it with an element of a different type (unless they are all variants), and that growing the cluster may be problematic; and with arrays of different device types, that each future device type would require a new array. Better to plan ahead.

    Your mixing two incompatible statements: you’re code is generic enough to switch types, but specific enough that it must use one specific type.  If you organize your code in levels, generic and specific**, then each level will be a lot cleaner.

     

    **Note that you can have intermediate levels, such as a generic “power supplyâ€.  Code can know that it is using power supplies (rather than generic devices) but not depend on the type of supply used. 

  9.  But if I group heterogeneous devices in an array, the array becomes of the ancestor class, and I lose the access to peculiar properties. 

    I think your conceptual problem is here.   Your high-level, handles-array-of-generic-devices, code shouldn’t want to know anything about specific device properties.  One of the biggest advantages of OOP is the ability to have generic code that doesn’t need to be complicated by a 1001 specific details.  Anything specific needs to be pushed down a level to the specific child classes.   The high-level code may have dynamically dispatched methods such as “Get Device configuration as Stringâ€, “Set Device configuration as Stringâ€, “Get Human-readable Device Statusâ€, “Show Device Configuration UIâ€, and so on.   It should never have anything as specific as “Set Rate Formulaâ€.

     

    Now if you do need to write specific code that “knows†what the devices specifically are, then use a cluster, not an array (note that you can use a cluster of arrays of specific types if you have a variable number of each device type).

  10. Oooh. You are so close. Won't be long now until you're talking about services instead of actors :D

    My actors are already services.   They’re private, rather than public, services, so access to them needs to be explicitly passed.  Rather like an unnamed Queue is different from a named Queue.

    It makes me want a “Tastes Like†message that tongue can send out to “registered recipientsâ€.  Other actors can route the message through the tree to the destination without knowing anything about the contents (like the post office).  

    If I were to adopt the AF, such a “Notification†and “Routing†system using “Data Messages†would be the first thing I would do.   Mouth would register for (and re-notify) Tongue’s Data Message.  Brain would register Chew to receive Mouth’s re-notified Data Message (originally from Tongue), contained in a “Command Envelope†that tells Chew what to do with the info (Command Envelopes illustrated here).  

  11. A previous related conversation:"Decoupling message based systems that communicate across a network"

     

    Added later: I'm a strong proponent of message decoupling, even with the string-labelled messages I use instead of the Command pattern.  I never want a component to explicitly contain text commands for anything that isn't a subcomponent of it.  Instead, and command text is injected as part of the "reply address" attached as part of the initial message received from higher-level code.  This has the great advantage of making it easier to follow code, since I don't need to place any actual commands in the low-level actors, and just need to study the high-level actors to understand the app.  The low-level actors are also more simple and reusable.

  12. Even if the child creates the DVR, the reference's lifetime is tied to the top level VI that created it. You're going to still have to use an Async Call VI method (which will at some point call the create DVR method), so that's what will control the lifetime of the reference.

    If one uses a named single-element queue, instead of a DVR, then one can get the lifetime of the queue to exceed that of its initial creator.  This is because one can create multiple references to it; the queue continues to exist till all references to it are released.

  13. If one needs a persistent reference, not tied to the lifetime of one VI hierarchy, then one can either:

    1) Async Call a VI to create and own the reference as brink is doing.

    or 2) Use a Named Single-Element Queue with multiple references instead of a DVR to hold the session data.

    -- James

    BTW: If I were designing a persistent session framework I would probably combine both, in order to get around their individual weaknesses:

    (1) can't handle VIs that forget to call the Close Session method, in violation of LabVIEW's standard "refs don't outlive their creator" rule.

    (2) can't execute cleanup code, as the data in the SEQ is just dropped.

  14. Thanks, I didn't know about the synchronous display stuff. The producer is actually doing other processing tasks with the frames, and needs to spend as less time as possible on the display, which is secondary compared to the overall acquisition rate, so I need display-related stuff to be wait-free in the producer.

    I suspect simply writing to an IMAQ image indicator inside the producer (and get rid of the consumer entirely) will be less overhead than your complex structure.  

  15. You’ll need to mark your Image Indicator as “Synchronous Display†if you want it to display before the Producer overwrites the buffer.  Indicators are asynchronous by default and update at something like 60Hz, slower than your 400 frames/second.

     

    BTW, I can’t see how this code would interface with some other process doing the main application work on all 400 frames.  What do you do with the full 400 frames?

    • Like 1
  16. Unfortunately I can't use any async framegrabber option, because I'm doing processing on sequence of images, which disables the possibility of a "get latest frame". I really need to implement triple-buffering by myself, or I'll have to slow down the producer with copying image to the display at each iteration.

     

    I don’t have enough of a feel for your application to give specific advice, but are you sure it wouldn’t be simpler to attend to the main processing of your 400 images per second in a simple clean way, then just make a copy for display 20-30 times per second for the separate display part, rather than invent a complex locking system to avoid those 20-30 copies?  You might be able to do the display with a single IMAQ reference, making it very simple.  

  17. But in my case a slower consumer can drop frames (maybe I should have pointed that before), as it's just for display. So if producer is faster it must not be slowed down waiting for consumer to process every frame. Does my problem make more sense now?

    Again, check that your frame grabber isn’t already buffering, with a “Get latest frame†method.  That is what I would expect it to do.  And this would greatly simplify your program as you’ll only need one loop.

     

    However, you can get “lossy behavior†by getting the Consumer to flush the queue and only process the last element, passing any other IMAQ refs returned back to the C—>P queue.  You might need more than 3 refs if your Consumer is very slow.

×
×
  • Create New...

Important Information

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