Автор работы: Пользователь скрыл имя, 12 Января 2013 в 01:43, лабораторная работа
Тема: Построение экспертной системы в оболочке GURU
Цель работы: получить практические навыки в представлении знаний продукционными правилами и в реализации полученной базы знаний в оболочке GURU.
Лабораторная работа № 5
Тема: Построение экспертной системы в оболочке GURU
Цель работы: получить практические навыки в представлении знаний продукционными правилами и в реализации полученной базы знаний в оболочке GURU.
/* Programma ekspertnoi sistemy "Diagnostika PK" na yazuke GURU */
/* fail stepa.rss */
GOAL: ADVICE
INITIAL:
e.tryp = "e" /*Zadaet strategiyu ocenki*/
e.lstr = 150 /*maksimalnaya dlina stroki = 500 */
advice = unknown
image = unknown
os = unknown
iodevice = unknown
perdevice = unknown
bios = unknown
hdd = unknown
hdd_on = unknown
power = unknown
sb = unknown
monitor = unknown
monitor_on = unknown
dvga = unknown
pb = unknown
pb_on = unknown
clear
?" "
?" Expertnaya sistema "
?" 'Diagnostika PC' "
?" "
?" Studenta Stepanenko A.S."
/* Razdel pravil */
RULE: R1
IF: image and os and iodevice and perdevice
THEN: advice = "1"
NEEDS: image os iodevice perdevice
REASON: Komp'yuter ispraven libo problema neizvestna.
RULE: R2
IF: image and os and iodevice and not perdevice
THEN: advice = "2"
NEEDS: image os iodevice perdevice
REASON: Trebuyetsya zamena neispravnogo periferiynogo ustroystva.
RULE: R3
IF: image and os and not iodevice
THEN: advice = "2"
NEEDS: image os iodevice
REASON: Neobkhodimo zamenit' neispravnoye ustroystvo vvoda - vyvoda!
RULE: R4
IF: image and os and bios and hdd
THEN: advice = "4"
NEEDS: image os bios hdd
REASON: Trebuyetsya pereustanovka operatsionnoy sistemy.
RULE: R5
IF: image and not os and bios and not hdd and hddon
THEN: advice = "5"
NEEDS: image os bios hdd hddon
REASON: Heobkhodimo zamenit' zhestkiy disk.
RULE: R6
IF: image and not os and bios and not hdd and not hddon
THEN: advice = "6"
NEEDS: image os bios hdd hddon
REASON: Trebuyetsya podklyuchit' zhestkiy disk k materinskoy plate.
RULE: R7
IF: image and not os and not bios
THEN: advice = "7"
NEEDS: image os bios
REASON: Heobkhodimo ochistit' CMOS!
RULE: R8
IF: not image and power and sb and monitoron and monitor and vga
THEN: advice = "8"
NEEDS: image power sb monitoron monitor vga
REASON: Trebuyetsya zamena materinskoy platy.
RULE: R9
IF: not image and power and sb and monitoron and monitor and not vga
THEN: advice = "9"
NEEDS: image power sb monitoron monitor vga
REASON: Trebuyetsya zamena videokarty.
RULE: R10
IF: not image and power and sb and monitoron and not monitor
THEN: advice = "10"
NEEDS: image power sb monitoron monitor
REASON: Trebuyetsya zamena monitora!
RULE: R11
IF: not image and power and sb and not monitoron
THEN: advice = "11"
NEEDS: image power sb monitoron monitor
REASON: Heobkhodimo podklyuchit' monitor k sistemnomu bloku.
RULE: R12
IF: not image and power and not sb and pb and pbon
THEN: advice = "8"
NEEDS: image power sb pb pbon
REASON: Trebuyetsya zamena materinskoy platy!
RULE: R13
IF: not image and power and not sb and pb and not pbon
THEN: advice = "13"
NEEDS: image power sb pb pbon
REASON: Heobkhodimo podklyuchit' blok pitaniya k materinskoy plate.
RULE: R14
IF: not image and power and not sb and not pb
THEN: advice = "14"
NEEDS: image power sb pb
REASON: Trebuyetsya zamena bloka pitaniya.
RULE: R15
IF: not image and not power
THEN: advice = "15"
NEEDS: image power
REASON: Heobkhodimo , chtoby sistemnyy blok i monitor byli podklyucheny k elektroseti.
/*Opredelenie peremennih*/
VARIABLE: image
FIND: ?"Yest' li izobrazheniye na ekrane?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then image = true
else image = false
endif
LABEL: Izobrazhenie
VARIABLE: os
FIND: ?"Zagruzhayetsya li operatsionnaya sistema?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then os = true
else os = false
endif
LABEL: Operatsionnaya sistema
VARIABLE: iodevice
FIND: ?"Rabotayut li ustroystva vvoda - vyvoda?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then iodevice = true
else iodevice = false
endif
LABEL: Ustroystva vvoda - vyvoda
VARIABLE: perdevice
FIND: ?"Rabotayut li periferiynyye ustroystva?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then perdevice = true
else perdevice = false
endif
LABEL: Periferiynyye ustroystva
VARIABLE: bios
FIND: ?"Zagruzhayetsya li nastroyka BIOS ?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then bios = true
else bios = false
endif
LABEL: Nastroyka BIOS
VARIABLE: hdd
FIND: ?"Otobrazhayetsya li zhestkiy disk v BIOS ?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then hdd = true
else hdd = false
endif
LABEL: Otobrazhayetsya li zhestkiy disk v BIOS
VARIABLE: hddon
FIND: ?"Podklyuchen li zhestkiy disk k materinskoy plate?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then hddon = true
else hddon = false
endif
LABEL: Podklyuchen li zhestkiy disk k materinskoy plate
VARIABLE: power
FIND: ?"Vklyucheny li sistemnyy blok i monitor v elektroset'?(y/n)"
e.lstr = 1
input otvet
e.lstr = 100
if otvet = "y" then power = true
else power = false
endif
LABEL: Podkluchenie k electroseti
VARIABLE: sb
FIND: ?"Rabotayet li sistemnyy blok?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then sb = true
else sb = false
endif
LABEL: Rabota systemnogo bloka
VARIABLE: monitor
FIND: ?"Ispraven li monitor?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then monitor = true
else monitor = false
endif
LABEL: Opredelyaem ispravnost monitora
VARIABLE: monitoron
FIND: ?"Podklyuchen li monitor k sistemnomu bloku?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then monitoron = true
else monitoron = false
endif
LABEL: Opredelyaem podkluchenie monitora
VARIABLE: vga
FIND: ?"Ispravna li videokarta?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then vga = true
else vga = false
endif
LABEL: Opredelyaem rabotu videokarty
VARIABLE: pb
FIND: ?"Ispraven li blok pitaniya?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then pb = true
else pb = false
endif
LABEL: Opredelyaem rabotu bloka pitaniya
VARIABLE: pbon
FIND: ?"Podkluchen li blok pitaniya k materinskoy plate?(y/n)"
e.lstr = 1
input otvet
e.lstr = 150
if otvet = "y" then pbon = true
else pbon = false
endif
LABEL: Opredelyaem podkluchenie bloka pitaniya
DO:
?" "
?"Na osnovanii poluchennoi informacii:"
?"Kod oshibki ",advice
?" "
?" "
test advice
case "1":
?"Skoree vsego vash komputer ispraven."
?"Ili v baze znaniy net dannyh ob etom vide polomki!"
break
case "2":
?"Otkluchite komputer ot electroseti."
?" Otkluchite neispravnoe ustroistvo."
?"Podkluchite novoe ustroistvo v sootvetstvuyushiy port i vkluchite PK."
break
case "4":
?"Vstavte ustanovochnyi disk Windows v diskovod i perezagruzite komputer."
?"Ispolzuya klavishu F11, vyberete zagruzku s CD-ROM."
?"Zatem sleduyte podskazkam ustanovshika."
break
case "5":
?"Otkluchite komputer ot electroseti."
?"Otkluchite neispravnoe ustroistvo ot razema SATA/IDE."
?"Podkluchite novoe ustroistvo k sootvetstvuyushemy razemu."
?"Esli trebuetsa, ustanovite OS."
break
case "6":
?"Otkluchite komputer ot electroseti."
?"Podkluchite HDD k razemu SATA/IDE."
?"Dlya identifikacii razemov ispolzuyte nadpisi na materinskoy plate."
break
case "7":
?"Dlya ochistki CMOS izvlekite batareyku BIOSa iz materinskoy platy."
break
case "8":
?"Otkluchite komputer ot electroseti."
?"Otsoedinite vse ustroistva ot materinskoy platy."
?"Zakrepite novuyu materinskuyu platy k korpusu i podkluchite ustroistva snova."
break
case "9":
?"Otkluchite komputer ot electroseti."
?"Izvlekite staruyu videokartu iz VGA/PCI razema."
?"Ustanovite novuyu videokartu."
?"Dlya identifikacii razemov ispolzuyte nadpisi na materinskoy plate."
break
case "10":
?"Podkluchite novuy monitor k systemnomu bloku i v elektroset'."
?"Predvaritelno otkluchiv PK."
break
case "11":
?"Podkluchite monitor k VGA razemy na zadney paneli korpusa."
break
case "13":
?"Otkluchite komputer ot electroseti."
?"Podsoedinite blok pitaniya k materinskoy plate v sootvetstvuyushie razemy."
break
case "14":
?"Otkluchite komputer ot electroseti."
?"Otsoedinite blok pitaniya ot korpusa i materinskoy platy."
?"Podsoedinite noviy blok pitaniya k korpusu i materinskoy plate "
?"v sootvetstvuyushie razemy."
break
case "15":
?"Podkluchite vse elementy k elektroseti (220 V, 50G)."
break
endtest
END:
Тестирование
Рис. 1 – Тест №1
Рис. 2 – Тест №2
Рис. 3 – Тест №3
Рис. 4 – Тест №4