Jump to content

ShaunR

Members
  • Posts

    4,940
  • Joined

  • Days Won

    308

Posts posted by ShaunR

  1. Thinking laterally (or is it vertically). You could create a single global event that each control can decide to register with or not. You can then filter the incoming events and take decisions based on either its type (boolen, numeric cluster etc) or a specific control. What this acheives is that changes to the system are consolodated into 1 vi.

  2. Hi all,

    Google Earth is called via ActiveX - it gets ref. from Automation Open, and eventually displays Google Earths "map" inside LV using IWebBrowser....

    Thanks!

    Yep. That would do it. The key point being "ActiveX".

    You can try to make sure the open ref is only executed once (when the vi is started...ie outside any loops) and hope that the "stall" isn't from the get method.

  3. Some exposition before the question:

    I'm trying to restrict access to a tool using semaphores.

    In my top-level vi, I obtain the reference during my "Initialize" state and release it in my "Stop" state. The reference is untouched in any other state and resides in a shift register. When I pull the reference from the shift register, the "Release Reference" vi generates an error, saying the reference is invalid. I'm only to the point of testing my top-level VI, so no other manipulation occurs.

    When instead I obtain the reference before my state machine loop begins (initializing the shift register), I don't get this error. I might be having a mental block, but it's not clear to me what the difference is between the two styles. What am I missing?

    Check to make sure you have "wired through" the shift register. You will normally see this behaviour if there is a case selector with an unwired tunnel. If there is a case which has no wire connecting the left shift register node to the right node, that case will insert a "NULL" reference.

  4. As already stated in another thread, I'd like to set the priority of the VI from within the application. Since many objects are derived from the same class I use reentrant VIs, but the property node to set priority doesn't agree with Open VI reference "prepare for reentrant run" option.

    Can I simply remove the "propare for reentrant run" option and use property node to set Execution.IsReentrant to get the same results?

    Thanks, Mike

    And to add to the problem, once one instance of the of the VI is running, it is not possible to create another instance of the same VI and set its priority...

    Sigh!

    It can be done (including your additional criteria) by saving the vi as a template (vit). You can then open it in edit mode (requirement for changing execution systems and priorities) modify the parms and then run it like this:

    However. This is probably not very helpful in the long term since the priority property is "Read Only" in the run-time engine so if you deploy it it will fail:frusty:

  5. It's a programming language...of course it has a pizzle! Who knows, maybe in LabVIEW 2011 the pizzle will have its own 'clean up' feature.

    -D

    Does it currently auto-grow or do you have to make it grow manually?:rolleyes:

  6. Why not place each parallel loop in separate subVIs and set the execution priority of the subVI?

    You have to do a bit more than that to force LV to run certain vi's is certain threads. This is where "Threadconfig.vi" comes into its own.

    vi.lib\utility\sysinfo\threadconfig.vi

    It all gets a bit tricky from here on in as you need to manually manage what vi's are going into which execution systems and at what priorities. Most of what you need to know is in this thread (no pun intended...lol)

    Loop Timing & Execution difference

    • Like 1
  7. I think that locking particular forums for newbies isn't the answer for a couple of reasons: the mods will be swamped by "why can't I post in LabVIEW General?" support tickets, and newbies might actually have something appropriate to put into LabVIEW General, and I wouldn't want to stop them from doing that.

    Our current policy is that it's the mods' responsibility to move newbies' posts out of LabVIEW General and into a more appropriate place and let the poster know that it's been moved if required. Maybe our mods have become a little too busy to keep that up recently. Maybe we need a couple more volunteers to move posts? I know that there's still a lot of posts in the LAVA 1.0 Content section that need moving - anyone volutneering?

    Well. A sticky at the top would dramatically reduce the "Why Can't I" PMs. And although they may have something to put in the general area (although haven't seen many newbies that don't post relevent to their problems), it might be a worthwile excersise to lock it for a short period to "Train" them and ease the workload on the mods for moving them.

    Just my 2 cents.:ph34r:

  8. No, you're not missing anything here - an array is an easy way to do this in LV. I'm just curious if the new features in LV allow it to be done neatly as a linked list, since that's how I'd do it in C. I'm building a list of chemical reactions. The list is read from a file, so I don't know in advance how large the list will need to be. Then I need to run those reactions. Sometimes the user might want to re-run a reaction before proceeding, but I'll never need to back up to a previous reaction, so a linked list is a reasonable structure. From a performance point of view there's no problem with either implementation, since the list is short and I only need to build it once when the run starts. My question is pure curiousity as to whether a LabVIEW implementation exists (or can exist) that does what I want.

    Yes. There is a very easy way to do what you want. But not in the way you want to do it.;) Your array would be short right? (By short I'm thinking less than 2000 lines!)

    Just load all lines of the file using the "ReadLinesFromFile.vi" (-1 as the lines argument will read all lines regardless of file size) or "ReadFromSpreadsheetFile.vi" (the output of this vi is already an array type and also reads all lines regardless of size) to an array and let the user index through it. If you give him a back button (decrement) then he will also be able to go backwards (never say never...users are illogical creatures) with little effort on your part.

    Labview does this sort of thing much better than C/C++ since you don't have to declare array sizes before you start and arrays are self re-allocating so you don't have to manage the re-allocation (as you would have to in C). You also don't have to worry about overrunning the end of the array. GPFs are rare in LV ;)

    Should take you 2 mins (including waiting for LV to load :cool:)

    KISS!

  9. Thanks for all the comments, but I should have phrased my original question more clearly. I'm trying to learn about what can be done with recursive data structures (using a parent class as a member of a child class), without using any type of reference (DVR, queue). I'm looking for an implementation, if anyone has one, that can efficiently add items to the end of a list (without having to iterate through the entire list for each insert). The problem is that, as far as I can tell, it's not possible to keep track of both the beginning and end of the list at the same time. Adding an item to the end of the list invalidates the front, because the front can only point at the list at a specific point in time. In C I would use two pointers, one to the beginning of the list and one for the current end, and I can't see a way to duplicate that structure in LabVIEW.

    I'm probably missing something huge here. But the beginning of an array is index(0) and the end is index(length-1). This is true if you add, delete or insert. The next item in the list is current index+1 and you just maintain an index to the current place in the list/array.:unsure: No iteration, uses LV primitives but suffers from re-allocation penalties.

  10. An array is a poor replacement for a linked list. A linked list is atomic and not contiguous in memory (hence the next-node pointer refs) and therefore doesn't suffer from memory re-allocation penalties when inserting, deleting or appending. You simply allocate the node and update the appropriate next-node pointer values. (The downside to this is of course fragmented memory). The main advantage of linked lists is that the operation time for insertion, append and deletion is consistent, which is not the case when array re-allocation occurs, since the re-allocation time is variable dependent on the array size.

    You can think of an array as a special (limited) case of a linked list where the list is of a fixed length and the pointer is the previous-node pointer+1. This case will perform the same as a linked list, but as soon as you insert, delete or append past the array length you will again get re-allocation penalties.

    I avoid linked lists like the plague in LV since I haven't come accross an effecient way of implementing them because the whole point of labview is that you don't have to worry about pointers :P . Perhaps a better way might be to write a dll (API) that manipulates your list. This may yield better results although you have other overheads but at least they will be consistent.

    Of course. this is only applicable if performance is the attractive quality of your linked list. If performance isn't an issue then just use a standard array and use the standard LV prototypes to insert, delete and append.

  11. I've been using a parser for quite some time to create typedefs. It doesn't pars C/C++ header files since it was designed to pars excel created text files for high channel count digital and analogue IO.

    The short answer is yes you can automagically create typedefs (they must not be in memory when you update them) and you don't need to use scripting.

    Here is a snippet that shows updating of the typdef.

  12. Hello

    I wrote a program to record the output voltage from a solar panal into an Excel file continously; however this will save the data into the Excel file in one column but I want it after finishing one day, it saves the recorded data into another column or another Excel file. Please help me in this manner if possible.

    < I used Create data string.vi, write characters to file.vi and multiple time delay match.vi to record the data into Excel file>

    Looking forward to hearing from You,

    M-H

    Append your data to a file with the date as the file name (e.g 2010-01-10.csv). Then when the new day starts, a new file will be created.

  13. Unfortunately its one I wrote for work (copyrights an' all that). But its not hard and you could probably knock up a straight forward one without bells and whistles (i.e compare vis in the project list with those in the directories) in about 1/2 an hour. Mine is quite slow, since it does a lot of checking (compares like the aforesaid and also loads up all vis and checks callers, callees, filepaths and compares duplicates etc) and gives me lists of vis on-disk but not in the project, in the project but in the wrong location, blah, blah. Oh. And I can choose to delete them :P

×
×
  • Create New...

Important Information

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