Jump to content

drjdpowell

Members
  • Posts

    1,981
  • Joined

  • Last visited

  • Days Won

    183

Everything posted by drjdpowell

  1. You could ignore the error, with NaN as default pressure and temperature. Or you could read flow first, and only get pressure/temperature if flow isn't "<unset>".
  2. BTW, one other use case I've had is "Multiple applications read/write to common config file", which requires careful thinking about preventing one App from overriding changes made by another App.
  3. I think you just need an extra string for each item to hold end-of-line comments, plus a "no item" data type to allow full-line comments. See how teh NI INI Library does it.
  4. There are actually multiple different use cases of config files, and multiple ways to implement those uses cases. My most common use case is "Computer writes config; Human reads and may modify; Computer reads config". The way I do this is mostly: Read config file into Application data structures. Later, convert Application data structures into config file. Comments don't exist in the Application data structures, so comments get dropped. Another (used, by the NI/OpenG INI libraries, and I'm guessing your TOML stuff) is: Read config file into intermediate structure Query structure to set Application data structures Update intermediate structure with changed values from Application data convert intermediate structure back to a config file Here, the intermediate structure can remember the comments in the initial file and thus preserve them. But, IMO, this is also less clean and more complex than the first method, as you have an additional thing to carry around, and the potential to forget to do that "update" part. Currently, with the latest version of JSONtext (now available!), I haven't really developed this second, comment-preserving method. I am more thinking of another, less common but important, use case: "Human writes (possibly from a template); Computer reads", where the computer never writes (this is @bjustice use case, I think). Here, the human writes comments (or the Template can be extensively commented). But I do intend to support keeping comments. It will probably involve applying changes from the new JSON into the original config-file JSON, preserving comments (and other formatting). But that is for the future. Note added later: the config-file JSON with Comments is now available in JSONtext 1.6.5. See https://forums.ni.com/t5/JDP-Science-Tools/BETA-version-of-JSONtext-1-6/m-p/4146235#M39
  5. Note: that package also has RFC3339-compliant Datetime format VIs, if you haven't already done Timestamps.
  6. Messenger Library uses the same watchdog mechanism, although I just trigger normal shutdown via an "Autoshutdown" message ; I don't call STOP. I would have thought 500 ms is too short a time to wait before such a harsh method.
  7. A "queue" is a first-in-first-out mechanism. Don't be confused by specific implementations; the LabVIEW Event system is just as much a queue** as the LabVIEW "Queue". **Specifically, the "event registration refnum" is an event queue.
  8. As thols says, the best practice is to NOT share things between loops, but if you do, I'd suggest a DVR.
  9. Like most problems, once I had a workaround, I no longer spent any time thinking about it.
  10. I've encountered a black imaq image display in exes, solved by unchecking the box to allow running in a later runtime version. Don't know if that is related to your problem.
  11. There are quite a lot of other message-passing frameworks that you might want have a look at. DQMH, (my own) Messenger Library, Workers and Aloha are on the Tools Network, for example. AF and the QMH template are not the only things out there.
  12. https://bitbucket.org/drjdpowell/jsontext/issues/80/2d-array-of-variants-not-converting Will be fixed in 1.5.2
  13. Can you attach the vi you show? Nevermind, I've reproduced it.
  14. Your attribute Values need to be valid JSON. You are inputting just strings. Convert your strings to JSON first.
  15. Do you check for an error coming out of SQLite Close? SQLite will not close and throw an error if unfinalized Statements exist on that connection. The unclosed connection would then continue to exist till your app is closed.
  16. Example are in <LabVIEW>\examples\JDP Science\JSONtext, accessible through VIPM: The JSONpath example might help.
  17. Have you looked at the examples?
  18. I've just implemented this and posted a beta: https://forums.ni.com/t5/JDP-Science-Tools/BETA-version-of-JSONtext-1-5-0/m-p/4136116 Handles comments like this: // Supports Comments { "a":1 // like this "b":2 /*or this style of multiline comment*/ "c": 3 /*oh, and notice I'm forgetting some commas A new line will serve as a comma, similar to HJSON*/ "d":4, // except I've foolishly left a trailing one at the end }
  19. I have been coming round to supporting comments in JSONtext, at least for ignoring comments on reading (which is quite simple to implement, I think). And possibly features to be more forgiving of common User error, such as missing commas.
  20. Can't tell if that is just NI being overcautious, or there is an actual reason for that. Python 2 was sunsetted at the start of this year, so no one should use that. I'm guessing the NI's testing was done against 3.6, as the latest available version when they originally developed the python node.
  21. Not sure it is sophisticated, but here is a simple implementation of an Example that increments a counter (state variable), with an error thrown if count exceeds a MaxCount (state variable). The py Module is called from a LVOOP Object that encapsulates the Python instance. The Class has methods that call the corresponding py-module functions. Python Incrementer.zip py module is this: # Demo of a Python Module, to be called by LabVIEW # Notes on Errors: # Return errors in a form matching the LabVIEW Error Cluster. Examples: # Error = (False,0,"") # No Error # Error = (True,1,"MySource<Err>MyDescription") # 1==Error in input import time # used for sleep() # Example of having global data (global just to this module): Count = 0 MaxCount = 10 def Initialize(): Error = (False,0,"") # No Error (change to indicate an error) return(Error,) def GetCount(): global Count return (Count); def Increment(): Error = (False,0,"") # No Error (change to indicate an error) global Count global MaxCount if Count >= MaxCount: Error=(True,1,"Increment<Err>Can't Increment as at MaxCount") else: Count += 1 time.sleep(.3) # Wait, to count slow enought to see return (Error,Count); def SetMaxCount(NewMaxCount): Error = (False,0,"") # No Error (change to indicate an error) global MaxCount MaxCount = NewMaxCount return(Error,)
  22. Side note: I am definitely going with the native node, in LabVIEW 2020. I think NI is underselling it by providing examples that are far too simple (including no examples of cluster-to-tuple or how to hold state data in your py module). I prototyped my analysis template py module yesterday and it went easy. No head banging frustrations at all.
  23. Hey, I haven't got even one project using python yet. And my Dev PC uses virtual machines, which I already use for issues like developing with or without Vision installed.
  24. Though I see the value in that, I don't think that is a significant advantage in my case. Actually a disadvantage, as my client is already overburdened with "too many things" complexity and would benefit from a standardized python environment. I also want to minimize the complexity of install on a fresh computer, and I think the native node only requires python itself.
  25. Can you say more about that? What do you mean by a "virtual environment"? I experimented with the native node in LabVIEW 2020 and I'm liking it so far.
×
×
  • Create New...

Important Information

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