Cluster vs multiple Shift Registers

I had a question about good coding practices.

Say you have several elements (numeric values, strings,... whatever) you need to iterate between the loops.

Is it better to make a registry change for each item?
Or cluster, and then move the cluster to a single shift register?

It is faster than the other? Or better/worse for another reason?

Cory,

Yes.  and no.

I usually create a large cluster of typedef I call indicators and flags (InF).  I put most of the things that need to be passed around with that.  The cluster of error, the State enum and large data tables are usually in separate shift registers.  Table L: shift registers and data are at the top of the loop and error and SRs of the State are at the bottom.  Most of the code goes between them.  Given the help of bundle/Unbundle documents name to which the data is used in a case.  The InF cluster is usually not displayed on the Panel before and may exist only in a Subvi to save space of block diagram.  The data are unbundled indicators as needed for display to the user.

If you have a situation where speed is concerned, separate data that must be processed everything quickly and optimize for that.  Strings and arrays within the cluster probably cause some memory interesting distribution issues since they change size, that can be an argument in favour of that separates them.

Lynn

Tags: NI Software

Similar Questions

  • How can I clear the shift registers of sub for loop for each iteration of a larger loop?

    Hello

    I write a program to concatenate multiple text files.  However, I need to treat each column individually before they are concatenated.  I use one for a loop at normalze 6 columns choice the largest loop of concatenation.  However, the shift registers store data from previous iterations of the larger loop.  How can I clear the shift registers of the void loop based on the iteration of the larger loop?

    Thanks in advance!

    OK, that's fine. are there headers?

    In all cases, all you need to do is to place all of the 2D array in the shift register of the inner loop, iterate over the columns relevant to be normaized (use 'index array' to get the column it normalize, put it to help to "replace the subset of table".) You probably want to initialize the outer loop shift register. Use then "building the table" added to the beginning or the data of each file sets.

  • Using shift registers global verses

    I'm new to 2009.  Our last update was 7.1.  I'm upgrading our laboratory SW and using events.  EVENT 1: is used to display the data in a text file in a table "data set".  EVENT 2: using to option button and the table "Data set", the user selects the data column to use for the test that is displayed in a table «Points de Test»  EVENT 3: If the user changes the data in the table "set of data', 'Points of Test' test point table is the update.  I use local variables for 'Set data', 'Points of Test' and I was going to use other settings as well (radio button, etc.).  I also think about using a shift register to realize that the same information.  I used shift registers in the past and they can be annoying, but I also understand that you should stay away from variables.  Please pass along an Advisor on the use of local variables shift verse records.  THANKS in advance!

    I don't know what you defined as 'EVENT 1' to '3', but they seem to be quite the case.

    The use of shift registers sounds messy, but they are much better than local Variables If you parallel threads past in your code.

    Clean the threads between the shift registers is to use clusters.

    People of the country appear more clean, until they 'byte' you in the... code...

    EDIT: "they are much better than local Variables If you parallel threads going on in your code" I have to explain... If you have parallel code that uses Variables to local variables as this may lead to a race or conditions...

  • Shift registers 'for' loop can accomidate how

    Hello

    I would like to know how shift registers we can add in for or while loop.

    Thanks in advance,

    Krishna

    Thanks for your quick reply Jarrod.

    Kind regards

    Krishna

  • Sort of the length of the sample segment longer that the iterations of the loop w/o shift registers?

    Hi all

    My loop runs about every s 0.06 and now I was prompted to add to program a function that will enjoy the latest 3 data and return the max/min value for two of the signals.  I can imagine a clumsy way by program to do this with SHIFT registers - take the max/min for each iteration, save-repeat-compare until you have enough iterations to fill 3 s of time.  But I can't help thinking there must be a cleaner way (better?) to do.

    Any help?

    Thank you

    Hello

    Try looking in a circular buffer.

    http://zone.NI.com/DevZone/CDA/tut/p/ID/7188

    Once you have determined how many times you put entries in the buffer, you will know exactly what is the size of a table to enter and do the Min/Max on.

    Another option is to use a circular table.

    http://decibel.NI.com/content/docs/doc-3414

    I would be created to operate somewhat like a Global functional or motor of the Action.   The Subvi would then be used in your loop DAQ for new data "stack."   Then called in another loop or part of your code to read every three seconds.

  • Need help with while loop and shift registers

    I have a broad set of data and required to read data at maybe 200 samples at a time to process these samples through my VI and have add and concatenate a file separate lvm.  The part where I am confused is the shift registers. How can I limit the number of samples read in an iteration? How do the while loop to stop when all data are read in?

    I have attached my diagram, there may be something wrong with my technique?

    This will give you an idea.  There are a lot of other (probably more effective) methods.  It is a basic solution, quick and dirty to help you grasp the overall concept.

  • Simplify the VI that rate but currently uses too many shift registers

    I have a VI that was made by the Director of scary movie, so beware, this VI is a nightmare!... or at least for me, it is.

    Background:

    I have 20 pans and I have a water level sensor that generates a voltage of 0 to 5 Volts Output. By knowing the volume of the Pan, I calibrated the output to be in gallons. Real output I need is a volumetric flow, i.e. gallons per minute per square foot. We currently is key this by using a VI that a filed summer internship (see table). It works well, but it's so dirty and difficult to clean up and expand. The plan is to have 100 total pans and I don't want to copy paste this code 5 times more!

    Issues related to the:

    -How can I earn a rate differently? If you notice on the attachment Subvi calibration, the rate is calculated manually knowing how fast the loop going in the main VI. I don't know if this is the best way

    -Can I get rid of the shift registers some how?

    Is there a way for me to combine the subVIs in calibration so that I don't have a Subvi for each channel?

    Thanks in advance!


  • Shift registers loop when the chain is connected to the registers

    Hello everyone! I just need to know how these shifts of registers. For example a photo added, I have a stacked sequence structure. Some time ago in a loop with inside case structures. As you can see, there is registry to offset looping with initial string and on the right side of passage registry there is string "entry". So my question is when we run the VI, to check the error case it is going to start from initial case and then transmit the information to the case of entry into the structure of the case. So basically, I need to know how the shift registers can be used with the structures of the case and while loop.

    http://www.NI.com/Tutorial/9330/en/

    With this you can post a photo that is executable code.  For us looking at your code is not better than watching a photo with text in Notepad.

    That being said here is some information on shift registers.

    http://www.NI.com/getting-started/LabVIEW-Basics/shift-registers

    https://zone.NI.com/reference/en-XX/help/371361H-01/lvconcepts/shift_registers_concepts/

    To simplify your code, I highly recommend getting rid of the outer sequence structure.  Stacked sequence structures serve generally to cause new problems to users, and sequence variables compound which.  If you want the code to run before the main States are called, you can have a status of initializing in your state machine and do be more manageable.

  • Uninitialized shift registers compiled in a DLL retain their values?

    Hello

    I'm using Labview 8.6 to create a DLL and then I create another Labview program that will call this DLL.  Within the DLL is a function called Untitled2 which is your basic uninitialized shift register.  It has a digital input which can be put in the shift register, and then I can read the number back.  After that I build it to the DLL and call it from another Labview program looks like registry of offset values are lost.  So, my question is whether Labview DLLs that contain uninitialized shift registers to the as registers of the SHIFT to retain their values?  I enclose a copy of Untitled2.vi so you can see my simple test vi.

    Does anyone know also - all good articles on the creation of DLLs in Labview?

    Thank you!

    Steve

    The short answer is the fastest is to call a VI a VI with a direct appeal. Any other way to do so is somehow above enveloping mechanism which means added. If you want to hear some details, you can read on.

    When a caller VI loads, it is "patched" with its subVIs. This means that he holds on a pointer in which he can use to call effectively than VI. The appellant also assigns a list of parameters for each call. When the call runs, the only thing the caller must do is to fill this list of parameters with the locations of their data and pass the pointer to this table in the code of the Subvi.

    When you call a VI that is embedded in a DLL, the call library node must all first set all parameters in the form provided by the convention call DLL. This is different from the approach of list for the parameter of LabVIEW and usually is to set each parameter on the processor stack. The function exported in the LabVIEW built DLL, must first obtain a connection to the VI to run. She accomplishes this by obtaining a reference VI of a cache of VI references created in the loaded DLL. Each VI reference has a list of parameters that should be filled in the settings for this call. It can then call the code. When the code is complete, there may be additional work to put the outputs in the form provided by the appellant. The VI reference must then be returned to the cache.

    So there will be several manipulation of the parameters in the call to a DLL and a couple of access to a cache may cause overhead and additional jitter include parallel calls. Even a call via a strict VI one reference would be faster. With whom you are in direct control of the VI reference so cache intervenes and the call puts the parameters directly from a list of parameters, the Subvi expected so there is less handling it.

    There are also several other limitations introduced by calling a VI in a DLL.

    1. If you are reporting to the DLL that contains the handles, then you must make sure that the DLL is called from never screw in the same version of LabVIEW. If you do not do this, then you will be allocated in a nursery memory to another instance handles and LabVIEW will stop.
    2. If you do not pass data containing the handles, then LabVIEW must make copies strings or arrays that are passed to the DLL, hindering more performance.
    3. Préallouée reentrancy is not available through dll. It's the kind of reentrancy, which allows the slot - VI maintain state specific to each caller. When it is called by a DLL, we have no idea where we are called to so we cannot give you a specific instance. Each VI reference in cache will be a specific instance of the VI but not sure which one you will get. Essentially, this makes it reentrant in dll screws act as shared reentrant. (Which could explain why it does not seem like your uninitialized register shift worked.)

    I hope this doesn't scare you use LabVIEW to create the dll. When you need to communicate to other software, this is the way to go and all of these steps are necessary to cross this limit. But if you're already in LabVIEW is not an ideal replacement to directly call a Subvi.

  • StateMachine in Subvi, restart shift registers

    Hello

    I'm having a problem with a reentrant Subvi, which implements a State Machine. The Subvi is called only once in the code, so problems with re-entrant execution concave/no is not the problem.

    The Subvi implements a State Machine whose output is a reference position for a drive motor. The state machine is implemented with while loop with shift registers. The Subvi is called once each control cycle (cycle being about milliseconds time), so that the State Machine while loop is executed once each cycle control (stop Terminal is connected to 'true'). And the shift registers are used to save data between executions.

    When I opened the main VI, it works perfectly. When I stop the VI and restart, the Subvi begins to use the last values of the previous main run of VI. I want that my position reference to start from 0. I guess my problem is that I should start the SubVIs shift registers.

    Is there a way to do this without adding any extra code? (Perhaps an invoke node functionality for the Subvi or something like that?)

    Thanks in advance for your help

    Best regards

    Pestana of Jesus

    Hi jespestana,

    I recommend adding a case of initialization.

    Mike

  • Multiple instances of VI with uninitialized SHIFT registers?

    Is it possible to run easily several instances of a VI that uses a shift uninitialized register? Take the Pt means by Pt function, for example. If I want to permanently keep a medium of digital data 1, I just put the VI in a loop and run it. If I want to have 2 digital data, I just change the settings of the VI "Preallocated clone environment execution" to and copy the VI below. Now if I want to have 5 digital data, he begins to take a little bit of real estate on the block diagram. I can put it in a loop For with a business structure that changes with each iteration. It is easy to make these cases, simply duplicate the case '0 '. But, if I decided to add something to the '0' case or something is a tiny bit different in each case, it then becomes a real pain to do this way. Is there a better way to handle this?

    Edit: I realized that if something changes with each iteration, I must rethink my datatype or continue to use a box structure. But, if we solve the first problem where I don't have to transmit a change to the stop "0" in all other cases, that would be great!

    Thank you!

    Use the node of the call by reference when you open N VI references to your VI MeanPtByPt - each instance will then be a VI reference who will maintain it's own memory space.

    Something like this:

    With the help of the indicator 0 x 8 means that each reference VI coming out of the open reference has its own data space. To be honest, need you the indicator 0 x 40 at the place/as well - but I don't remember off the top of my head.

  • writing multiple modbus registers

    Hello

    I am communicating to my labview program controller using modbus RTU and the controller has 16 bits in modbus registers.

    To send the float as '1.23' values, I write two registers to store the hex value that number in comma floating 32 bits.

    I use the modbus driver provided to this end by labview and use labview 8.2.1

    I have the following doubts in this regard.

    1. The "Modbus master series query. VI"has the command Modbus that records an entry which I use to set the registry values in the controller unit modbus. To send the above, mentioned in floating-point registers 501 and 502 (contains the full value of the PID parameters), use the same vi, whose value should be registered first... is the high or low, to be written to 501 and 502.
    2. The function code to write to multiple records in the modbus driver is 16. But my document that is specific to the Controller explained in the section "writing to multiple records" with the code of function like 10. And I see that feature codes 'writing in the single register' as well as the driver for modbus producing the same type of message frame as discussed in the document. But I see no similarity in the function "write multiple registers" in the document and the modbus labview driver.
    3. "Even if I write records 501 and 502 one after another will use"write in the single register"function code when these registries implement floating-point single using 2 registers ' 16 - bit '. If this method is possible, then I will come and do it the same way I did it for the entry in the single register. While writing data in records one after the other with a gap between the two as small as 4 ms scriptures do good?

    I suspect a confusion between 16 decimal and hexadecimal 10

    Two successive registry entries are not equivalent to a double entry: during the period between the two scripts your controller will be loaded with a false parameter. It is perhaps not necessarily a source of problems. It depends on your application. Writing the MSB should first reduce the problem.

    The order of Hi-Lo is dependent on the machine control. Some use the Big Endian, other Little Endian. But this choice should assign unique register values (U16) as well.

    If it is not documented, you should read the records and see if the result is logical. If this is not the case, invert the byte order and verify that the problem is resolved. Good luck

    Also, I assume that you know how to use the conversion feature to convert a single (32-bit float) 2 U16?

  • shift registers obvious between tracks

    Hello

    The day noob question! I'm building a table and want to erase registers with shift between runs. I have attached a VI. It works a while loop every second, then adds an array of the number of the iteration. I then display the length of the array. I would like it so that whenever I have press run, the program starts with a "blank slate." No standard way to erase everything. I'd like to do something like:

    %

    CLC

    Claire

    whether MATLAB...

    Right click on the shift on the right left register and select "create constant.

    (also use a real stop button, or at least make your Boolean lock action (right-click... mechanical action... lock release))

    () * EDIT: corrected right left)

  • Shift registers Subvi & choice of reentrant Type

    Hello

    I am trying to create a Subvi this VI (see attached image or vi), but I do not know how to move records to offset by the subvi. The main vi is also a while loop so I want to initialize it and pass them to the Subvi. Is it possible in this case?

    Also, I intend to implement this Subvi 3 - 4 times in the main vi (which will be called by different entries), and I'm not sure I understand the difference between the different types of neres: pre-allocate clone for each instance & part clones between instances. I think that I need the first type, is this correct?

    Thank you

    simply_me wrote:

    Hi Smercurio_fc,

    an array of strings or dbl entry, it did not work when I tried...

    Of course you can.  Most of the things in LabVIEW is not able to work without it.

    Right-click on a wire of the array and select Create a control and indicator to create.  You now have entry and exit tables which will be part of your login Panel.  Your Subvi is not the registry change.  The shift register will be a part of thw while loop in the largest VI which passes the array in the grant, and that gets the results back.

  • Shift registers and state machines

    I am creating a VI that controls a power supply, a switching system and a nanovoltmeter so that I can measure the Seebeck of different materials. After reading through these forums, it seems that the overwhelming opinion was that the state machine is much better than the structures of the cell, which was what I was going to initially use. However, I have a problem. To control my sourcemeter, I the user to enter the number of steps (time machine increases the voltage), a final voltage and output voltage. Of these, I get the value of the increment. However, within my state machine that the first step is transferred to the structure of the case. I used probes to see how information is moving, and it seems that the voltage value is increment correctly but the real VI for the power supply receives the initial value. I'm just wondering how to pass the updated values in the structure dealing with each iteration.

    I've included the vi. It is far from over because I'm sure you will see, but my current problem in the case of 'change v '. That said, if anything jumps out and you feel the immediate needs, feel free to say it, I learn and I accept all the entries.

    I recommend that you run your VI highlight execution lit.  This will help you understand what's happening better.

    Just to remind, only 1 case in structure can work iteratively.  If you have a TRUE/FALSE in the middle of a VI case structure you plan to run both cases?  Of course not.  Same thing here.

    So keep your current tension in a shift register and increment only when you are in the case of set.  Stop your state machine when your voltage exceeded the stop voltage (have a just State to check this box to make things easier).

Maybe you are looking for

  • air port utility

    Hello! I want to change the name of the base station and the password for it, and I use air port express 802.11n (2nd generation). The hard reset, soft reset in express air fitting is long so don't want to use it. Is it possible (using as book Mac -

  • My Photos automatically starts when I boot, need to stop it.

    Whenever I start up my Mac Mini Photo´s opens automatically. 1. There is no SD card inserted 2. the possibility of opening the connection is not selected 3. in Control Panel > users and groups > startup items, it is not checked Lack of I m nothing el

  • Error 800b0100 during the installation of any windows update

    Hello I have a problem running Vista updates. I can't update to SP1 via standalone as well. I am shown error 800b0100 all failures. I ran here is the log and system update readiness tool =================================Preparation of control system

  • Wireless internet guard fall on my computer pavilion dv6 Notebook PC laptop

    A week ago I bought the HP pavilion dv6 laptop and after a few days im having problems connecting to my Wi - Fi. When I use the internet laptop works but after a while, he falls and I can't use internet and then I usually launches solve programs to r

  • Trouble by sending an e-mail with a video or images

    He is a recent problem with my Outlook Express.  When I get an email with a video or photos attached, when I send this e-mail to others, they email saying that the video or photos are not there.