Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Lab4 #121

Merged
merged 44 commits into from
Jan 3, 2023
Merged

Lab4 #121

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bcff917
init
Sep 8, 2022
dc65484
pass lab1
Sep 16, 2022
3fc3196
pass lab1
Sep 16, 2022
1889085
Revert "pass lab1"
Sep 19, 2022
8edb121
Revert "pass lab1"
Sep 19, 2022
26dc8de
removed settings file vscode and reload the task1
Sep 19, 2022
c851b8e
make it better
Sep 22, 2022
8337800
add suport of code blocks
Sep 27, 2022
f6b3cf8
try to align the text
Sep 28, 2022
b71160f
delete one symbol
Sep 28, 2022
47a8719
fixed code block
Sep 28, 2022
aca5884
Merge branch 'brstu:main' into main
SenchaBrest Oct 10, 2022
48ca8e7
Merge branch 'brstu:main' into main
SenchaBrest Oct 20, 2022
7e7270c
lab2
Oct 20, 2022
25d2a19
yes! it works!
Oct 29, 2022
b9db885
marks2
Nov 3, 2022
d2bcd8e
del
Nov 3, 2022
34cdd51
Merge branch 'brstu:main' into main
SenchaBrest Nov 3, 2022
e6dc099
edit readme
Nov 3, 2022
3171774
try
Nov 3, 2022
c9e1fa3
Delete readme.md
idzm Nov 8, 2022
c78586d
Merge branch 'brstu:main' into main
SenchaBrest Nov 18, 2022
824d780
laba3 init
Nov 21, 2022
9922739
laba3 del
Nov 21, 2022
c3383ae
laba3 init
Nov 21, 2022
e3b1562
laba3 done
Nov 30, 2022
f59fd2c
Update lib.py
SenchaBrest Dec 1, 2022
39c83b9
Merge branch 'main' into main
SenchaBrest Dec 8, 2022
81e448c
Update lib.py
SenchaBrest Dec 8, 2022
da3ff52
Update export.py
SenchaBrest Dec 8, 2022
a69ef9f
Update alg_button_lib.py
SenchaBrest Dec 8, 2022
4e856b3
Update lib.py
SenchaBrest Dec 8, 2022
3d29da7
Update lib.py
SenchaBrest Dec 8, 2022
0c3018d
Merge branch 'main' into main
idzm Dec 12, 2022
b328afd
try to change virtual method
SenchaBrest Dec 14, 2022
0f8c3a5
Merge branch 'main' into main
SenchaBrest Dec 14, 2022
b0c5c74
Merge branch 'main' into main
idzm Dec 14, 2022
212e491
realize static method
SenchaBrest Dec 14, 2022
c6340ea
Update lib.py
SenchaBrest Dec 14, 2022
9682377
Merge branch 'main' into main
idzm Dec 19, 2022
4a594ab
Merge branch 'brstu:main' into main
SenchaBrest Dec 22, 2022
c691dea
lab4
Dec 24, 2022
3a0db8c
Revert "lab4"
Dec 24, 2022
013f77e
lab4
Dec 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pass lab1
  • Loading branch information
SenchaBrest committed Sep 16, 2022
commit dc65484a092058b2b815917e9975a3403fd91a8f
28 changes: 28 additions & 0 deletions trunk/ii02105/task_01/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
99 changes: 99 additions & 0 deletions trunk/ii02105/task_01/doc/report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Общее задание #
1. Написать отчет по выполненной лабораторной работе №1 в .md формате (readme.md) и с помощью запроса на внесение изменений (**pull request**) разместить его в следующем каталоге: **trunk\ii0xxyy\task_01\doc** (где **xx** - номер группы, **yy** - номер студента, например **ii02102**).
2. Исходный код написанной программы разместить в каталоге: **trunk\ii0xxyy\task_01\src**.

## Task 1. Modeling controlled object ##
Let's get some object to be controlled. We want to control its temperature, which can be described by this differential equation:

$$\Large\frac{dy(\tau)}{d\tau}=\frac{u(\tau)}{C}+\frac{Y_0-y(\tau)}{RC} $$ (1)

where $\tau$ – time; $y(\tau)$ – input temperature; $u(\tau)$ – input warm; $Y_0$ – room temperature; $C,RC$ – some constants.

After transformation we get these linear (2) and nonlinear (3) models:

$$\Large y_{\tau+1}=ay_{\tau}+bu_{\tau}$$ (2)
$$\Large y_{\tau+1}=ay_{\tau}-by_{\tau-1}^2+cu_{\tau}+d\sin(u_{\tau-1})$$ (3)

where $\tau$ – time discrete moments ($$1,2,3{\dots}n$$); $a,b,c,d$ – some constants.

Task is to write program (**Julia**), which simulates this object temperature.

---

# Выполнение задания #

Код программы:

function linear_model(a, b, y, u, i, t)
if i <= t
println(y)
linear_model(a, b, a*y + b*u, u, i + 1, t)
else
println("OFF")
end
end

function nonlinear_model(a, b, c, d, y, y_prev, u, u_prev, i, t)
if i == 1
println(y)
nonlinear_model(a, b, c, d,
a*y - b*y_prev^2 + c*0 + d*sin(0), y,
u, u,
i + 1, t)
elseif i <= t
println(y)
nonlinear_model(a, b, c, d,
a*y - b*y_prev^2 + c*u + d*sin(u_prev), y,
u, u,
i + 1, t)
else
println("OFF")
end
end

function main()
a = 0.5
b = 0.5
c = 0.5
d = 0.5
y = 0.0
u = 1.0
i = 0
t = 10
println("Linear Model")
linear_model(a, b, y, u, i, t)
println("Nonlinear Model")
nonlinear_model(a, b, c, d, y, y, u, u, i, t)

end

main()

Вывод программы:

Linear Model
0.0
0.5
0.75
0.875
0.9375
0.96875
0.984375
0.9921875
0.99609375
0.998046875
0.9990234375
OFF
Nonlinear Model
0.0
0.9207354924039483
0.4603677462019741
0.7270424420187648
1.178287482541788
1.2455838774265378
0.849346735359885
0.5696692622314266
0.8448751850864142
1.1809115507815064
1.1542842286073003
OFF
44 changes: 44 additions & 0 deletions trunk/ii02105/task_01/src/models.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function linear_model(a, b, y, u, i, t)
if i <= t
println(y)
linear_model(a, b, a*y + b*u, u, i + 1, t)
else
println("OFF")
end
end

function nonlinear_model(a, b, c, d, y, y_prev, u, u_prev, i, t)
if i == 1
println(y)
nonlinear_model(a, b, c, d,
a*y - b*y_prev^2 + c*0 + d*sin(0), y,
u, u,
i + 1, t)
elseif i <= t
println(y)
nonlinear_model(a, b, c, d,
a*y - b*y_prev^2 + c*u + d*sin(u_prev), y,
u, u,
i + 1, t)
else
println("OFF")
end
end

function main()
a = 0.5
b = 0.5
c = 0.5
d = 0.5
y = 0.0
u = 1.0
i = 0
t = 10
println("Linear Model")
linear_model(a, b, y, u, i, t)
println("Nonlinear Model")
nonlinear_model(a, b, c, d, y, y, u, u, i, t)

end

main()