Jump to content

torekp

Members
  • Posts

    216
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by torekp

  1. Thanks. I'm using 64-bit LabVIEW and 64-bit Visual Studio executable. LabVIEW runs first and creates the memory map, but I don't know how to "Open" in C++ other than "Open or Create". Since the map name is given, I figured "open or create" sounds appropriate.
  2. Update: I compiled an executable with ShaunR's help. My LabVIEW VI (LV 2017) communicates fine with a simple C++ program, but my executable doesn't. I found a workaround (turn the "keep it simple" boolean off, to use the workaround). Still, I'd like to understand. The C++ sharmemtest.zip uses Microsoft Visual Studio 2015 and boost (version 1.76.0, if it matters). sharmemtest.zip shmem_testr.vi
  3. Computers at the devices won't have any WWW connection, only local. And the GUI computer will normally not connect more than locally either. So I'm not too worried about security, although now you can explain why I'm an idiot as well as a noob 😬
  4. Thanks! If not Labview, Python is probably my least-incompetence path forward. Any suggestions on a good starting point - maybe a canned websocket example that I could adapt?
  5. I was trying a python http communication tutorial - https://aiohttp-demos.readthedocs.io/en/latest/tutorial.html#views - when I had to disable the NI Application Web Server to proceed. And then I thought, what the **** am I doing? Maybe I should take the free (well, prepaid) gift of a working web server. Here's my task. A central HQ computer will have a GUI that monitors five machine stations, each of which has its own computer. Every approx 10 ms (negotiable), each station gives a report consisting of two arrays, the larger being 2048 data points, the other much smaller. Whenever HQ feels like it, HQ can tell a station to start or stop (its computer stays on). A local IP connection is used, with a router at each end. There is also a Raspberry Pi with its own IP address at each station's router, that can send camera frames to HQ. The station-computers use Python and C++ to do their work, not counting whatever needs to be added to communicate with HQ. Your advice please? Should I use Labview? On both ends or just the HQ? And which if any of these helpful add-ons suggested by Hooovahh should I use?
  6. I'm not sure, but I think you can use the liblinear functions in https://github.com/oysstu/LabVIEW-libsvm (oysstu's package), and set the solver type to L2R_LR (not "...Dual"). The solver type is a parameter in the cluster "parameters" for liblinear_train.vi. This seems, on first glance, to be doing one-class regression (which is what you want), rather than two-class classification.
  7. As my avatar would say: Missed it by THAT much!
  8. I searched for "DLL" in titles of posts to the forum on Application Builder etc, and got 0 results. Which is wrong -- I know because I have posted a topic with "DLL" in the title! What gives?
  9. I left off an important fact about what I was doing, and apparently, doing wrong. After DAQmxWriteDigitalU32, I was doing DAQmxGetWriteTotalSampPerChanGenerated, DAQmxGetWriteCurrWritePos, and DAQmxGetWriteSpaceAvail. Those diagnostics told me how the problem proceeded, but they also helped cause it. Now that I commented them out, it has run for 17 hours, whereas mean time to failure was <1 hour when the diagnostic commands were used. Ever see the movie Mystery Men? One of the heroes, Invisible Boy, has his super-power only when no one is looking. My cDAQ task can do its job, as long as I don't look at it.
  10. Thanks guys. I already went to direct connection from computer to cDAQ, and that seemed to lengthen the duration without this error - although it's so intermittent that it's hard to tell. I've never heard of NAGLE before, and on reading about it, it sounds like a likely suspect. I'll see if I can finagle something. (Hmm, I probably shouldn't pun-ish people for answering my questions!) Edit: Fin Nagle didn't do me any favors. Network traffic is 416 Kbps sent, which makes sense for my data plus a relatively small header per packet. When I watch task manager as it crashes, the fall-off of traffic is a cliff, not a blip, when error -200621 happens. I have yet to observe another -200292, but that could show me more of a blip; it will keep writing data for about 10 more cycles before the crash. If I can figure out how to make the graph show multiple points per second (and yet not scroll away too fast).
  11. I've got a cDAQ-9185 chassis with four 9477 digital output modules, connected to my computer by Ethernet, writing samples at under 3 kHz (almost 150 samples, every 50 ms). The task keeps giving error -200292 (could not write samples, not enough space) but the real problem is that samples stop being generated. And that happens when there is a long time (~100 ms) between just before my DAQmxWriteDigitalU32 statement (in CVI LabWindows) and just after. It seems that the attempted write doesn't go through until it's too late. I have "Do Not Allow Regeneration" set, for what I think are good reasons, so when all samples in the buffer have been generated, it quits. So, I suspect that Windows and/or the Ethernet port driver are taking their sweet time. Questions: is there a way to have Ethernet based control without massive timing jitter? Or is it "Abandon all hope, ye who enter"? Would a USB-connected cDAQ chassis perform more deterministically?
  12. Just a quick idea, I didn't try to run your code. But I doubt that Excel tolerates an index less than 1. Is it possible that the count of "Shapes" is 0? Is it possible that the Sheet Index was 0, which in turn causes the count of Shapes to be 0?
  13. Wow, conditional auto-indexing in loops has been around since Labview 2012? How the heck did I not notice this?
  14. DLL functions or shared variables? Or something else? I have a Labview 2014-64 executable (or I can build a DLL) that runs one piece of equipment, the X-ray. The other engineer has a large CVI Labwindows 2015 + MS Visual Studio 2012 (C++) executable that runs everything else. I want the Labview code to be a slave of the CVI code, accepting commands to turn X-ray On or Off, reporting failures, and the like. Translating the X-ray code into C++ would be possible in principle, but not fun. Shared variables look easy, but I'm kinda scared of them. I would define all the shared variables in my LV code, since I'm more familiar with LV, then use them in both. There's a thread in here called "Shared Variable Woes" so maybe I should be scared. In the alternative, I tried building a proof-of-concept DLL in Labview, and calling its functions in CVI/C++, and it works, but it's kinda clunky. (I'm attaching it below in case you want to play, or advise.) Your advice would be appreciated. XrayDLL.zip
  15. For what it's worth, for some classifiers (PLSDA for example), I've gotten better results by using a sequence of binary classifiers, rather than just doing all-vs-all. Dunno if this applies to SVM, but I suspect it could. Might be worth the effort.
  16. After getting a PM from Xuan-Thai, I realized that if you want to sort more than two classes, my other statistical modeling post might be useful as a "prequel" to using this SVM code. That other post: Using the Multiple Discriminant Analysis (MDA) example could help you pick which two groups of classes to separate first. Then you would rinse and repeat, always separating along the most easily discernible lines. For example in the graph from my other thread that you can (depending on your browser?) partially see above, it makes sense to separate white from red-and-green first. The MDA example depends on the following Moore Good Ideas packages (get them with VI Package Manager): MGI Cluster, MGI Error Handling, MGI File, MGI String, MGI Read/Write Anything. I'm attaching a Labview 2017 version of the MDA_example code, or you can get a LV2012 version from the original thread (which also has a PLSDA classifier). MDA_example_without_MGI.zip
  17. Thanks! Sorry, I wasn't clear. I'm not trying to use a DLL in Labview. I'm trying to use a DLL (that Labview created) in C++. I read the first website on the "C Struct Hack" and tried to apply it to your advice, yielding this: int i; int len = 2, len2 = 3; int32_t datasz[2]={2,3}; double data1d[6] = { 1,2,3,11,12,13}; double aresult[2][2]; DoubleArray dataouta; DoubleArray datain; void viGet(DoubleArrayBase * result) { for (i=0; i<4; i++) aresult[i/2][i%2] = (result->element); } void viSet(DoubleArrayBase * myArray) { (myArray->dimSizes)[0] = 2; (myArray->dimSizes)[1] = 3; for (i=0; i<6; i++) (myArray->element) = data1d; } int main(int argc, char *argv[]) { viSet(datain); Linear_discrim_4dll(&datain,&dataouta,len,len2); viGet(dataouta); ) and some printf statements. This compiles (yay, a first!) but has a Fatal Runtime Error dereferencing a null pointer to datain, at the call to viSet.
  18. So I created a DLL from a Labview VI that has a 2D array input (and some scalar inputs) and some 2D array outputs. Labview creates a .h file with these lines And then it defines the 2D array arguments to my function as being of this type: "void __cdecl Linear_discrim_4dll(DoubleArray *dataObsFeat, int32_t grpAsz," etc etc. Trouble is, I have no idea how to fill out this structure so that the DLL can use it. Say for simplicity I had a 2 by 3 input called dataObsFeat with elements {1,2,3; 11,12,13}; how would I create the object with these values in C or C++ and pass it to the function? I am a total C++ noob, in case it isn't obvious.
  19. Ah, thank you! I tried this guy's advice item number 7 and it worked. A bit brute-force, but maybe that's OK. (I'm not using typedefs.)
  20. Yes it was. However my only other option for where the .chm file goes is "same as caller", which also fails.
  21. So, according to this NI document http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/linking_vis_to_help_files/ It should be possible to link a .chm file into your executable so that a user can choose Help > Help for This VI. Well, I followed the advice, and no dice. Here is my LV2017-64bit attempt. In the development environment, it works fine, but in the executable Help for This VI is grayed out. The .chm file is a poor excuse, and unrelated to this VI, but never mind that, it's not the problem here. LV17helpEx.chm html_help_VI.vi test_help_html.aliases test_help_html.lvlps test_help_html.lvproj
  22. Supposedly there are Labview tools available at http://www.lvs-tools.co.uk/software/utilities/ But whenever I try to register or login, nothing happens. (Also, I try to think, but nothing happens.) Are there any other Labview codes that use the Windows Memory-Mapped Files functions, or should I just reinvent this wheel? By the way, here is a Microsoft document on the subject: https://msdn.microsoft.com/en-us/library/ms810613.aspx
  23. Thanks guys! I'm downloading the matlab style package now. The primary user is me, actually, and I chose my scheme so that it's easy to ignore everything but color, which groups things nicely. It is a little more convenient for me to graph every particle on one graph, but maybe it would make better sense to have two graphs, one per location. Good idea. Thanks again.
  24. Here is a graph I made recently, which shows particle number (symbol), material (broad color family), measurement location (exact color), amplitude (X axis) and phase (Y axis). That's five dimensions in a 2D graph! There are some obvious limitations. For instance, there are only 16 symbols, so whatever you're representing by choice of symbol better not have more than 16 categories. And there are only so many colors, especially if you want them all to be ordered in a spectrum from red to violet. It gets worse when you try to have "broad color family" like I do here with reddish colors for aluminum and bluish for titanium, because the obvious logical thing to do is to skip over some shades in between the families, reducing the total number of available colors. What other options should I consider? How do you do it? I don't usually use 3D graphs because (a) they're harder to work with and (b) when I create a report for management, they like to have 2D images they can print out, or view without needing Labview on their computer. I'm attaching two VIs I use to create color spectra for my graphs. I use colors_darken_lighten to darken plots for a white background. To skip over colors, I obtained 6 colors in my spectrum and reshaped the array to two-by-three, then indexed by measurement location to get the first two colors from each broad color family. colors_darken_lighten.vi plot_color_spectrum.vi
×
×
  • Create New...

Important Information

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