Kikis Posted July 4, 2012 Report Posted July 4, 2012 Hi guys,What's the best way to have an analog 0-10V output with up and down ramp time?I want to have a ramp time of 0.3 sec for my signal.For example when i want to have 5V, instead of storing 511 (For 10-bit analog) immediately to the linked MI, i want the integer to be increasing gradually for 0.3 seconds and then to take it's final value. The same must happen when the MI is reset (From 5V to 0V).Thanks in advance,Kikis
MVP 2023 Joe Tauser Posted July 4, 2012 MVP 2023 Report Posted July 4, 2012 The best resolution you're going to get with your ramp is 0.01 sec, or 30 segments. If you use a 0.01 self-resetting timer to increment an MI from 0 to 30, you can feed the MI into a Linear block as the X value. Set the Y value to the raw limits of the analog output (0-1024) and map the Y value to the analog output. Instant ramp. Joe T.
Kikis Posted July 4, 2012 Author Report Posted July 4, 2012 I used PWM FB instead of a self -resetting timer. It is working as expected. Thanks for your support Joe! Kikis
External Moderators Nacho Posted July 9, 2012 External Moderators Report Posted July 9, 2012 I am curious. How do you use the PWM FB to get a ramp?
Kikis Posted July 9, 2012 Author Report Posted July 9, 2012 Hi Nacho, I start a timer of 0.3 sec. I use the inverted contact of this timer as a condition to run PWM with 50% duty cycle. Then i use the Positive transition contact of PWM result MB in order to increment an MI and use it as the X value in a linear block.
MVP 2023 Joe Tauser Posted July 10, 2012 MVP 2023 Report Posted July 10, 2012 Pretty clever, Kikis. An excellent way to "cheat" the system. What frequency did you choose for your PWM? You'll only be able to increment the MI once per scan, unless you use an interrupt routine. Joe T.
Kikis Posted July 10, 2012 Author Report Posted July 10, 2012 The ramp consists of 20 steps. I use a cycle time of 15ms (6*2.5ms)
External Moderators Nacho Posted July 10, 2012 External Moderators Report Posted July 10, 2012 A smart solution. I usually have an self-resetting timer and load the timer value to MI in a linear FB.
Kikis Posted July 10, 2012 Author Report Posted July 10, 2012 I think that it would be great if Visilogic offered a ramp function for analog output. Just like the way we configure a filter for analog inputs. The user to enable/disable the ramp and link an MI for the ramp time from the hardware confuguration menu.
Damian Posted July 11, 2012 Report Posted July 11, 2012 Could the Accelerate FB be used with an acceleration factor of unity?
dahnuguy Posted July 12, 2012 Report Posted July 12, 2012 how about using an addition function to add some amount to itself every scan and then use the result as the input to a scaled block? change the amount added to change the speed of the ramp. If Y is less than Setpoint, Then add X to Y Can also decel with subtract. Could also control around a setpoint...........
External Moderators Nacho Posted July 13, 2012 External Moderators Report Posted July 13, 2012 how about using an addition function to add some amount to itself every scan and then use the result as the input to a scaled block? change the amount added to change the speed of the ramp. Because the Scan time is not a fixed time the ramp will not be accurate.
dahnuguy Posted August 6, 2012 Report Posted August 6, 2012 Because the Scan time is not a fixed time the ramp will not be accurate. It will if this is done in a interrupt routine orrrrrrrr you can use the scan time as the base for a "timer" every scan, take the scan time from the system register and add it to a total time. When the total time exceeds the desired time, trigger some event and reset the total. Simple easy scan independent timer. Doesn't matter what your resolution is, unless you use an interrupt, nothing will happen until the ladder scan gets to that point in the logic anyway. INCrement makes a quick and easy ramp too.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now