Добавил:
СПбГУТ * ИКСС * ПИиВТ * Программная инженерия Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Отчеты / ЛиФП. Лабораторная работа 6

.pdf
Скачиваний:
8
Добавлен:
29.01.2021
Размер:
302.21 Кб
Скачать

Федеральное агентство связи ФЕДЕРАЛЬНОЕ ГОСУДАРСТВЕННОЕ БЮДЖЕТНОЕ

ОБРАЗОВАТЕЛЬНОЕ УЧРЕЖДЕНИЕ ВЫСШЕГО ОБРАЗОВАНИЯ «САНКТ-ПЕТЕРБУРГСКИЙ ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ ТЕЛЕКОММУНИКАЦИЙ ИМ. ПРОФ. М. А. БОНЧ-БРУЕВИЧА» (СПбГУТ)

Факультет инфокоммуникационных сетей и систем Кафедра программной инженерии и вычислительной техники

ЛАБОРАТОРНАЯ РАБОТА №6 по дисциплине «Логическое и функциональное программирование»

Выполнил: студент 3-го курса дневного отделения группы ИКПИ-85

Коваленко Леонид Александрович Преподаватель:

доцент кафедры ПИиВТ Ерофеев Сергей Анатольевич

Санкт-Петербург

2020

Постановка задачи

Написать программу на языке Turbo Prolog 2.0 для работы с базой данных пьезоматериалов.

Схема решения База данных будет содержать одну таблицу — таблицу

пьезоматериалов, столбцы которой перечислены далее:

1.Name — название пьезоматериала.

2.Source — изготовитель.

3.Density — плотность пьезоматериала.

4.Структура, содержащая константы-параметры пьезоматериала: C11E,

C12E,

C13E,

C33E,

C44E,

C11D,

C12D,

C13D,

C33D,

C44D,

S11E,

S12E,

S13E,

S33E,

S44E,

S11D,

S12D,

S13D,

S33D,

S44D,

E31,

E33,

E15,

D31,

D33, D15, H31, H33, H15, G31, G33, G15, E11S, E33S, E11T, E33T.

Предполагаются следующие возможности программы:

1.Добавление пьезоматериала с консоли;

2.Добавление пьезоматериалов с CSV-файла;

3.Отображение пьезоматериалов в консоли;

4.Отображение списка изготовителей пьезоматериалов;

5.Редактирование пьезоматериалов;

6.Удаление пьезоматериала по названию;

7.Удаление всех пьезоматериалов;

8.Сохранение пьезоматериалов в CSV-файл.

2

Код программы Входные данные поступают с клавиатуры либо файла, пример

содержимого которого приведен в табл. 1.

Таблица 1 — Входные данные в файле (сверху) и описание столбцов (снизу)

P-5C;Piezotite;8;3;4;2;0.0126;-0.0047;-0.0053;0.0128;0.0316;-0.0001;0.00016;0.00027;1230;1550

P-5E;Piezotite;7.8;3;4;2;0.0124;-0.0041;-0.0052;0.0143;0.034;-0.0001;0.0002;0.0003;1490;1510

P-6C;Piezotite;7.7;3;4;2;0.0094;-0.003;-0.003;0.0103;0.0256;-8E-05;0.00019;0.00029;760;800

Название_пьезоматериала; Изготовитель_пьезоматериала; Плотность_пьезоматериала;

Номер elastic constants для ввода (CE=1, CD=2, SE=3, SD=4);

Номер piezoelectric constants для ввода (E=1, D=2, H=3, G=4);

Номер permittivities constants для ввода (ES=1, ET=2);

5 elastic constants;;;;;

3 piezoelectric constants;;;

2 permittivities constants;

Код программы приведен в табл. 2.

Таблица 2 — Код программы

NOWARNINGS

%Раздел описания доменов

DOMAINS

file = datafile reals = real*

/* const_list = cl(C11E, C12E, C13E, C33E, C44E, C11D, C12D, C13D, C33D, C44D, S11E, S12E, S13E, S33E, S44E, S11D, S12D, S13D, S33D, S44D, E31, E33, E15, D31, D33, D15, H31, H33, H15, G31, G33, G15, E11S, E33S, E11T, E33T) */

const_list = cl(real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real, real)

/* priv_const_list = pcl(C11E, C12E, C13E, C33E, C44E, E31, E33, E15, E11S, E33S, Reg_C, Reg_e, Reg_s) */ priv_const_list = pcl(real, real, real, real, real, real, real, real, real, real, integer, integer, integer) strings = string*

const_matrix = const_list*

%Раздел описания предикатов

PREDICATES if_x_equals_0_then_1_else_x(real, real)

get_ce(integer, integer, integer, const_list, const_list) get_cd(integer, integer, integer, const_list, const_list) get_se(integer, integer, integer, const_list, const_list) get_sd(integer, integer, integer, const_list, const_list) get_e(integer, integer, integer, const_list, const_list) get_d(integer, integer, integer, const_list, const_list) get_h(integer, integer, integer, const_list, const_list) get_g(integer, integer, integer, const_list, const_list) get_et(integer, integer, integer, const_list, const_list) get_es(integer, integer, integer, const_list, const_list) get_constants(priv_const_list, const_list) get_constants_aux(integer, integer, integer, const_list, const_list) get_constants_aux1(real, const_list, const_list) get_constants_aux2(real, const_list, const_list)

eq1(real, reals, reals, reals, reals, reals) eq2(real, reals, reals, reals, reals, reals) eq3(real, reals, reals, reals)

start() menu() choose(string)

insert_into_database(string, string, const_list, real) dialog_str_delete_from_database_by_name() dialog_str_clear_database()

read_real_greater_0(real)

read_variant(integer, integer, integer, integer) choose_variant(integer, integer, integer, integer, integer) dialog_str_set_elastic_constants_from_console(integer, priv_const_list)

pre_dialog_str_set_elastic_constants_from_console(integer, real, real, real, real, real) enter_elastic_constants(real, real, real, real, real, string, string, string, string, string) dialog_str_set_piezoelectric_constants_from_console(integer, priv_const_list) pre_dialog_str_set_piezoelectric_constants_from_console(integer, real, real, real) enter_piezoelectric_constants(real, real, real, string, string, string) dialog_str_set_permittivities_from_console(integer, priv_const_list) pre_dialog_str_set_permittivities_from_console(integer, real, real) enter_permittivities(real, real, string, string)

dialog_str_read_from_file() dialog_str_read_from_console() dialog_str_read_from_console_1(string, string, real) dialog_str_read_from_console_2(priv_const_list)

3

dialog_str_read_from_console_3(priv_const_list) dialog_str_read_from_console_4(priv_const_list) dialog_str_show_data()

print_database()

print_database(strings, strings, const_matrix, reals) print_enter_rows(strings, strings, const_matrix, reals) print_enter_rows(strings, strings, const_matrix, reals, string) print_consts(const_list)

dialog_str_save_into_file() print_format_consts(const_list) exists(string)

read_rows()

front_string(string, string, string) clear_database() dialog_str_show_by_source()

read_cmd(string, string, const_list, real, string) print_sources(strings, integer) remove_duplicates(strings, strings)

member(string, strings) delete3(string, strings, strings)

material_edit(string, string, const_list, real, string, string, const_list, real) choose_edit(integer, string, string, const_list, real, string, string, const_list, real) material_edited()

should_be_positive(string, real) should_be_negative(string, integer, real, integer, integer) log_str(String)

length(strings, integer) get(strings, integer, string)

%Раздел описания базы данных

DATABASE

piezomaterial(string, string, const_list, real) % piezomaterial(Name, Source, Constants, Density)

%Раздел описания внутренней цели

GOAL

 

 

 

 

start().

 

 

 

 

% Раздел описания предложений

 

 

 

 

CLAUSES

 

 

 

 

length([], 0).

 

 

 

 

length([_|Xs], N) :-

 

 

 

 

length(Xs, P),

 

 

 

 

N = P + 1.

 

 

 

 

get([Head|_], 0, X) :- X = Head.

 

 

 

 

get([_|Tail], I, X) :- I1 = I - 1, get(Tail, I1, X).

 

 

start() :- makewindow(1, 15, 15, "Piezomaterial", 1, 0, 24, 80), menu().

 

menu() :-

 

 

 

 

clearwindow(),

 

 

 

 

write("

*************************

"), nl,

write("

*

MENU

*

"), nl,

write("

*************************

"), nl,

write("

*

1. Add from console

*

"), nl,

write("

*************************

"), nl,

write("

*

2. Add from file

*

"), nl,

write("

*************************

"), nl,

write("

*

3. Show data

*

"), nl,

write("

*************************

"), nl,

write("

*

4. Show by source

*

"), nl,

write("

*************************

"), nl,

write("

*

5. Delete by name

*

"), nl,

write("

*************************

"), nl,

write("

*

6. Clear

*

"), nl,

write("

*************************

"), nl,

write("

*

7. Save into file

*

"), nl,

write("

*************************

"), nl,

write("

*

0. Exit

*

"), nl,

write("

*************************

"), nl,

write("

int>"), readln(S), clearwindow(), choose(S), menu(); menu().

choose(S) :-

 

S = "0", !, exit;

 

S = "1", !, dialog_str_read_from_console();

S = "2", !, dialog_str_read_from_file();

 

S = "3", !, dialog_str_show_data();

 

S = "4", !, dialog_str_show_by_source();

 

S = "5", !, dialog_str_delete_from_database_by_name();

S = "6", !, dialog_str_clear_database();

 

S = "7", !, dialog_str_save_into_file().

 

dialog_str_show_by_source() :-

 

 

 

 

findall(Source, piezomaterial(_, Source, _, _), Sources), not(Sources = []), !,

 

write("

****************************

"), nl,

write("

 

ENTER SOURCE

 

"), nl,

remove_duplicates(Sources, SList), print_sources(SList, 1),

 

write("

****************************

"), nl,

length(SList, L), read_variant(N, 1, L, 0), N1 = N - 1, get(SList, N1, S),

 

findall(Name, piezomaterial(Name, _, _, _), Names),

 

 

findall(Consts, piezomaterial(_, _, Consts, _), ConstsList),

 

findall(Density, piezomaterial(_, _, _, Density), Densitys),

 

print_enter_rows(Names, Sources, ConstsList, Densitys, S);

 

write("

***********************

"), nl,

write("

*

NO DATA!

*

"), nl,

write("

***********************

"), nl,

write("

 

any>"), readln(_).

 

member(Name,[Name |_]) :- !.

 

 

 

 

member(Name,[_ |Tail]):- member(Name,Tail). delete3(_,[],[]) :- !.

4

delete3(X,[X|T],R):- !, delete3(X,T,R).

 

 

 

delete3(X,[H|T],[H|R]) :- delete3(X,T,R).

 

 

 

remove_duplicates([],[]) :- !.

 

 

 

 

remove_duplicates([H|T], [H|R]) :-

 

 

 

 

member(H,T),!,

 

 

 

 

delete3(H,T,R1),

 

 

 

 

remove_duplicates(R1,R).

 

 

 

 

remove_duplicates([H|T],[H|R]):-

 

 

 

 

remove_duplicates(T,R).

 

 

 

 

print_sources([], _) :- !.

 

 

 

 

print_sources([Source|Tail], N) :-

 

 

 

 

writef("

%3d. %s", N, Source), nl, N1 = N + 1, print_sources(Tail, N1).

print_enter_rows([], [], [], [], TSource) :-

 

 

 

write("

***********************

"), nl,

write("

*

DONE!

*

"), nl,

write("

***********************

"), nl,

write("

 

any>"), readln(_).

 

print_enter_rows([Name|NT], [Source|ST], [Consts|CT], [Density|DT], TSource) :-

 

Source = TSource,

 

 

 

 

clearwindow(),

 

 

 

 

write("*****************************************************************************"), nl,

write("* Name: ", Name), nl,

 

 

 

 

write("* Source: ", Source), nl,

 

 

 

 

write("* Density: ", Density), nl,

 

 

 

print_format_consts(Consts), write("*****************************************************************************"), nl,

write("

 

next>"), readln(C), read_cmd(Name, Source, Consts, Density, C),

print_enter_rows(NT, ST, CT, DT, TSource);

 

 

Source = TSource, !;

 

 

 

 

Source <> TSource, print_enter_rows(NT, ST, CT, DT, TSource).

 

insert_into_database(Name, Source, Consts, Density) :-

 

 

assertz(piezomaterial(Name, Source, Consts, Density)).

 

 

dialog_str_read_from_file() :-

 

 

 

 

write("

****************************

"), nl,

write("

*

ENTER FILE NAME

*

"), nl,

write("

****************************

"), nl,

write("

 

string>"), readln(Filename), exists(Filename),

 

openread(datafile, Filename), readdevice(datafile), read_rows(),

 

closefile(datafile), readdevice(keyboard),

 

 

write("

**********************

"), nl,

write("

*

DONE!

*

"), nl,

write("

**********************

"), nl,

write("

 

any>"), !, readln(_);

 

write("

**************************

"), nl,

write("

*

MATERIALS NOT ADDED!

*

"), nl,

write("

**************************

"), nl,

write("

 

any>"), readln(_).

 

exists(Filename) :-

 

 

 

 

existfile(Filename), !;

 

 

 

 

write("

****************************

"), nl,

write("

*

FILE NOT FOUND

*

"), nl,

write("

****************************

"), nl,

write("

 

any>"), readln(_), !, fail.

 

read_rows() :-

 

 

 

 

not(eof(datafile)),

 

 

 

 

readln(Line),

 

 

 

 

front_string(Line, Name, Tail1),

 

 

 

 

front_string(Tail1, Source, Tail2),

 

 

 

front_string(Tail2, Density_STR, Tail3), str_real(Density_STR, Density),

front_string(Tail3, Reg_C_STR, Tail4),

str_int(Reg_C_STR, Reg_C), Reg_C >= 1, Reg_C <= 4,

front_string(Tail4, Reg_e_STR, Tail5),

str_int(Reg_e_STR, Reg_e), Reg_e >= 1, Reg_e <= 4,

front_string(Tail5, Reg_s_STR, Tail6),

str_int(Reg_s_STR, Reg_s), Reg_s >= 1, Reg_s <= 2,

front_string(Tail6, C11E_STR, Tail7),

str_real(C11E_STR, C11E), should_be_positive(Line, C11E),

front_string(Tail7, C12E_STR, Tail8),

str_real(C12E_STR, C12E), should_be_negative(Line, Reg_C, C12E, 3,

4),

 

front_string(Tail8, C13E_STR, Tail9),

str_real(C13E_STR, C13E), should_be_negative(Line, Reg_C, C13E, 3,

4),

 

front_string(Tail9, C33E_STR, Tail10),

str_real(C33E_STR, C33E), should_be_positive(Line, C33E),

front_string(Tail10, C44E_STR, Tail11), str_real(C44E_STR, C44E), should_be_positive(Line, C44E),

front_string(Tail11, E31_STR, Tail12),

str_real(E31_STR, E31), should_be_negative(Line, Reg_e, E31, 1, 1),

front_string(Tail12, E33_STR, Tail13),

str_real(E33_STR, E33), should_be_positive(Line, E33),

front_string(Tail13, E15_STR, Tail14),

str_real(E15_STR, E15), should_be_positive(Line, E15),

front_string(Tail14, S11_STR, Tail15), str_real(S11_STR, E11S), should_be_positive(Line, E11S), front_string(Tail15, S33_STR, _), str_real(S33_STR, E33S), should_be_positive(Line, E33S), get_constants(pcl(C11E, C12E, C13E, C33E, C44E, E31, E33, E15, E11S, E33S, Reg_C, Reg_e, Reg_s), Consts), insert_into_database(Name, Source, Consts, Density), !, read_rows();

not(eof(datafile)), !,

 

 

 

 

write("

**********************************

"), nl,

write("

*

READING ERROR!

*

"), nl,

write("

*

REMAINING DATA WAS NOT READ!

*

"), nl,

write("

*

SOME MATERIALS ADDED!

*

"), nl,

write("

**********************************

"), nl; !.

should_be_positive(Line, C1XE) :-

 

 

 

C1XE > 0, !;

 

 

 

 

write("See: ", Line), nl,

 

 

 

 

write("

 

\'", C1XE, "\' should be > 0!"), nl, fail.

 

should_be_negative(Line, Reg_C, C1XE, T1, T2) :-

 

 

Reg_C = T1, C1XE >= 0, !,

 

 

 

 

write("See: ", Line), nl,

 

 

 

 

write("

 

\'", C1XE, "\' should be < 0!"), nl, fail;

 

Reg_C = T2, C1XE >= 0, !,

 

 

 

 

write("See: ", Line), nl,

 

 

 

 

write("

 

\'", C1XE, "\' should be < 0!"), nl, fail;

 

5

T1 <> T2, Reg_C <> T1, Reg_C <> T2, C1XE <=

0, !,

write("See: ", Line), nl,

 

 

write("

\'", C1XE, "\' should be > 0!"), nl, fail; !.

front_string("", "", "") :- !.

 

 

front_string(Line, Param, Tail) :-

 

 

frontchar(Line, LineH, LineT), LineH = ';',

!, Param = "", Tail = LineT;

frontchar(Line, LineH, LineT), LineH <> ';', !, front_string(LineT, T, Tail), str_char(LineHS, LineH),

concat(LineHS, T, Param).

 

 

dialog_str_read_from_console() :-

 

 

dialog_str_read_from_console_1(Name, Source, Density),

dialog_str_read_from_console_2(PrivConsts),

 

dialog_str_read_from_console_3(PrivConsts),

 

dialog_str_read_from_console_4(PrivConsts),

 

get_constants(PrivConsts, Consts),

 

 

 

 

 

 

insert_into_database(Name, Source, Consts, Density), !,

 

 

 

 

 

write("

 

*********************

 

 

"),

nl,

write("

 

* MATERIAL ADDED!

*

 

 

"),

nl,

write("

 

*********************

 

 

"),

nl,

write("

 

any>"), readln(_);

 

 

 

 

write("

*************************

 

 

"),

nl,

write("

*

MATERIAL NOT ADDED!

*

 

 

"),

nl,

write("

*************************

 

 

"),

nl,

write("

 

any>"), readln(_).

 

 

 

 

dialog_str_read_from_console_1(Name, Source, Density) :-

 

 

 

 

 

write("

*************************************

 

"),

nl,

write("

* NAME OF PIEZOMATERIAL TO INSERT *

 

"),

nl,

write("

*************************************

 

"),

nl,

write("

 

str>"), readln(Name), Name <> "", clearwindow(),

 

write("

*****************************

 

"),

nl,

write("

*

SOURCE OF PIEZOMATERIAL

*

 

"),

nl,

write("

*****************************

 

"),

nl,

write("

 

str>"), readln(Source), Source <> "",clearwindow(),

write("

******************************

 

"),

nl,

write("

*

DENSITY OF PIEZOMATERIAL

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

 

real>"), read_real_greater_0(Density),clearwindow().

dialog_str_read_from_console_2(PrivConsts) :-

 

 

 

 

 

write("

**********************************************

"),

nl,

write("

*

ELASTIC CONSTANTS

 

 

*

"),

nl,

write("

**********************************************

"),

nl,

write("

* 1. Set CE (C11E, C12E, C13E, C33E, C44E)

*

"),

nl,

write("

**********************************************

"),

nl,

write("

* 2. Set CD (C11D, C12D, C13D, C33D, C44D)

*

"),

nl,

write("

**********************************************

"),

nl,

write("

* 3. Set SE (S11E, S12E, S13E, S33E, S44E)

*

"),

nl,

write("

**********************************************

"),

nl,

write("

* 4. Set SD (S11D, S12D, S13D, S33D, S44D)

*

"),

nl,

write("

**********************************************

"),

nl,

write("

* 0. Close

 

 

 

*

"),

nl,

write("

**********************************************

"),

nl,

read_variant(N1, 1, 4, 0), clearwindow(),

 

 

 

 

 

dialog_str_set_elastic_constants_from_console(N1, PrivConsts), clearwindow().

 

 

dialog_str_read_from_console_3(PrivConsts) :-

 

 

 

 

 

write("

******************************

 

"),

nl,

write("

*

PIEZOELECTRIC CONSTANTS

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

*

1. Set E (E31, E33, E15)

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

*

2. Set D (D31, D33, D15)

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

*

3. Set H (H31, H33, H15)

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

*

4. Set G (G31, G33, G15)

*

 

"),

nl,

write("

******************************

 

"),

nl,

write("

*

0. Close

 

*

 

"),

nl,

write("

******************************

 

"),

nl,

read_variant(N2, 1, 4, 0), clearwindow(),

 

 

 

 

 

dialog_str_set_piezoelectric_constants_from_console(N2, PrivConsts), clearwindow().

 

 

dialog_str_read_from_console_4(PrivConsts) :-

 

 

 

 

 

write("

****************************

 

"),

nl,

write("

*

PERMITTIVITIES

 

*

 

"),

nl,

write("

****************************

 

"),

nl,

write("

*

1. Set ES (E11S, E33S)

*

 

"),

nl,

write("

****************************

 

"),

nl,

write("

*

2. Set ET (E11T, E33T)

*

 

"),

nl,

write("

****************************

 

"),

nl,

write("

*

0. Close

 

*

 

"),

nl,

write("

****************************

 

"),

nl,

read_variant(N3, 1, 2, 0), clearwindow(),

 

 

 

 

 

dialog_str_set_permittivities_from_console(N3, PrivConsts), clearwindow().

 

 

read_real_greater_0(D) :-

 

 

 

 

 

 

 

readreal(A), A > 0, !, D = A;

 

 

 

 

 

 

nl, write("

********** SHOULD BE GREATER THAN 0 **********

 

"), nl,

write("

 

real>"), read_real_greater_0(D).

 

 

read_variant(N, From, To, ErrorCode) :-

 

 

 

 

 

write("

 

int>"),

 

 

 

 

 

readint(C), choose_variant(N, C, From, To, ErrorCode).

 

 

 

 

 

choose_variant(N, C, From, To, ErrorCode) :-

 

 

 

 

 

bound(ErrorCode), C = ErrorCode, !, fail;

 

 

 

 

 

From <= C, C <= To, N = C, !;

 

 

 

 

 

 

write("

********** TRY AGAIN **********

 

"),

nl,

write("

 

int>"), readint(D), choose_variant(N, D, From, To, ErrorCode).

dialog_str_set_elastic_constants_from_console(N, pcl(C11E, C12E, C13E, C33E, C44E, _, _, _,

_, _, N, _, _)) :-

6

pre_dialog_str_set_elastic_constants_from_console(N, C11E, C12E, C13E, C33E, C44E). pre_dialog_str_set_elastic_constants_from_console(N, C11E, C12E, C13E, C33E, C44E) :-

N = 1, !, enter_elastic_constants(C11E, C12E, C13E, C33E, C44E, "C11E", "C12E", "C13E", "C33E", "C44E");

N = 2, !, enter_elastic_constants(C11E, C12E, C13E, C33E, C44E, "C11D", "C12D", "C13D", "C33D", "C44D"); N = 3, !, enter_elastic_constants(C11E, MC12E, MC13E, C33E, C44E, "S11E", "-S12E", "-S13E", "S33E",

"S44E"),

C12E = -MC12E, C13E = -MC13E;

N = 4, !, enter_elastic_constants(C11E, MC12E, MC13E, C33E, C44E, "S11D", "-S12D", "-S13D", "S33D", "S44D"),

C12E = -MC12E, C13E = -MC13E.

enter_elastic_constants(C11E, C12E, C13E, C33E, C44E, C11E_STR, C12E_STR, C13E_STR, C33E_STR, C44E_STR) :-

write("

**********************************************

"), nl,

write("

*

ELASTIC CONSTANTS

*

"),

nl,

write("

**********************************************

"),

nl,

write("

", C11E_STR, " real>"), read_real_greater_0(C11E),

write("

", C12E_STR, " real>"), read_real_greater_0(C12E),

write("

", C13E_STR, " real>"), read_real_greater_0(C13E),

write("

", C33E_STR, "

real>"),

read_real_greater_0(C33E),

write("

", C44E_STR, "

real>"),

read_real_greater_0(C44E).

dialog_str_set_piezoelectric_constants_from_console(N, pcl(_, _, _, _, _, E31, E33, E15, _, _, _, N, _)) :- pre_dialog_str_set_piezoelectric_constants_from_console(N, E31, E33, E15).

pre_dialog_str_set_piezoelectric_constants_from_console(N, E31, E33, E15) :-

N = 1, !, enter_piezoelectric_constants(ME31, E33, E15, "-E31", "E33", "E15"), E31

= -ME31;

N = 2, !, enter_piezoelectric_constants(ME31, E33, E15, "-D31", "D33", "D15"), E31

= -ME31;

N

=

3, !, enter_piezoelectric_constants(ME31,

E33,

E15,

"-H31",

"H33",

"H15"),

E31

= -ME31;

N

=

4, !, enter_piezoelectric_constants(ME31,

E33,

E15,

"-G31",

"G33",

"G15"),

E31

= -ME31.

enter_piezoelectric_constants(E31, E33, E15, E31_STR, E33_STR, E15_STR) :-

 

 

write("

**********************************************

"),

nl,

write("

*

PIEZOELECTRIC CONSTANTS

*

"),

nl,

write("

**********************************************

"),

nl,

write("

 

", E31_STR, " real>"), read_real_greater_0(E31),

 

 

write("

 

", E33_STR, " real>"), read_real_greater_0(E33),

 

 

write("

 

", E15_STR, " real>"), read_real_greater_0(E15).

 

 

dialog_str_set_permittivities_from_console(N, pcl(_, _, _, _, _, _, _, _, E11S, E33S, _, _,

N)) :-

pre_dialog_str_set_permittivities_from_console(N, E11S, E33S).

 

 

 

pre_dialog_str_set_permittivities_from_console(N, E11S, E33S) :-

 

 

 

N = 1, !, enter_permittivities(E11S, E33S, "E11S", "E33S");

 

 

 

N = 2, !, enter_permittivities(E11S, E33S, "E11T", "E33T").

 

 

 

enter_permittivities(E11S, E33S, E11S_STR, E33S_STR) :-

 

 

 

 

write("

**********************************************

"),

nl,

write("

*

 

PERMITTIVITIES

 

*

"),

nl,

write("

**********************************************

"),

nl,

write("

 

", E11S_STR, " real>"), read_real_greater_0(E11S),

 

 

write("

 

", E33S_STR, " real>"), read_real_greater_0(E33S).

 

 

dialog_str_delete_from_database_by_name() :-

 

 

 

 

findall(Density, piezomaterial(_, _, _, Density), DensityList), DensityList = [],

 

 

write("

 

***********************

 

"),

nl,

write("

 

*

NO DATA!

*

 

"),

nl,

write("

 

***********************

 

"),

nl,

write("

 

 

any>"), readln(_);

 

 

 

write("

*************************************

"),

nl,

write("

*

NAME OF PIEZOMATERIAL TO REMOVE

*

"),

nl,

write("

*************************************

"),

nl,

write("

 

 

str>"), readln(Name),

 

 

 

retract(piezomaterial(Name, _, _, _)), !,

 

 

 

 

write("

 

***********************

 

"),

nl,

write("

 

*

MATERIAL DELETED!

*

 

"),

nl,

write("

 

***********************

 

"),

nl,

write("

 

 

any>"), readln(_);

 

 

 

write("

 

*************************

 

"),

nl,

write("

 

*

MATERIAL NOT FOUND!

*

 

"),

nl,

write("

 

*************************

 

"),

nl,

write("

 

 

any>"), readln(_).

 

 

 

dialog_str_clear_database() :-

 

 

 

 

 

 

findall(Density, piezomaterial(_, _, _, Density), DensityList), DensityList = [],

 

 

write("

 

***********************

 

"),

nl,

write("

 

*

NO DATA!

*

 

"),

nl,

write("

 

***********************

 

"),

nl,

write("

 

 

any>"), readln(_);

 

 

 

write("

**************************************

"),

nl,

write("

*

ARE YOU SURE TO DELETE ALL DATA?

*

"),

nl,

write("

**************************************

"),

nl,

write("

 

 

[y/n]>"), readln(X), X = "y", !,

 

 

not(clear_database()),

 

 

 

 

 

 

 

write("

 

 

*******************

 

 

"),

nl,

write("

 

 

* DATA DELETED! *

 

 

"),

nl,

write("

 

 

*******************

 

 

"),

nl,

write("

 

 

any>"), readln(_).

 

 

 

clear_database() :-

 

 

 

 

 

 

 

retract(piezomaterial(_, _, _, _)), fail.

 

 

 

 

dialog_str_show_data() :-

 

 

 

 

 

 

 

findall(Name, piezomaterial(Name, _, _, _), Names),

 

 

 

 

findall(Source, piezomaterial(_, Source, _, _), Sources),

 

 

 

findall(Consts, piezomaterial(_, _, Consts, _), ConstsList),

 

 

 

findall(Density, piezomaterial(_, _, _, Density), Densitys), not(Densitys = []), !,

 

 

print_enter_rows(Names, Sources, ConstsList, Densitys);

 

 

 

 

write("

 

***********************

 

"),

nl,

write("

 

*

NO DATA!

*

 

"),

nl,

write("

 

***********************

 

"),

nl,

write("

 

 

any>"), readln(_).

 

 

 

print_enter_rows([], [], [], []) :-

 

 

 

 

 

write("

 

***********************

 

"),

nl,

write("

 

*

DONE!

*

 

"),

nl,

7

write("

***********************

"), nl,

write("

any>"), readln(_).

 

print_enter_rows([Name|NT], [Source|ST], [Consts|CT], [Density|DT]) :-

 

clearwindow(),

 

 

write("*****************************************************************************"), nl, write("* Name: ", Name), nl,

write("* Source: ", Source), nl, write("* Density: ", Density), nl, print_format_consts(Consts),

write("*****************************************************************************"), nl,

write("

 

next>"), readln(C), read_cmd(Name, Source, Consts, Density, C),

print_enter_rows(NT, ST, CT, DT).

 

 

 

 

read_cmd(Name, Source, Consts, Density, C) :-

 

 

C <> "delete", C <> "edit", C <> "close", !;

 

 

C = "close", !, fail;

 

 

 

 

C = "delete", retract(piezomaterial(Name, Source, Consts, Density)), !,

 

write("

***********************

"), nl,

write("

*

MATERIAL DELETED!

*

"), nl,

write("

***********************

"), nl,

write("

 

any>"), readln(_);

 

C = "edit", !, material_edit(Name, Source, Consts, Density, _, _, _, _);

 

write("

*************************

"), nl,

write("

*

MATERIAL NOT FOUND!

*

"), nl,

write("

*************************

"), nl,

write("

 

any>"), readln(_).

 

material_edit(Name, Source, Consts, Density, NewName, NewSource, NewConsts, NewDensity) :-

clearwindow(),

 

 

 

 

write("

***********************

"), nl,

write("

*

EDIT MATERIAL

*

"), nl,

write("

***********************

"), nl,

write("

Name: ", Name), nl,

 

 

write("

Source: ", Source), nl,

 

write("

***********************

"), nl,

write("

*

1. Edit name

*

"), nl,

write("

***********************

"), nl,

write("

*

2. Edit source

*

"), nl,

write("

***********************

"), nl,

write("

*

3. Edit density

*

"), nl,

write("

***********************

"), nl,

write("

*

4. Edit constants

*

"), nl,

write("

***********************

"), nl,

write("

*

0. Close

*

"), nl,

write("

***********************

"), nl,

read_variant(N, 1, 4, 0),

 

 

 

 

choose_edit(N, Name, Source, Consts, Density, NewName, NewSource, NewConsts, NewDensity),

material_edit(NewName, NewSource, NewConsts, NewDensity, _, _, _, _), !; !.

 

choose_edit(N, Name, Source, Consts, Density, NewName, NewSource, NewConsts, NewDensity) :-

N = 0, !, fail;

 

 

 

 

N = 1, !,

 

 

 

 

write("

***********************

"), nl,

write("

*

EDIT NAME

*

"), nl,

write("

***********************

"), nl,

write("

 

str>"), readln(Nm), Nm <> "", clearwindow(),

 

NewName = Nm, NewSource = Source, NewConsts = Consts, NewDensity = Density, retract(piezomaterial(Name, Source, Consts, Density)), asserta(piezomaterial(NewName, NewSource, NewConsts, NewDensity)), material_edited();

N = 2, !,

 

 

 

 

 

write("

***********************

"), nl,

write("

*

EDIT SOURCE

*

"),

nl,

write("

***********************

"),

nl,

write("

 

str>"), readln(S), S <> "", clearwindow(),

 

 

NewName = Name, NewSource = S, NewConsts = Consts, NewDensity = Density, retract(piezomaterial(Name, Source, Consts, Density)), asserta(piezomaterial(NewName, NewSource, NewConsts, NewDensity)), material_edited();

N = 3, !,

 

 

 

 

write("

***********************

"), nl,

write("

*

EDIT DENSITY

*

"), nl,

write("

***********************

"), nl,

write("

 

str>"), read_real_greater_0(D), clearwindow(),

NewName = Name, NewSource = Source, NewConsts = Consts, NewDensity = D, retract(piezomaterial(Name, Source, Consts, Density)), asserta(piezomaterial(NewName, NewSource, NewConsts, NewDensity)), material_edited(); N = 4, !,

dialog_str_read_from_console_2(PrivNewConsts), dialog_str_read_from_console_3(PrivNewConsts), dialog_str_read_from_console_4(PrivNewConsts), get_constants(PrivNewConsts, CS),

NewName = Name, NewSource = Source, NewConsts = CS, NewDensity = Density, retract(piezomaterial(Name, Source, Consts, Density)), asserta(piezomaterial(NewName, NewSource, NewConsts, NewDensity)), material_edited().

material_edited() :-

 

 

 

 

write("

***********************

"), nl,

write("

* MATERIAL EDITED

*

"),

nl,

write("

***********************

"),

nl,

write("

any>"), readln(_).

 

 

print_format_consts(cl(C11E, C12E, C13E, C33E, C44E, C11D, C12D, C13D, C33D, C44D, S11E, S12E, S13E, S33E, S44E, S11D, S12D, S13D, S33D, S44D, E31, E33, E15, D31, D33, D15, H31, H33, H15, G31, G33, G15, E11S, E33S, E11T, E33T)) :-

writef("* C11E: %6.3f\tC11D: %6.3f\tS11E: %6.3f\tS11D: %6.3f\t", C11E, C11D, S11E, S11D), nl, writef("* C12E: %6.3f\tC12D: %6.3f\tS12E: %6.3f\tS12D: %6.3f\t", C12E, C12D, S12E, S12D), nl, writef("* C13E: %6.3f\tC13D: %6.3f\tS13E: %6.3f\tS13D: %6.3f\t", C13E, C13D, S13E, S13D), nl, writef("* C33E: %6.3f\tC33D: %6.3f\tS33E: %6.3f\tS33D: %6.3f\t", C33E, C33D, S33E, S33D), nl, writef("* C44E: %6.3f\tC44D: %6.3f\tS44E: %6.3f\tS44D: %6.3f\t", C44E, C44D, S44E, S44D), nl,

8

writef("* E31: %6.3f\tD31: %6.3f\tH31: %6.4f\tG31: %6.6f\t", E31, D31, H31, G31), nl, writef("* E33: %6.3f\tD33: %6.3f\tH33: %6.4f\tG33: %6.6f\t", E33, D33, H33, G33), nl, writef("* E15: %6.3f\tD15: %6.3f\tH15: %6.4f\tG15: %6.6f\t", E15, D15, H15, G15), nl, writef("* E11S: %7.3f\tE11T: %7.3f", E11S, E11T), nl,

writef("* E33S: %7.3f\tE33T: %7.3f", E33S, E33T), nl.

 

 

dialog_str_save_into_file() :-

 

 

 

 

findall(Density, piezomaterial(_, _, _, Density), DensityList), DensityList = [], !,

 

write("

***********************

"), nl,

write("

*

NO DATA!

*

"), nl,

write("

***********************

"), nl,

write("

 

any>"), readln(_);

 

write("

****************************

"), nl,

write("

*

ENTER FILE NAME

*

"), nl,

write("

****************************

"), nl,

write("

 

string>"), readln(Filename),

 

openwrite(datafile, Filename), writedevice(datafile), print_database(),

 

closefile(datafile), writedevice(screen),

 

 

write("

***********************

"), nl,

write("

*

DONE!

*

"), nl,

write("

***********************

"), nl,

write("

 

any>"), readln(_).

 

print_database() :-

 

 

 

 

findall(Name, piezomaterial(Name, _, _, _), Names), findall(Source, piezomaterial(_, Source, _, _), Sources), findall(Consts, piezomaterial(_, _, Consts, _), ConstsList), findall(Density, piezomaterial(_, _, _, Density), Densitys), print_database(Names, Sources, ConstsList, Densitys); writedevice(screen).

print_database([], [], [], []) :- !.

print_database([Name|NT], [Source|ST], [Consts|CT], [Density|DT]) :-

write(Name, ";", Source, ";", Density, ";"), print_consts(Consts), nl, print_database(NT, ST, CT, DT). print_consts(cl(C11E, C12E, C13E, C33E, C44E, C11D, C12D, C13D, C33D, C44D, S11E, S12E, S13E, S33E, S44E, S11D, S12D, S13D, S33D, S44D, E31, E33, E15, D31, D33, D15, H31, H33, H15, G31, G33, G15, E11S, E33S, E11T,

E33T)) :-

write(C11E, ";", C12E, ";", C13E, ";", C33E, ";", C44E, ";", C11D, ";", C12D, ";", C13D, ";", C33D, ";", C44D, ";", S11E, ";", S12E, ";", S13E, ";", S33E, ";"), write(S44E, ";", S11D, ";", S12D, ";", S13D, ";", S33D, ";", S44D, ";", E31, ";", E33, ";", E15, ";", D31, ";", D33, ";", D15, ";", H31, ";", H33, ";", H15,

";", G31, ";", G33, ";", G15, ";", E11S, ";", E33S, ";", E11T, ";", E33T). % Алгоритм, переписанный с программы на Pascal if_x_equals_0_then_1_else_x(T, Temp) :-

abs(T) <= 0, Temp = 1.0, !; Temp = T.

get_ce(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL2_C11E, CL2_C12E, CL2_C13E, CL2_C33E, CL2_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T)) :-

RC = 2, Re = 1, Rs = 1, !,

CL2_C11E = CL1_C11D - CL1_H31 * CL1_E31,

CL2_C12E = CL1_C12D - CL1_H31 * CL1_E31,

CL2_C13E = CL1_C13D - CL1_H31 * CL1_E33,

CL2_C33E = CL1_C33D - CL1_H33 * CL1_E33,

CL2_C44E = CL1_C44D - CL1_H15 * CL1_E15; RC = 1, Re = 3, Rs = 1, !,

CL2_C11E = CL1_C11D - CL1_H31 * CL1_H31 / CL1_E33S,

CL2_C12E = CL1_C12D - CL1_H31 * CL1_H31 / CL1_E33S,

CL2_C13E = CL1_C13D - CL1_H31 * CL1_H33 / CL1_E33S,

CL2_C33E = CL1_C33D - CL1_H33 * CL1_H33 / CL1_E33S,

CL2_C44E = CL1_C44D - CL1_H15 * CL1_H15 / CL1_E11S; RC = 2, Re = 3, Rs = 2, !,

T1 = CL1_S33E * (CL1_S11E + CL1_S12E) - 2 * CL1_S13E * CL1_S13E, T2 = (CL1_S11E - CL1_S12E) * T1,

if_x_equals_0_then_1_else_x(T1, Temp1), if_x_equals_0_then_1_else_x(T2, Temp2), CL2_C11E = (CL1_S11E * CL1_S33E - CL1_S13E * CL1_S13E) / Temp2,

CL2_C12E = (CL1_S13E * CL1_S13E - CL1_S12E * CL1_S33E) / Temp2, CL2_C13E = -CL1_S13E / Temp1,

CL2_C33E = (CL1_S11E + CL1_S12E) / Temp1, CL2_C44E = 1.0 / CL1_S44E;

CL2_C11E = CL1_C11E, CL2_C12E = CL1_C12E, CL2_C13E = CL1_C13E, CL2_C33E = CL1_C33E, CL2_C44E = CL1_C44E. get_cd(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D,

CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33,

CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL2_C11D, CL2_C12D, CL2_C13D, CL2_C33D, CL2_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T)) :-

RC = 1, Re = 1, Rs = 1, !,

CL2_C11D = CL1_C11E + CL1_E31 * CL1_E31 / CL1_E33S,

CL2_C12D = CL1_C12E + CL1_E31 * CL1_E31 / CL1_E33S,

CL2_C13D = CL1_C13E + CL1_E31 * CL1_E33 / CL1_E33S,

CL2_C33D = CL1_C33E + CL1_E33 * CL1_E33 / CL1_E33S,

CL2_C44D = CL1_C44E + CL1_E15 * CL1_E15 / CL1_E11S;

RC = 1, Re = 3, Rs = 1, !,

CL2_C11D = CL1_C11E + CL1_H31 * CL1_H31 / CL1_E33S,

CL2_C12D = CL1_C12E + CL1_H31 * CL1_H31 / CL1_E33S,

CL2_C13D = CL1_C13E + CL1_H31 * CL1_H33 / CL1_E33S,

CL2_C33D = CL1_C33E + CL1_H33 * CL1_H33 / CL1_E33S,

CL2_C44D = CL1_C44E + CL1_H15 * CL1_H15 / CL1_E11S; RC = 1, Re = 3, Rs = 2, !,

CL2_C11D = CL1_C11E + CL1_H31 * CL1_E31,

CL2_C12D = CL1_C12E + CL1_H31 * CL1_E31,

CL2_C13D = CL1_C13E + CL1_H31 * CL1_E33,

9

CL2_C33D = CL1_C33E + CL1_H33 * CL1_E33,

CL2_C44D = CL1_C44E + CL1_H15 * CL1_E15; RC = 0, Re = 0, Rs = 0, !,

T1 = CL1_S33D * (CL1_S11D + CL1_S12D) - 2 * CL1_S13D * CL1_S13D, T2 = (CL1_S11D - CL1_S12D) * T1,

if_x_equals_0_then_1_else_x(T1, Temp1), if_x_equals_0_then_1_else_x(T2, Temp2), CL2_C11D = (CL1_S11D * CL1_S33D - CL1_S13D * CL1_S13D) / Temp2,

CL2_C12D = (CL1_S13D * CL1_S13D - CL1_S12D * CL1_S33D) / Temp2, CL2_C13D = -CL1_S13D / Temp1,

CL2_C33D = (CL1_S11D + CL1_S12D) / Temp1, CL2_C44D = 1.0 / CL1_S44D;

CL2_C11D = CL1_C11D, CL2_C12D = CL1_C12D, CL2_C13D = CL1_C13D, CL2_C33D = CL1_C33D, CL2_C44D = CL1_C44D. get_se(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D,

CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL2_S11E, CL2_S12E, CL2_S13E, CL2_S33E, CL2_S44E, CL1_S11D,

CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T)) :-

RC = 1, Re = 1, Rs = 1, !,

T1 = CL1_C33E * (CL1_C11E + CL1_C12E) - 2 * CL1_C13E * CL1_C13E,

T2 = (CL1_C11E - CL1_C12E) * T1,

if_x_equals_0_then_1_else_x(T1, Temp1), if_x_equals_0_then_1_else_x(T2, Temp2),

CL2_S11E = (CL1_C11E * CL1_C33E - CL1_C13E * CL1_C13E) / Temp2,

CL2_S12E = (CL1_C13E * CL1_C13E - CL1_C12E * CL1_C33E) / Temp2, CL2_S13E = -CL1_C13E / Temp1,

CL2_S33E = (CL1_C11E + CL1_C12E) / Temp1,

CL2_S44E = 1.0 / CL1_C44E;

RC = 2, Re = 4, Rs = 1, !,

T1 = CL1_C33E * (CL1_C11E + CL1_C12E) - 2 * CL1_C13E * CL1_C13E, T2 = (CL1_C11E - CL1_C12E) * T1,

if_x_equals_0_then_1_else_x(T1, Temp1), if_x_equals_0_then_1_else_x(T2, Temp2), CL2_S11E = (CL1_C11E * CL1_C33E - CL1_C13E * CL1_C13E) / Temp2,

CL2_S12E = (CL1_C13E * CL1_C13E - CL1_C12E * CL1_C33E) / Temp2, CL2_S13E = -CL1_C13E / Temp1,

CL2_S33E = (CL1_C11E + CL1_C12E) / Temp1, CL2_S44E = 1.0 / CL1_C44E;

RC = 2, Re = 3, Rs = 2, !,

CL2_S11E = CL1_S11D + CL1_D31 * CL1_G31,

CL2_S12E = CL1_S12D + CL1_D31 * CL1_G31,

CL2_S13E = CL1_S13D + CL1_D31 * CL1_G33,

CL2_S33E = CL1_S33D + CL1_D33 * CL1_G33,

CL2_S44E = CL1_S44D + CL1_D15 * CL1_G15;

CL2_S11E = CL1_S11E, CL2_S12E = CL1_S12E, CL2_S13E = CL1_S13E, CL2_S33E = CL1_S33E, CL2_S44E = CL1_S44E. get_sd(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL2_S11D,

CL2_S12D, CL2_S13D, CL2_S33D, CL2_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T)) :-

RC = 1, Re = 1, Rs = 1, !,

T1 = CL1_C33D * (CL1_C11D + CL1_C12D) - 2 * CL1_C13D * CL1_C13D, T2 = (CL1_C11D - CL1_C12D) * T1,

if_x_equals_0_then_1_else_x(T1, Temp1), if_x_equals_0_then_1_else_x(T2, Temp2), CL2_S11D = (CL1_C11D * CL1_C33D - CL1_C13D * CL1_C13D) / Temp2,

CL2_S12D = (CL1_C13D * CL1_C13D - CL1_C12D * CL1_C33D) / Temp2, CL2_S13D = -CL1_C13D / Temp1,

CL2_S33D = (CL1_C11D + CL1_C12D) / Temp1,

CL2_S44D = 1.0 / CL1_C44D;

CL2_S11D = CL1_S11D, CL2_S12D = CL1_S12D, CL2_S13D = CL1_S13D, CL2_S33D = CL1_S33D, CL2_S44D = CL1_S44D. get_e(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D, CL2_E31, CL2_E33, CL2_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T)) :-

RC = 1, Re = 3, Rs = 1, !, CL2_E31 = CL1_H31 * CL1_E33S, CL2_E33 = CL1_H33 * CL1_E33S,

CL2_E15 = CL1_H15 * CL1_E11S; RC = 1, Re = 3, Rs = 2, !,

CL2_E31 = CL1_D31 * (CL1_C11E + CL1_C12E) + CL1_D33 * CL1_C13E, CL2_E33 = 2 * CL1_D31 * CL1_C13E + CL1_D33 * CL1_C33E,

CL2_E15 = CL1_D15 * CL1_C44E; RC = 2, Re = 2, Rs = 1, !,

M = (2 * CL1_D31 * CL1_C13D + CL1_D33 * CL1_C33D) / (CL1_D31 * (CL1_C11D + CL1_C12D) + CL1_D33 * CL1_C13D),

A1 = 2 * CL1_D31 / CL1_E33S + CL1_D33 * M / CL1_E33S,

C1 = -CL1_D31 * (CL1_C11D + CL1_C12D) - CL1_D33 * CL1_C13D,

D1 = sqrt(1 - 4 * A1 * C1), CL2_E31 = (D1 - 1) / (2 * A1),

CL2_E33 = M * CL2_E31,

A2 = CL1_D15 / CL1_E11S,

C2 = -CL1_D15 * CL1_C44D, D2 = sqrt(1 - 4 * A2 * C2),

CL2_E15 = (D2 - 1) / (2 * A2);

CL2_E31 = CL1_E31, CL2_E33 = CL1_E33, CL2_E15 = CL1_E15.

get_d(RC, Re, Rs, cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D, CL1_C12D, CL1_C13D, CL1_C33D, CL1_C44D, CL1_S11E, CL1_S12E, CL1_S13E, CL1_S33E, CL1_S44E, CL1_S11D, CL1_S12D, CL1_S13D, CL1_S33D, CL1_S44D,

CL1_E31, CL1_E33, CL1_E15, CL1_D31, CL1_D33, CL1_D15, CL1_H31, CL1_H33, CL1_H15, CL1_G31, CL1_G33, CL1_G15, CL1_E11S, CL1_E33S, CL1_E11T, CL1_E33T), cl(CL1_C11E, CL1_C12E, CL1_C13E, CL1_C33E, CL1_C44E, CL1_C11D,

10

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.