adccommunitymod (AutomationDirect) asked a question.

how to calculate the volt change rate?

Created Date: January 21,2009

Created By: Benl

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

I read a linear volt analog (0-5v) signal from F2-8AD4DA-2. How can i calculate the instant voltage change speed from that? What I'm going to do is get voltage1 at time1, and voltage2 at time2, then the instant change speed is (v1-v2)/(t1-t2). But this has to be a very small amount of time, like 100ms or 50 ms, and have to do this math all the time in the process. Any better idea will be great. Thanks!


  • adccommunitymod (AutomationDirect)

    Created Date: January 21,2009

    Created by: bcarlton

    Be aware of the acquisition/conversion time of the analog module. Otherwise, at each timeout of your timer move the previous reading from 'new ' to 'old ', get the current reading as 'new '. Subtract the 'new ' from the 'old ' for the difference. ( 'New ' and 'old ' are any two 'V ' registers you would like to use.)

  • adccommunitymod (AutomationDirect)

    Created Date: January 21,2009

    Created by: Benl

    Thanks bcarlton! Your method is great, and easy to write the program.

    For the Acquisition/conversion time period, do you meean i should take time as a whole (23ms+25ms), or just one of them?

  • adccommunitymod (AutomationDirect)

    Created Date: January 21,2009

    Created by: bcarlton

    Yes - just have the preset of the timer be the time duration you want between samples. The time difference is equal to the preset obviously. In case it's not clear, the timer would be one enabled by the NC contact of its 'time done ' bit. Use the 'time done ' bit to trigger the moves, acquisition and math.

  • adccommunitymod (AutomationDirect)

    Created Date: January 21,2009

    Created by: Benl

    You made this issue really clear, bcarlton! Thanks so much.

  • adccommunitymod (AutomationDirect)

    Created Date: January 25,2009

    Created by: jesawyers

    bcarlton told you the correct method to calculate the dn/dt using a timer.

    Depending on the accuracy that you need and espically when calculating a dn/dt you might want to use an interrupt that is native to the PLC to improve accuracy and decrease noise of the dn/dt calculation.

    dn/dt calcuations espically with two samples like in your application can be very noisy.

    I have an application where I need to calculate the dn/dt of a temperature and control it to 1 degree per minute. By just using the timer method using two samples I found that in my application, the dn/dt calculation was too noisy. I use a rolling average (with 5 samples) dn/dt to reduce the noise and use a DL06 interrupt to make sure the subroutine used to calculate the dn/dt is called in a deterministic way.

    Bottom line is bcarlton told you the correct information, but depending on your application you may have to use other methods to improve the control when using a dn/dt calculation.

    Take care...John

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: January 21,2009

    Created by: Benl

    I read a linear volt analog (0-5v) signal from F2-8AD4DA-2. How can i calculate the instant voltage change speed from that?

    What I'm going to do is get voltage1 at time1, and voltage2 at time2, then the instant change speed is (v1-v2)/(t1-t2). But this has to be a very small amount of time, like 100ms or 50 ms, and have to do this math all the time in the process.

    Any better idea will be great.

    Thanks!

    Expand Post