Jump to content

jdunham

Members
  • Posts

    625
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by jdunham

  1. 1. Is it really true that a copy is made on the Dequeue operation? That surprises me since there can be only one destination for the queue element.

    Oh yeah, you are certain to get a copy there. You have that matrix on two totally separate wires on your diagram, so a copy is needed for each wire. Now in your trivial case, those two wires will never execute at the same moment (probably!) but if you make the diagram a little more complicated then they could execute at the same time and would absolutely need to have separate copies in memory of whatever might be in the two wires.

    2. Would I be able to eliminate the copy by wrapping the matrix in a DVR and passing the DVR on the queue? Would the performance hit of using the reference negate the savings? (I'm not sure if I would actually do this; it's more of an learning exercise at the moment.)

    This seems like a textbook case for DVRs, assuming you really need the producer-consumer pattern. I don't know too much about the internal implementation of DVRs, but it seems likely that dereferencing the DVR would be a very fast operation, and not something to worry about if your app is also throwing around 300kB arrays.

    Note that if you branch the wire of the matrix after dereferencing it, LV may still need to copy your data.

    Jason

  2. If you can create a VPN between the two computers, they will have extra IP addresses on the same subnet and you can create connections in either direction. If you can make an SSH connection, you should be able to make it act like a VPN. Search on the internet for "SSH Tunnelling".

    If you can't use a VPN, you will have to ask whoever owns the router create a rule for NAT (network address translation) that forwards inbound requests to your server PC inside the firewall. If none of that is possible or permitted, then like Tim says, you are probably out of luck.

  3. I think I have figured out how to get my LabVIEW built exe to always run as administrator (embed a custom manifest file) but now I need to run some post install batch files as administrator as well. Does anyone know how to get the LabVIEW installer to do this? I also need to mark some other batch files I install to only run as administrator. Perhaps there is a way to do this within the main batch file that I run post install.

    It would also be nice if the resulting installer was backward compatible with WinXP. But the Program Files (x86) thing is really getting in the way of that...

    John,

    we use elevate.exe to run some batch files during our installs:

    http://www.wintellec...e-in-vista.aspx

    the batch files also check the windows version and the existence of "ProgramFiles(x86)" which exists as an environment variable if you are running 64-bit windows

    @ECHO OFFPUSHD %~dp0REM "FIND" will not be found without its path if you have cygwin installedVER | %WINDIR%\SYSTEM32\FIND " 6."IF NOT ERRORLEVEL 1 (	InstallationSupport\Elevate.exe CMD "" /C "CD /D %CD% && InstallationSupport\InstallAll.bat" ) ELSE (	@ECHO This installer is for Windows Vista and higher only!	PAUSE)POPD

    This code finds our install folder and puts it in an environment variable so that other batch files can use it.

    @echo offIF "x%ProgramFiles(x86)%x" == "xx" (	REM CASE 32-bit	REM Quote marks are added here to make it consistent with 64-bit case 	SET ShotSpotterProgramDir="%ProgramFiles%\ShotSpotter"	) ELSE (	REM CASE 64-bit	REM quotation marks are unfortunate but totally necessary, or else the if statement cannot be parsed. 	REM this did not seem to be a problem in XP, but windows 7 chokes on it.	REM the added quote marks end up in the environment variable, but everything seems to work OK.	REM even the quotes end up in the middle of paths built using this variable.    REM if the additional elements of your filepath have no spaces you will be all set.	SET ShotSpotterProgramDir="%ProgramFiles(x86)%\ShotSpotter\"	)REM enable next line for debugging:REM @echo ShotSpotter Location = %ShotSpotterProgramDir%

    - Jason

  4. Normally you would control a DC motor with a motion control board. There are a whole host of technical problems that these boards solve, and NI and many other vendors sell them. It is usually a huge waste of time and money to reinvent that stuff.

    If that is not a permissible way to solve your problem, then it would help to give more information about your situation. Is this is a school project where you are supposed to learn about electronics or feedback control systems or programming? Are you developing custom motion control hardware and want to prototype it with a flexible DAQ system? Is it for hobby use and the requirements are simple enough that the motion control HW cost is not justified? If we know more about where you are going, we could help you get there.

    Jason

  5. From your research is a while loop running in parallel to other while loops (e.g. Main VI) always a thread?

    Well if you call them "LabVIEW threads", then 'yes', but if you mean OS threads, then 'possibly'.

    My understanding is that the LV execution engine can use one or more OS threads, as it sees fit, to execute your compiled chunks of diagram code.

    There is a little bit of explanation in the Labview Help under "LabVIEW Threading Model" (help index: "threading model") and "Execution Systems in LabVIEW" (help index: "multithreading, execution systems")

    The explanations are rather brief, but basically you are not supposed to worry about it. Still it's helpful to know that LabVIEW threads are not OS threads, and neither are LabVIEW Execution Systems, just in case you are using some system analyzer tool which monitors OS threads and you see something different than you expect.

  6. Lately I've been reading up on data flow languages in general and Labview's execution system and discovered I have been thinking about things all wrong. Chunks of code without data dependencies can execute in parallel, so over time I have come to associate that parallelism as meaning multiple OS threads are used. It turns out that's not the case. Multiple threads may be used, but are not necessarily used.

    So that leads to my question. If they're not threads, what do we call each arbitrary unit of code that is free from external data flow dependencies?

    Around here we call them "LabVIEW threads". I think it's a reasonable name because they have the same purpose and behavior as OS threads, even if the implementation is hidden in the LV execution engine. Even though it's much easier to implement a LabVIEW thread than an OS thread in many other languages, that's just one of the cool features of LabVIEW, it's not a reason to change the name.

    As a related example, you might have some operation that "reads data from disk file". But if you have a modern OS, it often occurs that the data is actually acquired from a cache and is not coming directly from the filesystem hardware (which of course may or may not be disk-shaped). But you don't care, and no one thinks any less of you that you chose your words imprecisely. And if LabVIEW inserted some other gee-whiz functionality to further change the implementation of disk-reads over what the OS provides (the way they do with threading), then it still wouldn't be a reason to change the name.

  7. Huh???

    ...

    'Mouse Up' certainly works, but you can get quirky behavior. Have you ever considered that you can click a blank area of the panel, move the mouse over a button, release the mouse button, and BOOM... fire an event! Hardly desired or intuitive action.

    And if you are concerned about the user changing his/her mind, the 'Switch/Latch when Released' provides the capability to drag the mouse off the button and release without firing the event. In fact, the button displays its previous indication when hovered off as an indication to the user that the action won't be performed. This is standard operation for most, if not all, Windows (and I assume MacOS) buttons.

    I agree with Scott. I've been using Value Changed for years with booleans and it always works well for me, including handling the edge cases Scott just mentioned just as the end-user would expect. Further, if you have set Key Navigation for the buttons, then Mouse Up is not going to fire and the user may wonder why your code doesn't work. I suppose you could program keypress events to duplicate the Key Navigation functionality but it works fine if you do it the easy way. Also with Value Changed, you can easily simulate the button press with the Value Signalling property if you need to test your code or chain events.

    Under normal configuration and use, you do not get more than one Value Changed event for each button press. I'm not sure what is causing the OP's problem if it's something other than what George suggested.

    Jason

  8. Nice! References and shared variables are so simple I'm disappointed I didn't think of it myself. Thanks for the tips. I've got a lot of reading and experimenting to do now!

    I feel like people haven't mentioned the obvious here: You can also set your VI to show when called, or else drop it in a "subpanel control" if you don't like the popup window. This way you can get the same data view you are accustomed to with the least amount of programming.

  9. Is this how the Copy node from the Advanced File Functions palette does it, only without a progress update?

    I would be shocked if the Copy primitive used something other than a direct OS/WinAPI call. I still think rewriting OS functions is a crazy thing to do, but I understand the need to keep your users from pulling the plug. When the file is getting transferred does anything appear on the other end? To wit, you may be able to:

    1. read the remote file size (the source file)

    2. Use the Copy File primitive to start the transfer to a new target file

    3. In parallel, start monitoring the target file size, displaying a progress bar for the percentage transferred.

    4. Terminate the progress bar popup when the target is at 100% size.

    The great part is that if your code has bugs, it shouldn't affect the data, just the user experience.

  10. I am currently using the File Copy.VI trying to copy a folder from a network location. It is a remote server location and the copy can take upwards of 3 minutes for a 200k file.

    I changed the program to use System EXEC.vi and execute XCOPY, which is significantly faster.

    Does anyone have another way to accomplish this? Possibly a way to do this that will have some type of progress indication?

    It was suggested that you roll your own, but you will lose any metadata (modification time, permissions, creator, etc.) which may be attached to the file. It also seems like a waste of your time to rewrite components of your OS. What's wrong with System Exec.vi and invoke XCOPY if it's working for you?

    If you really need to write something, i think there is a network queue library somewhere around here. That sounds like the easiest way to send a file across a network, as a queue of strings. The first element in thEdite queue could be the number of chunks to expect, and maybe any other metadata you want to send, like file timestamp (though then you would have to find some API function to fix the timestamp to match the other system.

  11. I've looked thru the LabVIEW faqs and dev zone stuff on 32 vs 64 bit LabVIEW but I can't seem to find an answer to this specific question. That is, if I install LV 32 bit on Win7 64 bit and build an exe (from LV 32 bit), does it build an application that I can install on other 32 bit Win OS's (XP SP2 is the one I have in mind)? I'm in the process of finally upgrading (I get a new machine and I get to install LV2009 finally) and I'm trying to make a decision about whether my primary Win7 OS should be 64 or 32 bit. I have to be able to build code I can deploy to WinXP SP2 32 bit machines.

    I have this configuration and it works fine. In general a 32-bit app doesn't know anything about a 64-bit OS. It's the OS's job to provide a virtual 32-bit environment for the 32-bit app to run in. So 32-bit LabVIEW is going to build you a 32-bit app which will run fine on XP.

  12. I have UDP data packets based on a cluster containing 2 I32s and 5 SGL values: call this cluster type X. The data packet itself is an array of 16 elements where each element is composed of 2 I32 values, followed by 4 separate clusters of type X, and this is followed by an array of 12 elements of the type X cluster. So this total packet size is 7296 bytes. I have previously worked with data packets containing an array of 32 SGLs or DBLs and used the unflatten VI to recover the array as well as reconstruct data packets consisting of data for a simple, non-nested cluster. I tried making a template of the data that I wanted to retrieve from the data packet, but that does not seem to work at all because of the complexity of the data in the packet. Anyone have an ideas how to parse out this data?

    The flatten and unflatten functions should be able to handle any data type. You should be able to make this packet into a typedef cluster and use it to flatten data for sending over UDP and unflattening data received from UDP. Maybe if you post some code or diagram screenshots we could see where you are going astray.

  13. Am I correct in thinking that they have a low overhead and high reliability and speed of update?

    Yes, you are correct. If you have many notifiers and continually look them up by name, you will pay a penalty for that, but if you wire the notifier references directly, they are very fast and reliable.

    Our application has dozens of parallel while loops (sometimes hundreds) and most of them wait in an idle state until data is received on a queue or a notifier.

    EDIT: I should also mention this code will be deployed on RT. As such should I use data references? I wonder because the in place structure blocks the reference to avoid race conditions but this is non deterministic, I am only writing in 1 place and reading at multiple others so wonder if there is a good alternative?

    I think we would need to know more about your application. Notifiers are themselves references, but with a built-in trigger for catching updates. However there is no protection from a race condition or a missed update. If you are streaming data to multiple readers I would use one queue for each recipient and have the single writer looping through the array of queues every time there is a new update it needs to broadcast.

  14. i want to send a file of around 1MB from one PC to another using labview through serial port.im using Xmodem protocol for this application.

    I apologize for not answering your exact question, but have you considered using PPP over serial? This is built into Windows, and you will end up with a network between the two computers. You could either share files directly or else use LabVIEW's TCP/IP functions which are going to be much easier to work with for data transfer. All the problems of link detection and error correction have been solved by other programmers long ago.

    If this is a school assignment or there is some other reason to use obsolete stuff, then maybe you can post your code and forum members can try to help with specific problems.

  15. Hello,

    I want to create an unsteady pulse width modulated signal to control solenoid valves. I can create steady pwm signals. For example i want to create a pulse signal with a frequency of 1 hz (this is not the frequency of the pwm signal of the solenoid valve, it is 400 hz). I mean the valve will run 0.4 seconds with a duty cycle of 0.9 and 0.6 seconds with a duty cycle of 0.2. As the same example i will create a sinusoidal duty cycle for example with a frequency of 2 hz. If i can solve the pulse problem i can do the rest.

    Can anyone help me?

    What do you mean 'create a pulse'? Do you have some hardware (like a board from NI) to generate pulses? Which one?

    What have you tried so far. If you post the code that you've tried already, then maybe someone on the board can make some suggestions.

  16. I have seen something like this, though I haven't reported it because I can't accurately reproduce it.

    I regularly work in LV2009 with an LVProject open which has about 3500 VIs. Usually everything is normal.

    When LV gets slow, then often the open windows rearrange their Z-order in the middle of an editing operation, which is very frustrating. Switching from front panel to diagram or changing windows and some editing operations will cause this. On my laptop it can take more than a minute to regain control of LabVIEW, though other applications are not affected (thankfully).

    This is much more likely to happen if I have more than one project open. It may also happen if I open an lvlib or an lvclass open in its own window, but I'm not sure.

    This also tends to happen if I use ctrl-F in the project window to find a VI, though it doesn't always happen.

    Once it starts, the situation does not improve until I restart LabVIEW.

    Does this sound like the same problem?

  17. You could probably just wire it through a case structure. In one case jus pass the refnum. in the other case (ie. when you want to set it to not-a-refnum) just leave the output tunnel unwired and select "use default if unwired"

    If you use a Diagram Disable structure for this, it makes your intent clearer. You can also use 'create constant' but you will want to make sure that it doesn't have some non-null value in the constant when you create it.

  18. What I mean is that SVN does not keep track of what's been already merged between branches. This makes it nearly impossible to maintain multiple branches (feature branches, developer branches, maintenance branches) and merge between them.

    I think that LabVIEW's diff and merge support, while very nice to have, are still lacking. I would like to see them improved such that they could handle merging between two hierarchies of VIs (in memory concurrently), rather than just between two individual VIs.

    So what about all the SVN 1.5 changes for merge tracking? Have you tried to use them with your labview. I have to confess that I haven't tried, but it's on my list since it seems like these would go a long way toward fixing merge problems.

  19. There was a (long) thread on various hash (or map or dictionary) implementations started by Aristo Queue when he introduced an implementation using classes - various implementations were tried and benchmarked - this seems to be the relevant page in thr topic.

    At the ime variant attribute seemed like it was the best (cespite those that should know about the internals of LabVIEW being surprised). I know AQ noted that his map with classes suffered from some specific bugs deep in the memory management interneals - I'm less clear if the performance has been fixed in 2009...

    Last time I looked into this about six months ago, the bug which had destroyed performance in the lvclass implementation had been fixed as of LV2009, but variant attributes still blew away the lvclass implementation in terms of performance, so we are still using that for hash tables. You'll want to keep your variant (which doesn't need to contain any data itself) in a functional global (aka LV2 global). You could also keep the variant in a data value reference or in a single-element queue to protect its integrity.

  20. Does this link help you at all? It's written for a FieldPoint unit but will work on a PC. Transferring Logged Data from the FP-20xx through Serial Modem Communication.

    That seems like it would do what you are asking, but another idea is to configure a PPP connection over the modem. Then you would have a network and could use more modern tools shared folders, etc. to transfer your data. The nice part is that if your link changes to more modern network hardware at some point in the future, your code would not be affected. I would think it's a waste of engineering time to write modem software when various OS components, which are generally much better tested, will do the job for you.

×
×
  • Create New...

Important Information

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