-
Posts
1,981 -
Joined
-
Last visited
-
Days Won
183
Content Type
Profiles
Forums
Downloads
Gallery
Everything posted by drjdpowell
-
Name: Shortcut Menu from Cluster Submitter: drjdpowell Submitted: 06 Mar 2013 Category: User Interface LabVIEW Version: 2011License Type: BSD (Most common) A pair of subVIs for connecting a cluster of enums and booleans to a set of options in a menu (either the right-click shortcut menu on control or the VI menu bar). Adding new menu options requires only dropping a new boolean or enum in the cluster. See original conversation here. I use this heavily in User Interfaces, with display options being accessed via the shortcut menus of graphs, tables, and listboxes, rather than being independent controls on the Front Panel. Relies on the OpenG LabVIEW Data Library. Click here to download this file
-
No, the DD methods are not per child class; they are just methods to do stuff (which the children can override). Child DUTs can also provide new methods, and messages can be written that call them by casting the DUT input to the correct child class. — James Added later: here’s an example “execute” method (though called “Do.vi”): “VI Display name" is the message; it calls two methods on “Logger Daemon” to complete its task.
-
Your Message class should have an “execute message” dynamic-dispatch method that has a DUT input. Inside the execute method you call dynamic-dispatch methods of DUT. So you can make child message classes that call different DUT methods, and child DUT classes that override those methods.
-
Error Handling in messaging systems
drjdpowell replied to John Lokanis's topic in Application Design & Architecture
I made one yesterday. Here is the only public API method, “Send Message with Reply Timeout”, which is identical to my regular “Send Message” method but with a timeout input and an optional input for the Timeout message to send: Works by an asynchronous call of a small “watchdog” that waits on the reply and returns either that reply or a timeout message. It then shutsdown. I should add that this only works for a system where the address to send replies to can be attached to the original request message. Hard to define a “reply timeout” without a defined reply. — James -
Error Handling in messaging systems
drjdpowell replied to John Lokanis's topic in Application Design & Architecture
Well, timing out would be an error, and one could handle that error in multiple ways: log error and shutdown anyway, display error to User and wait for input, trigger hardware emergency safe mode. My point is that one’s code may require awareness about something, that is supposed to happen, not happening in a reasonable time. It’s obvious how to do that with synchronous command-response, but not so clear if one is staying fully asynchronous. I’m thinking of creating a “helper” VI for my framework that can be configured to wait for a message. If it receives the message within the designated time it just forwards the message to its caller and shuts down; otherwise it sends a "timed-out” message instead. That way the calling loop can send a command that it expects a reply to, and execute code to handle the case that the reply never comes, while remaining fully asynchronous and unblocked. -
Error Handling in messaging systems
drjdpowell replied to John Lokanis's topic in Application Design & Architecture
Question: Doesn’t a fully asynchronous message system still need the concept of a timeout? In your shutdown example, the UI loop is at some point waiting to receive the “Exited” messages from Loops 1 and 2. If one of those messages fails to arrive, won’t it be waiting forever? -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
Could you point me to that thread? I had a quick scan but couldn’t find it. -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
I mean if you can’t service the queue as fast as elements are added, then you’ll eventually run out of memory. — James PS, if you recall this conversation we had, one can use a timeout in a way that is guaranteed to execute the desired code on time -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
mje was talking about using a “zero or calculated timeout”, a technique I’ve also used. If a zero timeout never executes your actor’s gonna fail anyway. -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
I was thinking more of the use of a message queue as a job queue for the actor, rather than what to do about filtering messages, but the general idea would be to have the actor’s message handler serve as supervisor or manager of a specialized process loop. The manager can do any filtering of messages, if needed, or it can manage an internal job queue. It can also handle aborting the specialized process by in-built means that can be more immediate than a priority message at the front of the queue (like an “abort” notifier, or directly engaging a physical safety device). It wouldn’t be a hollow shell. -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
I particularly second this. Actors should endeavor to read their mail promptly, and the message queue should not double as a job queue. -
Self-addressed stamped envelopes
drjdpowell replied to drjdpowell's topic in Application Design & Architecture
Hi Ben, The launch technique is stolen from mje’s “message pump” package. It’s used by the Actor Framework, also. The Actor Manager installs in a different location, and should be available under the Tools menu: Please note that the Actor Manager is badly in need of rewriting. It’s not pretty. What’s your use case for TCP? I have TCP Messengers in the package (which use TCP actors to run the client/server) that are intended to seamlessly substitute for other messengers (handling replies and observer registrations). At some point I will write the code to launch an actor sitting behind one of these servers. Do you want a TCP actor to talk to external non-LabVIEW code? BTW, I’m in the midst of writing a talk on this package that I’m going to present at the European CLA Summit. Of course, this has made me relook at lots of things I did and want to change them . I’m going to upload a new version before that summit in April. — James -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
In the framework I’ve developed, I get a lot of use out of subclassing the central enqueuer-like class (called, perhaps too simply, “Send”). Below is the class hierarchy. But “assertions of correctness”, what’s that? Breaking down some walls will certainly lose something to what AQ is trying to do. Personally, I think the tradeoff in flexibility would be worth it, but it would mean that that flexibility would be used to build some problematic code. -
Actor-Queue Relationship in the Actor Framework
drjdpowell replied to mje's topic in Object-Oriented Programming
A related conversation I started was “Suggestion: A different class structure for Queues”. -
But aren’t you in danger of being the overzealous designer, Jack. You want to impose “Must Implement” of a “Construct.vi” on “Message”, a class that I don’t believe even has a constructor at the moment. And at least initially, you imagined this required constructor to be “Send”. What requirements could you have made at that point that were not, in hindsight, either blindingly obvious (“we need to construct our objects”), or overzealous (“must be called Send or Constructor”, "must have an Enqueuer input”)? You can’t enforce “must actually use this function”, so any error in requirements will just lead to unused “husk” methods made only to satisfy the requirements. — James BTW: There is an example of this very thing in the Alpha/Beta Task example in 2012, where “Alpha Task Message” has two independent constructors: a “Send Alpha Task”, following the standard pattern (not enforced, of course), and then a “Write Data” constructor written when it became necessary to write a message without sending it.
-
A good example, because “Send” being a method of Message has always looked wrong to me. Messages are written; sending is an action of a communication channel. The act of sending should be independent of the message type. I don’t want to implement Send.vi; I want to implement Write.vi. How will “Must Implement Send.vi” feel about that? Also, what about messages that have no data, and thus don’t need a creation method of any kind? They don’t need to implement Send or Write.
-
I don’t know why that caused you problems, but always try and use the Default Data Directory for saved files, since you can rely on having write access even in an executable.
-
I do have an example of a parent-class restriction that I wish I could make. I have an abstract “address” object that defines a method for sending a message. The framework that uses this parent assumes that “Send.vi” is non-blocking (and reasonably fast). But there is nothing stopping a child-class being implemented with a blocking enqueue on a size-limited queue, other than documentation.
-
One of the topics in the thread following this post by MattW is a possible reduction in performance due to LabVIEW needing to check if the dll path input has changed between calls. In this later post by me I explained why I switched to using an in-place structure: "I found through testing that some of my subVIs ran considerably slower than others, and eventually identified that it was do to details of how the class wire (from which the library path is unbundled) is treated. Basically, a subVI in parallel to the CLN node (i.e., not forced by dataflow to occur after it) would cause the slowdown. I suspect some magic in the compiler allows it to identify that the path has not changed as it was passed through several class methods and back through a shift register, and this magic was disturbed by the parallel call. This being a subtle effect, which future modifiers may not be aware off, I’ve rewritten the package to use In-Place-Elements to access the library, thus discouraging parallel use." Opps! I really should document more. This was only my second “wrap a C dll” job, and the first time I’ve used “MoveBlock”. The issue is the fact that C strings have an extra 00 byte at the end and thus are one byte longer than their LabVIEW string length. I’m not sure I’m doing it correctly, but in “Pointer-to-C-string to String” I’m walking along the string to find the 00 byte, while in the other MoveBlock uses I’m getting the exact string length from sqlite. Check that you are “reseting” any statements when finished (or you’ll be holding a Read lock on the database file), and that you aren’t holding an SQL transaction open (a Write lock). — James
-
Could you post some code illustrating the problem? Or images of your producer and consumer code? I can only guess that your holding a lock on the database open somehow.
-
Variant Config: format timestamps in human readable form
drjdpowell replied to d_laub's topic in OpenG Developers
I wonder if anyone has ever saved Timestamps needing better than millisecond precision in a config file. That would be the potential issue with this suggestion. -
Hi, You have a call to a missing xnode: "Minimum Array Size.xnode" in your “Toolbar.xctl:Set Toolbar Images.vi"
-
I assume you meant “Must Override”; I don’t use that much, but I’ve never had experience with writing parent classes for other designers to make children of, so I can’t really comment on that. As far as “Must Implement”, I can’t really think of a good use. Child classes can be used for purposes that are different from what the designer of the parent class envisioned, so adding restrictions at that stage seems inappropriate. Especially ones that can be easily broken by adding a not-to-be-used extra methods (what icon glyph should we have on VIs never meant to be called but needed to satisfy misguided restrictions?).
-
More than that. The IPE makes explicit what the compiler tries to do anyway: minimize copies. In fact, the IPE’s real benefit is as a guide to the programmer in writing code that can be done in place, rather than actually allowing in-placeness.