Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

[task_03] Лабораторная 3 выполнена#360

Open
flikyy wants to merge 15 commits into
brstu:mainfrom
flikyy:task_03_ii02816
Open

[task_03] Лабораторная 3 выполнена#360
flikyy wants to merge 15 commits into
brstu:mainfrom
flikyy:task_03_ii02816

Conversation

@flikyy
Copy link
Copy Markdown
Contributor

@flikyy flikyy commented Dec 20, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 20, 2025 15:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 20, 2025

📌 Duplicate code detection tool report

The tool analyzed your source code and found the following degree of similarity between the files:

trunk/ii002713/task_03/doc/html/index.md

📄 trunk/ii002713/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 92.93
trunk/ii02816/task_03/api.md 92.93
trunk/ii02810/task_03/doc/pages/index.md 92.86
trunk/ii002826/task_03/doc/html/index.md 92.44
trunk/ii002717/task_01/src/main.cpp

📄 trunk/ii002717/task_01/src/main.cpp

File Similarity (%)
trunk/ii02717/task_02/src/main.cpp 93.36 ⚠️
trunk/ii002826/task_03/doc/html/index.md

📄 trunk/ii002826/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 94.14 ⚠️
trunk/ii02816/task_03/api.md 94.14 ⚠️
trunk/ii02817/task_03/doc/html/index.md 93.85 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 92.64
trunk/ii02823/task_03/doc/html/index.md 92.47
trunk/ii002713/task_03/doc/html/index.md 92.44
trunk/ii02818/task_03/doc/html/index.md 92.42
trunk/ii02701/task_03/doc/html/index.md

📄 trunk/ii02701/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02810/task_03/doc/pages/index.md 94.38 ⚠️
trunk/ii02801/task_03/api.md 92.92
trunk/ii02816/task_03/api.md 92.92
trunk/ii02812/task_03/doc/report/index.md 92.32
trunk/ii02707/task_04/doc/README.md

📄 trunk/ii02707/task_04/doc/README.md

File Similarity (%)
trunk/ii02817/task_04/doc/README.md 93.07 ⚠️
trunk/ii02707/task_05/doc/README.md

📄 trunk/ii02707/task_05/doc/README.md

File Similarity (%)
trunk/ii02719/task_05/doc/README.md 92.48
trunk/ii02717/task_02/src/main.cpp

📄 trunk/ii02717/task_02/src/main.cpp

File Similarity (%)
trunk/ii002717/task_01/src/main.cpp 93.36 ⚠️
trunk/ii02719/task_05/doc/README.md

📄 trunk/ii02719/task_05/doc/README.md

File Similarity (%)
trunk/ii02707/task_05/doc/README.md 92.48
trunk/ii02726/task_02/src/test.cpp

📄 trunk/ii02726/task_02/src/test.cpp

File Similarity (%)
trunk/ii02726/task_03/src/plant.cpp 92.42
trunk/ii02726/task_03/src/plant.cpp

📄 trunk/ii02726/task_03/src/plant.cpp

File Similarity (%)
trunk/ii02726/task_02/src/test.cpp 92.42
trunk/ii02801/task_03/api.md

📄 trunk/ii02801/task_03/api.md

File Similarity (%)
trunk/ii02816/task_03/api.md 100.0 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 94.91 ⚠️
trunk/ii02823/task_03/doc/html/index.md 94.22 ⚠️
trunk/ii002826/task_03/doc/html/index.md 94.14 ⚠️
trunk/ii002713/task_03/doc/html/index.md 92.93
trunk/ii02701/task_03/doc/html/index.md 92.92
trunk/ii02801/task_03/test/testlab_3.cpp

📄 trunk/ii02801/task_03/test/testlab_3.cpp

File Similarity (%)
trunk/ii02816/task_03/test/testlab_3.cpp 99.84 ⚠️
trunk/ii02804/task_03/doc/readme.md

📄 trunk/ii02804/task_03/doc/readme.md

File Similarity (%)
trunk/ii02812/task_03/doc/Readme.md 92.94
trunk/ii02810/task_02/doc/Readme.md

📄 trunk/ii02810/task_02/doc/Readme.md

File Similarity (%)
trunk/ii02810/task_02/test/Test.cpp 92.36
trunk/ii02810/task_02/test/Test.cpp

📄 trunk/ii02810/task_02/test/Test.cpp

File Similarity (%)
trunk/ii02810/task_02/doc/Readme.md 92.36
trunk/ii02810/task_03/doc/pages/index.md

📄 trunk/ii02810/task_03/doc/pages/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 94.91 ⚠️
trunk/ii02816/task_03/api.md 94.91 ⚠️
trunk/ii02701/task_03/doc/html/index.md 94.38 ⚠️
trunk/ii002713/task_03/doc/html/index.md 92.86
trunk/ii02823/task_03/doc/html/index.md 92.83
trunk/ii002826/task_03/doc/html/index.md 92.64
trunk/ii02812/task_03/doc/report/index.md 92.16
trunk/ii02810/task_05/doc/Readme.md

📄 trunk/ii02810/task_05/doc/Readme.md

File Similarity (%)
trunk/ii02810/task_06/doc/Readme.md 92.25
trunk/ii02810/task_06/doc/Readme.md

📄 trunk/ii02810/task_06/doc/Readme.md

File Similarity (%)
trunk/ii02810/task_05/doc/Readme.md 92.25
trunk/ii02812/task_03/doc/Readme.md

📄 trunk/ii02812/task_03/doc/Readme.md

File Similarity (%)
trunk/ii02804/task_03/doc/readme.md 92.94
trunk/ii02812/task_03/doc/report/index.md

📄 trunk/ii02812/task_03/doc/report/index.md

File Similarity (%)
trunk/ii02701/task_03/doc/html/index.md 92.32
trunk/ii02810/task_03/doc/pages/index.md 92.16
trunk/ii02816/task_03/api.md

📄 trunk/ii02816/task_03/api.md

File Similarity (%)
trunk/ii02801/task_03/api.md 100.0 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 94.91 ⚠️
trunk/ii02823/task_03/doc/html/index.md 94.22 ⚠️
trunk/ii002826/task_03/doc/html/index.md 94.14 ⚠️
trunk/ii002713/task_03/doc/html/index.md 92.93
trunk/ii02701/task_03/doc/html/index.md 92.92
trunk/ii02816/task_03/test/testlab_3.cpp

📄 trunk/ii02816/task_03/test/testlab_3.cpp

File Similarity (%)
trunk/ii02801/task_03/test/testlab_3.cpp 99.84 ⚠️
trunk/ii02817/task_03/doc/html/index.md

📄 trunk/ii02817/task_03/doc/html/index.md

File Similarity (%)
trunk/ii002826/task_03/doc/html/index.md 93.85 ⚠️
trunk/ii02818/task_03/doc/html/index.md 92.57
trunk/ii02817/task_04/doc/README.md

📄 trunk/ii02817/task_04/doc/README.md

File Similarity (%)
trunk/ii02707/task_04/doc/README.md 93.07 ⚠️
trunk/ii02818/task_03/doc/html/index.md

📄 trunk/ii02818/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02817/task_03/doc/html/index.md 92.57
trunk/ii002826/task_03/doc/html/index.md 92.42
trunk/ii02823/task_03/doc/html/index.md

📄 trunk/ii02823/task_03/doc/html/index.md

File Similarity (%)
trunk/ii02801/task_03/api.md 94.22 ⚠️
trunk/ii02816/task_03/api.md 94.22 ⚠️
trunk/ii02810/task_03/doc/pages/index.md 92.83
trunk/ii002826/task_03/doc/html/index.md 92.47

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements Laboratory Work #3, which includes a PID (Proportional-Integral-Derivative) controller simulation system with both linear and nonlinear process models. The implementation includes:

  • A discrete PID controller using a recurrent algorithm
  • Process models supporting both linear and nonlinear behavior
  • Unit tests using Google Test framework
  • Comprehensive documentation using Doxygen

Reviewed changes

Copilot reviewed 44 out of 68 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
trunk/ii02816/task_03/src/pid.h Header file defining the PIDController class with parameters K, T, Td, T0
trunk/ii02816/task_03/src/pid.cpp Implementation of PID controller calculation, reset, and coefficient retrieval
trunk/ii02816/task_03/src/mdl.h Header file for ProcessModel class supporting linear and nonlinear models
trunk/ii02816/task_03/src/mdl.cpp Implementation of process model equations
trunk/ii02816/task_03/src/main_lab3.cpp Main program demonstrating PID controller with both model types
trunk/ii02816/task_03/test/testlab_3.cpp Comprehensive unit tests for PID controller and process models
trunk/ii02816/task_03/src/CMakeLists.txt CMake configuration for building the project and tests
trunk/ii02816/task_03/doc/readme.md Detailed documentation of the laboratory work

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/test/testlab_3.cpp
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp
Copilot AI review requested due to automatic review settings December 20, 2025 16:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 44 out of 68 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/src/mdl.cpp Outdated
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Comment thread trunk/ii02816/task_03/src/mdl.h Outdated
Copilot AI review requested due to automatic review settings December 20, 2025 16:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 69 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/src/mdl.h Outdated
Comment thread trunk/ii02816/task_03/src/mdl.cpp Outdated
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Lictwin
Lictwin previously approved these changes Jan 11, 2026
@Lictwin Lictwin enabled auto-merge (squash) January 11, 2026 02:31
Comment thread .github/workflows/ii02816.yml Fixed
Comment thread .github/workflows/ii02816.yml Fixed
Comment thread .github/workflows/ii02816.yml Fixed
Copilot AI review requested due to automatic review settings January 11, 2026 11:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 69 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/test/testlab_3.cpp
auto-merge was automatically disabled January 12, 2026 05:38

Head branch was pushed to by a user without write access

Copilot AI review requested due to automatic review settings January 12, 2026 05:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 46 out of 71 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (7)

trunk/ii02816/task_03/src/main_lab3.cpp:1

  • The include directive references "plot_utils.h" but this header file is not present in the codebase. This will cause a compilation error.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The variable control_signals is declared but never used in the function. This creates unnecessary memory allocation and should be removed to improve code maintainability.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The comment mentions increasing the number of steps, but it's unclear what the original value was or why 100 steps was chosen. The comment should explain the rationale for this specific value.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The function generatePythonPlotScript() is called but never defined in the visible code. This will result in a linker error. Additionally, the generated script would be named "plot_results.py" based on line 77, but line 72 tries to execute "plot_pid_results.py".
    trunk/ii02816/task_03/src/CMakeLists.txt:1
  • The executable target is named "your_target" which is a placeholder name and should be renamed to something more descriptive like "lab3_pid_visualizer" or similar.
    trunk/ii02816/task_03/src/CMakeLists.txt:1
  • The CMakeLists.txt references "plot_utils.cpp" which does not exist in the provided codebase. This will cause a build failure.
    trunk/ii02816/task_03/doc/readme.md:1
  • The link text shows "https://v1tyokkk.github.io/OTIS-2025/" but the actual URL points to "https://oniisssss.github.io/OTIS-2025/". These should be consistent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 12, 2026 06:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (5)

trunk/ii02816/task_03/src/main_lab3.cpp:1

  • The function generatePythonPlotScript() is defined at line 76 but is also declared at line 71 within main(). This creates a duplicate definition. The function at line 76-142 should be moved before main() or the declaration should be removed.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The ProcessModel is initialized with initial_value of 10.0, but later at line 51 it's reset to 0.0 for the nonlinear simulation. The initial value of 10.0 for the linear simulation is inconsistent with the nonlinear simulation starting at 0.0, which may produce misleading comparison results.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The comment on line 45 states "Увеличим количество шагов" (increase number of steps) suggesting this was changed from a smaller value. The magic number 100 should be defined as a named constant to improve maintainability and clarity.
    trunk/ii02816/task_03/src/main_lab3.cpp:1
  • The variable control_signals is created and populated but never used. This suggests incomplete implementation or dead code that should be removed.
    trunk/ii02816/task_03/doc/readme.md:1
  • The documentation link text shows one URL but links to a different URL. The link text is https://v1tyokkk.github.io/OTIS-2025/ but the actual link target is https://oniisssss.github.io/OTIS-2025/. These should match.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/src/plot_utils.cpp
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp
Comment thread trunk/ii02816/task_03/src/plot_pid_results.py
upd
Copilot AI review requested due to automatic review settings January 12, 2026 06:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Copilot AI review requested due to automatic review settings January 12, 2026 06:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +51
ProcessModel process(model_params, 10.0);

double K = 0.8;
double T = 4.0;
double Td = 0.05;
double T0 = 1.0;

PIDController pid(K, T, Td, T0);
std::vector<double> setpoints(100, 20.0); // Увеличим количество шагов

// Симуляция линейной модели
auto linear_results = simulateSystem(pid, process, setpoints, false);

pid.reset();
process.setInitialValue(0.0);
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial value is hardcoded as 10.0 in main, but then set to 0.0 for the linear model simulation. This inconsistency could lead to unexpected behavior. The initial value should be consistent or clearly documented why it differs.

Copilot uses AI. Check for mistakes.
Comment thread trunk/ii02816/task_03/src/main_lab3.cpp Outdated
Comment on lines +14 to +19
std::vector<double> control_signals; // Сохраняем управляющие воздействия

for (double setpoint : setpoints) {
double current_value = (results.empty()) ? 0.0 : results.back();
double control_signal = pid.calculate(setpoint, current_value);
control_signals.push_back(control_signal);
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable control_signals is declared and populated but never used. This creates unnecessary memory overhead and makes the code confusing. Consider removing this unused variable.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,190 @@
/**
* @file test.cpp
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references a file name that doesn't match the actual file name. The comment says "@file test.cpp" but the actual file is "testlab_3.cpp". This documentation inconsistency should be corrected.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 12, 2026 06:48
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


void generatePythonPlotScript() {
std::cout << "Running Python visualization..." << std::endl;
system("python3 plot_pid_results.py");
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function uses the system() call to execute a Python script, which poses a security risk. This can lead to command injection vulnerabilities if the executed command or file path is not properly controlled. Consider using safer alternatives or ensuring the Python script path is validated.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 12, 2026 07:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 47 out of 72 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trunk/ii02816/task_03/src/pid.h Outdated

public:
PIDRegulator(double P_gain, double I_time, double D_time, double sample_time);
double update(double target, double measurement);
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is named update in the header, but the tests and main program call it as calculate. This naming inconsistency will cause compilation errors. The method name should be consistent across all files.

Copilot uses AI. Check for mistakes.
Comment thread trunk/ii02816/task_03/src/pid.h Outdated
public:
PIDRegulator(double P_gain, double I_time, double D_time, double sample_time);
double update(double target, double measurement);
void clear();
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is named clear in the header, but the tests and main program call it as reset. This naming inconsistency will cause compilation errors. The method name should be consistent across all files.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +154
/**
* @file mdl.cpp
* @brief Implementation of process model methods for thermal object simulation
* @author Litvinchuk I.M.
* @date 2025
*/

#include "mdl.h"
#include <stdexcept>
#include <cmath>

/**
* @brief Constructs a new Process Model object
*
* Initializes the thermal object model with given parameters and starting condition.
* The model represents a physical system with thermal inertia characteristics.
*
* @param params Vector containing 4 model coefficients:
* [a1, a2, b1, b2] where:
* - a1: Linear state coefficient
* - a2: Nonlinear damping coefficient
* - b1: Linear input gain
* - b2: Nonlinear sinusoidal input gain
* @param initial_value Starting temperature or output value of the system
*
* @throw std::invalid_argument If insufficient parameters provided (less than 4)
*
* @note The model assumes normalized values where 0.0 represents minimum
* and 1.0 represents maximum operational range
*/
ProcessModel::ProcessModel(const std::vector<double>& params, double initial_value)
: prev_value(initial_value) {

// Validate input parameters
if (params.size() < 4) {
throw std::invalid_argument("Process model requires exactly 4 parameters: "
"linear_coeff, nonlinear_coeff, input_gain, sin_gain");
}

// Copy validated parameters
this->params = params;

// Initialize internal state
this->prev_value = initial_value;
}

/**
* @brief Computes linear model response
*
* Implements first-order linear difference equation representing
* simplified thermal dynamics:
* y[k] = a₁·y[k-1] + b₁·u[k]
*
* This model assumes linear relationship between current output,
* previous output, and current input without nonlinear effects.
*
* @param input Control signal or heat input at current time step
* @return double Current system output (temperature)
*
* @warning Model may exhibit unrealistic behavior for large inputs
* due to lack of saturation effects
*/
double ProcessModel::linearModel(double input) {
// Linear dynamics calculation
double output = params[0] * prev_value // State feedback
+ params[1] * input; // Input contribution

// Update internal state for next iteration
prev_value = output;

return output;
}

/**
* @brief Computes nonlinear model response with thermal effects
*
* Implements enhanced model capturing nonlinear thermal phenomena:
* y[k] = a₁·y[k-1] - a₂·y[k-1]² + b₁·u[k] + b₂·sin(u[k])
*
* The model includes:
* 1. Quadratic damping term representing heat loss non-linearity
* 2. Sinusoidal input coupling for periodic excitation effects
*
* @param input Control signal or heat input at current time step
* @return double Current system output with nonlinear effects
*
* @note The sinusoidal term models alternating heat transfer effects
* common in certain thermal systems
*/
double ProcessModel::nonlinearModel(double input) {
// Calculate base linear response
double linear_component = params[0] * prev_value
+ params[2] * input;

// Add nonlinear effects
double nonlinear_damping = params[1] * prev_value * prev_value; // Quadratic loss
double periodic_effect = params[3] * std::sin(input); // Sinusoidal coupling

// Combine all components
double output = linear_component
- nonlinear_damping
+ periodic_effect;

// Update internal state
prev_value = output;

return output;
}

/**
* @brief Resets the model to specified initial condition
*
* Allows re-initialization of the model state without reconstructing
* the object. Useful for comparing multiple simulation runs or
* switching between different operating points.
*
* @param value New initial value for the system state
*
* @see ProcessModel::ProcessModel() for constructor initialization
*
* @note Resetting preserves model parameters, only changes state
*/
void ProcessModel::setInitialValue(double value) {
prev_value = value;
}

/**
* @brief Retrieves current model parameters
*
* Provides read-only access to the model coefficients for
* diagnostic or analysis purposes.
*
* @return const std::vector<double>& Reference to model parameters
*
* @warning Modifying returned vector directly may cause undefined behavior
*/

const std::vector<double>& ProcessModel::getParameters() const {
return params;
}

/**
* @brief Retrieves current model state
*
* Returns the most recent output value, representing the current
* state of the simulated thermal system.
*
* @return double Current output value (last computed)
*
* @note This represents y[k-1] at the beginning of next calculation
*/
double ProcessModel::getCurrentState() const {
return prev_value;
} No newline at end of file
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProcessModel class is missing implementations for setParameters(), getParameters(), and getPreviousState() methods that are declared in the header file. These missing implementations will cause linker errors.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +45
ProcessModel::ProcessModel(const std::vector<double>& params, double initial_value)
: prev_value(initial_value) {

// Validate input parameters
if (params.size() < 4) {
throw std::invalid_argument("Process model requires exactly 4 parameters: "
"linear_coeff, nonlinear_coeff, input_gain, sin_gain");
}

// Copy validated parameters
this->params = params;

// Initialize internal state
this->prev_value = initial_value;
}
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial value for ProcessModel is set incorrectly. In the constructor, prev_value is initialized using the initializer list on line 32, but then it's assigned again on line 44. The first initialization is redundant and the member variable current_value is not properly initialized.

Copilot uses AI. Check for mistakes.
Comment thread trunk/ii02816/task_03/src/pid.h Outdated

#include <array>

class PIDRegulator {
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name in the header file is PIDRegulator, but the tests and main program use PIDController. This naming inconsistency will cause compilation errors. The class should be consistently named across all files.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 12, 2026 07:13
@flikyy flikyy review requested due to automatic review settings February 19, 2026 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants