Rltool for Scilab:
A GUI based tool for SISO system design
Ishan Pendharkar
Department of Electrical Engineering,
Indian Institute of Technology Bombay
Mumbai -- 400076, INDIA.
E-mail: ishan@ee.iitb.ac.in, ishan@iitbombay.org
Welcome to help pages of RLTOOL, version 1.4
It is recommended that you use Netscape/Mozilla to view these man
pages. The default help viewers that come with Scilab aren't very good
at displaying images and links.
1 Overview of Rltool for Scilab
1.1 Description
RLTOOL is a completly graphics based tool for designing compensators
for SISO continuous plants. An attempt has
been made to provide most of the features available in a utility of
similar name which is available with a well known commercial
software.
1.2 Targetted users
The intention behind developing this package is to provide a free and
easy to use tool for students taking a first course in control
engineering. Learning is more fun if computer based teaching is used to
supplement classroom lectures. It is intended to make RLTOOL as simple
and user friendly as possible and yet have some powerful and
innovative features.
1.3 Features
-
Handle Single input Single output continuous time transfer functions.
- Choose between Time Domain and Frequency Domain Design.
- Utility for easy editing of poles and zeros at the click of a mouse.
- Interface for viewing various plots.
- Various settings for plots are accessible to the user.
- Save and Load your plants as required.
1.4 How to start RLTOOL
Once installed (see the README file accompanying this package), RLTOOL
can be invoked by typing 'rlt()' on the Scilab command prompt.
2 Detailed Help on usage
2.1 Starting RLTOOL
load the rltool library as per instructions in the README file. If the
library loads properly the following message is displayed on Scilab prompt:
mode(-1);
rltool is loaded;
enter "rlt()" to start
Type ``rlt()'' to start this programme.
2.2 Using RLTOOL
It is intended to make RLTOOL very user friendly and as such most
features should be obvious.
On typing ``rlt()'', the you will be prompted to either select a new
rltool session or load a previous saved file. If a new session is
selected, the you will be prompted to enter the transfer
function as numerator / denominator in the variable 's'. Rltool will
automatically load the plant you were working with in the previous
session of rltool. Click ``Ok'' to confirm this plant. You may wish to
edit the plant, in that case type the new plant and click ``Ok''.
A Rootlocus plot of the transfer function is displayed. Open loop
poles are shown by crosses and zeros by circles. Click on any point of
the rootlocus plot to know the gain and closed loop poles
corresponding to that point. All poles are highlighted by a mark and
the corresponding gain is displayed on the top of the graphics window.
If you want a grid on the rootlocus, select ``Grid--> On''. Likewise,
to turn it off, select ``Grid--> Off''. If you want to draw constant
damping ratio z and natural frequency wn lines,
click on ``Grid--> Zeta/Wn''. You will be prompted to enter one
z and one wn of your choice. If you want to do this for
various values of z and wn try ``Grid--> sgrid''.
The rootlocus is plotted with a finite (maximum) gain. This is, by
default set to 1000. You can change this by clicking on ``Settings->
Rootlocus''. You might want to increase/decrease the maximum possible
gain if your rootlocus shows hanging/incomplete lines or is too
cluttered. Keeping this gain more than 1× e10 may result in
errors.
2.2.2 Frequency design
Rltool comes with two design modes... time domain (rootlocus) and
frequency domain. You can select the frequency domain mode by clicking
on ``Design-->Frequency''. You will see the frequency magnitude plot
of the open loop transfer function. The magnitude is shown in decibel
and frequency in rad/sec. Click on the plot to determine the magnitude
and frequency. The frequency domain part is still under
development. It will be a great idea to take up this aspect and design
it further! You can ofcourse return to the rootlocus mode by clicking
on ``Design ® Root Locus''.
3 Editing of Plants
In the Root Locus mode, you can edit your plant at the click of a
mouse. The following options are provided. The function of most of
these should be obvious:
-
Undo: Undo one change in the (open loop) plant.
- Add pole: Select the pole to be added by clicking on the
graphics window. If you select a point with nonzero real part, both
the point and its complex conjugate are added. That is, if G(s) is
the current open loop transfer function and you select a complex point
z, the new open loop plant will be
where z* denotes the complex conjugate of z.
- Remove pole: Click on the open loop pole that you want to
remove. If you click on a pole with nonzero real part, both the pole
and its complex conjugate are removed.
- Add zero: Similar to Add pole. Zero(s) are added to open loop
transfer function.
- Remove zero: Similar to Remove pole. Zero(s) are removed from
the open loop transfer function.
- Add cascade: You will be prompted to enter a transfer function
H(s)=a(s)/b(s). If G(s) is the current transfer function, it is
modified to
G(s)× H(s)
You will be prompted to ``accept'' this product. You can edit it if
you wish (to truncate some spurious decimal places etc). This command
is like a simultaneous addition of pole(s) and zero(s). However, in
this case you are required to enter these through the keyboard,
instead of using the mouse for the selection.
- Remove cascade: is like dividing G(s) by H(s), i.e. the open
loop plant is modified to
- Edit plant: The current plant is displayed in a dialogue
box. You can modify it directly by typing in the appropriate value.
4 Closed loop responses
Closed loop responses are available only in ``rootlocus'' mode.
There is a great deal of flexibility in rltool to see various closed
loop responses. First you will have to select one ``gain configuration'' out of
the possible two. Click on ``Settings-->Gain Configuration''. You will
see a selection dialogue box with two choices:
You can choose the gain to be in the forward path like the following
figure shows:
This corresponds to the option ``K in forward path''. You can choose
to put ``K in the feedback path''. However, ``K in forward path'' is
the default.
To see closed loop responses, click on ``Response-->Closed Loop''. You
will be prompted to click on a point of the rootlocus to select the
``operating point'' at which you want to see the closed loop
response. Once you select the operating point, you are done!
Rltool calculates the closed loop transfer function for the
configuration you have selected, i.e. the closed loop transfer
function for ``K in forward path'' is
and the closed loop transfer function for ``K in feedback path'' is
You will see a selection menu that shows the following:
-
The gain corresponding to operating point you selected.
- Whether the closed loop system is stable or unstable.
- Impulse response: Click here to see the impulse response!
- Step response selection: Unit step response is displayed. A
``details'' button in the step response also displays parameters such
as percent overshoot, rise time, settling time, z corresponding
to second order approximation etc.
- Ramp response: Unit ramp response.
- Arbitrary input: You can enter piece-wise linear, single valued
inputs through a graphics window. Use the mouse (press left button and
drag) to ``draw'' this input. There are a host of features like
``undo'', ``abort'' etc which can be used. You can also resize your
window to suit the range of your input. Click ``Edit-->Ok'' when you are
done. If your input is single-valued, you will see the response of the
closed loop system to this input.
- Sinusoidal input: The input is of the form
A sin (w t)
Output is simulated, by default for ONE CYCLE of the input and is
plotted. Other default settings are A=1 and w=1
rad/sec. These can be changed by clicking on ``Settings'' button in
the sinusoidal response window. You must close this window to return
to the response selection menu.
- Frequency response (bode plot) of closed loop system. There is a
choice in the units (Rad/sec) or (Hz). These are available in
``Options'' menu in the frequency response window.
- Sensitivity plot: Sensitivity is defined as the transfer function between the input u(t) and the error e(t). For the system shown in the above figure, the sensitivity can be found to be
This transfer function is evaluated on the imaginary axis (by substituting s=iw) and the resulting (magnitude) plot is shown for various values of w. Options are similar to above.
Click on ``cancel'' to close the response selection menu and return to
the main window of rltool.
5 Other responses
5.1 Nyquist plot
Nyquist plot of the open loop plant G(s) can be seen by clicking on
``Response-->Nyquist''. The gain and phase margin is displayed on the
plot. If you find that your plot is too coarse or cluttered, you can
change the minimum and maximum frequency in
``Settings-->Nyquist-Nichols plot''. The units for frequency can be
changed in the ``Options'' menu of the Nyquist plot window. You must
close this window to return to the main rltool window.
5.2 Nichols plot
Nichols plot for G(s) is obtained by selecting
``Response-->Nichols''. If the grid (in the main menu) is set to
``on'' you will see the logarithmic grid superimposed on the Nichols
plot. Here too, you can select the desired frequency units. You must
close this window to return to the main rltool window.
5.3 Popov plot
The Popov plot can be used to predict the stability of the closed loop
system with a sector bound nonlinearity in loop. We plot real part of
G(iw) on the real axis and w Imaginary
G(iw) on the imaginary axis. A simple construction then gives
the range of the ``Popov sector'' and the ``multiplier''. Please see
any standard text on nonlinear systems for more details on the Popov
plot.
6 Saving and loading plants
To save your current plant, click on ``Save-->Save''. You will be
prompted to enter the filename to which the plant should be written.
To load an existing plant from a file, click on "Save->Load". You will be
prompted to enter the filename.
You must have the appropriate read/write permissions to do this
operation.
7 Settings
We now look at the various settings that a user can access:
-
Rootlocus: Set the maximum allowed gain, Kmax in rootlocus. The
rootlocus is plotted for the gain range (0,Kmax).
- Magnitude plot: Set the minimum frequency, maximum frequency and
the frequency step for the (open loop frequency) Magnitude plot. The unit for
the frequency is rad/sec.
- Nyquist-Nichols plot: Frequency settings similar to above, for
Nyquist plot and Nichols plot.
- Bode plot: Frequency settings for the (closed loop) Bode plot.
- Dynamic response: Set the maximum simulation time and the
timestep for all dynamic responses (impulse, step, ramp, arbitrary
input, sinusoidal input).
- Sensitivity plot: Frequency settings for the sensitivity plot.
- Graphics attributes: Graphics attributes like font, colour etc
can be set from here.
- Gain configuration: Two options are possible for using rltool
(a) Gain, K, is in the forward path.
(b) Gain is in the feedback path.
The default is (a).
8 Help
A short online help is provided on some topics.
9 Some FAQs
Q. What sort of plants does RLTOOL handle?
A. RLTOOL, ver 1.2 handles real valued SISO continuous time plants (proper scalar transfer functions).
Q. How do I enter transfer functions for RLTOOL?
A. The default value is 1/s. You can change this by editing the
numerator and denominator. You should enter these as polynomials in
s. For example, 3s2+2s+5 should be entered as 3*s2+2*s+5.
Q. My rootlocus plot shows "hanging" incomplete lines, what should I
do?
A. You need to increase the maximum allowable gain. To do this, write
the appropriate value in Settings --> Rootlocus.
Q. I can't make out details on my rootlocus plot, what should I do?
A. Use the zoom utility for a bigger picture. Alternately, reduce the maximum allowed gain and you would get a more detailed plot.
Q. Though I don't click on a open loop pole/zero, the mouse handler reads the click as a open loop pole/zero, what should I do?
A. This happens because of tolerances set in RLTOOL. You can change the tolerances in Limits() macro. Alternately, ZOOM the
region before selecting the point.
Q. Why is open loop frequency response (gain AND phase) not provided
in the Design Frequency menu?
A. There is a bug in Scilab graphics that doesn't recognize mouse coordinates in subplots. If you can figure out a way to read the
mouse coordinates in magnitude as well as phase plots, please let me know..
Q. Why is my Nyquist plot drawn only for positive frequencies? Why is it coarse?
A. This is the default. You can put the lower limit of frequency as -1000 Hz for instance and you would get a symmetric Nyquist plot.
If it is too coarse, reduce the step size. This can be found in
Settings --> Nyquist plot.
Q. I can't UNDO changes to my plant, what should I do?
A. RLTOOL requires to save your configuration details in a file called .rltoolcfg.sci. This is located in your present working directory.
If you don't have write permissions in your present working directory,
a warning message is displayed and you can't use the UNDO feature.
Q. Which dynamic responses can I see?
A. You can view the following CLOSED LOOP UNITY FEEDBACK responses: IMPULSE, STEP, RAMP, ARBITRARY INPUT.
Click on Response --> Dynamic to select the "operating point" on the
rootlocus. You will then see a pop-up window which will prompt
you to select the desired plot.
Q. Can I simulate with any arbitrary inputs?
A. No! At present you can simulate with inputs that are (1) piece-wise linear (2) continuous (3) single-valued. You will receive an
error message if your input is not of this type.
Q. Can I change the size of the plotting frame in defining the
arbitrary input?
A. Yes, click on Edit->size in the plotting frame. Enter the required x and y co-ordinates. The default is x=[0,1], y=[0,1]. You may
change these as required.
Q. My step/ramp/impulse response is incomplete/coarse, what should I do?
A. You need to set parameters for maximum time for incomplete response. For a finer resolution, decrease the step size. These
settings are located at Settings --> Dynamic response.
Q. Sometimes I see an error message while plotting the step response/ frequency response why is this? What should I do about it?
A. This happens when the pole and zero are too close by and the mouse handler can't distinguish between the two points. When pole
and zero are close by, zoom the region by the ZOOM utility before selecting a point (gain).
Q. What should I do if I get a warning/error message?
A. Look up the quick reference on errors or warnings in RLTOOL. It will probably help you remove your error.
Q. I think I have found a bug, what should I do?
A. Please mail the bug report to ishan[AT]iitbombay.org. I would appreciate if you also let me know the remedy. It will help improve
RLTOOL.
Q. My RLTOOL crashes , what should I do?
A. Mail your "plant" along with the explicit details to the author. It will help improve RLTOOL.
Q. I would like the feature XYZ to be in RLTOOL, what should I do?
A. Code it into RLTOOL and submit a fresh update. Alternately, let me know about it by e-mail. I shall try to add that feature
sometime...
END OF FAQ.
author: Ishan Pendharkar
10 Error and warning messages
-
``Error Entering input'': There is an error while entering
numerator and denominator polynomials. Ensure that the entered
format is correct. For example, a polynomial s2+3s+2 should be
entered as s2+3*s+2.
- ``Numerator and denominator are equal'': This error message is
displayed when all poles and zeros of your transfer function
cancel each other and you get a constant, memoryless system.
- ``plzr() function couldnot handle your transfer function. See Scilab error code 60'': This is typically displayed when you have
very high gains in the system (order of 1e10) and calculations are very sensitive. Reduce the maximum permissible gain of the
rootlocus plot.
- ``Warning! I need write permission in <directory name>. Please change your present working directory'':This warning is
displayed when your present working directory is one in which you don't have a write permission. Set your appropriate
working directory using "Settings->PWD".
- ``Warning! Couldnot undo changes. No previous data available'': This warning is displayed when you don't have read /write
permission in your present working directory. Solution is as above.
- ``Sorry! I couldnot plot your step/ramp/impulse response. Due to numerical tolerances a pole zero cancellation has occured.
Please reselect the point'': This error message is displayed when the closed loop transfer function is not proper (due to
spurious pole-zero cancellations). Please reduce the maximum permissible gain in Settings->Rootlocus. or zoom the branch
of the rootlocus before selecting the point
- ``Sorry! I couldnot plot your frequency response. Due to numerical tolerances a pole zero cancellation has occured. Please
reselect the point''. Same as above.
- ``Error entering input. Input is not single valued'': While defining the arbitrary input, ensure that (1) input is piecewise linear (2)
continuous (3) Single valued. If you don't ensure these, you will see this error. You will be prompted to select the response
again.
- ``Error Saving Plant. Ensure that you have write permissions'': You don't have write permission in your pwd.
- ``Error loading Plant. Ensure that the file exists and you have
read permission'': Either the file you are asking for doesn't exist
or you don't have read permission. Change your pwd() or check the
filename.
11 Contributions to Rltool
Since RLTOOL, 1.2 the following modified codes provided by Jose
Paulo Vilela Soares da Cunha have been included. These enable a user
to plot various frequency domain plots (Bode, magnitude, Nyquist,
Nichols etc) in both Hz. and rad/sec. (as opposed to Hz only in
native Scilab functions). Users may address queries about these codes
to the author at jpaulo@ieee.org
-
Bode
- Nyquist
- Gain
- Nichols
The latest details about RLTOOL are available at:
http://www.ee.iitb.ac.in/uma/ ishan/scilab/rltool.htm
If you find RLTOOL useful, I shall be glad to hear from you!
This version is RLTOOL, 1.4. (Released May 2004).
This document was translated from LATEX by
HEVEA.