Data types in the design for the producer consumer model

Is it possible for me to use any type of data in a model of design producer consumer, without specifying specific data type?

what I mean is if there is a way to connect to a data type with which I can use any other type of data, not to mention that one that I have connected, and if not, how can I specify the data type for a number or any other data type, for use in a design of producer-consumer model?

You can make a part of your cluster of data a Variant.  It will take any type of data.  A common architecture for the producer/consumer is a cluster which is an enum and a Variant.  The enum contains all possible "orders", you might want to send.  The variant contains data that could be of any type.

Ungroup you in the consumer and get the enum and Variant.  Attach the enum to a case structure.  In the specific case, convert the variant type in a data type of regular LabVIEW and with it as you please.

Tags: NI Software

Similar Questions

  • acquisition and recording of analog data with producer consumer model

    Someone on this forum, in a separate last week discussion, suggested that I use the producer model consumer data acq.  My ultimate goal is to acquire analog channels 1-4 continuous data, display graphical band style and save the data on the boot disk when the user presses the 'Start Saving' button (and will continue to display recorder cards).  Economy will stop when the user presses the button "Stop Saving" but strip map will continue to operate.

    My attempt to use the producer-consumer model is attached (LV 8.5 only).  It does not work.  I have not tried to implement for recording user controls - just trying to make simple continuous display and save (1 channel) at this stage, using this model.  VI runs, but the graphic Strip is never updated with the actual data, and the data file that is saved has zero byte inside.

    Thank you.

    WCR,

    Looked at your code, and you are right.  It won't work.

    Take a look at this example:

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

    The VI of the acquisition must be inserted in the loop of the producer.  In addition, you must tell him how many samples for (otherwise, it will get 0).

  • Buffer could replace the queue in the design of producer/consumer model

    Hello

    I have a question to which the task of buffer to store the data and the queue is also of the same thing so we could use the inplace queue buffer in a design of producer/consumer model.

    No, these examples of buffer not almost equal to a queue, and never "replaces" queue at the producer/consumer.

    The advantage the most important of the queues for the producers/consumers (which none of the other mechanics buffer sharing), it is that it works activities to warn the reader that the data is available. So if you would simply replace the queue by mechanics of tampon too developed that you have attached to your last post, you will lose a large part of the object using producer/consumer.

    Thus, to compare the two mechanics:

    -Tail works activities, while the example of the buffer is not.

    -Tail must allocate memory during execution if several items are written in that corresponding queue. This also applies to the buffer (must be resized).

    -Given that the buffer is actually simply a table with overhead, memory management becomes slow and messy with the increase in fragmentation of memory. Queues to play much better here (but have their limitations, there also).

    -Overload of the buffer (the table manipulation) must be implemented manually. The queue functions encapsulate all the necessary features that you will need. So the queues have a simple API, while the buffer is not.

    -Given that the buffer is simply a table, you will have a hard time sharing the content in two parallel running loops. You will need to implement an additional charge using data value references to manage the buffer or lose a lot of memory using mechanics as variables. Lose the memory, you will probably encounter racing conditions so don't think not even on this subject.

    This led to four '+' for the queue and only a single point where 'buffer' is equal to the queue.

    Hopefully, this clears things up a bit.

    Norbert

  • Modification of the data types of the custom shared variables

    My application includes a library containing a number of shared single process variables. I use type defs to create the shared variable "of the custom control." I know that shared variables do not-automatic update since the type defs, so I'm updating shared variables (data type, do a right click, properties) whenever I update the type definitions.  However, if I make a change to a type design that does not change the data type, for example to change the labels controls, these changes will be reflected in the shared variable.  The data types of variable window shared list contains entries for each previous update, which indicates he uses the previous entries.  How can I make the window of properties of shared variables 'forget' my previous defs type wandering without deleting the variable total? Withdrawal and replacement would be troublesome because the done variable references throughout my project.

    Thank you

    Wes

    The variable is not in the Distributed System Manager, or Manager of the Variable, and cancellation of the deployment has not been resolved.  However, I found Labview from closing completely and reboot clears the memory of the previously used custom data types that sees the library.  Thus, the effective workaround I found is:

    1 make a significant change to the data type of the type (per your suggestion) FED. Record.

    2 - redefine the variable screw-notice type FED.

    3. save the project. Close and restart labview.

    4 - the old def type is now disabled.

    5. return the significant change of the def type, implement trivial change and save.

    6 redefine the variable using the type correct now def. Viola!

    Thank you!

  • Should I use the design of producer/consumer model (Instead of Globals)?

    Hello everyone.

    I have a request including several loops in it. A loop reading data series and he analyses for use in the other loops, another loop acquires via DAQmx data and performs calculations on it for use in other loops, the other formats the data from two loops and poster and one last test data. I was wondering if this is a good candidate for the design of producer/consumer model.

    For now, I use global variables to send data from the series and DAQmx loops to other loops. I use motors of the action for the different parts of the program that should be used everywhere, as the serial port. The test loop needs than the most recent data to run his test.

    Thanks for your suggestions!

    The short answer is Yes. If nothing else using queues to pass data will allow your various loops inactive if no data is present. By using globals your curls must continuously survey to see if the data has changed. You always are beter off if you can make your request, driven by events rather than to use the polling stations.

  • When not data type of the variant of wire to the data?


    When the data type of the sink of the thread (its destination) database is well defined, LabVIEW makes a type definition back from the variant to the data output. It does not work on polymorphic functions and structures border entries, etc. It is usually harmless to leave the type continuous wire in most of the cases but do not forget that you let LabVIEW decide for you, how to convert the data.

    In addition, if you put the following line in your file labview.ini:

    coerceFromVariant = TRUE

    you will be able connect variant directly to the sink, without variation in data (and its error handling).

  • A question about the conservation of fields (hour, min, sec) time DATE type in the table on the changes of NLS_DATE_FORMAT

    Hello

    Oracle version: 12.1.0.1.0 - 64 bit

                      OS:   Fedora Core 17 X86_64

    My question is about the conservation of fields (hour, minute, second) time DATE type in the array on NLS_DATE_FORMAT changes.

    Take the following test case:

    SQL> create table tmptab(dateval date);
    
    Table created.
    
    SQL> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
    
    Session altered.
    
    SQL> insert into tmptab(dateval) values('2014-01-01 00:00:00');
    
    1 row created.
    
    SQL> insert into tmptab(dateval) values('2014-01-01 10:00:00');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from tmptab;
    
    DATEVAL
    -------------------
    2014-01-01 00:00:00
    2014-01-01 10:00:00
    
    SQL> alter session set nls_date_format = 'yyyy';
    
    Session altered.
    
    SQL> select * from tmptab where dateval > '2014';
    
    no rows selected
    
    SQL>
    

    I don't understand why it returns nothing. The second test case above insert statement inserted a line with 10 as the value for the time of the DATE field column dateval.

    Accordingly, while comparing this with the literal '2014' (which based on the new value of NLS_DATE_FORMAT = "yyyy" is implicitly converted to DATE), shouldn't the above query returns the line 2014-01-01 10:00 ?

    I mean, I changed the NLS_DATE_FORMAT but data from time in the table fields are preserved and that's why they should normally be taken into account in the comparison of date.

    What I'm trying to say is that for me (Please correct me if I'm wrong), no matter what NLS_DATE_FORMAT configuration is the following test

    SQL> select * from tmptab where dateval > '2014';
    

    is the same thing that

    SQL> select * from tmptab where dateval > to_date('2014-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
    

    And because the line 2014-01-01 10: 00:00 in the tmptab table. The following test

    2014-01-01 10:00:00 > to_date('2014-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
    

    evolves normally true (beucase of TIME = 10 on the left side of the test) and therefore this line must be returned which is not the case in the test above.

    You kindly could you tell me what I misunderstood?

    Thanks in advance,

    This is the price for the use of implicit conversions. Implicit DATE conversion rules are not as direct as it can be assumed. In your case, all you provide is year as date format. In this case date implicit conversion rules assumes that month in the current month, day 1 and time as 00:00:00.

    SQL > alter session set nls_date_format = "yyyy";

    Modified session.

    SQL > select to_char (to_date ('2014 "), ' mm/dd/yyyy hh24:mi:ss') twice;

    TO_CHAR (TO_DATE('20)
    -------------------
    01/08/2014-00:00:00

    SQL >

    So, when you start:

    Select * from tmptab where dateval > '2014 '.

    Oracle implicitly converts date using "YYYY", which translates as August 1, 2014 '2014'. That's why your quesry returns no rows.

    SY.

  • convert the varchar2 data type to the data number type

    How to convert the varchar2 data type to the data type number.


    It looks like my data

    create table one)
    col1 varchar2 (50)
    col2 varchar2 (500);

    Insert in a (col1, col2) values ('1234 ', ' 2345');

    Select Column1 of number (19)) cast (to_number (col1);

    IAM getting error invalid number


    I need to create a table with the same columns with data like number types (19)

    can someone help me

    Thank you

    You have changed your original post, so now I see that you get the invalid number.

    This is why you should always avoid the varchar columns to store numbers or dates...

    Since your table source contains a nonnumeric value, you can write a pl/sql to convert data and see what records are false:

    SQL> insert into a (col1,col2) values ('xxxx','2345');
    
    1 row created.
    
    SQL> select * from a;
    
    COL1     COL2
    -------- --------
    1234     2345
    xxxx     2345
    
    2 rows selected.
    
    SQL> create table b (col1 number(19), col2 number(19));
    
    Table created.
    
    SQL> set serverout on
    
    SQL> declare
      2  cursor c is
      3  select * from a;
      4  begin
      5    for r in c loop
      6     begin
      7       insert into b values (to_number(r.col1), to_number(r.col2));
      8     exception
      9       when invalid_number then
     10        dbms_output.put_line('Row rejected: col1='||r.col1||' col2='||r.col2);
     11     end;
     12    end loop;
     13  end;
     14  /
    Row rejected: col1=xxxx col2=2345
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from b;
    
          COL1       COL2
    ---------- ----------
          1234       2345
    
    1 row selected.
    

    Max

    Published by: Massimo Ruocchio, June 14, 2011 20:00
    Added the first query in the example

  • Data type of the other schema reference

    Hello

    I want to reference the data type on the other schema, inv.customer, 1st schema table, 2nd table tran.order.

    then, when I declare my package.


    Procedure p_insertOrder
    (
    p_empid in customer.customerid%type
    p_orderid in tran.order.orderid%type
    );


    However, it gives me this error message

    PLS-00201: identifier 'tran.orde' must be declared.

    the following package is located in inv schema. so when I make reference to the customer table, I do not have the diagram for it.

    So what is the cause of this?



    ~ vincent.

    what grants do you have enabled on the table?

    Log in as tran or a dba and try:

    grant select on tran.order to inv;
    

    You can also create a public synonym so you don't have to precede the table with the schema name. Beware of the tables of the same name in your current schema if you do it well.

  • change the data type of the columns

    Oracle 10g version.
    I have a table with 150 columns.
    I would like to change the data type of the columns in my table to varchar.
    Do we have a query for this task?

    Thank you.

    Not knowing yet what you meet John:

    If your table is empty, you can use the datadictionary to generate a statement and run the query to a file that makes the DDL using dynamic SQL or spool and run that...

    Example:

    MHO%xe> create table bla (col1 number, col2 number);
    
    Tabel is aangemaakt.
    
    MHO%xe> select column_name, data_type from user_tab_columns where table_name = 'BLA';
    
    COLUMN_NAME                    DATA_TYPE
    ------------------------------ ---------------------------------------------------------------------
    COL1                           NUMBER
    COL2                           NUMBER
    
    MHO%xe> declare
      2    l_sql varchar2(4000);
      3    l_sep varchar2(1);
      4  begin
      5    l_sql := 'alter table BLA modify ('||chr(10);
      6    for rec in ( select column_name from user_tab_columns where table_name = 'BLA')
      7    loop
      8      l_sql := l_sql||l_sep||' '||rec.column_name||' varchar2(50)'||chr(10);
      9      l_sep := ',';
     10    end loop;
     11    --
     12    dbms_output.put_line(l_sql||' )');
     13    --
     14    execute immediate l_sql||' )';
     15    --
     16  end;
     17  /
    alter table BLA modify (
     COL1 varchar2(50)
    , COL2 varchar2(50)
     )
    
    PL/SQL-procedure is geslaagd.
    
    MHO%xe> select column_name, data_type from user_tab_columns where table_name = 'BLA';
    
    COLUMN_NAME                    DATA_TYPE
    ------------------------------ ---------------------------------------------------------------------
    COL1                           VARCHAR2
    COL2                           VARCHAR2
    
  • y at - it Systemtable of the data types of the column?

    Is QUESTION 1 Systemtable of the data types of the column?

    _________________________________________________________________
    QUESTION2

    IF REGEXP_SUBSTR (p_datatype, "[''!" [¤ % & / =? *; >: <]') IS NOT NULL

    We say: you can not write that! » ¤ % & / = ? ' ^ * ; >: <-each of each example ">".

    How can I say... you can NOT write PENIS, NIPPLES, hole word "NIPPLES".
    __________________________________________________________________

    Published by: user619226 on 19-sep-2008 01:15

    Do you mean something like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_txt VARCHAR2(200) := 'FRED,JOE';
      3  begin
      4    IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
      5      dbms_output.put_line('Text is OK as it contains just a word');
      6    ELSE
      7      dbms_output.put_line('Text is not OK.  Must only contain a single word');
      8    END IF;
      9* end;
    SQL> /
    Text is not OK.  Must only contain a single word
    
    PL/SQL procedure successfully completed.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_txt VARCHAR2(200) := 'FRED';
      3  begin
      4    IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
      5      dbms_output.put_line('Text is OK as it contains just a word');
      6    ELSE
      7      dbms_output.put_line('Text is not OK.  Must only contain a single word');
      8    END IF;
      9* end;
    SQL> /
    Text is OK as it contains just a word
    
    PL/SQL procedure successfully completed.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    v_txt VARCHAR2(200) := 'FRED JOE';
      3  begin
      4    IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
      5      dbms_output.put_line('Text is OK as it contains just a word');
      6    ELSE
      7      dbms_output.put_line('Text is not OK.  Must only contain a single word');
      8    END IF;
      9* end;
    SQL> /
    Text is not OK.  Must only contain a single word
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • First try the producer consumer Architecture: continuous play and dynamically update settings.

    Hello

    I am currently working with two instruments; an Agilent E3646A and a NI 6212 BNC. My goal is to have the 6212 continuously take measures according to predefined parameters while the E3646A parameters can be continuously updated. This combination simple instrument aims to help me learn the manual architecture; continuous measurement, output dynamic controls and instruments more will be added in the future.

    I've already posted on a similar, but more complicated configuration (http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Split-second-lag-when-controlling-two-instrum... and was advised to try the producer consumer Architecture.) I found the documentation on the website (http://www.ni.com/white-paper/3023/en/, https://decibel.ni.com/content/docs/DOC-2431), searched the forums and built my own VI. While my first attempt at a producer consumer Architecture has solved some of the problems I had when I posted on the subject, however, new questions have been raised regarding the reading and adoption of the VI.

    I am currently able to run the VI and update the settings on the device. Previously, I'd get a freeze while the instrument has been updated and could not switch settings until it was done. This has been resolved, although that reading updates only when a parameter has been updated, although it is outside the structure of the event. In addition, the Stop button does not in any context. I also got occasional mistakes on the part of Deqeue, but the major part of the sentence is error-200279 'A tried to read samples that are no longer available' to DAQmx Read. I realize that there is a problem in my loop of producer but have not been able to find a way to solve it.

    This is my first attempt at a producer consumer Architecture and already I can see that it is a powerful tool. I read as much as I could and looked at examples, but should have some problems at the beginning. Would be very grateful of any advice so I can take full advantage of the architecture.

    Hope to hear from you,

    Yusif Nurizade

    You're going to overflow this buffer, unless the events are generated faster than "sample rate/number of samples.   Period.  Nothing could be simpler.

    You don't need a local to stop your curls.

    Try something like this attachment.  I simply moved the structure of the event in its own loop dedicated since it had nothing to do with acquiring data at all.

    Data acquisition loop stops very well when you destroy the task and destrying the stops of power queue (sending the default values of the queue for the power control) for EXAMPLE, to ADD a group of setting 'Safe shutdown' to a 'package' and it wire to the Center terminal (Prototype).

  • Using the producer/consumer with GPIB/VISA model

    Hi all

    So I have a .VI I learned to communicate with my camera, I joined. I tried strip down as much as possible, just to understand the concept. It basically just takes a resource VISA name, use this open VISA, then uses the same resource VISA to write a command that reads the data from my machine (xall?) and then bed in 500 bytes and which prints. If it works, and it's good.

    I try to use producer/consumer model for doing essentially exactly what this guy. I have a RLC, I want to press a button that starts my measure, I want him to taste several times per second, save the data in a text file or .csv and then stop when I press the stop button. Thus, he will be given indefinitely potentially.

    I would like to have the data in a format something like:

    Time C R

    0 5.0 4.3

    ... etc.

    I read the link of model p/c above, but my LabView knowledge is still low. Currently, my plan is to take the part of read/write of my attached VI, which are a sub - VI and then put that in the pink box in the VI for the producer/consumer above page that is labeled "produce data to be placed in the queue":

    What prevents me to do this, it's that I can't get the piece of read/write to work properly as a standalone Subvi.

    What is the right way to go about this?

    Thank you!

    I put if you actually found data of your instrument.  Your instrument is not made to take new measures or just send you the last reading, she did.

    Insofar as the file IO, I recommend that you learn to use the palette for the file IO functions.  You need to create your file before your loop, write in a text file inside and then close after the loop.  I don't do the thing the comment on the express VI entry will do what you want.

  • Convert single while loop with variable Timing literal to the producer consumer

    I have a controller for a biological system that updates every n minutes or every minute 2n, under certain conditions. My app has a synchronization controller calculates if the current iteration is n or 2n and feeds the output of this calculation in a loop of "Timing" VI in my all. If I understand correctly, this is similar to the issuance of an order of sleep() in a language similar to C and should be avoided. I'm refactoring my code and I heard that they are well suited for this kind of things. Here's how it should work:

    1. Loop begins at the time T, T is saved.
    2. Schedule controller runs and calculates if loop will get minutes 2n or n minutes. This controller will take a number of milliseconds to complete, so we are is more to time T.
    3. Now that the update interval (n or 2n, let's call it u) is known, the loop must until T +u fill.
    4. The PDC is executed, but a number of milliseconds to execute.
    5. The rest of the time until the next iteration of loop should produce the CPU for other processes.

    It sounds to me like it's the kind of a real-time system, although as long as we are in the minute of the original deadline, there will be nothing wrong.

    What the producer-consumer loop would look like? Assumed that the synchronization and the main order controller are separate from the VI.


  • Cannot terminate everything in a loop to the producer/consumer

    I have attached a simple vi which was built from the producer/consumer (events) model.  In vi I set up a counter.  I want to be able to complete the meter when you press the stop button.  This does not work as expected.  The meter goes to its full count before the program stops.  The vi works as expected when run in execution to highlight mode.  Cannot understand it.

    Thanks in advance.

    Race condition.  No matter what time something behaves differently with that highlight run it at full speed, and suspect it is a problem of synchronization due to a race condition.

    As soon as your producer loop has the command queued up, she is ready to handle the next event.  If you press the stop button, it is ready to deal quickly and the stem while the ends of the loop and Stop immediately gets back to false.  This probably happens before the loop of consumer has the opportunity to read the local variable of the button stop in the moment, it's true.  Have your consumer while loop redefine the Stop button to false instead ensuring consumer loop has a chance to see if it is true.

Maybe you are looking for

  • OS 10 removed ringtones

    Hello I have an iphone 5 c that I've recently updated with os 10.  Now, I have no custom ringtones.  Where are they passing and how to bring them back? Thank you for your help

  • No audio in my Compaq Presario CQ56-can I replace it?

    The audio just stopped.  Services troubleshooting, all the rest apparently is OK and the problem does not appear in Device Manager.  Is there a replaceable part?  It is of course just out of warranty.

  • HP Officejet Pro L7680 All - in - One will not print black

    Original title: HP Officejet Pro L7680 All - in - One I started my printer and it won't print in black.  Don't copy in black no more.  Test page does not work and the color works very well.  I changed all the cartridges, so it isn't the ink... No ide

  • Director of HP or power on password

    HP 15 f039 asking for these, but just bought it gives 96456289 as disabled system code

  • Walkman: adopt please feature SONER

    I am updating a new version of Walkman: 8.4.A.1.4 om my M, I'm still miss to have certain characteristics that almost all Sony Ericsson has in his Walkman: (1) press and hold the volume button down to play the NEXT track and volume key until the PREV