Jump to content

Porter

Members
  • Posts

    233
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by Porter

  1. I'm a bit late to the party, but this is a great use of the Tag Engine and muParser. Use cases like this were exactly what I had in mind when I released those libraries. I've also been asked several times about implementing something similar.

    One suggestion would be to always use labels rather than captions. Personally, I would never consider using captions for this purpose. I would also introduce a flag character, such as @, as the first character of the label to indicate that the control's value should be updated automatically.

    Another improvement would be to allow the user to specify whether a control should be updated on a tag value change event or on a periodic interval. For periodic updates, I'd have the control values refresh every X milliseconds (user-configurable), with the timer reset whenever a control value change event occurs. Perhaps the second character of the label could be used to indicate this option, with periodic updates as the default behavior.

    Why update periodically? In many systems, data arrives much faster than it needs to be displayed on the UI, so periodic updates can reduce unnecessary processing.

    I would also avoid writing directly to tag values. Instead, I would use a Tag SetRequest event. In my view, the UI should not write directly to tag values. Hmm... maybe use the third character of the label to decide this? Looks like maybe all of these flags need to be contained within some brackets.

    Parsing labels as expressions is a nice idea. It had never occurred to me to do that. My usual mindset is that if a value is important enough to be displayed on the UI, it should already exist as a tag.

    Anyway, all this to say. Thanks for sharing what you have done. Nice video. And it would be great if you could share the source code so that everyone can try it out and learn from it. And maybe even improve it.

  2. Its worth noting that I kept the VISA locks in place only to (possibly) support multiple applications trying to access the same VISA resource. I implemented my own locking mechanism using a single element queue as a mutex for locking within a single application instance because the behavior of VISA locks (at the time) was erratic. You might want to try removing the VISA lock/unlock calls from the MB_VISA_Lock library and see if that helps.

    image.png.056674bda4b48e4dd59c3e51c50ec9b8.png

    Another culprit could be the VISA flush in the TX ADU.vi. I have once come across a serial device that didn't like the flush command.

    Try replacing it with a read all bytes at port.

    image.png.f70d1993a305dcb133965ba39a27c288.png

  3. Thanks Rolf for the thorough analysis.

    I axed support because cross compiling for 32-bit Linux was another hassle, and I suspect that nobody will ever need it. I also noticed that the produced .so was 3MB which seems to be abnormally large and I don't have time to figure out how to get the size back down to a reasonable 300-500kB.

  4. 1) That is indeed the expected behavior. Variable values must be explicitly specified. Their default value is NaN. Note that you are defining x,y,Z as constants in the above example.

    2) I was using 5000 range because this package is not NI Tools Network certified and therefore I have no reserved an error range to target. If there is a better starting number, I am open to suggestions. I would not propagate an error code offset input all the way to the top level though. Best to just pick a range and stick with it. But I do understand that 5000 is commonly used at the top level of user applications.

  5. I finally got the 32-bit shared object built on Linux. After 3 hours of fiddling I simply re-installed gcc-multilib and it just worked. 😡

    I have pushed the changes to github. After testing, this will be v3.0.0 because I expect the static linking to be a breaking change in some instances.

    The next step is to compile a large list of test cases to confirm that the new operators are behaving as expected under as many corner cases as we can think of.

    • Like 1
  6. 2 hours ago, AndyS said:

    The only I'd like to remark is, that LabVIEW was searching for the DLL when I placed a muparser VI for the first time. After a while the dll was found the reference updated. LabVIEW did not search again.

    What is the path to your vi.lib? Are you using labview 64-bit?

  7. On 8/30/2023 at 8:06 PM, Rolf Kalbermatter said:

    A star before the file ending is translated to 32 resp 64, a star for the file ending is translated to the respective platform specific shared library file ending.

    Is your shared library name different between bitnesses? Otherwise you do not need a star at all before the file ending

    The shared libraries were named libmuparser-x##-lv.XX

    Where ## is bitness and XX is file extension. So libmuparser-x*-lv.* worked wonderfully on the development version of the code.

    Unfortunately as soon as I build vipm package, the *s get replaced with 32 and dll. So when I open the vis on x64 labview, they are pointing to the wrong dll.

    My solution is link the CLFNs to libmuparser-lv.dll and have a post-install vi copy the appropriate version of the shared library to that filename. I know it looks weird to see a dll in linux, but it doesn't seem to break anything. 

  8. I tried the .\libmuparser-x*-lv.* trick for the CLFN path but when I build a VIPM package, it converts it to libmuparser-x32-lv.dll because I am building on LV 32-bit, Windows. So then the VIs are broken on 64 bit and Linux. If I can preserve the wildcards in the CLFN path it would be ideal.

    Here is my latest attempt. Statically linking to libmuparser-lv.dll but located in the vi.lib next to mupLib.lvlib: lv_muparser-2.2.0.6.vip

  9. Give this a try: lv_muparser-2.2.0.4.vip

    It worked with LV2020 x32 and x64, Windows.

    In Linux I had to manually copy the .so file to libmuparser-lv.dll. Permission issues with the installer of course. I think that Labview needs to be run as root during the install but my community edition was activated under my user account. After doing that manual copy it worked fine though.

    All CLFNs are statically linked to "<resource>\libmuparser-lv.dll"

  10. I prefer not to add any overhead to each call by having to retrieve the path to dll. If I recall correctly, when it was not a path constant wired to the CLFN (eg. a shift register instead) there was some overhead added to each call.

    It will be a bunch of busy of work, but I think that the API is mature enough now that it is worth the effort. I think its about 12 VIs, 4 cases each.

  11. On 8/30/2017 at 11:52 PM, Porter said:

    I also prefer the statically linked dll because I can imagine that no one will remember to include the correct DLL or even know where to find the DLL when they build their exe.

    However, since this library is under development, I think that it is wise to stick with the in-lined mupLibPath vi for now.

    When we get closer to V1.0 perhaps it will be worth putting in the extra effort to setup a conditional disable structure around each CLN.

    This is going back a while. We are at V2.x already. But this fell off of the list of priorities.

    It would allow the application builder to pickup the DLL automatically (and drop it in a support dir).

    I will need to add conditional disable structures around all muparser DLL calls in mupLib.lvlib

×
×
  • Create New...

Important Information

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