Using rule based expert system .pdf

First International Conference on Emerging Trends in Engineering and Technology
Using Rule Based Expert System to Wrap Procedural Code of Integrated
Watershed Model
Manish Godse, Rajendra Sonar, T. I. Eldho, E. P. Rao
Indian Institute of Technology Bombay
{manishgodse, rm_sonar}@iitb.ac.in, {eldho, ceepria}@civil.iitb.ac.in
interfaces may be 2-D or 3-D depending on application
types. Interfaces may also be provided with
multimedia.
The GUI history starts with batch processing in
which real time interaction with system was nil. Later
introduced console command-line interfaces involving
series of request-response transactions in textual
commands. Though it changed user’s interaction but
was not sufficient on ‘look and feel’ and quality of
interaction with system. Then introduction of graphics
changed user’s experience and expectations [2, 4].
Part of overall application coding involves writing
code for GUI development. The results of Myers in
1995 showed that an average of 48% application code
and 50% time was required for GUI development. This
later reduced to 17% line of code for GUI and time to
50% because of use of GUI builder [1]. The simplified
GUI development removes frustration of programmers
and allows them to focus more on algorithm
development rather than putting more time in GUI
development. GUI development tool provide drag-drop
controls for automatic generation of code. But
developments of a GUI need working knowledge of
GUI builders. The understanding of GUI builder is
time consuming process.
There are three conventional approaches of
programming: Console, client server and web. The
console applications have textual user interface, while
client sever (C/S) and web applications have graphical
user interface. C/S applications have thick clients with
part of the processing done at desktop. The clients are
responsible for GUI presentation in C/S applications.
GUI presentation in C/S is dependent of operating
systems, programming languages, hardware etc. The
web applications are thin clients using open standards
using markup and scripting languages like Hyper Text
Markup Language (HTML), JavaScript etc. and are
browser independent. The interfaces in C/S or W/S are
pre-programmed with multiple controls, information
etc, which may reduce usability. Rule based expert
system may be desktop or web based application, but
Abstract
Graphical User interface (GUI) is an integral part
of any software system. It provides communication
media between software program and human being. It
usually consists of commands, menus, icons, images,
graphs, tables, texts etc. The proper GUI presentation
is influential in human-computer interaction. The
present age commonly used GUIs are windows or web,
which has improved usability compared to earlier text
based UI.
The usual way of GUI development is based on use
of GUI builders, which needs understanding, and
knowledge of using them. IT professionals more
commonly use them. For other professional who are
developing algorithms in their own domain may have
to spend more time on development of GUI rather than
spending more on their domain algorithm work. The
novel way of using expert systems for GUI
development can reduce a GUI development efforts
and time for other domain professionals. In this paper
a rule-based expert system is presented for use of GUI
development of integrated watershed model (IWM).
Keywords: Rule-based expert system, Graphical User
interface (GUI), Procedural Programming
1. Introduction
User interface is a program that controls a display
for the user and that allows the user to interact with the
system [8]. The GUI plays important role in
transferring information to user in a better way. The
better-presented self-explanatory GUI gives better
navigation and, helps in better understanding of
information provided to the user. The GUI has changed
since the computers were introduced from character
based to interactive and self-explanatory graphics,
which helps in efficient intuitive interaction with
systems, and permits use of input devices such as
mouse, touch screens, barcode scanners etc. These
978-0-7695-3267-7/08 $25.00 © 2008 IEEE
DOI 10.1109/ICETET.2008.32
332
Authorized licensed use limited to: INDIAN INSTITUTE OF TECHNOLOGY BOMBAY. Downloaded on June 6, 2009 at 05:54 from IEEE Xplore. Restrictions apply.
major difference compared to conventional system lies
in the way interfaces are invoked or information is
asked and displayed and shown to the user. The user
interfaces of rule-based expert system approach are not
pre-programmed. They are accessed or invoked based
on heuristics. The next input or interface is dependent
on facts or inputs provided. During every state of
consultation only required information is provided to
user, which improves usability. The communication in
expert system is kept very simple so that any novice
user can use the system. [3]
The focus of this paper is on how rule based expert
systems approach can be used to provide user interface
for procedural programmed API (Application
Programming Interface). A research case study related
to this work is explained. This research project is
carried at Civil Engineering Department of Indian
Institute of Technology Bombay (IITB) [11]. It is
development of integrated watershed model (IWM) for
rainfall-runoff using FEM, GIS and Remote Sensing.
APIs required for this model are programmed in C
language.
2. Cast study
A case study of IWM for GUI development is
discussed in this section.
2.1. Background
Water resources management is all about to fulfill
increasing water demand with available water
resources. In a watershed perspective, spatial and
temporal estimation of runoff for a fewer rainfall is
important for the sustainable management of water
resources. With the development of remote sensing and
Geographical Information Systems (GIS), the
hydrological models are getting more sophisticated and
are being integrated with other process models [9].
In IWM research work, the objective was to
develop Finite Element Method (FEM) based rainfallrunoff models using GIS and remotely sensed data. In
the rainfall-runoff modeling, various hydrologic
processes such as interception, infiltration, runoff, and
interflow have been considered. Finally, an integrated
model using FEM, GIS and Remote Sensing has been
developed and applied for many watersheds. The IWM
is programmed in C language.
Civil engineering scholars developed the integrated
watershed development model using C programming
language. The system developed was console based
desktop application. Some of inputs/outputs were
stored in text files and others were user fed at runtime.
Then results were interpreted manually after looking
into files or were converted manually into graphs using
another graph generation tools. The developed system
was satisfactory, but was lacking on usability. There
were three major requirements in system:
• GU interfaces to accept user data and display
textual as well as graphical output
• Web-based version
• Complete control on GUI development
1.1. Problem questions
A scenario is
• The civil engineering research group has team
members’ having thorough understanding of
their domain and is able to write programs in C.
• Team members are not familiar with any GUI
development tool.
The problem was
• How to develop a web based GUI with fewer
efforts?
• No addition and/or modification in existing code
to add GUI.
The questions raised were
• Shall outside person’s help be asked to develop
GUI from scratch?
• Is involvement of outsider going to increase the
dependency on her/him?
• Shall team member learn GUI tool so that she/he
can develop GUI for their work?
• What time shall be required to understand GUI
builder and then develop GUI?
• Is there any other method to develop GUI, which
will reduce learning and development time?
2.2. Solution
We used iKen Studio for development of this
application. iKen Studio is a web-based Integrated
Development Environment (IDE) to develop, deploy,
and run enterprise level applications which includes
knowledge-based expert systems and decision support
systems. The IDE is based on hybrid Artificial
Intelligence techniques mainly expert system, casebased reasoning, neural network, genetic algorithm,
and analytical methods [5]. The IDE include generic
functions to generate graphs. It has inbuilt form and
Based on questions raised it was decided that rather
than learning GUI tool and developing system from
scratch, find out other solutions which would help to
develop system with lesser efforts and have complete
control of research team on GUI development.
333
Authorized licensed use limited to: INDIAN INSTITUTE OF TECHNOLOGY BOMBAY. Downloaded on June 6, 2009 at 05:54 from IEEE Xplore. Restrictions apply.
report interfaces to develop HTML input forms and
output reports.
iKen studio has capability to use external APIs
through Dynamic-Link Libraries (DLL). DLL contains
functions and data that can be used by another module
in Windows environment (application or DLL) [7].
The code of IWM was written and compiled using
turbo C. It was not possible to call this code directly in
expert system hence, it was recompiled in Visual
Studio 6.0 [6], and DLL was created. The created DLL
is called in expert system to run the IWM. The more
details of DLL generation are not provided here
because it is not in scope of this paper.
The input data required for the system has two
parts:
• Fixed set of values stored in text files
• Values that vary for different scenarios
The data stored in the text file is provided to the
model by specifying the path of the files, using expert
system input form. Form based interface is used to
collect other required data from the user at run time.
These interfaces are managed and controlled by expert
system. This data is then transferred to the model.
After processing the data, the model gives back the
results to expert system. The outputs of model are in
two forms: graph, and data stored in text files.
An example of the rule written in the system is
shown in Table-1. This rule is as per syntax of expert
system development tool. E.g. ASK() prompts the user
to enter value of variable. As shown in Table-1, first
line of rule asks the path of input files which are
required for expert system. These rules have complete
control on calling required user input forms; passing
fixed as well user data to models; collecting output
from models; displaying output, generation of required
graphs
etc.
E.g.
Integrated
Watershed
Model.PathForm shows user input form for providing
file and directory path as shown in Figure-1. The
variable ‘Integrated Watershed Model.Select Model’
used in rule displays input form to user. As shown in
Figure-2, two options (Kinetic Wave Model, Diffusion
Wave Model) are available to the user. User has to
select one of the two options. Depending upon the
user’s selection next interface will be displayed.
Assuming that user selects ‘Kinetic Wave Model’, the
input form (Figure-3) of Kinetic Wave Model is called
as shown in Table-1, ‘ASK(Integrated Watershed
Model.Kinematic Wave Model)’. In a same way next
interfaces will be shown depending upon facts that user
has entered. System will continue to ask the facts till
user enters valid facts. At the end of consultation
session CUSTOM_FUN() is called to transfer captured
data to the IWM. After processing received data the
IWM send results back to expert system. The results
are displayed in form as shown in Figure-4 which
shows links to these results including inputs. The
results are of two types: Graphs (Figure-5) and output
stored in text file (Figure-6). The required graphs are
generated using inbuilt generic functions like
CREATE_GRAPH() and SET_GRAPH_OPTION().
E.g. the runoff hydrograph is shown in Figure-5. At the
end of session a session report is displayed (Figure-7).
Table-1: Example of Rules
IF ASK(Integrated Watershed Model.PathForm)
AND Integrated Watershed Model.Select
Model=Kinematic Wave Model
AND ASK(Integrated Watershed Model.Kinematic
Wave Model)
AND Integrated Watershed
Model.ChannelSection=Trapezoidal
AND Integrated Watershed
Model.InterceptionModel=Yes
AND ASK(Integrated Watershed Model.Interception
Model)
AND Integrated Watershed
Model.InfiltrationModel=GAML model
AND ASK(Integrated Watershed Model.GAMLForm)
AND ASK(Integrated Watershed
Model.FinishSession)
AND Integrated Watershed
Model.Status:=CUSTOM_FUN(Dll_Main,Integrated
Watershed Model.NumberOfStrips+",1,"+Integrated
Watershed
Model.KWM_TotNoOfNodeStripsAllSubWatersheds+
",188,"+Integrated Watershed
Model.KWM_TotalSimulationTime+",540,"+Integrate
d Watershed Model.KWM_TimeStep+","+
Integrated Watershed
Model.KWM_TimeInMinDistributedOutput+",1,1,"+
Integrated Watershed
Model.Incptn_mod_LeafAreaIndex+","+
Integrated Watershed
Model.Incptn_mod_FractionVegetationCover+","+
Integrated Watershed
Model.GAML_SatHydraulicConductivity+","+
Integrated Watershed
Model.GAML_AveragSuctionHead+","+
Integrated Watershed
Model.GAML_SatWaterContent+","+
Integrated Watershed
Model.GAML_InitialWaterContent+",0.3955,0.575,0.
55,2,1,"+Integrated Watershed
Model.ConfigFilePath+","+Integrated Watershed
Model.RelativePath)
AND Integrated Watershed
Model.Temp_Duration:=C_NUMBER(Integrated
Watershed
334
Authorized licensed use limited to: INDIAN INSTITUTE OF TECHNOLOGY BOMBAY. Downloaded on June 6, 2009 at 05:54 from IEEE Xplore. Restrictions apply.
Model.KWM_TotalSimulationTime*60/Integrated
Watershed Model.KWM_TimeStep)
AND Integrated Watershed
Model.Trend1:=C_TREND(CUSTOM_FUN(GetTime,
C_TEXT(Integrated Watershed
Model.Temp_Duration)))
AND Integrated Watershed
Model.Trend2:=C_TREND(CUSTOM_FUN(GetRuno
ff,C_TEXT(Integrated Watershed
Model.Temp_Duration)))
AND Integrated Watershed
Model.TempMatrix:=CREATE_MATRIX(Integrated
Watershed Model.Temp_Duration,1,0)
AND SET_MATRIX_COLUMN(Integrated
Watershed Model.TempMatrix,1,Integrated Watershed
Model.Trend2)
AND CREATE_GRAPH(IWM,Integrated Watershed
Model.TempMatrix)
AND SET_GRAPH_OPTION(IWM,Title,RUNOFF
HYDROGRAPH)
AND ASK(Integrated Watershed Model.Graph)
AND ASK(Integrated Watershed
Model.SessionReport)
THEN Integrated Watershed Model.Goal IS Complete
Figure 3: Data Input form for Kinematic Wave
Model
The few screen shots of systems are as following-
Figure-1: Input form for File and Directory path
Figure 4: Result form - URL for input and
output files
Figure 2: Form for Selecting Model Type
Figure 5: Output- Hydrograph
335
Authorized licensed use limited to: INDIAN INSTITUTE OF TECHNOLOGY BOMBAY. Downloaded on June 6, 2009 at 05:54 from IEEE Xplore. Restrictions apply.
takes less time compared to the conventional systems.
The sequences of all operations are controlled by rules,
hence modification and maintenance of system is very
easy. This approach may also be suitable for using
legacy systems in web environment. The role of
experts system in this project is best depicted as host to
control full application, and models acting as assistant.
4. Acknowledgement
This work is done as a part of WWM project. The
WWM project is funded by ISRO-IITB Technology
Cell to Civil Engineering Department of IIT Bombay.
10. References
Figure 6: Output - Text file
[1] Brad A. Myers, “User Interface Software Tools,” ACM
Transactions on Computer-Human Interaction 2, 1, March
1995, pp. 64-108
[2] C. R. Kulseth, E. Roethke, R. Bhamagar, “User Interface
Issues For Evolving Open Systems”, IEEE Transactions on
Power Systems, Vol. 8, No. 3, August 1993, pp. 1039-1044
[3] Efrain Turban, Jay E. Aronson, “Decision support
systems and Intelligent systems”, Pearosn Education Asia,
First Indian reprint, 2001
[4] Eric Steven Raymond, Rob W. Landley, "The Art of Unix
Usability",
http://www.catb.org/~esr/writings/taouu/html/index.html, 27
January 2008
[5] http://www.ikenstudio.com, 27 January 2008
[6] http://www.microsoft.com, 29 January 2008
[7]
http://msdn2.microsoft.com/en-us/library/ms682589.a
spx, 27 January 2008
[8] http://wordnet.princeton.edu, 02 January 2008
[9] K. V. Reddy, T.I. Eldho, E. P. Rao, N. Hengade, “A
kinetic water based distributed watershed model usig
FEM,GIS, and remotely sensed data”, J. Hydrological
Processes, 21, 2007, pp. 2765-2777
Figure 7: Session Report
3. Discussion and conclusion
We have successfully implemented use of rule
based expert systems to wrap procedural C code. Use
of this approach improves usability as it shows only
relevant and required information to user. Rule
syntaxes are normally in routine English and are self
explanatory, hence it reduces cognitive and learning
efforts of programmer. The amount of training required
is less compared to training on conventional
programming. It also improves productivity and
reduces time. Rule modification is very easier and
[10] Robert DeMoyer, E. Eugene Mitchell, "Use of the
MATLAB Graphical User Interface Development
Environment for Some Control System Applications", 29th
ASEE/IEEE Frontiers in Education Conference, November
10-13, 1999, 12b3, pp. 7-11
[11] T.I. Eldho, E.P. Rao, “Integrated Watershed Modelling
using Finite Element Method, Remote Sensing and GIS”,
Technical Report submitted to ISRO-IITB Technology Cell,
IIT Bombay, 2008
336
Authorized licensed use limited to: INDIAN INSTITUTE OF TECHNOLOGY BOMBAY. Downloaded on June 6, 2009 at 05:54 from IEEE Xplore. Restrictions apply.