Robotics and Energy Logo

Expert System project: PC repair assistant

Expert system PC repair assistant

It is needless to say how important PCs are in our daily lives. And like every machine and device; they tend to fail from time to time. When they do, this could be a hit.

Only computer technicians have the proper knowledge and are certified to repair PCs. In this project we program that knowledge into an expert system.

Download zip file

What will you learn?

In this project you will learn how to program your computer to ‘know’ and master the field of computer problem diagnostics. You will learn the fundamentals of expert systems, logic programming in Prolog, knowledge base design, and inference engine implementation.

What is an Expert System?

An Expert System is a highly complex algorithm (type of AI) usually consisting of a big database and set of rules. It gathers information about a problem and provides solutions — just like a human expert would. Expert systems are used in medicine, engineering, finance, and many other domains where deep specialist knowledge can be encoded as rules.

Prolog

Short for ‘Program In Logic’, Prolog is a leading language in logic programming that was developed in 1970. It uses true/false statements derived from facts and rules, making it ideal for expert systems. Prolog is declarative — you describe what is true, and the engine figures out how to reach conclusions.

The project and its field of expertise

The expert system is designed to:

  1. Identify the problem
  2. Give guidance and explanation on how the problem was found
  3. Offer a solution to fix the problem
  4. Explain how it got to the solution and why it worked

System troubleshooting areas:

Power Supply
Graphics
CPU
RAM
Motherboard
Disk Drives
DVD/ROM Drives
Audio

The overlay

The first requirement of an expert system is to have the ability to answer for a particular query. The system consists of four main components:

Knowledge Basis

The knowledge basis refers to the content of an expert system. It describes the components of the field of knowledge — facts and rules stored as Prolog predicates.

Conclusion Algorithm

The conclusion algorithm consists of a mechanism capable of drawing conclusions based on knowledge. It traverses the state machine to reach a diagnosis.

Explanation System

The explanation system allows an explanation to the user after the process of diagnosis and inference of the system — showing the path taken through the knowledge graph.

Overlay (Envelope)

The envelope includes the inference mechanism, the explanation mechanism and the user interface. Software installation is not required — run directly from the file.

Graphical representation of knowledge (facts)

The data structure used for this project to store all of the data is a state machine. All of the facts in this database were consulted with a real computer expert and vast research was made to make these facts accurate.

Missing

State machine diagram — Start (The pc malfunction)

Missing

State machine diagram — PSU / I'm not sure

Missing

State machine diagram — Display & Video

Missing

State machine diagram — Motherboard / CPU / RAM

Missing

State machine diagram — Hard drive

Missing

State machine diagram — Optical drive

Missing

State machine diagram — Sound & audio

Code structure

Edge definition

Each edge connects two states in the state machine with a value (the user's answer)._origin and _destination are the IDs of the states the arc is connecting, and _value is the transition value.

edge(_origin, _value, _destination).

Example edges:

edge(b4, no,  b6).
edge(b4, yes, b7).
edge(b5, yes, b8).
edge(b5, no,  b9).
edge(b7, yes, b10).
edge(b7, no,  b11).
edge(b9, yes, b12).
edge(b9, no,  b13).
edge(b11, no, b12).

Vertice data

Each vertex (node) in the state machine stores a name and an explanation string.

vertice_data(_vertice, _name, _explanation).

Example:

vertice_data(d12, 'Insert another power lead into the drive.', '').

Dictionary (term)

Technical terms are stored in a dictionary accessible during explanations.

term(_code, _term, _description).

Example:

term(20, 'PATA', 'Parallel ATA (PATA), originally AT Attachment (ATA), is an information cable...').

Data storage files

  • data.pl — edges, vertice data, and terms
  • library.pl — helper predicates and utilities

Rules

Now we get to the programming.

engine.pl methods

MethodDescription
load.Load all files
start.Start the program
menu.Transfer user to main menu
menu(_option)Receive user input and route
system_activate(_vertice, _trip)Search method — traverses the state machine
system_finish_manu(_trip)Finishes the troubleshooting process
explanation1(_trip)Activates the explanation engine
explanation2(_trip)Displays the trip as a flowchart
explanation_engine(_trip, _memory, _trip_explain)Core explanation method

Built-in Prolog functions used

FunctionPurpose
sort/2List sorting
member/2Check if value exists in list
atom_concat/3Concatenate two strings
findall/3Find all values that satisfy a condition
reverse/2Flip all values in a list

Missing

Screenshots of the running expert system / console output

Summary

Computer hardware is an area I have delved into long enough. I decided to do the project around this topic from the beginning. Throughout the work, I had to gather a huge amount of information about all the computer parts and consult with a real expert to ensure the facts were accurate.

Preparing for the project was difficult and challenging. Eventually, I learned a great many things in the field of computer hardware and my proficiency in Prolog improved.

Thank you

We thank you for learning and hopefully completing our project. We are looking forward to hearing from you in the comment section. Questions and constructive criticism are welcome.

We would like to know what you think about our Expert System project: PC repair assistant