ILC_H

sine wave generation for frequency tests purpose

24 posts in this topic

Hallo everyone,

i have a logix5561 PLC wich control a pumpsystem. The Pump is driven by a linear Motor. I need to perform frequency tests on the system. So first of all i  want to know how i can generate sine wave with this controller? I google it but didn't find any valuable information.  

Can i perform such tests without additional hardware? 

thanks for your replys! 

1 person likes this

Share this post


Link to post
Share on other sites

There may be an easier way but you could write a structured text routine for the SIN function (copy / paste from Wikipedia):

Its most basic form as a function of time (t) is:

y(t) = A\sin(2 \pi f t + \varphi) = A\sin(\omega t + \varphi)

where:

  • Aamplitude, the peak deviation of the function from zero.
  • fordinary frequency, the number of oscillations (cycles) that occur each second of time.
  • ω = 2πfangular frequency, the rate of change of the function argument in units of radians per second
  • \varphiphase, specifies (in radians) where in its cycle the oscillation is at t= 0.
     
    When \varphi is non-zero, the entire waveform appears to be shifted in time by the amount \varphi/ω seconds. A negative value represents a delay, and a positive value represents an advance.

 

Share this post


Link to post
Share on other sites
19 hours ago, Michael Lloyd said:

There may be an easier way but you could write a structured text routine for the SIN function (copy / paste from Wikipedia):

Its most basic form as a function of time (t) is:

y(t) = A\sin(2 \pi f t + \varphi) = A\sin(\omega t + \varphi)

where:

  • Aamplitude, the peak deviation of the function from zero.
  • fordinary frequency, the number of oscillations (cycles) that occur each second of time.
  • ω = 2πfangular frequency, the rate of change of the function argument in units of radians per second
  • \varphiphase, specifies (in radians) where in its cycle the oscillation is at t= 0.
     
    When \varphi is non-zero, the entire waveform appears to be shifted in time by the amount \varphi/ω seconds. A negative value represents a delay, and a positive value represents an advance.

 

Thanks for your reply Michael!

Is there already  a sin function integrated in Logix that i could call to generate the wave y (t)? 

 

Share this post


Link to post
Share on other sites
4 hours ago, ILC_H said:

Thanks for your reply Michael!

Is there already  a sin function integrated in Logix that i could call to generate the wave y (t)? If you 

 

There's a SIN function block and you can use SIN( ) in structured text but there's more to it than just the SIN portion of the equation.

The value for t seems to be as easy as using a periodic task and then extracting t with: GSV(Task, THIS, Rate, TaskRate); // Get the rate of the task. The units are microseconds

t := TaskRate / 1000000;; // Convert Microseconds to Seconds

I may tinker with writing an AOI for this if I can find some free time today

Share this post


Link to post
Share on other sites

Removed. Not valid

Edited by Michael Lloyd

Share this post


Link to post
Share on other sites

Thinking thru the AOI over lunch- I think I used the wrong value for t. <-- scratch this, more thinking below

Edited by Michael Lloyd
1 person likes this

Share this post


Link to post
Share on other sites
On 6/14/2020 at 9:01 AM, ILC_H said:

Hallo everyone,

i have a logix5561 PLC which control a pump system. The Pump is driven by a linear Motor. I need to perform frequency tests on the system. So first of all i  want to know how i can generate sine wave with this controller? I google it but didn't find any valuable information.  

Can i perform such tests without additional hardware? 

thanks for your replys! 

Ok... scratch the AOI. I almosts always over complicate the first draft and this was no exception. Besides that it has errors. 

How do you see this function working?  The idea behind what you want to implement isn't clear. Are you going to drive an analog output? Linear motor driving a pump? 

Share this post


Link to post
Share on other sites
1 hour ago, Michael Lloyd said:

Ok... scratch the AOI. I almosts always over complicate the first draft and this was no exception. Besides that it has errors. 

How do you see this function working?  The idea behind what you want to implement isn't clear. Are you going to drive an analog output? Linear motor driving a pump? 

Thanks for asking. i will try to be as clear as possible. I have a closed loop system, wich consist of a pump as a plant. servo motor to control the pump and a SPS (Logix5561). The idea is to produce frequency response i.e Bode diagramm (Amlitude and Phase) of this closed loop system. In order to perform such diagramm, i need to generate sine wave with differents frequencies to trigger the system and collect the responses. 

Share this post


Link to post
Share on other sites

I think you can use a PID loop with the analog output fed back to the PV of the loop, then vary the gain and integral values to adjust the output "characteristics". Tap off of the output for an analog representation of the sine wave.

I am struggling to understand what type of signal you are looking for. If analog, what is the scale or limits? 0-100%; -100% - 0 - 100%? Actual frequency and amplitude? Frequency in Hz. kHz?

I don't think you are looking for a Boolean value but I don't want to assume so I'll ask.

Share this post


Link to post
Share on other sites

I'm just as confused as Micheal Lloyd on this question ILC_H.  

I'm assuming you have a Servo Motor which turns a pump and that pump moves a fluid through a closed loop piping system.

My first question is what type of Servo Motor? 

Is it a Stepper motor where the Angular value of the SIne Wave will dictate the motors position.  So a sine wave at different frequencies will produce different pump speeds and differnet system results?

Or is your servo motor an induction motor and a VFD is controlling it's speed and trying to match the fequency of the Sine Wave?

I still don't follow what you're BODE Plotting.

Share this post


Link to post
Share on other sites
On ‎15‎.‎06‎.‎2020 at 0:05 AM, Michael Lloyd said:

I think you can use a PID loop with the analog output fed back to the PV of the loop, then vary the gain and integral values to adjust the output "characteristics". Tap off of the output for an analog representation of the sine wave.

I am struggling to understand what type of signal you are looking for. If analog, what is the scale or limits? 0-100%; -100% - 0 - 100%? Actual frequency and amplitude? Frequency in Hz. kHz?

I don't think you are looking for a Boolean value but I don't want to assume so I'll ask.

The Pump is already controlled with a PID-Controller implemented in Ladder Diagramm in the PLC. I Need to measure frequency Response on the closed System. To do so, the Input of the System has to be a sine wave with different frequency in order to excit the Systems and record the Responses. With this Information i can produce the Bode Diagramm (Gain and Phase of the Systems ).

Share this post


Link to post
Share on other sites
13 hours ago, BobLfoot said:

I'm just as confused as Micheal Lloyd on this question ILC_H.  

I'm assuming you have a Servo Motor which turns a pump and that pump moves a fluid through a closed loop piping system.

My first question is what type of Servo Motor? 

Is it a Stepper motor where the Angular value of the SIne Wave will dictate the motors position.  So a sine wave at different frequencies will produce different pump speeds and differnet system results?

Or is your servo motor an induction motor and a VFD is controlling it's speed and trying to match the fequency of the Sine Wave?

I still don't follow what you're BODE Plotting.

Yes your assumption is Right Boblfoot.

The Motor is a linear Motor. AS i said to Michael, i have a closed loop System controlled by a plc with a PID Controller. So i just Need to perform frequency test on it. I just want to know if  i can create sin wave with different frequency with logix or i Need an extra Signal Generator.

Share this post


Link to post
Share on other sites

A linear motor driving a pump with a PLC PID controller setting the motor speed?

Please tell us if you cana bout the PID COntrol.  What is it's Setpoint , Its Control Variable and it's Process Variable?

Where in this system does the Sine Wave get injected.  

I'm sorry if I am dense, but I am still not following the design and test logic.

1 person likes this

Share this post


Link to post
Share on other sites
3 minutes ago, BobLfoot said:

A linear motor driving a pump with a PLC PID controller setting the motor speed?

Please tell us if you cana bout the PID COntrol.  What is it's Setpoint , Its Control Variable and it's Process Variable?

Where in this system does the Sine Wave get injected.  

I'm sorry if I am dense, but I am still not following the design and test logic.

I don't think you're dense, but if you are you have company :)

Share this post


Link to post
Share on other sites
34 minutes ago, Michael Lloyd said:

I don't think you're dense, but if you are you have company :)

Actually that's a symptom of the other pandemic we are having.

1 person likes this

Share this post


Link to post
Share on other sites
13 hours ago, BobLfoot said:

A linear motor driving a pump with a PLC PID controller setting the motor speed?

Please tell us if you cana bout the PID COntrol.  What is it's Setpoint , Its Control Variable and it's Process Variable?

Where in this system does the Sine Wave get injected.  

I'm sorry if I am dense, but I am still not following the design and test logic.

what is wrong with a linear Motor (controlled by a plc)  driving a pump?. OK Forget About the sine wave and all the above stuff if you want. My Question is how do i perform frequency reponse  test on a closed loop System controled by a plc ?

Share this post


Link to post
Share on other sites
4 minutes ago, Michael Lloyd said:

This?: http://www.ni.com/tutorial/6450/en/

Controlled by a PLC or controlled by a PID loop in a PLC?

yess thanks Michael by a PID loop in a PLC. LabVIEW use the transfert function of the plant. If i had the transfert function, i could easily plot it on MATLAB too or other Simulation Software.

Share this post


Link to post
Share on other sites

Boy does my head hurt now.  So you're trying to perform a Labview/MatLab program experiment on a Real World System.

That is usually a recipe which breaks something.

Please understand I am Electronics Engineering Tech by Training and not an EE or ME like those that wrote the lab, so my understanding could be flawed.

Where I in your shoes, I'd generate the sine wave into a DINT with values of between -1 and 1 corresponding to 0 to 360 range.  

I would then take a Multiplier value starting at 1 through 100 and modify my setpoint as follows:

SineWaveMultiplier * MultiplierValue + SetpointMaster = Setpoint to PID loop.

You can then plot your angle versus your output and see how the system responds.

BE WARNED AT SOME POINT THINGS WILL GO INTo RUN AWAY.  HAVE AN EMERGENCY SHUTDOWN PLANNED AND USE IT.

This is not how I was taught to tune or test PID Loops, but it might work, I've been known to be proven wrong from time to time.

2 people like this

Share this post


Link to post
Share on other sites
On ‎6‎/‎22‎/‎2020 at 11:37 AM, BobLfoot said:

Boy does my head hurt now.  So you're trying to perform a Labview/MatLab program experiment on a Real World System.

That is usually a recipe which breaks something.

Please understand I am Electronics Engineering Tech by Training and not an EE or ME like those that wrote the lab, so my understanding could be flawed.

Where I in your shoes, I'd generate the sine wave into a DINT with values of between -1 and 1 corresponding to 0 to 360 range.  

I would then take a Multiplier value starting at 1 through 100 and modify my setpoint as follows:

SineWaveMultiplier * MultiplierValue + SetpointMaster = Setpoint to PID loop.

You can then plot your angle versus your output and see how the system responds.

BE WARNED AT SOME POINT THINGS WILL GO INTo RUN AWAY.  HAVE AN EMERGENCY SHUTDOWN PLANNED AND USE IT.

This is not how I was taught to tune or test PID Loops, but it might work, I've been known to be proven wrong from time to time.

I've never had the luxury, need, or desire to continuously disrupt the process by using a sinewave for a setpoint. I'm sure you haven't either. Typically you step the setpoint, analyze the result, adjust tuning parameters, step change, etc. Maybe the OP is working on an exercise intended to teach loop tuning?

Share this post


Link to post
Share on other sites
14 hours ago, Michael Lloyd said:

I've never had the luxury, need, or desire to continuously disrupt the process by using a sinewave for a setpoint. I'm sure you haven't either. Typically you step the setpoint, analyze the result, adjust tuning parameters, step change, etc. Maybe the OP is working on an exercise intended to teach loop tuning?

You are Right Michael. I notice that in practice  Control Engineers usualy do empirical adjustments, wich is fine. My plan is to design an Iterative learning Control algorithm for the existing Control system.

The point to have a Bode plot, is to analyse the stability of the System. That is, to know, at wich frequency my System goes instabil. Knowing that i can design a filter at a desired cuttoff frequency for my learning Control.

Share this post


Link to post
Share on other sites
On ‎22‎.‎06‎.‎2020 at 7:37 PM, BobLfoot said:

Boy does my head hurt now.  So you're trying to perform a Labview/MatLab program experiment on a Real World System.

That is usually a recipe which breaks something.

Please understand I am Electronics Engineering Tech by Training and not an EE or ME like those that wrote the lab, so my understanding could be flawed.

Where I in your shoes, I'd generate the sine wave into a DINT with values of between -1 and 1 corresponding to 0 to 360 range.  

I would then take a Multiplier value starting at 1 through 100 and modify my setpoint as follows:

SineWaveMultiplier * MultiplierValue + SetpointMaster = Setpoint to PID loop.

You can then plot your angle versus your output and see how the system responds.

BE WARNED AT SOME POINT THINGS WILL GO INTo RUN AWAY.  HAVE AN EMERGENCY SHUTDOWN PLANNED AND USE IT.

This is not how I was taught to tune or test PID Loops, but it might work, I've been known to be proven wrong from time to time.

Thanks you for your Reply. Can i generate high frequency(100Hz) and smooth sine wave with this approach ?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now