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 bang-bang control algorithm #968

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

wca747
Copy link

@wca747 wca747 commented Dec 5, 2021

First draft of a page covering the bang-bang control algorithm. Looking for feedback!

wca747 and others added 2 commits December 4, 2021 19:55
Split each sentence into it's own line per suggestion from ntindle.
@wca747 wca747 marked this pull request as ready for review December 5, 2021 06:31
Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

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

I just did a quick look-over now, but will do a more rigorous review later.

Is there any way you could add a bit of example code? I guess I don't understand how the water temperature images are so linear and some example code (or at least an explanation of why flipping this switch will also cause a drastic, linear decrease in temperature) would be nice to explain how this model is being done.

An additional image directly lining up the on / off pulses with the increasing / decreasing temperatures would be nice as well.

This is a really good start / Thanks for the submission!


##### More Reading:
Bang-bang controllers are only meant for systems controlled with binary on/off inputs.
For systems with a continously variable input signal (for example, cruise control in a car), try PID Control.
Copy link
Member

Choose a reason for hiding this comment

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

As we do not have a PID chapter yet in the AAA, could you link to external sources for now?

@@ -0,0 +1,57 @@
# Bang-Bang Control

A bang-bang controller is one of the simplest forms of feedback controller, used in systems where a simple on/off control signal is used to regulate some aspect of the system (temperature, for example).
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a sentence on why it's called "bang-bang" and a link to an original paper?

@ntindle
Copy link
Member

ntindle commented Dec 5, 2021

If we want to go into signals and such here, the discrete form of the unit step function would be applicable as a mathematical example as well

@leios
Copy link
Member

leios commented Dec 5, 2021

Yeah, I think having something we could abstract out to a signal processing section makes sense. Do you have something specific in mind @ntindle ?

@ntindle
Copy link
Member

ntindle commented Dec 5, 2021

I've referred to this as signals and systems but it's based on control theory. I think a catch all signals and systems top level chapter would be good.

Edit: reread the question. The example above would work. I'm not super familiar with latex so I can't type it out but the example above would be something like this

X[n], where n is temperature, exhibits the following behavior for discrete values of n.

X[n]= {0, n>=50
      {1, n<=45

When this is in the presence of an external factor (such as what is being controlled) it will often oscillate causing that characteristic sawtooth graph in the chapter

@leios
Copy link
Member

leios commented Dec 5, 2021

I agree with that, although "signals" and "control theory" seem a bit too distinct for me right now, maybe just "control theory"?

When I think of signals, I think signal processing with FFTs and things like that.

I think this chapter is a nice way to lead into PID controls. I wonder if we can revive the #346 PR? That one was close to being done, so we could fork it and open it up again with @Gathros co-authoring it.

@ntindle
Copy link
Member

ntindle commented Dec 5, 2021

I think @wca747 's goal was using this as a stepping stone to the much harder PID chapter

Also for signal processing in computer engineering (not sure other places), FFTs are taught using things like bang bang as the introduction to why they are needed. It's a part of a much larger array of signal processing techniques


##### Cons:
1. The system is not controlled to a *specific* target value; it instead oscillates between specified upper and lower limits.
2. Setting tight min/max limits on the system output may require the controller to toggle on/off very frequently to maintain the correct output.
Copy link
Member

Choose a reason for hiding this comment

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

I'd like this to also discuss overshooting. Since it's a binary operation often used for heating/cooling, it's often over shot when implemented exactly at the limit of the target.

Imagine a water heater that needs to regulate temperature, keeping within an allowable range of 45 to 50°C.
The heater only has binary on/off control with no in-between states.
In order to regulate the system temperature, the heater must cycle between on/off states to keep the temperature within the specified range.
A basic bang-bang controller would implement the following logic:
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if here is the best place but I would love a section on the unit step function that makes this possible.

Potentially with a full signals diagram and a work up of the example

@ShadowMitia ShadowMitia added the Chapter This provides a new chapter. (md files are edited) label Dec 5, 2021
@leios
Copy link
Member

leios commented Feb 11, 2022

Hey, it's been a while. Were you at all able to look at this chapter? I think example code is essential to understanding how the plots were generated. I am happy to continue the review from that stage!

@ntindle
Copy link
Member

ntindle commented May 6, 2022

I could probably pick this up in your place @wca747 if you'd like

@leios
Copy link
Member

leios commented May 7, 2022

I think the chapter needs some work right now, but it's definitely in the right direction. Namely, I would really like to see some code for the plots. Once that is there, I think I will have a better understanding of what they were supposed to show and we can finish the chapter from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chapter This provides a new chapter. (md files are edited)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants