paulusB

MrPLC Member
  • Content count

    9
  • Joined

  • Last visited

Posts posted by paulusB


  1. On 28-9-2011 at 1:59 PM, BITS N BYTES said:

    See attached example for LONG WORD addition. Adds [D100,101] + [D102,103] + [D104,105}........... The key here is to double increment the index register using ,IR++. During each pass of FOR/NEXT routine [now changed to 50 times] the index pointer moves 2 words instead of one. i.e. D100 then D102 then D104. Hope this helps. SUM LONG.pdf

    where can I find the attachement? Also want to use this?

     


  2. Hello,

    I am looking for some help to build a linear regression formula (https://en.wikipedia.org/wiki/Simple_linear_regression).

    The scope is to write a function block with a variable "n". The measured "y" will be a real value. The "n" can be 5, 10, 20 or 40. In Excel I have the formula working and made function block without a variable n. I just sum the totals and do the calculations

    Looking for a way to easy sum the results for different "n". Not much experience with structured text. Please advice.

    regression formula.jpg

    200727 - Regression_Test_V1.0.cxp

    200727 - Regression_Test_V1.0.opt

    200727 - Regression_Test_V1.0.bak

    200727 - regression - v1.0.xlsx


  3. To calculate a walking or moving average I want to use WSFT and SUM in a function block. Does anybody have experience with this?

    The idea is to take a 1 hour average of a proces value and store this average value each hour.
    The software then have to calculate the walking or moving average over say 4 hours or 12 hours with a maxium of 24 hours.

    See attached files with logic but then not in a function block

     

     

    Walking_AVG.cxp

    Walking_AVG.opt

    Walking_AVG.bak

    2020-05-11_08-42-28.png


  4. I'm building a function block to sum flow and production hous and calculate average flow based on a REAL input.

    For avering I use /L function.
    The Result R is a LWORD

    To get a more acurate result I want to convert the result to a REAL.

    The first two words of the LWORD is the Quatient in DINT
    The last two words of the LWORD is the Remainder in DINT

    How do I read out the remainder in a function block.

    A bit shift is nog working (NASR/NSRL) is only availabe to 32 bits,'.

    When not in a function block and using de D channel you simply pick the 3rd channel

    LWORD = D100

    D100 = DINT for QuatientA
    D102 = DINT for remainder.

    m3_test.opt

    m3_test.bak

    m3_test.cxp