Sunteți pe pagina 1din 24

Project 3

VIBRATION ATTENUATION OF CANTILEVERED


FLEXIBLE BEAMS FOR USE IN NEXT-GENERATION OF
MICROCANTILEVER-BASED BIOSENSING

CHRISTOPHER BALINO
CHRISTOPHER BRENNAN
SAM GREEN
ERIC HOLTZMAN
OLIVER QUADROS

Mechatronic Systems
Northeastern University

April 29th, 2015

TABLE OF CONTENTS
TABLE OF CONTENTS ......................................................................................................................................... 2
TABLE OF FIGURES .............................................................................................................................................. 2
TABLE OF TABLES ................................................................................................................................................ 2
ABSTRACT ............................................................................................................................................................... 3
INTRODUCTION ..................................................................................................................................................... 4
THEORY .................................................................................................................................................................... 5
RESULTS ................................................................................................................................................................ 10
DISCUSSION.......................................................................................................................................................... 16
CONCLUSION ....................................................................................................................................................... 18
APPENDIX ............................................................................................................................................................. 19

TABLE OF FIGURES
Figure 1: Diagram of Theoretical Model ...................................................................................................... 5
Figure 2: Experimental Setup ........................................................................................................................... 9
Figure 3: Uncontrolled Velocity Response of Cantilever Tip ............................................................ 10
Figure 4: Zoomed View of the Uncontrolled Velocity Response...................................................... 11
Figure 5: Velocity Response of Cantilever Tip with Controller 1 .................................................... 12
Figure 6: Velocity Response of Cantilever Tip with Controller 2 .................................................... 13
Figure 7: Experimental Data - Amplitude Spectrum of Uncontrolled Beam ............................... 14
Figure 8: Simulated Data - Amplitude Spectrum of Uncontrolled Beam ...................................... 14
Figure 9: Simulated Uncontrolled Beam Strain ...................................................................................... 15
Figure 10: Simulated Beam Strain with Controller 1 ........................................................................... 15
Figure 11: Simulated Beam Strain with Controller 2 ........................................................................... 16
Figure 12: Simulink system diagram for use in MATLAB-only simulation ................................. 19
Figure 13: MATLAB Code for Analysis and Simulation ....................................................................... 23
Figure 14: Simulink theoretical model for validation of MATLAB simulation ........................... 24
Figure 15: Simulink theoretical simulation data to verify MATLAB code. .................................. 24

TABLE OF TABLES
Table 1: Controller Parameters and Calculated Percent Reduction ............................................... 17
Table 2: Tabulated peak values from both physical and theoretical systems. ........................... 17

ABSTRACT
Microcantilevers, or small, projecting beams fixed only at one end, can be incorporated into
microelectromechanical systems (MEMS) for use in atomic force microscopy and biological
sensing. In such applications, it becomes necessary to precisely regulate the dynamics
occurring at the cantilever tip. The objective of this study was to implement a PID
controller on a cantilever system so as to minimize the first-mode vibrations. This
cantilever system consisted of a beam with a piezoelectric patch (PZT) attached near its
base. A stinger was used to induce a sine-wave excitation on the system while a laser
Doppler vibrometer, force transducer, and strain gauge monitored the tip dynamics. The
PID controller, which was designed according to the Ziegler-Nichols method, regulated the
voltage into the PZT such that the strain from first mode vibrations was minimized. From
this method with an input frequency of 8.1 Hz, first-mode amplitude reductions of 43% and
56% were realized for controller gains P=33, I=0, D=0.1 and gains P=50, I=440, D=0.1
respectively. The experiment was now run without a controller and a sine chirp from 0 to
25 Hz. This allowed for an updated transfer function and system model to be created for
simulation. A new natural frequency of 7.9 Hz was found for the system. This system was
then stimulated with the same 8.1 Hz frequency from this experiment to compare the
systems. The same controller gains were then applied to this closed loop model of the
cantilever system, and from this model, first-mode amplitude reductions of 59% and 71%
were realized for controller gains P=33, I=0, D=0.1 and gains P=50, I=440, D=0.1
respectively. These discrepancies between the experimental and theoretical results can be
attributed to the increased complexity of the real system as well as signal noise.

INTRODUCTION
Vibration analysis and control has long been an issue in the field of engineering,
particularly with machinery and structural systems. The study of vibrations is of great
importance when designing any system (including mechanical, structural, etc.) in order to
ensure that the design meets all requires specifications. An example case study was the
Tacoma Narrows Bridge, built in 1940 only to be destroyed a year later due to intense
winds1. The design of this bridge was deeply flawed as its vibration modes were excited by
small gusts of wind, thus leading to its collapse once the resonance condition was reached
for an extended period of time.
This case study is obviously an extreme case demonstrating the importance of vibration
control, but the principle remains the same. Smart structures are increasingly becoming a
heavily-researched topic in engineering. These smart systems are essentially structures
with sensors and actuators comprised of smart materials (the most prominent being Lead
ZirconateTitanate or PZT) as well as a control system2. These PZTs have the ability to sense
and respond to certain behaviors on these structures, and either minimize or maximize
certain physical characteristics of the system3. PZTs have a many advantages such as their
flexibility, ease of implementation, and relative low costs. Smart structures have a vast
array of applications from active vibration control to energy harvesting and bio-sensing4.
Cantilever beams are of particular interest because of their ability to be applied in many
different environments, including micro-cantilevers for bio-sensing. Micro-cantilevers are
ideal for bio-sensing applications because of their superior dynamic response, higher
reliability/precision, and their small size5. The goal of this project was to study the
vibration characteristics of a cantilever beam, excited at the fixed end, and use a
piezoelectric transducer (PZT) to dampen the vibration at the free end. This was done by
first exciting the cantilever at its first natural frequency and using a PID (ProportionalIntegral-Derivative) controller in a closed-loop control system. Experimental data was
taken at both the fixed (excited) end and free (vibrating) end in the using a strain gauge
and Laser Doppler Vibrometer, respectively. This data was then used to tune the PID
controller gains to optimal values according to the Ziegler-Nichols Method.

Karman, T., Collapse of the Tacoma Narrows Bridge, Resonance, 10 (8), 97-102, (2005).
Dong, X., Meng, G., Peng, J., Vibration control of piezoelectric smart structures based on system
identification technique: Numerical simulation and experimental study, Journal of Sound and Vibration, 297
(3-5), 680-693, (2006).
3Xinke, G., Haimin, T., Active Vibration Control of a Cantilever Beam Using Bonded Piezoelectric Sensors and
Actuators, Electronic Measurements and Instruments, 2007. ICEMI 07. 8 th International Conference on. 4-85488, (2007).
4Aphale, S., "Characterization and Enhancement of Sensing Properties of Piezoelectric Materials with
Applications to Vibration Suppression", Clemson University, (2009).
5 Hansen, K., Thundat, T., Microcantilever Biosensors, Methods, 37 (1), 57-64, (2005).
1
2

THEORY
The microcantilever-based sensor is comprised of a projecting beam with a piezoelectric
patch attached to its base. Since the beam is fixed at one end, the forces experienced by the
system vary as a function of distance. As a result, the cantilevers motion must be
characterized using the distributed parameter method, which describes systems as a
function of time and one or more spatial variables6. For reference, a diagram of the
theoretical model is depicted in Figure 1with thickness t, width W and length L given as
dimensions for the piezo patch and beam respectively.
z
Beam

Piezo
tb
tp

W
W

Lp
Figure 1: Diagram of Theoretical Model

The equations of motion were derived using the finite element method, which breaks the
system into simpler parts and approximates a solution by solving the individual boundaryvalue problems7. Here, the cantilever was divided into two sections to account for the
sections with and without the piezo patch. From Hamiltons principle, a particle will follow
the path that minimizes its action according to equation 1 below:
=

, ,

(1)

where S is the resulting path and L is the Lagrangian given as the difference between the
kinetic and potential energies for the variable q. An extension of this principle, called the
principle of virtual work, states that the work of the applied forces on a particle is zero for
all possible movements of that particle from static equilibrium8. That is a particle disturbed
from static equilibrium will return to static equilibrium and due to path independence the
work done on that particle will be zero. Therefore, since the cantilever starts from static

6Bilbao,

Stefan and Julius O. Smith. Discrete-Time Lumped Models. Center for Computer Research in Music
and Acoustics (CCRMA). Stanford University, (2014).
7J. Chaskalovic, Finite Elements Methods for Engineering Sciences, Springer Verlag, (2008).
8Torby, Bruce. "Energy Methods". Advanced Dynamics for Engineers. HRW Series in Mechanical Engineering.
United States of America: CBS College, (1984).

equilibrium, the motion of the two sections can be described from the principle of virtual
work given as
=

2
1

1 + 2 1 + 2 + = 0

(2)

where the operator denotes a functional derivative and Wncdenotes work from nonconservative forces. From here, the equations of motion for each section can be written as

2 1
2

( )

( )

4 1
4

= 0

(3)

and

2 2

4
( ) 2
4

= 0

(4)

Further, the eight boundary conditions, two geometric and two natural for each section,
can be derived by evaluating these equations at the endpoints 0, Lp, and L. Using the
assumed mode method, the equivalent mass and stiffness of the cantilever beam can be
estimated from a chosen mode shape that is consistent with the boundary conditions9.
These assumed mode shapes are solutions to the eigenvalue problem for the cantilever
beam and can be given as the following eigenfunctions:
1 = 1 sin(1 ) + 1 cos 1 + 1 sinh 1 + 1 cosh 1

(5)

and
2 = 2 sin(2 ) + 2 cos 2 + 2 sinh 2 + 2 cosh 2

(6)

where 1 and 2 are eigenfunction constants and A1-D2 are eigenfunction coefficients. Note
that the values of the eigenfunction coefficients depend on the given boundary conditions,
yet the eigenfunction constants are independent of these conditions since they relate to the
natural frequencies of the system10. From here, 2 can be written in terms of 1 as
2 = 1

( )

+ ( ) )

1/4

(7)

( )

which gives the relation between natural frequency (Hz) and the 1 values as
12

= 2

( )

+ ( ) )

1/2

( + )

(8)

Through orthonormalization of the discontinuous cantilever, the eigenvalue problem can


be solved for the multi-degree-of-freedom system given by
+ + =
9Tribology
10Gere,

Group. Rotordynamics Laboratory. Texas A&M Univerisity. (2015).


J. M. and Timoshenko, S. P., 1997, Mechanics of Materials, PWS Publishing Company. (2011).

(9)

thus yielding the eigenvectors x1 and x2, which can be put into state space as according to:
=

0
1
=

1
1 11

(10.1)

0
1

= 2

(1)

(10.2)
(10.3)

=0

(10.4)

formass M=1 , stiffness K=12 , and input force F 11.


Further, the viscous damping for the system can be calculated from these parameters
through the following relation:
11 =

(1) 2

(1) 2

(11)

Additionally, orthonormalization allows for the equation of motion for the first mode to be
written as
2

+ 2 (1) + (1) = 1

(12)

where q is the strain measured by the strain gage and F is the input piezo voltage. This
equation of motion yields a transfer function for the first mode that can be found by simply
measuring the first mode frequency, 1 , and the damping ratio of the system, .
Experimentally, both the damping ratio and first modal frequency were realized by
measuring the force, velocity, and acceleration of the structures tip upon a linear sine chirp
excitation from 0- 200 Hz. The recorded data was then analyzed using MATLABs Fast
Fourier Transform algorithm and used to calculate the autopower spectra. The fourautopower spectra were calculated using Eq. 13 through 16 as given below:
=

(13)

(14)

(15)

(16)

where denotes the input FFT (force data or piezo voltage), denotes the output FFT
(velocity or acceleration data) and * denotes the complex conjugate.

Khot, Nitesh P Yelve, RajatTomar, Sameer Desai and S Vittal. Active Vibration Control of Cantilever Beam
by using PID based output feedback controller. Journal of Vibration Control. (2011).
11SM

The calculated autopower spectra were then used to calculate the frequency response
functions given by Eq. 17 and Eq. 18 below:

1 =

(17)

2 =

(18)

The coherence was then determined with Eq. 19 below:

= 1

(19)

The frequency response functions were used to determine the resonance frequencies of the
structure. Both 1 and 2 were graphed and the most intense peaks within the usable
range of frequency data was taken as the resonance frequencies of the structure. The
damping ratio was then determined using the half-power bandwidth method around the
fundamental frequency.
The damping ratio is given by:
=

2 1

(20)

where2 and 1 were taken as the 3db frequency values on the positive and negative side
of the fundamental frequency ( ), respectively.
In project 2, the theoretical model anticipated the first three modal frequencies occurring
at f1= 9.475 Hz, f2=56.74 Hz, and f3= 152.7 Hz while the experimental results from
experiment 2 gave the first three modal frequencies at f1= 7.70.3 Hz, f2=46.00.4 Hz, and
f3= 1200.4 Hz. To account for this discrepancy, the eigenfunction coefficients of the
theoretical model, given by Eq. 5 and Eq. 6, were modified to better match the experimental
results. Plugging these new values into Eq. 12 and taking the Laplace Transform yielded the
modified transfer function between strain and input piezoelectric force as

= 2 +3.8704 +2.3407 10 3

(21)

Lastly, before a controller to be designed, the effective mass and effective stiffness can be
calculated. Using the following equations these values can be calculated based off of a
known frequency of 7.9 Hz.
=

= 3 2 =

(22)

= 6.4750 , = 2.6

(23)
(24)

As shown later in the report, a natural frequency of 7.9 Hz was used because this was the
newly found frequency of the system. Note that this is different from the value from
experiment 2 (7.7 Hz), and the experiment 3 input frequency of (8.1 Hz). This difference
will be talked about later in the Discussion of the report.
From here, the goal was to reduce the first-mode vibrations at the tip using a PID
controller.
A PID controller is a control loop feedback mechanism designed to regulate system inputs
such that the error between a system state and the commanded set point becomes
minimized. The general form of a PID controller is given by
= +

(25)

where , , and are the proportional, integral, derivative gains respectively. Each of
these gains is tuned to contribute to the system input based on the error dynamics of the
system. The P gain produces actions that are proportional to the current error in the
system, the D gain produces actions based on the trends of error in the system, and the I
gain produces actions based on the accumulated error in the system.
Note that a PID controller implemented on the cantilever system would attempt to regulate
the voltage of the PZT such that the strain induced by vibrations becomes minimized.

Figure 2: Experimental Setup

The particular PID gains used to minimize first mode vibrations were experimentally
determined using the Ziegler-Nichols method. The results from these gains were then
compared against the results of the simulated closed loop system subject to the same gains.

The Ziegler-Nichols method for PID tuning involved adjusting the proportional gain, with
derivative gain and integral gain set to zero, until the closed loop system became
marginally stable at the ultimate gain Ku. Once marginally stable, the oscillation period Tu
was calculated and used to adjust the P, I, and D gains accordingly for the specified control
type12. Note that a stinger was used to induce a sine-wave excitation on the system and
that stability was evaluated using a laser Doppler Vibrometer, force transducer, and strain
gauge as shown by the experimental setup given inFigure 2. As explained in the Results
section, an appreciable first-mode vibration reduction was realized from the ZieglerNichols method, and the magnitude of this reduction was successfully compared against
the results of the theoretical model subject to the same gains.

RESULTS

Figure 3: Uncontrolled Velocity Response of Cantilever Tip

J.G and Nichols, N. B. (1942). Optimum settings for automatic controllers. Transactions of the
ASME 64. pp. 759768
12Ziegler,

Figure 4: Zoomed View of the Uncontrolled Velocity Response

Figure 3displays the velocity response of the cantilever beam tip when the base is being
vibrated at the first fundamental frequency of 8.1 Hz. Figure 4displays a zoomed view of
the same data. This data was recorded in order to compare the uncontrolled response of
the cantilever to the controlled response with the same disturbance input. The positive and
negative peaks of the velocity data were found in order to quantitatively compare
controlled versus uncontrolled performance. The peaks are marked in the data with orange
and green xs.
The first PID controller was developed through on-the-fly tuning in the lab and is given
here:
= 33 + 0.1

(26)

This first controller was implemented in the feedback loop and the velocity response of the
cantilever beam tip was again recorded for the same disturbance input. The velocity data is
displayed in Figure 3. The positive and negative peaks were again found. The reduction in
amplitude was then calculated by subtracting the average peak height of the controlled
data from the uncontrolled data. It was found that controller 1 reduced the amplitude
response by 43%.

Figure 5: Velocity Response of Cantilever Tip with Controller 1

The first PID controller was then improved through on-the-fly tuning and a second PID
controller was developed. This PID controller is given here:
= 50 +

440

+ 0.1

(27)

The second PID controller was then implemented in the feedback loop and the velocity
response of the cantilever beam tip was again recorded for the same disturbance input. The
velocity data is displayed in Figure 6. The positive and negative peaks were again found
and the amplitude reduction was again calculated. It was found that controller 2 reduced
the amplitude response by 56%.

Figure 6: Velocity Response of Cantilever Tip with Controller 2

Figure 7 displays the velocity amplitude response of the uncontrolled beam recorded from
a sine chirp force input at the beams base. This data was used to verify the first
fundamental frequency of the beam so that the modeled transfer function of the cantilever
beam could be updated (from project 2).
The updated transfer function of the system is given here:

= 2 +3.971+2.4638 10 3

(28)

Figure 8 displays the simulated data of the updated model. The two figures show strong
agreement between the actual and simulated frequency response of the cantilever beam.
This verified the model used and allowed for further simulation with this model to simulate
controller performance.

Figure 7: Experimental Data - Amplitude Spectrum of Uncontrolled Beam

Figure 8: Simulated Data - Amplitude Spectrum of Uncontrolled Beam

Figure 9 displays the simulated strain response of the uncontrolled beam with a sinusoidal
force input at 8.1 Hz. Figure 10 displays the simulated strain response with controller 1
implemented. There is an obvious reduction in amplitude response when controller 1 is
used. The peaks were detected and used to calculate the simulated amplitude reduction
with the controller. It was found that controller 1 reduced the simulated amplitude
response by 59%.

Figure 9: Simulated Uncontrolled Beam Strain

Figure 10: Simulated Beam Strain with Controller 1

Figure 11 displays the simulated strain response with controller 2 implemented. It is clear
that the response is again reduced in this simulation. The peak amplitudes were again used
to calculate the simulated reduction and it was found that controller 2 reduced the
simulated amplitude response by 71%.

Figure 11: Simulated Beam Strain with Controller 2

The simulated amplitudes of the system with controllers are slightly better than the actual
system reductions as expected. For controller 1 the simulated reduction of 59% is better
than the actual reduction of 43%. For controller 1 the simulated reduction of 71% is better
than the actual reduction of 59%. These differences are due to the increased complexity of
the real system in addition to signal noise.

DISCUSSION
The initial experiment gave data that allowed for analysis on two different controllers as
well as a non-controlled system. Figure 3, Figure 5, and Figure 6 represent the responses to
the physical system without a controller and to controller 1 and 2, respectively. Both
controllers were created through tuning during a live experiment. The results of the
experiment and the values for the individual gains for each controller are shown below in
Table 1. On-the-fly tuning allowed us to visually see how each gain affected the system
attributes; noise, amplitude, stability, etc Once experimental data was examined, we
could then theoretically analyze the same controllers and compare the differences.

Table 1: Controller Parameters and Calculated Percent Reduction

Kp
Ki
Kd
% Reduction

Controller 1
33
0
0.1
43%

Controller 2
50
440
0.1
56%

Before the experiment was stopped it was decided to repeat Experiment 2 by introducing a
sine chirp as the forcing function on the system. Because in this experiment, the actuator
was now the impedance head, instead of the piezo patch, we wanted to re-evaluate and
update our system model and transfer function. Figure 5 represents the beam tip response
to a sine chirp from 0-25 Hz. Figure 6 represents the simulated system response to the sine
chirp. Both of these charts represent uncontrolled systems to try and find the natural
frequency. One thing to note is that this analysis was done after the experiment in the lab.
Therefore, while the natural frequency of the first mode was found to be at 7.9 Hz, the
experiment was run with a constant sinusoidal force input at 8.1 Hz. A controller designed
around the natural frequency would be more effective at other frequencies. This 7.9 Hz was
used as the natural frequency for all simulation models as well as development of the
transfer function of the system. The input force remained constant at 8.1 Hz to allow for
proper comparison between physical system and simulated model response.
Shown in Table 2, the two controllers used in the experiment gave reductions of 43% and
56% respectively. By analyzing the system response, given the transfer function in Figure
12, we can compare the expected reduction percent given the same parameters of our PID
controller. Using the MATLAB code in combination with the Simulink model, Figure 12, in
the appendix, the percent reduction of the controllers in a theoretical system was found
and also displayed in Table 2. These controllers cause a much larger reduction in a
theoretical system as expected. This can be due to many factors such as simplified
modelling of the system, addition of signal noise, and some non-rigid movement in the base
of the system.
Table 2: Tabulated peak values from both physical and theoretical systems.

Controller 1
Controller 2

Theoretical/Simulation Physical Experiment


% Reduction
% Reduction
59%
43%
71%
56%

CONCLUSION
For this experiment, an aluminum cantilever beam was subjected to a sustained vibration
at its fixed end (in the form of a sine wave at 8.1 Hz), and a piezoelectric patch was used to
control the vibration of the beam at the free end. A Laser Doppler Vibrometer was used to
collect velocity data at the free end of the beam in order to quantify the vibration. The
piezoelectric patch was controlled using a PID controller, and a strain gauge was used in
the closed loop feedback system. In the previous laboratory experiment, the resonance
frequency was found to be 7.7 Hz, but with this new experimental setup, the excitation
frequency was set at 8.1 Hz. Upon further research, it was found that the actual resonance
frequency with the new setup was closer to 7.9 Hz, but all of the systems were forced with
a frequency of 8.1 Hz. Two PID gain combinations were found that yielded a significant
decrease in vibration amplitude. The first controller had gains of KP=33, KD=0, and KI=0.1,
yielding a vibration amplitude reduction of 43% (compared to the theoretical value of
59%). The second controller had gains of KP=50, KI=440, and KD=0.1, yielding a 56%
reduction (compared to the theoretical value of 71%). The theoretical values were found
from a simulated system modelled after a simplified transfer function of a beam with
natural frequency of 7.9 Hz.

APPENDIX

Figure 12: Simulink system diagram for use in MATLAB-only simulation


%Script to Analyze experimental Data and Run Simulation to verify
%Experimental Data. Includes AD-HOC Analysis and Commented Notes
%%
clear
closeall
A=load('experiment002-cut.csv');
Time=A(:,1);
PZT=A(:,5); % Chirp (piezo-Voltage) %input 1 (x1)
Transducer=A(:,3); % Base force %input 2 (x2)
Accelerometer=A(:,2); % Base accel %output 1 (y1)
LaserVib=A(:,4); % Tip vel %output 2 (y2)
Strain=A(:,6); %Strain
PZT=PZT*200; %true voltage experienced by the PZT
Accel=Accelerometer*(10); %Acceleration in g
Force=Transducer*(1/.02216); %Force in N %Was 0.2216
Veloc=LaserVib*.1; %Velocity in m/sec (*.1)
figure('name','Uncontrolled Velocity vs. Time');
plot(Time,Veloc);
title('Uncontrolled Experimental Data: Velocity vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec)');
[AToppks,AToplocs] = findpeaks(Veloc,Time,'MinPeakHeight',0.014);
[ABotpks,ABotlocs] = findpeaks(Veloc*-1,Time,'MinPeakHeight',0.014);
holdon
plot(AToplocs,AToppks,'x');
plot(ABotlocs,ABotpks*-1,'gx');
holdoff
AtopAvg=mean(AToppks);
AbotAvg=mean(ABotpks);
%{
figure('name','Velocity Response vs. Force Response');

plot(Time,Veloc,Time,Force);
legend('Velocity','Force');
title('Uncontrolled Experimental Data: Velocity & Force vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec) or Force (N)');
figure('name','Velocity Response vs. Acceleration Response');
plot(Time,Veloc,Time,Accel);
legend('Velocity','Acceleration');
title('Uncontrolled Experimental Data: Velocity & Acceleration vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec) or Acceleration (m/sec^2)');
%}
B=load('experiment004-cut.csv');
TimeB=B(:,1);
PZTB=B(:,5); % Chirp (piezo-Voltage) %input 1 (x1)
TransducerB=B(:,3); % Base force %input 2 (x2)
AccelerometerB=B(:,2); % Base accel %output 1 (y1)
LaserVibB=B(:,4); % Tip vel %output 2 (y2)
StrainB=B(:,6); %Strain
PZTB=PZTB*200; %true voltage experienced by the PZT
AccelB=AccelerometerB*(10); %Acceleration in g
ForceB=TransducerB*(1/.02216); %Force in N %Was 0.2216
VelocB=LaserVibB*.1; %Velocity in m/sec (*.1)
figure('name','Controller 2 Experimental Data');
plot(TimeB,VelocB);
title('Controller 2 Experimental Data: Velocity vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec)');
[BToppks,BToplocs] = findpeaks(VelocB,TimeB,'MinPeakHeight',0.005);
[BBotpks,BBotlocs] = findpeaks(VelocB*-1,TimeB,'MinPeakHeight',0.005);
holdon
plot(BToplocs,BToppks,'x');
plot(BBotlocs,BBotpks*-1,'gx');
holdoff
BtopAvg=mean(BToppks);
BbotAvg=mean(BBotpks);
%{
figure('name','Controller 2 Velocity Response vs. Force Response');
plot(TimeB,VelocB,TimeB,ForceB);
legend('Velocity','Force');
title('Controller 2 Experimental Data: Velocity & Force vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec) or Force (N)');
figure('name','Controller 2 Velocity Response vs. Acceleration Response');
plot(TimeB,VelocB,TimeB,AccelB);
legend('Velocity','Acceleration');
title('Controller 2 Experimental Data: Velocity & Acceleration vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec) or Acceleration (m/sec^2)');
%}
C=load('experiment005-cut.csv');
TimeC=C(:,1);

PZTC=C(:,5); % Chirp (piezo-Voltage) %input 1 (x1)


TransducerC=C(:,3); % Base force %input 2 (x2)
AccelerometerC=C(:,2); % Base accel %output 1 (y1)
LaserVibC=C(:,4); % Tip vel %output 2 (y2)
StrainC=C(:,6); %Strain
PZTC=PZTC*200; %true voltage experienced by the PZT
AccelC=AccelerometerC*(10); %Acceleration in g
ForceC=TransducerC*(1/.02216); %Force in N %Was 0.2216
VelocC=LaserVibC*.1; %Velocity in m/sec (*.1)
figure('name','Controller 1 Experimental Data');
plot(TimeC,VelocC);
title('Controller 1 Experimental Data: Velocity vs. Time');
xlabel('time(s)');
ylabel('Velocity (m/sec)');
[CToppks,CToplocs] = findpeaks(VelocC,TimeC,'MinPeakHeight',0.005);
[CBotpks,CBotlocs] = findpeaks(VelocC*-1,TimeC,'MinPeakHeight',0.005);
holdon
plot(CToplocs,CToppks,'x');
plot(CBotlocs,CBotpks*-1,'gx');
holdoff
CtopAvg=mean(CToppks);
CbotAvg=mean(CBotpks);
Cont2TopDiff=1-(BtopAvg/AtopAvg);
Cont2BotDiff=1-(BbotAvg/AbotAvg);
Cont1TopDiff=1-(CtopAvg/AtopAvg);
Cont1BotDiff=1-(CbotAvg/AbotAvg);
%% Model Verification
D=load('experiment006-cut.csv');
TimeD=D(:,1);
PZTD=D(:,5); % Chirp (piezo-Voltage) %input 1 (x1)
TransducerD=D(:,3); % Base force %input 2 (x2)
AccelerometerD=D(:,2); % Base accel %output 1 (y1)
LaserVibD=D(:,4); % Tip vel %output 2 (y2)
StrainD=D(:,6); %Strain
PZTD=PZTD*200; %true voltage experienced by the PZT
AccelD=AccelerometerD*(10); %Acceleration in g
ForceD=TransducerD*(1/.2216); %Force in N
VelocD=LaserVibD*.1; %Velocity in m/sec (*.1)
FsD = 1000; % Sampling frequency
TD = 1/FsD; % Sample time
LD = length(TimeD); % Length of signal
tD = (0:LD-1)*TD; % Time vector
NFFTD = 2^nextpow2(LD); % Next power of 2 from length of y
YD = fft(VelocD,NFFTD)/LD;
fD = FsD/2*linspace(0,1,NFFTD/2+1);
% Plot single-sided amplitude spectrum.
figure('name','Actual Amplitude Spectrum of Uncontrolled Beam');
%plot(f,2*abs(Y(1:NFFT/2+1)))
plot(fD(1:(length(fD)/20)),2*abs(YD(1:(NFFTD/2+1)/20)))
title('Amplitude Spectrum of Uncontrolled Beam')
xlabel('Frequency (Hz)')

ylabel('|Y(f)|')
sim('StrainOutputModel');
SimTime=StrainOut.time;
SimPiezo=PiezoVoltageIn.data;
SimStrain=StrainOut.data;
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L = length(SimTime); % Length of signal
t = (0:L-1)*T; % Time vector
figure('name','Simulated Raw Strain Data');
plot(Fs*t,SimStrain);
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(SimStrain,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
figure('name','Simulated Chirp Amplitude of Beam');
%plot(f,2*abs(Y(1:NFFT/2+1)))
plot(f(1:(length(f)/20)),2*abs(Y(1:(NFFT/2+1)/20)))
title('Simulated Amplitude Spectrum of Uncontrolled Beam')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
%% Simulated Control (see how well it matches actual results)
s = tf('s');
%Pest1 = 1/(s^2+4.0715*s+2.5902*10^3); %8.1 Hz
Pest1 = 1/(s^2+3.9710*s+2.4638*10^3); %7.9 Hz
figure('name','UnControlled System Sine Response');
t = 0:0.001:5;
u = sin(2*pi*8.1*t); %8.1 Hz response
lsim(Pest1,u,t)
o = lsim(Pest1,u,t);
[PToppks,PToplocs] = findpeaks(o,t);
[PBotpks,PBotlocs] = findpeaks(o*-1,t);
holdon
plot(PToplocs,PToppks,'x');
plot(PBotlocs,PBotpks*-1,'gx');
holdoff
PtopAvg=mean(PToppks)
PbotAvg=mean(PBotpks)
%% PID controller
%Controller 1
K1=33;
D1=0.1;
I1=0;
C1 = (D1*s^2+K1*s+I1)/s;
C1 = C1*20;
System1 = feedback(Pest1,C1);

figure('name','Simulated System Sine Response with Controller 1');


%t = 0:0.001:5;
%u = 0.5*sin(2*pi*8.1*t);
lsim(System1,u,t)
So1 = lsim(System1,u,t);
[SToppks1,SToplocs1] = findpeaks(So1,t);
[SBotpks1,SBotlocs1] = findpeaks(So1*-1,t);
holdon
plot(SToplocs1,SToppks1,'x');
plot(SBotlocs1,SBotpks1*-1,'gx');
holdoff
StopAvg1=mean(SToppks1)
SbotAvg1=mean(SBotpks1)
ContTopDiff1=1-(StopAvg1/PtopAvg)
ContBotDiff1=1-(SbotAvg1/PbotAvg)
%Controller 2
K2=50;
D2=0.1;
I2=440;
C2 = (D2*s^2+K2*s+I2)/s;
C2 = C2*20;
System2 = feedback(Pest1,C2);
figure('name','Simulated System Sine Response with Controller 2');
%t = 0:0.001:5;
%u = 0.5*sin(2*pi*8.1*t);
lsim(System2,u,t)
So2 = lsim(System2,u,t);
[SToppks2,SToplocs2] = findpeaks(So2,t);
[SBotpks2,SBotlocs2] = findpeaks(So2*-1,t);
holdon
plot(SToplocs2,SToppks2,'x');
plot(SBotlocs2,SBotpks2*-1,'gx');
holdoff
StopAvg2=mean(SToppks2)
SbotAvg2=mean(SBotpks2)
ContTopDiff2=1-(StopAvg2/PtopAvg)
ContBotDiff2=1-(SbotAvg2/PbotAvg)
Figure 13: MATLAB Code for Analysis and Simulation

Figure 14: Simulink theoretical model for validation of MATLAB simulation

Figure 15: Simulink theoretical simulation data to verify MATLAB code.

S-ar putea să vă placă și