Labreport
Labreport
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
A
LAB REPORT
ON
SIMULATION STUDY USING SIMULINK OF
MATLAB
SUBMITTED BY:
SUBMITTED TO:
Magh 6, 2081
EXPERIMENT-4: SIMULATION STUDY USING SIMULINK OF MATLAB
OBJECTIVE:
• To Familiarisation with MATLAB SIMULATION.
• Study simulation of discrete time control system using Simulink.
Whenever a digital controller is involved, the signal should be in digital form. Since must real
world signals are in analog form, thus signals must be converted into digital form. The process
of converting analog signal to digital form is known as sampling process.
A sampler in a digital system converts an analog signal into a train of amplitude modulated
pulses. The hold circuit holds the value of the sampled pulse signal over a specified period of
time. The sample and hold is required in the A/D converter to produce a number that accurately
represents the input signal at the sampling instants.
Proportional negative feedback systems are based on the difference between the required set
point (SP) and measured value (MV) of the controlled variable. This difference is called error.
Power is applied in direct proportion to the current measured error, in the correct sense to tend
to reduce the error (and so avoid positive feedback). The amount of corrective action that is
applied for a given error is set by the gain or sensitivity of the control system.
At low gains, only a small corrective action is applied when errors are detected: the system may
be safe and stable, but may be sluggish in response to changing conditions; errors will remain
uncorrected for relatively long periods of time: it is over-damped. If the proportional gain is
increased, such systems become more responsive, and errors are dealt with more quickly. There
is an optimal value for the gain setting when the overall system is said to be critically damped.
Increases in loop gain beyond this point will lead to oscillations in the MV; such a system is
under-damped
To resolve these two problems, many feedback control schemes include mathematical
extensions to improve performance. The most common extensions lead to proportional-
integral-derivative control, or PID control.
Derivative action
The derivative part is concerned with the rate-of-change of the error with time: If the measured
variable approaches the setpoint rapidly, then the actuator is backed off early to allow it to coast
to the required level; conversely if the measured value begins to move rapidly away from the
setpoint, extra effort is applied—in proportion to that rapidity—to try to maintain it.
Integral action
The integral term magnifies the effect of long-term steady-state errors, applying ever-increasing
effort until they reduce to zero. In the example of the furnace above working at various
temperatures, if the heat being applied does not bring the furnace up to setpoint, for whatever
reason, integral action increasingly moves the proportional band relative to the setpoint until
the time-integral of the MV error is reduced to zero and the setpoint is achieved.
Controller used in discrete time control system is usually a digital controller. If the controller is
KI
PID controller, then transfer function is given by G D ( z ) = K p + −1
+ K D (1 − z −1 ) .
(1 − z )
A digital controller takes data in digital form and processes it and gives output data in digital
form. A hold circuit is used to convert the digital form of the data to analog form. A zero order
hold circuit smoothest the input signal to produce the output signal which is constant from the
last sampled value until the next sample is available. Transfer function of ZOH is given by
1 − e −Ts
G h 0 ( s) = .
s
D. SIMULINK
SIMULINK is a tool for modeling, analyzing, and simulating an extraordinarily wide variety
of physical and mathematical systems, including those with nonlinear elements and those,
which make use of continuous and discrete time.
As an extension of MATLAB, SIMULINK adds many features specific to dynamic systems
while retaining all of MATLAB's general-purpose functionality. Using SIMULINK, we model
a system graphically, side stepping much of the nuisance associated with conventional
programming.
Kp
1
Pulse
Generator s+1
Product2 z Zero-Order Plant
Ki Hold Scope
z-1
Integrql1
Inputp
z-1
Kd
z
Derivative1
Kp
1
s+1
Product1 Plant1
First-Order
z Hold
Ki
z-1
Integral2
z-1
Kd z
Derivative2
Kp
1
s+1
Plant2
1
Ki
s
Integral4
Kd du/dt
Derivative
Analysis of simulation to find differences among continued simulation, simulation using first
order hold and using 2nd order hold
Kp=1, Ki =0 , Kd =0 , Ts =0.001
Comment: The smooth line represents the ideal continuous system output. The First-Order Hold
(FOH) exhibits a smoother output due to its linear interpolation between sample points, leading
to a better approximation of the input signal. In contrast, the Zero-Order Hold (ZOH) holds the
input constant between samples, resulting in a "staircase" waveform with abrupt changes. This
"staircase" effect introduces more distortion and generally lower accuracy.
Kp=2, Ki =0 , Kd =0, Ts =1
Comment: Increase the Kp, system response increases as well as overshoot also increases.
Kp=0, Ki =1 , Kd =0 , Ts =1
Kp=1, Ki =0 , Kd =0, Ts =1
Kp=1, Ki =0 , Kd =0, Ts =0.1
Comment: These three figures shows that increment in sampling time result in high accuracy
with good response. However, it will increase the computational load in system.
1
Plant transfer function= 𝑠2 +𝑠+1
0.478
Transfer function of motor =
0.12s + 1
Transfer function of tachometer =0.15 V/Rad/sec
Sampling time in input = 0.1
I/P Transfer
Gain Gain O/P
Function
Block Block Block
controller Tacho-Generator
Motor
DISCUSSION:
Discrepancy observed in simulation using continuous time model and discrete model
Discrepancies between continuous-time and discrete-time models arise from differences in time
handling. Continuous models capture system changes instantaneously, leading to high accuracy
and stability. Discrete models, however, sample at specific intervals, which might miss rapid
changes and introduce approximation errors if the sampling time is too large. This results in
less accurate representations and potential stability issues, like oscillations. Resolving these
discrepancies involves balancing computational efficiency with the need for precise and stable
system behavior. By carefully choosing the sampling time, the trade-offs between these two
modeling approaches can be managed effectively.
The impact of sampling time in discrete simulation hinges on its ability to accurately capture
system dynamics. Smaller sampling times, while increasing computational cost, enhance
accuracy by minimizing discretization errors. Conversely, larger sampling times reduce
computational burden but can introduce significant errors, especially for systems with rapid
changes. The optimal sampling time is determined by a balance between these factors,
considering the system's behavior, simulation goals, and the chosen algorithms.
Variation on the response was observed when parameters of controller were varied
We observe the simulation in Simulink by changing the value of proportional gain (Kp), integral
gain (Ki), derivative gain (Kd) and sampling time as shown in SIMULINK TASKS AND
RESULTS section. We observed the following changes in system’s behaviour while varying
those parameters:
a) Change in proportional gain (Kp): When we increase the Kp the system’s response speed
was increased. Thus, it results in decreasing in rise time. However, it also increased
overshoot, making the system slightly less stable. Conversely, decreasing Kp showed a
slow response and reduced overshoot but might increase steady-state error.
b) Change in integral gain (Ki): When we increase the Ki , we were able to get rid of offset.
However, it had caused the system to become more oscillatory. Lowering Ki had
reduced overshoot and oscillations.
c) Change in derivative gain (Kd): When we increase the Kd , we observed the slow system
response with damped oscillation, i.e. reduce in overshoot. Reducing the Kd decreased
the damping effect, potentially increased overshoot and oscillations.
d) Change in sampling time: We observed that the change in sampling time of system
affected its performance and stability. When we chose a very small sampling time, it
improved the speed and control accuracy, but it increased the computational load in
system. Conversely, when we chose the large sampling time, it reduced the
computational burden of system, but it increased the risk of instability and slower
response time. Hence, we must choose optimal sampling time to balance the system
performance and stability.
CONCLUSION:
In the fourth lab of Digital Control System, based on focused objectives to study the simulation
in MATLAB and the discrete control system using Simulink, the additional lab exercises and
activities made us more confident towards the fulfilment of objectives. This practical
experience will be beneficial for future projects and studies involving simulation and control
systems.