This repository has been archived by the owner on Jan 23, 2025. It is now read-only.
forked from brstu/TMAU-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
2,455 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<p align="center"> Министерство образования Республики Беларусь</p> | ||
<p align="center">Учреждение образования</p> | ||
<p align="center">“Брестский Государственный технический университет”</p> | ||
<p align="center">Кафедра ИИТ</p> | ||
<br><br><br><br><br><br><br> | ||
<p align="center">Лабораторная работа №1</p> | ||
<p align="center">По дисциплине “Теория и методы автоматического управления”</p> | ||
<p align="center">Тема: “Моделирования температуры объекта”</p> | ||
<br><br><br><br><br> | ||
<p align="right">Выполнил:</p> | ||
<p align="right">Студент 3 курса</p> | ||
<p align="right">Группы АС-63</p> | ||
<p align="right">Поплавский В. В.</p> | ||
<p align="right">Проверила:</p> | ||
<p align="right">Ситковец Я. С.</p> | ||
<br><br><br><br><br> | ||
<p align="center">Брест-2024</p> | ||
|
||
--- | ||
|
||
**Задание**: | ||
Задание на английском языке: | ||
|
||
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 (**С++**), which simulates this object temperature. | ||
|
||
Вывод программы(для выполнения программы необходимо ввести исходные данные): | ||
|
||
``` bash | ||
Input a,b,c,d, current y, current u, n | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
4 | ||
linear | ||
takt-1 23 | ||
takt-2 41 | ||
takt-3 59 | ||
takt-4 77 | ||
nonlinear | ||
takt-1 231 | ||
takt-2 693 | ||
takt-3 2079 | ||
takt-4 6237 | ||
``` | ||
......... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(Task01) | ||
|
||
add_executable(Task01_18 Source.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
|
||
using namespace std; | ||
|
||
double temperature1(double a,double b,double c, double d, double yCurr, double uCur); | ||
double temperature2(double a, double b, double yCurr, double uCurr); | ||
|
||
int main() { | ||
double a, b, c, d, yCurr, uCurr,n,yNext; | ||
|
||
cout << "Input a,b,c,d, current y, current u, n\n"; | ||
cin >> a >> b >> c >> d >> yCurr >> uCurr>>n; | ||
cout << "linear\n"; | ||
for (int i = 0; i < n; i++) { | ||
yNext = temperature1(a, b, c, d, yCurr, uCurr); | ||
cout <<"takt-"<<i+1<<" "<< yNext << '\n'; | ||
yCurr = yNext; | ||
} | ||
cout << "nonlinear\n"; | ||
for (int i = 0; i < n; i++) { | ||
yNext = temperature2(a, b, yCurr, uCurr); | ||
cout << "takt-" << i + 1 << " " << yNext<<'\n'; | ||
yCurr = yNext; | ||
} | ||
} | ||
|
||
double temperature1(double a, double b, double c, double d, double yCurr, double uCurr) { | ||
double yPrev, uPrev, yNext; | ||
yPrev = uPrev = 0; | ||
yNext = a * yCurr - b * yPrev*yPrev + c * uCurr + d * sin(uPrev); | ||
return yNext; | ||
} | ||
|
||
double temperature2(double a,double b, double yCurr, double uCurr) { | ||
double yNext; | ||
yNext = a * yCurr + b * yCurr; | ||
return yNext; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Отчёт | ||
|
||
## Об отчёте | ||
|
||
Отчет содержит информацию о программе, моделирующей ПИД-регулятор. В качестве объекта управления используется математическая модель температуры, а также классы линейной и нелинейной моделей. | ||
## Классы | ||
|
||
### Класс `Model` | ||
|
||
Это абстрактный класс для математических моделей, от которого будут наследоваться последующие модели. Он включает виртуальную функцию temperature_sim, которую необходимо реализовать в производных классах. Эта функция принимает текущий выход, предыдущий выход и входной сигнал, возвращая вычисленную модель результата. | ||
|
||
### Класс `Linear_Model` | ||
|
||
Класс Linear_Model, который наследует Model, представляет собой линейную модель. Он включает два коэффициента: alpha и beta, используется для вычисления выходного значения формулы alpha * curr_temp + beta * contorl_var. | ||
|
||
### Класс `NonLinear_Model` | ||
|
||
Представляет нелинейную математическую модель. Данный класс наследуется от абстрактного класса Model и реализует его виртуальную функцию temperature_sim. Имеет четыре приватных переменных - alpha, beta, charlie и delta, которые используются в формуле для вычисления выходного значения модели. Конструктор класса принимает значения коэффициентов alpha, beta, charlie и delta и инициализирует соответствующие приватные переменные по формуле alpha * curr_temp + beta * prev_temp^2 + charlie * control_var + delta * sin(prev_control_var) для вычисления выходного значения на основе текущих и выходных значений, а также входного значения. | ||
|
||
### Класс `PID_regulator` | ||
|
||
Класс PID_Regulator реализует работы ПИД-регулятора. Он включает пять коэффициентов: K, T, TD, T0, model_lifetime, Uk. Функция regulate принимает целевую температуру, начальную температуру, а также тип модели для моделирования и вычисляет управляющий сигнал. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<p align="center"> Министерство образования Республики Беларусь</p> | ||
<p align="center">Учреждение образования</p> | ||
<p align="center">“Брестский Государственный технический университет”</p> | ||
<p align="center">Кафедра ИИТ</p> | ||
<br><br><br><br><br><br><br> | ||
<p align="center">Лабораторная работа №2</p> | ||
<p align="center">По дисциплине “Теория и методы автоматического управления”</p> | ||
<p align="center">Тема: “Изучение ПИД-регуляторов”</p> | ||
<br><br><br><br><br> | ||
<p align="right">Выполнил:</p> | ||
<p align="right">Студент 3 курса</p> | ||
<p align="right">Группы АС-63</p> | ||
<p align="right">Карпеш Н.П.</p> | ||
<p align="right">Проверил:</p> | ||
<p align="right">Ситковец Я. С.</p> | ||
<br><br><br><br><br> | ||
<p align="center">Брест 2024</p> | ||
|
||
--- | ||
|
||
## Цель работы: | ||
Написать программу на языке C++, которая моделирует работу ПИД-регулятора. В качестве объекта управления: математическая модель, которая была получена в прошлой работе. Реализуйте программу с использованием объектно-ориентированного подхода, включая не менее трех классов с использованием наследования. | ||
## Ход работы | ||
Была реализована программа на языке С++, моделирующая работу ПИД-регулятор. Для документирования программы был использован инструмент Doxygen, затем документация была преобразована в Markdown (.md). Результаты работы программы были записаны в файл results.txt. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
----------Линейная модель. Введите параметры---------- | ||
Введите параметр alpha: 1 | ||
Введите параметр beta: 2 | ||
----------Нелинейная модель. Введите параметры---------- | ||
Введите параметр alpha: 1 | ||
Введите параметр beta: 2 | ||
Введите параметр charlie: 3 | ||
Введите параметр delta: 4 | ||
----------Линейная модель---------- | ||
Err = 7 Yt = 8.64 Uk = 1.82 | ||
Err = 3.36 Yt = 10.3872 Uk = 2.6936 | ||
Err = 1.6128 Yt = 11.2259 Uk = 3.11293 | ||
Err = 0.774144 Yt = 11.6284 Uk = 3.31421 | ||
Err = 0.371589 Yt = 11.8216 Uk = 3.41082 | ||
Err = 0.178363 Yt = 11.9144 Uk = 3.45719 | ||
Err = 0.0856141 Yt = 11.9589 Uk = 3.47945 | ||
Err = 0.0410948 Yt = 11.9803 Uk = 3.49014 | ||
Err = 0.0197255 Yt = 11.9905 Uk = 3.49527 | ||
Err = 0.00946824 Yt = 11.9955 Uk = 3.49773 | ||
Err = 0.00454475 Yt = 11.9978 Uk = 3.49891 | ||
Err = 0.00218148 Yt = 11.999 Uk = 3.49948 | ||
Err = 0.00104711 Yt = 11.9995 Uk = 3.49975 | ||
Err = 0.000502613 Yt = 11.9998 Uk = 3.49988 | ||
Err = 0.000241254 Yt = 11.9999 Uk = 3.49994 | ||
Err = 0.000115802 Yt = 11.9999 Uk = 3.49997 | ||
Err = 5.5585e-05 Yt = 12 Uk = 3.49999 | ||
Err = 2.66808e-05 Yt = 12 Uk = 3.49999 | ||
Err = 1.28068e-05 Yt = 12 Uk = 3.5 | ||
Err = 6.14726e-06 Yt = 12 Uk = 3.5 | ||
Err = 2.95068e-06 Yt = 12 Uk = 3.5 | ||
Err = 1.41633e-06 Yt = 12 Uk = 3.5 | ||
Err = 6.79838e-07 Yt = 12 Uk = 3.5 | ||
Err = 3.26322e-07 Yt = 12 Uk = 3.5 | ||
Err = 1.56635e-07 Yt = 12 Uk = 3.5 | ||
Err = 7.51846e-08 Yt = 12 Uk = 3.5 | ||
Err = 3.60886e-08 Yt = 12 Uk = 3.5 | ||
Err = 1.73225e-08 Yt = 12 Uk = 3.5 | ||
Err = 8.31482e-09 Yt = 12 Uk = 3.5 | ||
Err = 3.99111e-09 Yt = 12 Uk = 3.5 | ||
|
||
----------Нелинейная модель---------- | ||
Err = 7 Yt = 10.46 Uk = 1.82 | ||
Err = 1.54 Yt = 65.5376 Uk = 2.2204 | ||
Err = -53.5376 Yt = 23.0871 Uk = -11.6994 | ||
Err = -11.0871 Yt = 14.3034 Uk = -14.582 | ||
Err = -2.3034 Yt = 5.84656 Uk = -15.1809 | ||
Err = 6.15344 Yt = 12.245 Uk = -13.581 | ||
Err = -0.245003 Yt = 10.6686 Uk = -13.6447 | ||
Err = 1.33141 Yt = 11.5796 Uk = -13.2986 | ||
Err = 0.420441 Yt = 12.7582 Uk = -13.1893 | ||
Err = -0.758223 Yt = 12.5073 Uk = -13.3864 | ||
Err = -0.507315 Yt = 11.5205 Uk = -13.5183 | ||
Err = 0.479515 Yt = 11.561 Uk = -13.3936 | ||
Err = 0.438983 Yt = 12.2173 Uk = -13.2795 | ||
Err = -0.217266 Yt = 12.3753 Uk = -13.336 | ||
Err = -0.37532 Yt = 11.9159 Uk = -13.4336 | ||
Err = 0.0840626 Yt = 11.7149 Uk = -13.4117 | ||
Err = 0.28514 Yt = 11.9946 Uk = -13.3376 | ||
Err = 0.00544487 Yt = 12.2036 Uk = -13.3361 | ||
Err = -0.203596 Yt = 12.0489 Uk = -13.3891 | ||
Err = -0.0488545 Yt = 11.8627 Uk = -13.4018 | ||
Err = 0.137325 Yt = 11.9355 Uk = -13.3661 | ||
Err = 0.0645359 Yt = 12.0835 Uk = -13.3493 | ||
Err = -0.0834846 Yt = 12.0655 Uk = -13.371 | ||
Err = -0.0655433 Yt = 11.9535 Uk = -13.388 | ||
Err = 0.0464562 Yt = 11.9429 Uk = -13.376 | ||
Err = 0.0570634 Yt = 12.0206 Uk = -13.3611 | ||
Err = -0.0205607 Yt = 12.0458 Uk = -13.3665 | ||
Err = -0.0457768 Yt = 11.9951 Uk = -13.3784 | ||
Err = 0.00486618 Yt = 11.966 Uk = -13.3771 | ||
Err = 0.0340316 Yt = 11.996 Uk = -13.3683 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.0.0) | ||
project(Lab01) | ||
|
||
add_executable(task02_6309 main.cpp) |
Oops, something went wrong.