Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding PID controller feature for Thermal Management #856

Conversation

hisandeepsingh
Copy link
Contributor

Adding Derivative term in PI Controller .
Included the PID changes protected inside flag. Please review it and let me know if its looks good then we can do respective changes in test cases and in thermal doc thermal_mgmt.md

@ssg-bot
Copy link

ssg-bot commented Oct 9, 2023

Can one of the admins verify this patch?

@mohamedasaker-arm
Copy link
Collaborator

jenkins: ok to test

Copy link
Collaborator

@leandro-arm leandro-arm left a comment

Choose a reason for hiding this comment

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

Can you also please update the top banner in all modified files to be
Copyright <created year> - 2023.
We also encourage that all new code needs to come with its corresponding Unit test, can you please add them for this new feature?
Thanks!

@@ -177,7 +177,13 @@ struct mod_thermal_mgmt_dev_config {

/*! Integral term (PI loop) */
int32_t k_integral;
} pi_controller;
#ifdef PID
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please rename it to THERMAL_HAS_PID_CONTROLLER ?

#ifdef PID
pid_control(id);
#else
pi_control(id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please run clang-format or check tools/check_tabs.py script?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, please run the formatter on this change. There are a couple of lines that need formatting.

@leandro-arm leandro-arm linked an issue Oct 19, 2023 that may be closed by this pull request
Copy link
Collaborator

@nicola-mazzucato-arm nicola-mazzucato-arm left a comment

Choose a reason for hiding this comment

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

And also please sing-off the patch

Thanks

@@ -34,6 +34,68 @@ struct mod_thermal_mgmt_actor_ctx *get_actor_ctx(
return &dev_ctx->actor_ctx_table[actor];
}


#ifdef PID
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO there's no need to create two implementations that are almost identical but the kd part.
I would suggest to add the derivative part in the pi_control as is, no additional #IFDEF.
Platforms that do not care about the derivative part can simply leave that coefficient to zero.

Then rename pi_controller() to pid_controller() please

#ifdef PID
pid_control(id);
#else
pi_control(id);
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, please run the formatter on this change. There are a couple of lines that need formatting.

nicola-mazzucato-arm added a commit to nicola-mazzucato-arm/SCP-firmware that referenced this pull request Dec 8, 2023
The current implementation of Thermal Management provides a PI
controller, without a derivative term.

Improve the controller by adding the derivative term, thus becoming a
PID control.

At the same time, update the TC2 configuration as required by this
change.

This change originates from:
ARM-software#856
and has been lightly reworked to improve readability, update unit
testing and comply with coding style.

Signed-off-by: Sandeep Singh <hisandeepsingh@hotmail.com>
Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Co-authored-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Change-Id: Ie0b667c680476714d4e6ad17afa3623ca36a56b8
leandro-arm pushed a commit that referenced this pull request Dec 11, 2023
The current implementation of Thermal Management provides a PI
controller, without a derivative term.

Improve the controller by adding the derivative term, thus becoming a
PID control.

At the same time, update the TC2 configuration as required by this
change.

This change originates from:
#856
and has been lightly reworked to improve readability, update unit
testing and comply with coding style.

Signed-off-by: Sandeep Singh <hisandeepsingh@hotmail.com>
Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Co-authored-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Change-Id: Ie0b667c680476714d4e6ad17afa3623ca36a56b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PI controller for thermal management
5 participants