Getting a numerical value to change with time

Hi,
I'm trying to control a bunch of relays connected to a NI 6008 and 6501 unit. I've got a program which can take a binary coded decimal code and turn on the appropriate relays for that code but I'd like to automate the system to free me from keeping an eye on the clock and changing the code as necesary. As such I was trying to get the program to reference a spreadsheet each iteration of the loop, however this returns an Array which I can't seem to find a block which will pull the value I require out. I then tried making a waveform replicating the on/off cycle of the relays with no joy at pulling the value of the waveform at each time step out and giving them to the microcontrollers.
I'm sure there must be a simple way that the program references an array/speadsheet/waveform and gets the value out at the specific time but I can't seem to find it!!
The number is a double, 64bit real type.
Sample data would be the number being 0 for the first 40seconds, ramp up to 7 in the next 10 seconds, hold that for 20 seconds then ramp back down to 0 in a final 10 seconds.
Any clues or suggestions would be very much appriciated!!
Cheers,
Stuart
Solved!
Go to Solution.

You've mentioned a few different things there.
The attached vi is one suggestion of how you could generate the waveform you described.
Troy
CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
Beware of the man who won't be bothered with details. - William Feather
The greatest of faults is to be conscious of none. - Thomas Carlyle
Attachments:
gen_ramp_waveform.vi ‏13 KB

Similar Messages

  • How to get the numeric value of DocTotal from UI API

    When I hit the ADD button I need to get the DocTotal from the UI API !
    All I have is the EditText which gives it in string and the problem is to double.Parse it
    it's a pain to do it while there is CultureInfo related issue with it.
    So It would be wise to get the numeric value directly from the UI API instead of getting the DocTotal by string and trying to convert it.  So is there any way to get the numrci value of DocTotal from UI API ?

    Hello Marc,
    Here is a function which considering the Culture Info and always working. You can speed it up by using extending admininfo to global vairables, and loading the values at startup of the addon.
    Use the oEditText.value.ToString() to convert into into the doulbe number:
    Public Function _string2double(ByVal s As String) As Double
            Dim d As Double
    ' This part is fast, when regional settings equal to sap B1 settings:
            Try
                d = Convert.ToDouble(s)
                d = Math.Round(d, 6)
                Return d
            Catch
            End Try
    ' Speed up performance: extend CompaneService variables to global variables and query them at addon startup.
            Try
                Dim nfi As System.Globalization.NumberFormatInfo = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
                Dim oCompanyService As SAPbobsCOM.CompanyService = oCompany.GetCompanyService()
                Dim oAdminInfo As SAPbobsCOM.AdminInfo = oCompanyService.GetAdminInfo()
                Dim sbodsep As String = oAdminInfo.DecimalSeparator
                Dim sbotsep As String = oAdminInfo.ThousandsSeparator
                If s.IndexOf(Space(1)) > 0 Then
                    If oAdminInfo.DisplayCurrencyontheRight = BoYesNoEnum.tYES Then
                        s = s.Substring(0, s.IndexOf(Space(1)))
                    Else
                        s = s.Substring(s.IndexOf(Space(1)), s.Length - s.IndexOf(Space(1)))
                    End If
                End If
                Dim s1 As String = s.Replace(sbotsep, nfi.NumberGroupSeparator)
                s1 = s1.Replace(sbodsep, nfi.NumberDecimalSeparator)
                d = Convert.ToDouble(s)
                d = Math.Round(d, 6)
                Return d
            Catch
                Return 0
            End Try
        End Function
    Regards,
    J.
    Edited by: János Nagy on Oct 7, 2009 8:55 AM

  • How to get instantane​ous values according to elapsed time?

    How can i get the instantaneous value at a specified time (say 2.5 seconds) when my VI runs for 5 seconds?
    Any help is much appreciated. Thanks!
    noviceLabVIEWuser
    Attachments:
    Instantaneous Value.vi ‏36 KB

    I have already done the coding, so compare this to yours.  When using floating point numbers (orange wires), you should not use equals function because of rounding off errors (5 might be represented by 4.99999999 or 5.00000000001 and equal will fail).  Use the In Range function like shown here:
    - tbob
    Inventor of the WORM Global

  • Numeric value variable problem with user exit

    Dear experts,
    I've created a variable (numeric value, user exit) and I want to get the value of variable from an user exit.
    Actually, I want to convert "0calyear" to a number to be albe to calculate (multiplying, dividing etc).
    If there is a possible solution only in FOX, the solution will be the best. However I couldn't find anything.
    So, the next solution I am trying is user-exit. But I am in stuck here.
    The problem is that I have no idea whether the numeric value variable has any sturcture like other variables(char. value) or not. If yes, what structure it has?
    I know, the characterisc value variables have the structure as blow,
        ls_varsel-chanm =
        ls_varsel-seqno =
        ls_varsel-sign  =
        ls_varsel-opt   =
        ls_varsel-low   =
    I've tried several times with the same way like above, but it doesn't work when I call the variable in "BPS0" or "UPSPL".
    How can I solve it? Please let me know.
    I am using SEM_BW 4.00.
    Many Thanks.
    Bruce

    Hi Ravi,
    Sorry, there's a correction. <b>var2 is used for getting the first month of the year selected by the user in var1</b>. If the user doesn't enter a value for var1, then var2 should take first month of current year from var1 which has by default last month of current year (populated in i_step1 from sy-datum). The user can select the value of var1 according to his requirement. Then var 2 should get first month of the year selected. That's why I'm using two exit variables.
    It works fine during the initial run of the query. But when the user clicks on the variable button in the toolbar and executes the query, var1 is not being displayed and an error message <i>No value could be determined for var2</i> is shown. All other variables used in the query are displayed except var1.
    Krzys, Is the option <i>Can be changed in Query Navigation</i>  available for Exit variables. I'll check that and get back to you.
    Boujema, Thanks for the OSS note.
    Thanks
    Hari

  • Getting error while deploying a cube with time dimension

    Hi,
    I created a time dimension using WB with Cal yr and day heirarchy. Designed a cube using both and tried to deploy it. I got the following error.
    Appreciate your help..
    Name
    Type
    Status
    Log
    TIME_CUB1
    Cube
    Success
    VLD-0001: Validation completed successfully.
    TIME_CUB1
    Description : Runtime User : OWB_REP_OWNER Started : 2006-12-13 15:37:17.0
    Name
    Action
    Status
    Log
    TIME_CUB1
    Create
    Error
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "OLAPSYS.CWM2_OLAP_CUBE", line 394
    ORA-06512: at line 5

    Hi,
    I'm having problems to deploy this cube (this was the origin of my problem), when I change it to "Deploy Data Object Only", It don't generate code and the cube is not created. This is what I get:
    -- Product : Oracle Warehouse Builder
    -- Generator Version : 11.1.0.6.0
    -- Created Date : Wed May 12 08:41:59 CST 2010
    -- Modified Date : Wed May 12 08:41:59 CST 2010
    -- Created By : edennis
    -- Modified By : edennis
    -- Generated Object Type : TABLE
    -- Generated Object Name : FACT_TMP_SALDOS
    -- Comments :
    -- Copyright © 2000, 2007, Oracle. All rights reserved.
    WHENEVER SQLERROR EXIT FAILURE;
    Ideas?
    Thanks for your help!

  • Need to create a Default Value or WorkFlow with Time Expressions

    There are numerous times where our people's targets are measured by week. Our weeks run from Monday through Sunday so we say "week ending" is on Sunday night at midnight. Each rep puts in calls, proposals, etc. but are measured on each weeks targets.
    I was able to create an expression in analytics that would take the Created Date and look ahead to find that week's Sunday. I need to return that date and save it on the record itself to speed up retrieval as well as limit how many places/reports I need to perform this very common calculation. This will also allow the user to quick search their activities over a given week since it will be stored in an indexed date field.
    Example: If today was Thursday 5/12/2011 then I would want the function to return 5/15/2011.
    Here is how I solved it in Anaytics on a report which just looks at the DAYOFWEEK (1-7) to determine if it is a mon-sun and then figures out how many days to add to get me to the next Sunday.
    TIMESTAMPADD(SQL_TSI_DAY, (8 - CASE WHEN DAYOFWEEK(CAST(Activity."Created Date" AS DATE)) = 1 THEN 8 ELSE DAYOFWEEK(CAST(Activity."Created Date" AS DATE)) END),CAST(Activity."Created Date" AS DATE))
    How do I modify this so I can do the same thing with Expression Builder?

    I tried the above expression and it wasn't getting me a guaranteed result. The date that I'm trying to convert is the actual "CREATED DATE" timestamp field. In some cases I was getting the correct date and in others I was getting one day less which breaks the calculations.
    What I may not understand is how this will work and if time zones come into play at all. I need it to set the time to the Sunday MM/DD/YYYY 12:00 AM timestamp no matter what timezone they are in? I'm not sure if all of the reps even have their time zones set correctly. In some cases the date is correct but the time is set to 1:00AM/2:00AM/etc.
    It may just be the time zones but I tried a different function as well just in case:
    ToChar([<CreatedDate>] + (6 - IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") <=2, 1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") , IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 4, 3, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 5, 4, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 7, 5, IIf(1.0 * IfNull(Mid(1.0 * JulianDay([<CreatedDate>])/7, 8, 1), "0") = 8, 6,-99)))))),"MM/DD/YYYY")
    Basically (today + the number of days until Sunday) truncated to MM/DD/YYYY format which hopefully gets me a MM/DD/YYYY 12:00 AM format.

  • How do I get access to files backed up with time machine on another computer?

    Hi. I recently migrated to a new macbook air. got most of the data across, but not my iphoto library, which exists now only on an external harddrive onto which i backed it up using time machine.
    I had to delete the iphoto library from my old computer before migration.
    The harddrive doesnt work on my old computer anymore (says the disk is damaged. Im currently trying to repair it, but no luck so far, disk utility says it cannot repair it.)
    I can get the harddrive to work on my new computer.However, the folder i want to access is inside a time machine backup folder (made on my old machine) and it is locked. I tried to unlock it using command+ i but that did not work.
    How can i access such a locked folder?

    maedi wrote:
    I realize it is not good to get time-machine created files back by going through finder, but that seems like that is my only option.
    Were you trying to access it via either Setup Assistant or Migration Assistant?  If those don't work, you still may be able to use the "Star Wars" display to see and restore some data.  It all depends on just what and where the damage is.
    If you can get into the display, you may be able to restore the iPhoto Library; start with the most recent backup, and work back in time. 
    the  problem now is the folder is locked with a big red no go sign, and command-i cannot change it (not even when i do it on the computer on which the file was created).
    Correct; Time Machine protects it's backups with very restrictive ACLs, basically "nobody can do anything," so us mere mortals won't damage them. 
    If you use the same user account on the same Mac that did the backup, via the Finder, you should have read rights, and you may be able to copy from the backups.   
    if i succeed, am i going to see my iphoto library file in that folder?
    Yes.  Each of those date-stamped backup folders should contain a set of "hard links" to the backup copies of everything that was on your system at the time of that backup, no matter when each item was actually backed-up.  If you can copy the most recent one successfully, that will get everything.
    The iPhoto Library looks like a file; but it's actually a special kind of folder called a "package."  If you can't copy it, right-click it and select Show Package Contents to see inside it, but don't copy individual items except as a last resort -- at best, you'll recover raw photos, with no organization or data, and probably no editing, either.

  • How to get the returned value from Functions with Callable statement?

    I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
    String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
    and getting the output variables by
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!

    Here is  my code
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1202.
      MODULE subscreen_find.
      CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_1202.
      CALL SUBSCREEN SUBSEARCH.
    MODULE subscreen_find.
      case sy-ucomm.
        when 'SELECTED'.             "fcode
          case 'ZSKILL_SEARCH'.     "data element
            when '01'.                       " value range
              dynnr = 0110.
            when '02'.
              dynnr = 0111.
          endcase.
      endcase.
    ENDMODULE.
    kindly tell me what is wrong
    Edited by: Raji Thomas on Feb 8, 2010 10:20 AM

  • How to get the day value from the current time?

    Hi,
    I like to write a program that prints out the current time in the formate as "Thu May 3 07:57:02 PDT 2002". Then I want to get the day, time, year and month value out and do some manipulation.
    I know to format the current time, I can use
    SimpleDateFormat formatter
    = new SimpleDateFormat ("EEE MM.dd hh:mm:ss z yyyy");
    Date currentTime_1 = new Date();
    Now how do I get the day, time, year and month value? All the getday(), gettime()..,method have been deprecated. Can anyone provide the answer?
    Thanks.

    Try using Calendar.get(int) and take a look at the constants used to specify the field you are trying to access.

  • HT3728 Can't get my initial backup to work with Time Capsule...get the following error: An unexpected error occurred (error code -6584)

    I linked up my Time Capsule yesterday and my initial backup failed twice. I then hooked up the Time Capsule to my iMac with an ethernet cable and now it won't work at all....can anyone help us out? Getting frustrated with this "easy" stuff!!
    Thanks.

    Let me guess.. you are using Lion.
    Redo the setup but download and install 5.6 utility if indeed Lion is involved.
    http://support.apple.com/kb/DL1482
    Use SMB names for wireless and TC.. this helps..
    Short, no spaces pure alphanumeric..
    Set and lock the wireless channels.

  • Can I get a numeric value entered as a whole number on a form to "know" it's really a percentage?

    Hi everyone,
    I'm a non-technical person using LiveCycle 7.1 to design forms for the court system I work in. I've developed a judgment form where different values are entered: damages, interest start/stop dates, interest rate, additional costs/credits, which are then totaled. The form works great, I used FormCalc to perform all the math in the form. The question I have is: is there a way for the form to know a number entered in a field is really a percentage? So if a user entered "12" the form would know it's really 12%. Right now the form requires the user to enter the interest rate as a decimal value: 12% as ".12". I'm a bit concerned about the potential for user error. It would be ideal if the user could enter "12" (without decimal) and have the form know that that numeric field was always a percentage value. Any ideas? Thanks, any help is greatly appreciated.

    Thanks for the heads up, I'm actually on the line with apple right now (even though I've been on hold for more then 20 minutes ) I guess I'll see what they say.
    But I was also wondering if anyone else had to go through this

  • Can you restore only the files that have recently changed with Time Machine?

    Greetings,
    Before i ask my question,  i'll give a bit of background as to my issue.
    I was editing my $PATH within the ~/.bash_profile file and accidently overwrote my $PATH. So now simple terminal commands such as open or 'ls' no longer work. In order to edit the file, I need to change the defaults to allow me to see hidden files, but I can't do that because the defaults command stopped working after I screwed up the $PATH. Also, I used the echo commadn to verify that the previous $PATH no longer exists. The environment variable now just points to an empty folder I accidently set it to in TextEdit.
    So, I have Time Machine running, and it backs up to a Time Capsule. I have the hourly backups that I can restore to, but when I start the restore, it crawled up towards 200,000 files before I finally decided that wasn't right and decided to post a question (it's still "preparing to copy"). I had to select the OS X Volume to restore from my one hour old backup, since I can't restore the folder the bash_profile exists within (it is hidden) or so I assumed.\
    Now my question, it seems that Time Machine is doing a full restore of every file in the backup and not just the files it incrementally changed between its hourly backups. Why does it do this? My restore process should have just been a couple of minutes, restoring a couple hundred or so files at most. Restoring several hundred thousand files seems stupid when the I select a backup that is one hour old. Is there anyway to set it up so I can restore incrementally?
    Thanks,
    Johnathon.
    Message was edited by: Scionwest
    A quick note, I performed the restore from within the Time Machine while booted into OS X; the restore did not take place in the special bootup tool available. Why it does not provide an option to simply restore the files changed over the last hour is mind boggling to me

    You are making this way too complicated. In Terminal, choose Shell > New Command…. In the text box that opens, enter bash --noprofile . A Terminal window will open that does not use your .bash_profile, so the bad $PATH will not be an issue. Now you can remove, move, or edit .bash_profile.

  • How do I get a numerical value for the number of tick boxes or "true / false" in a column?

    Hi,
    Any help for my very simple brain appreciated...
    All I want to do is add in a formula for adding up the ticks in column B i.e. B2 - B46 so the answer of ticks is in B47!?
    And what's doing my head in is I can't even copy and paste a section to show on here!!
    Thanking anyone that can help.

    dominic.birch wrote:
    Hi,
    I just can't do it - it's doing my head in!!
    I'm adding the footer as suggested but the =COUNTIF(B, TRUE) isn't working; it just shows as I've typed it i.e. doesn't add up the ticks??
    D
    It would appear that you are typing it in as text, not creating a formula.  On the iPad, you don't type an "=" nor do you type the function name. You press the "=" button which then lets you start a formula. You choose the function by pressing the "functions" button then choosing it from the list. The function shows up in the editting bar with words in colored ovals for the parameters. You click on the various parameters in the formula to edit them. And you use the mathematical operators and click on cells or choose formulas to create mathematical operations.

  • Intensity changes with value

    I have a 2d array of temperature vs time. I would like to have an indicator whose color is proportional to temperature that changes with time. Any suggestions?

    If you just want to display the current 2D temperature array, use an intensity graph with an appropriate color ramp. For an example, open the example finder and search for "heat eqaution". It will show a simulation of the heating of a 2D plate starting with certain boundary conditions..
    LabVIEW Champion . Do more with less code and in less time .

  • Not able to use date with time in sql query

    Hi,
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id,b.creation_date
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between to_date('21-10-2013 9:19:48','DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    If I execute this query in toad it is giving me proper results.This query populates the results between the two date with time.
    But I am facing issue when I am using this query in the procedure. The procedure is as below.
    If I use the same query in the procedure I am getting wrong output.
    CREATE OR REPLACE procedure xx_prog_upd_annualized_amt(errbuf out varchar2, retcode out varchar2)
    as
    cursor c1 (l_date in varchar2)is
    select a.contract_number,b.start_date,b.end_date,b.price_negotiated,b.attribute_category,b.attribute1,a.sts_code,a.contract_number_modifier,b.cle_id
    from OKC_K_HEADERS_ALL_B a,OKC_K_LINES_B b
    where a.id = b.dnz_chr_id
    and b.cle_id is not null
    and a.contract_number_modifier is not null
    and a.sts_code in ('ACTIVE','SIGNED','60 DAY HOLD','HOLD')
    and b.creation_date between  to_date(l_date,'DD-MM-YYYY HH24:MI:SS')  and  sysdate;
    v_date varchar2(100);
    v_total_days number;
    v_annualized_amount number;
    begin
    begin
    select max(fcr.actual_start_date) into v_date
    from fnd_concurrent_programs_vl fcp
    ,fnd_concurrent_requests fcr
    where fcp.concurrent_program_id = fcr.concurrent_program_id
    and fcp.user_concurrent_program_name like 'Renewed Annualized Amount Updation';
    exception
    when others then
    fnd_file.put_line(fnd_file.log,'Invalid date');
    end;
    fnd_file.put_line(fnd_file.output,v_date);
    fnd_file.put_line(fnd_file.output,sysdate);
    fnd_file.put_line(fnd_file.output,'***************Start of Program***************');
    fnd_file.put_line(fnd_file.output,'***************Hi***************');
    For i in c1(v_date) loop
    SELECT
             1
           + 30 * TRUNC (MONTHS_BETWEEN ( TO_DATE (i.end_date, 'DD-MON-YYYY'),  TO_DATE (i.start_date, 'DD-MON-YYYY')))
           + LEAST (EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')), 30)
           - LEAST (EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')), 30)
           + CASE
                WHEN EXTRACT (DAY FROM TO_DATE (i.end_date, 'DD-MON-YYYY')) < EXTRACT (DAY FROM TO_DATE (i.start_date, 'DD-MON-YYYY')) THEN 30
                ELSE 0
             END
              daysbetween into v_total_days
      FROM dual;
      fnd_file.put_line(fnd_file.output,i.contract_number);
      fnd_file.put_line(fnd_file.output,v_total_days);
      If v_total_days < 360 then
      v_annualized_amount := (360*i.price_negotiated)/v_total_days;
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = v_annualized_amount
      where cle_id = i.cle_id;
       fnd_file.put_line(fnd_file.output,v_annualized_amount);
        fnd_file.put_line(fnd_file.output,i.cle_id);
        elsif v_total_days >= 360 then
      update OKC_K_LINES_B
      set attribute_category = 'Annualized Amount',attribute1 = i.price_negotiated
      where cle_id = i.cle_id;
      end if;
    end loop;
    commit;
    fnd_file.put_line(fnd_file.output,'***************End of Program***************');
    null;
    end;

    SureshM wrote:
    Hi Purvesh,
    Apologize for not giving the sufficient information.
    max(fcr.actual_start_date) = here I am getting date with time (for eg :9/4/2012 6:47:49 PM)
    Datatype for this column is date.
    This actual start date I am storing in varchar2 variable and then converting this value to date with time.
    My requirement is to pick the rows between the two timestamps which I am unable to do in the procedure.
    Regards
    Suresh
    YOu are losing the Time information while fetching the data into a VARCHAR2 variable. change the datatype of v_date to DATE and get rid of the TO_DATE logic in cursor and simply use v_date variable.
    Message was edited by: PurveshK misread.

Maybe you are looking for