Change a VI to a more sophisticated pattern (e.g. consumer/producer)

Hi everybody!
I have written a VI taking spectra from a triggered flash lamp and spectrometer. The whole systems works in a rotating device. So the triggering and exact timing is quite important. I finally got my Vi to work  but there are still some problems with the spectrometer. I think this is due to the fact that the spectrometer runs into a internal timeout but I don't know why. Furthermore there is still a lot of false triggering when changing to the next sample with a different delay.
So it's really time to take a deep and think about my program. At the moment I have a flat sequence with some for loops defining the number of measurings as well as the while loops for the triggering...
Well that's I want to do:
1. All the necessary data comes in a cluster from a different vi
2. Initialize: Create folders, calculate positions for the step motor and move it to the initial position, open spectrometer and so on
3. Start the speed measuring and calculation of delays
4. Measure the spectrometer dark current
5. Move step motor to the first position
6. Start retriggerable task for lamp and spectrometer (the triggering occurs in a subvi, whereas the delays are updated continuously by a reference) 
7. Measure at step motor position first sample, second sample and so on
8. Move stepmotor -> 7
9. Stop retriggerable task for lamp and spectrometer
10. Save data and wait for a specified time
11. Back to step 5
12. In the end: Close the spectrometer, stop the speed measurement and so on
Furthermore the data has to be displayed:
1. The actual scan
2. Step motor position dependent absorption for the actual scan as well as the former scans (by option)
So much for the theory. I thougt that maybe a produce/consumer patttern would fit but I have no idea how to realize this. Of course I have read a lot but I don't know how to do the triggering stuff and so on.
I have attached my main vi that you can see how I deal with this at the moment. Of course all the subvis are missing but the working principle should be clear. Please let me know if If you need any more information!
I want to do two things. First I want to separate the data aquisition from the display and file I/O, second the data aquisition has to be seperated from the lamp and spec triggering.
Especially the second point seems to be very important because my spectrometer runs into some internal timeout (not because there is no trigger) after some minutes or hours (the exact time is not reproducible, but it does happen) and crashes my whole system  as I mentioned before.
I don't know why but I hope so much that a more sophisticated vi pattern will solve this problem.
May you help me with this?
Thanks!
Attachments:
radial_scan_v5.10.vi ‏293 KB

If the vi runs without user intervention, then simple Enum based state machine architecture can be used.
1. All the necessary data comes in a cluster from a different vi
State -1
2. Initialize: Create folders, calculate positions for the step motor and move it to the initial position, open spectrometer and so on
State -2 Initialise state
3. Start the speed measuring and calculation of delays
This can be a Dynamically launched vi ( and can be launched in State-2) where it waits for the notification from State -2 to start Acquisision.
This vi will also stop acquisiion based on another notification from the main vi states
State-3 -> Set start notification for this cont. running sub vi
4. Measure the spectrometer dark current
State -4
5. Move step motor to the first position
State -5
6. Start retriggerable task for lamp and spectrometer (the triggering occurs in a subvi, whereas the delays are updated continuously by a reference)
This can also be another dynamically launched subvi, that is launched in State -2 itself.
State-6 -> Send Notification to start the Retriggerable task
7. Measure at step motor position first sample, second sample and so on
State -7.Measurement
8. Move stepmotor -> 7
9. Stop retriggerable task for lamp and spectrometer
State -8 Send stop notification to stop the Retriggerable task.
10. Save data and wait for a specified time
State -9 - Log the Data
11. Back to step 5
State 10 .. Check for completion.if required again redirect to state -5
12. In the end: Close the spectrometer, stop the speed measurement and so on
State -11 Send stop ACQ notification for all the dynamically launched vis, stop those vis..close  all instrument refs .. stop main vi
If the states are dependent on user intervention then Event based producer consumer can be used where, the producer will control when to start the whole process and when to stop the process( Using queues).The consumer can be Queue driven Enum based state machine

Similar Messages

  • Color pattern match in consumer producer architecture

    The way I currently have my code is as follows:
    If the number of matches in a color pattern match is greater than 0, it sends the information to the consumer loop.
    If it is not greater than 0, it doesn't send anything.
    What I was wondering is, if it finds a match the first time and it sends the information to the consumer loop, will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match? If the number of matches in the color pattern match will be greater than 0 after the first match, and it will still be greater than 0, even though it doesn't find a match in the following scenarios, how can I make the number of matches in the color pattern match return to 0?

    Fernan1988 wrote:
    ... will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match?...
    it's hard to say unless you can post your code....have you tried probing tool,retain wire value,highlight execution,single stepping into and out, breakpoints?

  • DB name shortening algorithm probably needs more sophistication

    Hi,
    I think it might be wise to come up with a more sophisticated way to
    shorten the names when the class names and field names are too long. I
    ran into the following situation with a class called
    "AttributeCollection" with a HashSet field called "attributes". The
    elements of attributes are instances of "Attribute" a simple persistent
    class with a "name" and "value" string. Changing the field name to
    "set" fixed it. The only reason that I found the problem relatively
    easily is that I remembered observing the shortening algorithm (snip) in
    another harmless case.
    David Ezzio
    Yankee Software
    E:\MyCode>kodoschematool -action refresh
    Refreshing schema for type "class
    com.ysoft.jdo.attributes.AttributeCollection" and known subclasses...
    CREATE TABLE ATTRIBUTECOLLECTION_ATTRIBUTEX (ATTRIBUTESX NUMBER, JDOIDX
    NUMBER)
    CREATE INDEX ATTRIBUTECOLLECTION_ATTRIBUTEX ON
    ATTRIBUTECOLLECTION_ATTRIBUTEX (ATTRIBUTESX)
    CREATE INDEX ATTRIBUTECOLLECTION_ATTRIBUTEX ON
    ATTRIBUTECOLLECTION_ATTRIBUTEX (JDOIDX)
    java.sql.SQLException: ORA-00955: name is already used by an existing
    object
    E:\MyCode>kodoschematool -action refresh
    Refreshing schema for type "class
    com.ysoft.jdo.attributes.AttributeCollection" and known subclasses...
    CREATE TABLE ATTRIBUTECOLLECTION_SETX (SETX NUMBER, JDOIDX NUMBER)
    CREATE INDEX ATTRIBUTECOLLECTION_SETXSETX ON ATTRIBUTECOLLECTION_SETX
    (SETX)
    CREATE INDEX ATTRIBUTECOLLECTION_SETXJDOIDX ON ATTRIBUTECOLLECTION_SETX
    (JDOIDX)
    CREATE TABLE ATTRIBUTECOLLECTIONX (JDOIDX NUMBER NOT NULL, JDOLOCKX
    NUMBER, JDOCLASSX VARCHAR2(255), PRIMARY KEY (JDOIDX))
    Refreshing schema for type "class com.ysoft.jdo.attributes.Attribute"
    and known subclasses...
    CREATE TABLE ATTRIBUTEX (JDOIDX NUMBER NOT NULL, JDOLOCKX NUMBER,
    JDOCLASSX VARCHAR2(255), NAMEX VARCHAR2(255), VALUEX VARCHAR2(255),
    PRIMARY KEY (JDOIDX))

    Hi,
    I had the same problem about a month ago. Patrick Linskey suggested in his post from 12.09.01 "Re: Schematool problem" to "use the 'table' class-level extension in
    your system.jdo file". But this didn't seem to work, so I shortened the name of the class to fix it.
    Here is Patricks original post:
    Martin,
    As Joe Mannerling pointed out earlier, the problem that you are seeing
    is related to a bug in Kodo's table name generation algorithm. In
    order to keep table and column names below database limits (Oracle,
    for example, has a 30 character limit), Kodo truncates names to this
    length. Unfortunately, it performs this truncation after assembling
    the name, so if a class name is over a certain length, then name
    conflicts such as those that you are seeing will arise.
    We are working on a better name generation algorithm to resolve this
    problem. In the mean time, use the 'table' class-level extension in
    your system.jdo file:
    <?xml version="1.0"?>
    <jdo>
         <package name="de.mediateam.quizmaster.data">
              <... snip ...>
              <class name="Question">
                   <field name="prerequisites">
                        <collection element-type="Question" />
                   </field>
              </class>
              <class name="TextQuestion" persistence-capable-superclass="Question" />
    <!-- change this section -->
              <class name="MultipleChoiceQuestion"
    persistence-capable-superclass="Question" >
                   <extension key="table" value="MCQuestionX"/>
    </class>
    <!-- end changes -->
              <class name="BooleanQuestion" persistence-capable-superclass="Question" />
              <... snip ...>
         </package>
    </jdo>
    Thanks, and good luck.
    Cheers
    Martin
    On Thu, 18 Oct 2001 08:44:11 -0400, David Ezzio <[email protected]> wrote:
    Hi,
    I think it might be wise to come up with a more sophisticated way to
    shorten the names when the class names and field names are too long. I
    ran into the following situation with a class called
    "AttributeCollection" with a HashSet field called "attributes". The
    elements of attributes are instances of "Attribute" a simple persistent
    class with a "name" and "value" string. Changing the field name to
    "set" fixed it. The only reason that I found the problem relatively
    easily is that I remembered observing the shortening algorithm (snip) in
    another harmless case.
    David Ezzio
    Yankee Software
    E:\MyCode>kodoschematool -action refresh
    Refreshing schema for type "class
    com.ysoft.jdo.attributes.AttributeCollection" and known subclasses...
    CREATE TABLE ATTRIBUTECOLLECTION_ATTRIBUTEX (ATTRIBUTESX NUMBER, JDOIDX
    NUMBER)
    CREATE INDEX ATTRIBUTECOLLECTION_ATTRIBUTEX ON
    ATTRIBUTECOLLECTION_ATTRIBUTEX (ATTRIBUTESX)
    CREATE INDEX ATTRIBUTECOLLECTION_ATTRIBUTEX ON
    ATTRIBUTECOLLECTION_ATTRIBUTEX (JDOIDX)
    java.sql.SQLException: ORA-00955: name is already used by an existing
    object
    E:\MyCode>kodoschematool -action refresh
    Refreshing schema for type "class
    com.ysoft.jdo.attributes.AttributeCollection" and known subclasses...
    CREATE TABLE ATTRIBUTECOLLECTION_SETX (SETX NUMBER, JDOIDX NUMBER)
    CREATE INDEX ATTRIBUTECOLLECTION_SETXSETX ON ATTRIBUTECOLLECTION_SETX
    (SETX)
    CREATE INDEX ATTRIBUTECOLLECTION_SETXJDOIDX ON ATTRIBUTECOLLECTION_SETX
    (JDOIDX)
    CREATE TABLE ATTRIBUTECOLLECTIONX (JDOIDX NUMBER NOT NULL, JDOLOCKX
    NUMBER, JDOCLASSX VARCHAR2(255), PRIMARY KEY (JDOIDX))
    Refreshing schema for type "class com.ysoft.jdo.attributes.Attribute"
    and known subclasses...
    CREATE TABLE ATTRIBUTEX (JDOIDX NUMBER NOT NULL, JDOLOCKX NUMBER,
    JDOCLASSX VARCHAR2(255), NAMEX VARCHAR2(255), VALUEX VARCHAR2(255),
    PRIMARY KEY (JDOIDX))

  • I'm trying to change my secret question because I forgot to answer. Followed all the instructions, but not yet I receive a message to let me change the answer, I tried more than once, but without an answer

    I'm trying to change my secret question because I forgot to answer.
    Followed all the instructions, but not yet I receive a message to let me change the answer, I tried more than once, but without an answer

    See this thread:
    https://discussions.apple.com/message/23280567#23280567

  • Hi, My printing has suddenly changed in adobe to a large scale, as in, what should be one page of print comes out as 24 pages?   I havent changed anything, its happening on more than one document also, I have to stop my printer before all the pages spew o

    Hi, My printing has suddenly changed in adobe to a large scale, as in, what should be one page of print comes out as 24 pages?   I havent changed anything, its happening on more than one document also, I have to stop my printer before all the pages spew out. I have tried printing 'one single page' and it does exactly the same? Help?

    Is the Poster Print feature turned ON?

  • Why import of change request in production takes more time than quality?

    Hello All,
                 why import of change request in production takes more time than import into quality?

    Hi jahangeer,
    I believe it takes same time to import a request in both quality and production as they will be in sync.
    Even then if it takes more time in production that may depend on the change request.
    Thanks
    Pavan

  • I can only see three weeks of emails on the imap email account on my iMac even though the same email address set up as a pop account on my iPhone, iPad and another iMac show all my emails.  How do I change the setting to see more emails?

    I have two iMacs, an iPhone, and an iPad.  All use the same email address but the new iMac would only let me set up the email account as an imap account. On this iMac I can only see three weeks worth of emails.  On the other iMac, iPhone, and iPad, this email address is set up as a pop account and I can see emails as far back as three years.  I use Yosemite on the new iMac and I cannot find out how to change the settings to let me see more than three weeks worth of emails.  This is an att&t email account which is basically a Yahoo account.

    Nope. It will reset all settings. For fix errors.
    Or you can try Logging out and Restart your iPad and Sign in again.

  • Change this code to retrieve more than one row in the drop out menu

    How I can change this code, it only works when the cursor retrieves one row
    like this
    201410
    Fall 2013
    If it returns 2 rows, I only get the fir one in the drop out menu 
    201410
    Fall 2013
    201420
    Spring 2014
    I try to put a loop but it does not work..
    I need to be able to display any term that is retrieve by the cursor  (can be more than one)
    Term Fall 2013
    Spring 2014
    PROCEDURE p_enter_term
    IS
    v_code  stvterm.stvterm_code%TYPE;
    v_desc   stvterm.stvterm_desc%TYPE;
    CURSOR select_term_c IS
    SELECT
    stvterm_code,
    stvterm_desc
    from
    stvterm,
    sobterm
    where
    sobterm_dynamic_sched_term_ind = 'Y'
    and sobterm_term_code = stvterm_code;
    select_term_rec  select_term_c%rowtype;
    BEGIN
    --check for open cursor
    if select_term_c%isopen
    then
    close   select_term_c;
    end if;
    open    select_term_c;
    fetch select_term_c into v_code,v_desc; 
    HTP.p ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
       HTP.p ('<FORM ACTION="/test/btsewl.p_sel_crse" METHOD="POST" onSubmit="return checkSubmit()">');
       HTP.p ('<TABLE  CLASS="dataentrytable" summary="This layout table is used for term selection."width="50%"><CAPTION class="captiontext">Search by Term: </CAPTION>');
       HTP.p ('<TR>');
       HTP.p ('<TD class="dedefault"><LABEL for=term_input_id><SPAN class="fieldlabeltextinvisible">Term</SPAN></LABEL>');
       HTP.p ('<SELECT NAME="p_term" SIZE="1" ID="term_input_id">');
       HTP.p ('<OPTION VALUE="'||v_code||'">');
       HTP.p (v_desc);
        HTP.p ('</OPTION>');
       HTP.p ('</SELECT>');
       HTP.p ('</TD>');
       HTP.p ('</TR>');
       HTP.p ('</TABLE>');
       HTP.p ('<BR>');
       HTP.p ('<BR>');
       HTP.p ('<INPUT TYPE="submit" VALUE="Submit">');
       HTP.p ('<INPUT TYPE="reset" VALUE="Reset">');
       HTP.p ('</FORM>');
    END;

    You are using the Eclipse Dali plugin to generate tables from your entities, not the EclipseLink JPA provider at runtime, so the settings in your persistence.xml are ignored.  The documentation for the Dali table Wizards state it will drop and create tables.  If you want to use the EclipseLink persistence settings to just create tables, access your persistence unit in a test case or deployment. 

  • Snippets Problem: HTML ID changes when pasted twice or more

    Hi there,
    I have an external CSS style sheet in a website that formats elements in a snippet. However, when I paste a snippet more than once, the ID field receives a number. For example, the first snippet will post with an element as <td id="Title">, while the second paste will cause it to be <td id="Title2">. The CSS sheet only knows to format elements with the ID "Title" so when I paste this more than once the ID changes.
    Under normal circumstances, I would just edit the HTML code, however, the site is meant to be heavily template driven, and the second person managing it doesn't have time to edit/learn HTML code as they are busy with other tasks. For the moment, PHP/MySQL isn't an option either.
    Is there a way to have pasted elements not include an additional number in the ID fields?
    Thanks,
    David

    You can't technically use the same HTML id twice.
    <div id="edgar"></div>
    <div id="edgar"></div>
    Is a no-no.
    Use classes instead...
    <div class="edgar"></div>
    <div class="edgar"></div>
    Your css would go from
    #edgar {
         some attributes
    to
    .edgar {
         some attributes
    EDIT: Or in your case <td id="Title"> to <td class="Title"> and in the CSS #Title to .Title

  • Developing more sophisticated enum control methods

    I would like to select a function name and map it to a module and channel.  For instance, it would be much better to specify "Cold Water Flow Rate" than to specify "Module 3" and "Channel 7" which have no real meaning.  How can I develop something like an enum but with immutable data with more than one dimension?  I'm thinking the best solution is to make an enum of the function names and use it as an index into an array of module and channel enums but the array is not immutable, or is it?  What other methods should I consider?
    Solved!
    Go to Solution.

    An array is not immutable.  But is Module 3 or Channel 7 something which will never change? What if you get a new DAQ device with different channel numbering?
    Make the array a diagram constant or read the data from a configuration file and then do not change the values in the array within the program.  Then index as you mentioned.
    Lynn

  • Change the report title to more meaningful title? How to achieve it?

    Hi Guys,
    We have some BI reports which the users runs from BEx analyser. Currently the report title shows the names of the reports. For example a Sales by products reports has the title SALES BY PRODUCT REPORTING.
    What we want to do is these reports have selection screen and based on what the user selects on the selection screen we want the report title to be more meaningful. For example if the report is run for the period 1 and company code ABC selected on the selection screen then the report title must show SALES BY PRODUCT FOR PERIOD 1 AND COMPANY CODE ABC.
    My questions is how to show the variable in the report title? I am new to BI and need help on the same. We are on 7.1 version of BI.
    Cheers
    VJ

    Hi,
    We have done the same but in my case the input Month will display.
    Eg: We have MM reports which will run Period wise, so user wil give 001.2009, in the report title it will display...
    Stocks report for 001.2009.
    Using Text Variable we can do it.
    Steps;
    1. Create a Text Variable with Customer Exit option.
    2. Take the user input value and pass into Custome exit Variable.
    For Sample Code, you can see one blog and some Articles.
    https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    See the blog "Using Text Variables with Customer Exits in Report Headings" and see Customet Exit articles..
    WHEN 'ZT_C'.   " ZT_C = Text variable with customer Exit
        IF i_step = 2.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZMONTH'.  " ZMONTH = User input variable on 0CALMONTH
            IF sy-subrc = 0.
              CLEAR: l_s_range.
              zsmy = loc_var_range-low.
              zemy = loc_var_range-high.
              zsmnth = zsmy+4(2).
              zemnth = zemy+4(2).
              zfyear1 = zsmy+0(4).
              zfyear2 = zemy+0(4).
              CONCATENATE zsmnth '.' zfyear1 INTO zsmnyr.
              CONCATENATE zemnth '.' zfyear2 INTO zemnyr.
              l_s_range-low+0(7) = zsmnyr.
              l_s_range-low+9(2) = 'To'.
              l_s_range-low+13(7) = zemnyr.
              l_s_range-sign = 'I'.
              l_s_range-opt = 'BT'.
              APPEND l_s_range TO e_t_range.
            ENDIF.
          ENDLOOP.
        ENDIF.
    Thanks
    Reddy

  • HOW TO CHANGE THE USEFUL LIFE FOR MORE ASSETS AT A TIME FOR ASSET CLASS

    Hi All,
    Asset which is under Asset Class Support system-B700. Here every thing is ok but the problem in USE FULL LIFE which is come by default. It must be 4 instead of  5.   So can any body help me out from this how to change the Useful life in that Asset class.  In that Asset Class we have the morethan 200 Assets. It was happend in Prdocution system so now the problem is where i can change the useful life for the asset class either in DEV or PRD.
           Also i want to know the information of How these assets are Uploaded into the system (Lsmw or etc). this is very urgent for me.
    Thanks in Advance,
    Regards,
    Siva.

    Hi Ashok,
         Can i know the reason how it was happend. i mean instead of 4 years the system showing is 5yesrs any reason is there behind that.
    Thanks in Advance.

  • TS1424 I love the info about every single word spelled in a question. I feel great talking to something that has all the answers and none solutions. the more sophisticated  apple gets the more complicated it is. Ok i'm stupid.

    What makes apple more complicated to use, the people behind apple now days or the you have to buy your time spent with an apple product. I have been trying for two days to watch a movie I rented in my macbook pro. Oh yes its downloaded allready, its in my rented movies in the mac. I have no rented movies in the icloud. have anything else, but not the movie.
    my life was a lot simpler with an apple 2gs.

    Rentals will be available on the device from whcih you rented it.
    If you rented on a computer, it will only be on that computer, unless you sync it to another device ( you cannot move it to another computer.
    Can I play my rental on more than one device?
    If you download a rented movie on your computer: You can transfer it to a device such as your Apple TV (1st generation), iPhone, iPad, or iPod if it’s a standard-definition film (movies in HD can only be watched on your computer, iPad, iPhone 4 or later, iPod touch (4th generation or later), or Apple TV). Once you move the movie from your computer to a device, the movie will disappear from your computer's iTunes library. You can move the movie between devices as many times as you wish during the rental period, but the movie can only exist on one device at a time.
    If you download a rented movie on your iPhone 4 or later, iPad, iPod touch (4th generation or later), or Apple TV: It is not transferable to any other device or computer.
    iTunes Store: Movie rental frequently asked questions (FAQ)

  • I have installed yosemite yesterday and photoshop elements 12 doens't work anymore: it opens, I can change doc size but no more... also screen size too large

    Yesterday I have updated my mac with Yosemite since I try to work on PHOTOSHOP ELEMENTS 12 but I cannot go further than opening documents and changing size. Screen is also too large but with Yosemite no mean to adapt it with the screen menu...
    How can I recover the photoshop tools?

    Unfortunately there is no option in PSE to vhange the UI fonts (other than switching to System Font' in preferences. So traditionally changing the Windows display font size has been the only workaround, and even that can cause problems with individual menus disappearing and being replaced with a hard to spot  >> drop-down menu.
    If you have a dual-display system you could have the menus on the lower resolution screen with images on the hi-res.
    Cheers,
    Neale
    Insanity is hereditary, you get it from your children
    If this post or another user's post resolves the original issue, please mark the posts as correct and/or helpful accordingly. This helps other users with similar trouble get answers to their questions quicker. Thanks.

  • ChaRM: Change process for correction belonging more sap systems?

    Dear friends of SolMan,
    a question regarding ChaRM.
    How can I solve the following process with ChaRM by SolMan?
    I have a change request belonging BI. Therefore I create a normal correction and do my customizing or developement in BI. But for the change I have to do some customizing in the ERP 6.0 system too.
    How can I handle the developement and/or customizing in two different systems within one change?
    Thanks for your help in advance.
    Best regards,
    Alex
    Edited by: Alexander Barth on Mar 16, 2009 11:27 AM

    Hi Holger,
    try this condition:
    &Servicevorgang CRM.Anwenderstatus&  [*] E0002+DHFHEAD 
      and    &Servicevorgang CRM.ErrorFreeFlag&  = X 
    Keep me informed, if this helped.
    b.r.
    dirk

Maybe you are looking for