c) Các luật về dùng thuốc điều trị cho mỗi triệu chứng
3.6.3. Thiết kế chương trình:
domains
list=symbol* % Khai bao kieu danh sach predicates
% Khai bao cac vi tu drop_mang(list,string) string_hour(string,list) sccode(integer,string) prepare(integer,string) run clauses
% Luat dan 1: Xac dinh loi
sccode(Y,C):- Y = 101, C = "Loi den quet"; Y = 120, C = "Loi dan Scan";
Y = 300, C = "Loi dau ra cao ap sac"; Y = 303, C = "Do dien ap luoi sac";
Y = 305, C = "Loi dong co lau day cao ap"; Y = 310, C = "Loi sensor do dien tren trong";
Y = 322, C = "Loi nhan dang tin hieu dong bo Laser"; Y = 335, C = "Loi dong co guong nhieu canh";
Y = 340, C = "Loi dien ap tren TD sensor"; Y = 341, C = "Loi khi dieu chinh TD sensor"; Y = 345, C = "Loi cua dien ap dat vao truc tu"; Y = 401, C = "Loi dau ra cua cao ap tach muc"; Y = 402, C = "Loi do dau ra cua cao ap tach muc"; Y = 430, C = "Loi cua den xoa trang";
Y = 440, C = "Loi xung khoa dong co chinh"; Y = 410, C = "Loi xung khoa dong co tu";
Y = 490, C = "Loi xung khoa dong co quat thong gio chinh"; Y = 495, C = "Loi cua bo hoi muc thai";
Y = 496, C = "Loi cua binh muc thai";
Y = 497, C = "Loi cua dong co thu hoi muc thai"; Y = 501, C = "Bo nang khai 1 lam viec sai chuc nang"; Y = 502, C = "Bo nang khai 2 lam viec sai chuc nang"; Y = 507, C = "Loi dong co keo giay sai chuc nang";
Y = 515, C = "Loi cua dong co dieu khien chan giay sau khay kep"; Y = 541, C = "Mo bo do nhiet do say";
Y = 544, C = "Loi nhiet do say qua cao"; Y = 550, C = "Het giay lau truc say";
Y = 601, C = "Loi truyen tin thuc hien giua bang BCU va khoi scan"; Y = 611, C = "Loi truyen tin giua BCU va ADF thoi diem ngung phat tin"; Y = 670, C = "Loi khoi dong cua may";
Y = 700, C = "Loi khi keo ban goc vao ADF";
Y = 701, C = "Loi cua dong co nang khai cua ADF"; Y = 827, C = "Loi ma chua doan Ram";
Y = 828, C = "Loi ma chuan doan Rom";
Y = 860, C = "Loi khoi dong o cung khi bat cong tac nguon"; Y = 863, C = "Loi khi HDD doc tham so";
Y = 865, C = "Loi khich hoat HDD";
Y = 953, C = "Loi khi dieu chinh hinh anh scan"; Y = 954, C = "Loi cai dat in anh";
Y = 955, C = "Loi cai dat bo nho"; Y = 964, C = "Loi san sang in". % Luat dan 2: Huong dan kiem tra thiet bi
prepare(Y,H):- Y = 101, H = "Kha nang hu den quet, Kiem tra ket noi cua den quet, Kiem tra tam trang tieu chuan ban";
Y = 120, H = "Kiem tra dong co scan, Kiem tra duong dan noi giua SBU SDRB dong co scan bi dut, Hu sensor vi tri ban dau cua dan scan";
Y = 300, H = "Kiem tra nguon cao ap sac, Dut dan noi cao ap sac, Tiep xuc cua cum cao ap xau";
Y = 303, H = "Kiem tra nguon cao ap sac, Dut day noi cua nguon sac, Tiep xuc cua cum cao ap toi";
Y = 305, H = "Kiem tra dong co lau day cao ap, Kiem tra bang BCU"; Y = 310, H = "Kiem tra lai sensor do dien the trong, Dut day noi toi sensor";
Y = 322, H = "Kiem tra lai ket noi giua bo nhan tin hieu dong bo va I/F, Bo nhan tin hieu dong bo lap sai";
Y = 335, H = "Kiem tra lai day noi giua dong co guong nhieu canh, Kiem tra lai dong co guong nhieu canh";
Y = 340, H = "Kiem tra TDsensor, Kiem tra lai BCU, Kiem tra lai dong co quay lo muc";
Y = 341, H = "Kiem tra ket noi cua TDsensor, Kiem tra lai dong co qua lo muc";
Y = 401, H = "Kiem tra nguon cao ap tach muc, Kiem tra lai tiep xuc o cac dau noi o bang nguon cao ap";
Y = 402, H = "Kiem tra nguon cao ap tach muc, Kiem tra day noi o cum dau ra cao ap tach muc";
Y = 430, H = "Kiem tra den xoa trang, Kiem tra lai day noi cua den xoa trang";
Y = 440, H = "Kiem tra he thong co khi cua dong co, Kiem tra dong co chinh";
Y = 410, H = "Kiem tra he thong khi cua dong co, Kiem tra lai dong co tu"; Y = 490, H = "Kiem tra khoi dong co quat, Kiem tra dong co quat gio chinh";
Y = 495, H = "Kiem tra he thong co khi, Kiem tra sensor het muc";
Y = 496, H = "Kiem tra xem co binh muc thai, Kiem tra cong tac nhan binh muc thai";
Y = 497, H = "Kiem tra lai dong co thu hoi muc thai"; Y = 501, H = "Kiem tra lai dong co nang khay 1"; Y = 502, H = "Kiem tra lai dong co nang khay 2";
Y = 507, H = "Kiem tra dong co keo giay khay, Kiem tra ket noi dong co keo giay";
Y = 515, H = "Kiem tra sensor chan giay, Kiem tra lai dong co chan giay"; Y = 541, H = "Kiem tra lai bo do nhiet do, Bo do nhiet do khong ket noi"; Y = 544, H = "Kiem tra lai BCU, Kiem tra lai PSU";
Y = 550, H = "Kiem tra lai giay lau, Kiem tra sensor bao het giay"; Y = 601, H = "Kiem tra lai duong ket noi";
Y = 611, H = "Kiem tra lai ket noi khong chac chan hoac bi dut"; Y = 670, H = "Kiem tra BCU lap sai";
Y = 672, H = "Kiem tra lai Controller lap sai, Kiem tra day noi ban phim"; Y = 700, H = "Kiem tra Sensor pick-up roller loi, Kiem tra day cu ro khong binh thuong";
Y = 701, H = "Kiem tra lai sensor vi tri khay, Kiem tra lai dong co nang khay";
Y = 828, H = "Kiem tra phan mem, Kiem tra lai Rom";
Y = 860, H = "Kiem tra lai o cung khong duoc lap, Kiem tra lai o cung"; Y = 953, H = "Kiem tra lai phan mem scan";
Y = 954, H = "Kiem tra lai phan mem"; Y = 955, H = "Kiem tra lai phan mem"; Y = 964, H = "Kiem tra lai phan mem in". drop_mang([_,Y],T):- T=Y.
string_hour(S,[H|T]):-fronttoken(S,H,S1),!,string_hour(S1,T). string_hour(_,[]).
%goi cac luat dan tren run:-
%tao cua so
makewindow(1,7,7,"SU DUNG PROLOG TRONG CHUAN DOAN LOI MAY PHOTO",1,1,24,79),
%nhap ma loi
write("Nhap ma loi (XXX): "), readln(XX1), %goi luat dan 1,2
str_int(XX1,X1), sccode(X1,L1), prepare(X1,H1),
write("===== CACH KHAC PHUC LOI ====="),nl,nl, write("+ Noi dung cua loi: ",L1),nl,
write("+ Huong dan khac phuc loi: ", H1),nl. goal
%goi chuong trinh run