Jump to content

drjdpowell

Members
  • Posts

    1,969
  • Joined

  • Last visited

  • Days Won

    172

Posts posted by drjdpowell

  1. In triple buffering the producer never waits, that's its strength. 

    Uh, it aint magic.   If you can consume 90 frames a second then you can’t produce 100 frames a second.   In that case, a single buffer would lead to something like 45 frames/sec, as the Consumer waits about half the time for the producer.  With two buffers the frame rate would still be less than 90/sec, as jitter in the Producer sometimes causes the Consumer to wait.  With three buffers the jitter doesn’t matter, and one gets 90 frames/sec.  But you don’t get 100.

    BTW, you should check to see if your Matrox frame grabber isn’t already buffering frames asynchronously, rendering additional buffering pointless.

  2. Version 1.3 contains the following significant changes/additions:

     

    1) new pallet location under “Data Communicationâ€. 

     

    post-18176-0-93020100-1413402977.png

     

     

    2) a new “DEV Actor Template†which is my attempt to combine two past templates I have used into a singular one with the advantages of both.  Find the templates under “<LabVIEW>\examples\drjdpowell\Messenging\Actor Templatesâ€.  This design owes a debt to the excellent JKI “state machine†template.

     

    post-18176-0-63943800-1413402955_thumb.p

     

     

    3) I have had a project where I have dealt with an array of actors (and analysis chain), and this has let me exercise and extend the “FutureToken†part of the library.  A Future Token is a single-use address that can be used to represent and organize messages that have not yet been sent.  This is mostly used to deal with the indeterminate response order when gathering information multiple actors at once (for example, when requesting configuration information from many actors for saving to a single file).  

     

    post-18176-0-60696700-1413403686.png

    This allows the gathering of multiple response messages into a single “Message Bundle†that can be acted on as a single step.  The Bundle can be easily converted into an array or cluster of the required type. (Originally described in this conversation.)  This is a form of the Scatter-Gather messaging pattern.

     

    post-18176-0-53523400-1413403699.png

    This helper actor deals with the fact that replies to a series of requests can come back out-of-order, leaving the last reply not consistent with the last request.  I developed this in an app where mouse-move events over icons representing running actors triggered a request-reply to the relevant actor to get a description for display to the User.  Fast mouse moves could exceed the response time of some busy actors, resulting in an inconsistent description.  This is a form of the Resequencer pattern.

  3. I believe Quick Drop uses the VI Title, rather than Name, so we can easily change the titles without causing any other issues.

     

    String values are escaped; however I realized recently that the name strings in JSON Objects aren’t escaped.  That’s on my list of changes to make when I have the time.  

     

    —James

     

    PS> since we are listing issues that need to be addressed, the parsing fails on empty subObjects, such a {subObj:{},â€OtherItemâ€:1}

  4. I apologize to users of this library.  When NI made me rename the library to “SQLite Library†from “SQLite LabVIEWâ€, I inadvertently allowed VIPM to rename the root directory accordingly, so this might cause your minor conflict headaches when opening old projects.  Sorry.

    • Like 1
  5. I keep meaning to make time to work on JSON but here’s an idea:

     

    Instead of storing the JSON Object’s values in a Variant look-up table, store them in an array and store the index to that array in the lookup table.  That might have better performance since one may be able to do some operations in-place on the array (Variant attributes always make copies, sadly).   As an added advantage, one can output the JSON Object in the original order by using the array order.  There would be some overhead here, as you’d have to sort the names based on the indexes to match them to the array order, but this part could be easily be optional based on a boolean input (similar to “Pretty Printâ€).

     

    Let me think about it some more...

  6. To be honest, it's a little esoteric to me right now

    The basics isn’t complicated.  I don’t even have a formal MVC architecture like mje and couldn’t tell you exactly what’s the “model†in my projects.  The central idea is that state is held (“ownedâ€) by the component furthest down towards the actual thing that the state is about (data, as mje talked about, or hardware, as is more likely in my case).  This component is the Model.  UI commands flow down to this Model.  UI “views†(the information shown to the User) flow up from the Model.   There is a clear C —> M —> V linear chain of action.

     

    The simplest MVC in LabVIEW is to call a write method on an object, setting it with a Front Panel control, then calling the read method periodically and writing to a local variable of the same control.  For example, if set “Output Voltage†to 6V and the limit is 5V, then my control will say 5V, the actual output value, rather than 6.  If an automatic safety feature kicks in a limits voltage to 1V, then my control will show 1V.  My FP control, acting as a “Viewâ€, will always reflect the true state of the system, while still serving its dual role as a “Controller†element.  

    When I first started doing this I used to hard-code the notification mechanism, but found myself often creating brainless loops where the sole responsibility was to go translate one transport mechanism to another (convert a queue to a user event, for example). When going about this, do yourself a favor and abstract the subject/observer interface. The subject shouldn't care if the transport mechanism is a notifier, queue, user event, or some derived construct. Make the subject take an abstract class, and have the observer decide how it would best like to receive that notification. Is my observer an Actor? Fine, it will supply a concrete observer class that packages the notification into a message and shoots it off. Maybe my observer is a primitive UI loop? Fine, it will supply an observer that packages the notification into a user event. Maybe my observer is a remote object so we use a class which pushes notification over TCP/IP. You can change all this without any modification to the model or other views which already use the model.

    Note: I also highly recommend abstracting away the transport method from the sender of information via a “callbackâ€-like feature.  That’s a central feature of the framework I use.  

  7. Some sort of MVC if that helps (I don't think in those terms). 

     

    Start thinking in those terms.   The Model IS the state.  The Model never requests anything from the UI (View Controller).  Nor is state “copied†into it.  The Controller commands the Model and the Model updates the View with a copy of any state info the View requests.  

    • Like 1
  8. Would it really hurt that much to make the output look exactly like the input which is what we all kind of expect and know to be right? Relying on a specs throw away description about an unordered list seems a bit of a cop out to me and it would probably make testing much easier and simpler as you could do a straight input/output compare. It wouldn't break existing code, either. So I'm not sure what the resistance is apart from the effort required which has already been done.

    I haven’t looked at the change, but I imagined that it involved building a separate array of item names.  If so, that is a significant additional overhead that will reduce performance.  If this ordering can be added either without significant overhead (or can be turned on optionally when needed) then I don’t really object.  

     

    Note, though, that “what we all kind of expect and know to be right†is the assumption that caused the other-language JSON implementation to be released in such a flawed and brittle state.  

     

    — James

  9. SQLite is the nicest solution, but if you only need a decimated graph of the full data (no zoom in for fine scale), then a quick fix is a “self-compressing arrayâ€.  An example taken from a past project:

     

    Self Compressing Array.zip

     

    This automatically decimates the data to keep the total under a fixed size.   Never allocates memory except at initialization.  But you can’t zoom in; for that and other cool features you have to go with SQLite.

    • Like 1
  10. The problem is when I recursively dive into sub clusters and convert them into arrays of variants (inside individual elements of the outer array).  For example, if I am setting a cluster that matches the JSON text,

     

    {subcluster1:{a:1,b:2},subcluster2:{c:3,d:4}}

     

    then I will end up with an array of two Variants, each of which is an array of two Variants.  

×
×
  • Create New...

Important Information

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