All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
To design a closed loop control scheme for a DC motor the following changes need to be done in the model in the previously created model. Speed is the controllable parameter, so we will set the reference speed in step block as 10,20, 40 whichever you want. Subtract the actual speed from the reference speed to generate…
Yogessvaran T
updated on 21 Jan 2023
To design a closed loop control scheme for a DC motor the following changes need to be done in the model in the previously
created model.
Speed is the controllable parameter, so we will set the reference speed in step block as 10,20, 40 whichever you want.
Subtract the actual speed from the reference speed to generate the error signal e(t)
Add Kp as K(1) and Kd as K(2) parameter determined from place command (K=place(A,B,P)). (use gain block to mention
values of Kp, Kd, and Ki)
The feedback for Kd is provided from the output current of the plant/model (figure 1). OR we can take feedback (error speed
signal as input to Kd shown by figure 2)
Add Ki manually with gain and integrator block and tune different values of Ki and check the impact of it on results.
To check the location of poles on the s-plane from MATLAB the following command (‘pzmap ’-pole zero placement or
mapping) can be used in continuation to the above script. You can see two crosses in red indicate complex poles lying on the
left hand of the plane which indicate it is a stable system.
As we know that given value of transfer function spring mass damper system as shown
in fig
Block Used:
Pulse Generator Block
sum Block
Derivative Block
integrator block
Gain Block
Transfer Function Block
Scope
Pulse Generator:
Generate square wave pulses at regular intervals
Library:
Sources
Description:
The Pulse Generator block generates square wave pulses at regular intervals. The block's waveform
parameters, Amplitude, Pulse Width, Period, and Phase Delay, determine the shape of the output waveform. The following
diagram shows how each parameter affects the waveform.
The Pulse Generator can emit scalar, vector, or matrix signals of any real data type. To cause the block to emit a scalar signal,
use scalars to specify the waveform parameters. To cause the block to emit a vector or matrix signal, use vectors or
matrices, respectively, to specify the waveform parameters. Each element of the waveform parameters affects the
corresponding element of the output signal. For example, the first element of a vector amplitude parameter determines the
amplitude of the first element of a vector output pulse. All the waveform parameters must have the same dimensions after
scalar expansion. The data type of the output is the same as the data type of the Amplitude parameter
The block's Pulse type parameter allows you to specify whether the block's output is time-based or sample-based. If you
select sample-based, the block computes its outputs at fixed intervals that you specify. If you select time-based, Simulink
computes the block's outputs only at times when the output actually changes. This can result in fewer computations being
required to compute the block's output over the simulation time period.
Depending on the pulse's waveform characteristics, the intervals between changes in the block's output can vary. For this
reason, Simulink cannot use a fixed solver to compute the output of a time-based pulse generator. Simulink allows you to
specify a fixed-step solver for models that contain time-based pulse generators. However, in this case, Simulink computes a
fixed sample time for the time-based pulse generators. It then simulates the time-based pulse generators as sample-basedIf
you select time-based as the block's pulse type, you must specify the pulse's phase delay and period in units of seconds.
If you specify sample-based, you must specify the block's sample time in seconds, using the Sample Time parameter, then
specify the block's phase delay and period as integer multiples of the sample time. For example, suppose that you specify a
sample time of 0.5 second. And suppose you want the pulse to repeat every two seconds. In this case, you would specify 4
as the value of the block's Period parameter
Data Type Support:
A Pulse Generator block outputs real signals of any data type except int64
and uint64
. The data type of the output signal is
the same as that of the Amplitude parameter.
Parameters and Dialog Box:
Pulse type:The pulse type for this block: time-based or sample-based. The default is time-based.
Characteristics:
Sample Time | Inherited |
Scalar Expansion | Of parameters |
Dimensionalized | Yes |
Zero Crossing | No |
Sum:
Add or subtract inputs
Library:
Simulink Math Operations and Fixed-Point Blockset Math
Discription:
The Sum block performs addition or subtraction on its inputs. This block can add or subtract scalar, vector, or matrix inputs.
It can also collapse the elements of a single input vector.
You specify the operations of the block with the List of Signs parameter. Plus (+
), minus (-
), and spacer (|
) characters
indicate the operations to be performed on the inputs:
If there are two or more inputs, then the number of characters must equal the number of inputs. For example, "+-+
" requires
three inputs and configures the block to subtract the second (middle) input from the first (top) input, and then add the third
(bottom) input.
All nonscalar inputs must have the same dimensions. Scalar inputs will be expanded to have the same dimensions as the
other inputs.
A spacer character creates extra space between ports on the block's icon.
If only addition of all inputs is required, then a numeric parameter value equal to the number of inputs can be supplied
instead of "+
" characters.
if only one vector is input, then a single "+
" or "-
" will collapse the vector using the specified operation.
When the Show additional parameters check box is selected, some of the parameters that become visible are common to
many blocks. For a detailed description of these parameters, refer to Block Parameters in the Fixed-Point Blockset
documentation.
Data Type Support:
The Sum block accepts signals of any complexity and data type, including fixed-point data types, except int64
and uint64
.
The inputs may be of different data types unless the Require all inputs to have same data type parameter is selected.
Parametar And Dialog Box:
If selected, additional parameters specific to implementation of the block become visible as shown.
Icon shape:Designate the icon shape of the block.
List of signs:Enter as many plus (+
) and minus (-
) characters as there are inputs. Addition is the default operation, so if you
only want to add the inputs, enter the number of input ports. For a single vector input, "+
" or "-
" will collapse the vector
using the specified operation.You can manipulate the positions of the input ports on the block icon by inserting spacers (|
)
between the signs in the List of signs parameter. For example, "++|--
" creates an extra space between the second and third
input ports.
Require all inputs to have same data type:Select this parameter to require that all inputs must have the same data type.
Output data type mode:Specify the output data type and scaling to be the same as the first input, or inherit the data type
and scaling from an internal rule or by backpropagation. You can also choose a built-in data type from the drop-down list.
Lastly, if you choose, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling
tool parameters become visible.
Output data type:Specify any data type, including fixed-point data types. This parameter is only visible if is selected for
the Output data type mode parameter.
Output scaling value:Set the output scaling using radix point-only or [Slope Bias] scaling. This parameter is only visible if is
selected for the Output data type mode parameter.
Lock output scaling against changes by the autoscaling tool:If selected,Scalling of out-put is locked.This parameter is only
visible if is selected for the Output data type mode parameter.
Round integer calculations toward:Select the rounding mode for fixed-point output.
Saturate on integer overflow:If selected, overflows saturate.
Conversion and Operations:The Sum block first converts the input data type(s) to the output data type using the specified
rounding and overflow modes, and then performs the specified operations. Refer to Rules of Artimetic operation in the Fixed
Point Blockset documentation for more information about the rules that this block obeys when performing fixed-point
operations.
Characteristics:
Dimensionalized | Yes |
Direct Feedthrough | Yes |
Sample Time | Inherited from driving blocks |
Scalar Expansion | Yes |
States | 0 |
Zero Crossing | No |
Derivative:
Output the time derivative of the input
Library:
Continuous
Description:
The Derivative block approximates the derivative of its input by computin
where u is the change in input value and t is the change in time since the previous simulation time step. The block accepts
one input and generates one output. The value of the input signal before the start of the simulation is assumed to be zero.
The initial output for the block is zero.
The accuracy of the results depends on the size of the time steps taken in the simulation. Smaller steps allow a smoother and
more accurate output curve from this block. Unlike blocks that have continuous states, the solver does not take smaller steps
when the input changes rapidly.
When the input is a discrete signal, the continuous derivative of the input is an impulse when the value of the input changes,
otherwise it is 0. You can obtain the discrete derivative of a discrete signal using and taking z-tranfarm.
Using linmod to linearize a model that contains a Derivative block can be troublesome. For information about how to avoid
the problem, see Linearizing Models in Using Simulink
Data Type Support:
A Derivative block accepts and outputs a real signal of type double
.
Dialog Box:
Characteristics:
Direct Feedthrough | Yes |
Sample Time | Continuous |
Scalar Expansion | N/A |
States | 0 |
Dimensionalized | Yes |
Zero Crossing | No |
Integrator:
Integrate a signal
Library:
Continuous
Description:
Integration deals with two essentially different types of problems.
In the first type, derivative of a function is given and we want to find the function. Therefore, we basically reverse the
process of differentiation. This reverse process is known as anti-differentiation, or finding the primitive function, or finding
an indefinite integral.
The second type of problems involve adding up a very large number of very small quantities and then taking a limit as the
size of the quantities approaches zero, while the number of terms tend to infinity. This process leads to the definition of
the definite integral.
Definite integrals are used for finding area, volume, center of gravity, moment of inertia, work done by a force, and in
numerous other applications.
By definition, if the derivative of a function f(x) is f'(x), then we say that an indefinite integral of f'(x) with respect to x is
f(x). For example, since the derivative (with respect to x) of x2 is 2x, we can say that an indefinite integral of 2x is x2.
In symbols −
f'(x2) = 2x, therefore,
∫ 2xdx = x2.
Indefinite integral is not unique, because derivative of x2 + c, for any value of a constant c, will also be 2x.
This is expressed in symbols as −
∫ 2xdx = x2 + c.
Where, c is called an 'arbitrary constant'.
MATLAB provides an int command for calculating integral of an expression. To derive an expression for the indefinite integral
of a function, we write −
int(f);
Characteristics:
Direct Feedthrough | Yes, of the reset and external initial condition source ports |
Sample Time | Continuous |
Scalar Expansion | Of parameters |
States | Inherited from driving block or parameter |
Dimensionalized | Yes |
Zero Crossing | If the Limit output option is selected, one for detecting reset, one each to detect upper and lower saturation limits, one when leaving saturation |
Gain:
Multiply the input by a constant
Library:
Simulink Math Operations and Fixed-Point Blockset Math
Description:
The Gain block multiplies the input by a constant value (gain). The input and the gain can each be a scalar, vector, or matrix
You specify the value of the gain in the Gain parameter. The Multiplication parameter lets you specify element-wise or matrix
multiplication. For matrix multiplication, this parameter also lets you indicate the order of the multiplicands.
When the Show additional parameters check box is selected, some of the parameters that become visible are common to
many blocks. For a detailed description of these parameters, refer to Block Prameters in the Fixed-Point Blockset
documentation.
The Matrix gain block is an implementation of the Gain block with different default settings.
Data Type Support:
The input and gain of the Gain block can be a real or complex scalar, vector, or matrix of any data type except boolean,
int64,
and uint64. If the input is real and the gain is complex, the output is complex.
Parametar And Dialog Box:
Parameter data type mode:
Set the data type and scaling of the gain to be the same as that of the input, or to be inherited via an internal rule.
Alternatively, choose to specify the data type and scaling of the gain through the Parameter data type, Parameter scaling
mode, and Parameter scaling parameters in the dialog.
Parameter data type:
Set the gain data type. This parameter is only visible if is selected for the Parameter data type mode parameter.
Parameter scaling mode:
Set the mode to determine the scaling of the gain.
Use specified scaling --This mode allows you to set the scaling of the gain in the Parameter scaling parameter.
Best Precision: Element-wise--This mode sets radix points for the elements of the gain such that the precision of each elemnt is maximized.
Best Precision: Row-wise--This mode sets a common radix point within each row of the gain such that the largest element of
ach row has the best possible precision.
Best Precision: Column-wise--This mode sets a common radix point within each column of the gain such that the largest
element of each column has the best possible precision.
Best Precision: Matrix-wise--This mode sets a common radix point for all the elements of the gain such that the largest
element has the best possible precision.This parameter is only visible if is selected for the Parameter data type
mode parameter.
Parameter scaling:Set the gain scaling using either radix point-only or [Slope Bias] scaling. This parameter is only visible if is
selected for the Parameter data type mode parameter, and if Use specified scaling is selected for the Parameter scaling
mode parameter.
Output data type mode:Set the data type and scaling of the output to be the same as that of the input, or to be inherited via
an internal rule or by backpropagation. Alternatively, choose to specify the data type and scaling of the output through
the Output data type and Output scaling value parameters in the dialog.
If you select internal rule for this parameter, Simulink chooses a combination of output scaling and data type that requires
the smallest amount of memory consistent with accommodating the output range and maintaining the output precision of the
block. If the Production hardware characteristics parameter on the Advanced pane of the Simulation Parameters dialog is set
to Unconstrained integer sizes, Simulink chooses the output data type without regard to hardware constraints. If the
parameter is set to Microprocessor, Simulink chooses the smallest available hardware data type capable of meeting the range
and precision constraints. For example, if the block multiplies an input of type int8 by a gain of int16
and Unconstrained
integer sizes
is specified, the output data type is sfix24. If Microprocessor
is specified and the microprocessor supports 8-bit,
16-bit, and 32-bit words, the output data type is int32. If none of the word lengths provided by the target microprocessorcan
accommodate the output range, Simulink displays an error message in the Simulink Diagnostic Viewer
Output data type:Set the output data type. This parameter is only visible if is selected for the Output data type
mode parameter.
Output scaling value:Set the output scaling using either radix point-only or [Slope Bias] scaling. This parameter is only visible
if is selected for the Output data type mode parameter.
Lock output scaling against changes by the autoscaling tool:If selected,scaling output is locked. This parameter is only visible
if
is selected for the Output data type mode parameter.
Round integer calculations toward:Select the rounding mode for integer output.
Conversion And Operation:
The gain is converted from doubles to the specified data type offline using round-to-nearest and saturation. Refer to
Parameter of conversion in the Fixed-Point Blockset documentation for more information about parameter conversions. The
input and gain are then multiplied, and the result is converted to the output data type using the specified rounding and
overflow modes. Refer to Rules of artimatic Operation in the Fixed-Point Blockset documentation for more information about
the rules that this block obeys when performing fixed-point operations.
Characteristics:
Dimensionalized | Yes |
Direct Feedthrough | Yes |
Sample Time | Inherited from driving block |
Scalar Expansion | Of input and Gain parameter for Element wise multiplication |
Zero Crossing | No |
Transfer Function:
Implement a linear transfer function
Library:
Continuous
Description:
The Transfer Fcn block implements a transfer function where the input (u) and output (y) can be expressed in transfer
function form as the following equation
where nn and nd are the number of numerator and denominator coefficients, respectively. num and den contain the
coefficients of the numerator and denominator in descending powers of s. num can be a vector or matrix, den must be a
vector, and both are specified as parameters on the block dialog box. The order of the denominator must be greater than or
equal to the order of the numerator
A Transfer Fcn block takes a scalar input. If the numerator of the block's transfer function is a vector, the block's output is
also scalar. However, if the numerator is a matrix, the transfer function expands the input into an output vector equal in width
to the number of rows in the numerator. For example, a two-row numerator results in a block with scalar input and vector
output. The width of the output vector is two.
Initial conditions are preset to zero. If you need to specify initial conditions, convert to state-space form using tf2ss
and use
the State-Space block. The tf2ss utility provides the A, B, C, and D matrices for the system. For more information, type help
tf2ss or consult the Control System Toolbox documentation.
Transfer Fcn Block Icon:
The numerator and denominator are displayed on the Transfer Fcn block icon depending on how they are specified:
If each is specified as an expression, a vector, or a variable enclosed in parentheses, the icon shows the transfer function with
the specified coefficients and powers of s. If you specify a variable in parentheses, the variable is evaluated. For example, if
you specify Numerator as and Denominator as (den) where den
is, the block icon looks like this:
If each is specified as a variable, the icon shows the variable name followed by (s). For example, if you specify Numerator as
num and Denominator as den, the block icon looks like this:
Specifying the Absolute Tolerance for the Block's States:
By default Simulink uses the absolute tolerance value specified in the Simulation Parameters dialog box (see Error
Tolerances) to solve the states of the Transfer Fcn block. If this value does not provide sufficient error control, specify a more
appropriate value in the Absolute tolerance field of the Transfer Fcn block's dialog box. The value that you specify is used to
solve all the block's states.
Data Type Support:
A Transfer Fcn block accepts and outputs signals of type double.
Parameters and Dialog Box:
Denominator:The row vector of denominator coefficients. The default is [1 1].
Absolute tolerance:Absolute tolerance used to solve the block's states. You can enter auto
or a numeric value. If you
enter auto
, Simulink determines the absolute tolerance (see "Error Tolerances). If you enter a numeric value, Simulink uses
the specified value to solve the block's states. Note that a numeric value overrides the setting for the absolute tolerance in
the Simulation Parameters dialog box.
Characteristics:
Direct Feedthrough | Only if the lengths of the Numerator and Denominator parameters are equal |
Sample Time | Continuous |
Scalar Expansion | No |
States | Length of Denominator -1 |
Dimensionalized | Yes, in the sense that the block expands scalar input into vector output when the transfer function numerator is a matrix. See the preceding block description. |
Zero Crossing | No |
Scope: To visualize your simulation results over time, use a Scop block or Time Scope (DSP System Toolbox) block
To connect multiple signals to a scope, drag additional signals to the scope block. An additional port is created automatically.
To specify the number of input ports:
Open a scope window.
From the toolbar, select File > Number of Input Ports > More.
Enter the number of input ports, up to 96.
Program.m File:
m = 3.6;
k= 400;
c = 100;
%% Design of PID Controller
A =[0 1; -k/m -c/m];
b=[0 ; 0.01];
%% Placement of Pole
fn=1;
wn=sqrt(k/m);
zeta=c/(2*sqrt(m*k));
p1=-zeta*wn+wn*sqrt(zeta^2-1);
p2=-zeta*wn-wn*sqrt(zeta^2-1);
p=[p1;p2];
K=place(A,b,p);
kp=K(1);
kd=K(2);
Command Window:
Out-Put Graph: Here the (ki) value consider = 800 than out-put get stable response shown in fig.
CONCLUSION :
To complte the project of Position control of mass spring damper system transfer function of a mass spring damper system
and use it in the model. Add a PID controller to adjust the force on mass so that its position follows a reference signal to
using matlab and simulink wave from plot.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 14 challenge
ASSEMBLY OF BUTTERFLY VALVE:- 1.All the parts that are saved in the required folder is opened in the Add components tool box. 2.Now using the Move option and Assembly Constraints option the different parts are joined together with the help of Align,touch,infer/Axis operations. 3. Finally,the assembly of butterfly valve…
18 Feb 2023 09:34 AM IST
Project - Position control of mass spring damper system
To design a closed loop control scheme for a DC motor the following changes need to be done in the model in the previously created model. Speed is the controllable parameter, so we will set the reference speed in step block as 10,20, 40 whichever you want. Subtract the actual speed from the reference speed to generate…
21 Jan 2023 10:29 AM IST
Project - Analysis of a practical automotive wiring circuit
Identify each of the major elements in the above automotive wiring diagram. Ans: Major Elements in the above automotive wiring diagram are - Genarator, Battery, …
14 Dec 2022 03:37 AM IST
Week 6 - Data analysis
-
04 Dec 2022 11:06 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.