-
-
Notifications
You must be signed in to change notification settings - Fork 360
Adding bang-bang control algorithm #968
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
Open
wca747
wants to merge
9
commits into
algorithm-archivists:main
Choose a base branch
from
wca747:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2f0f689
Initial draft of bang-bang control
wca747 c7bc7a3
Update bang-bang.md
wca747 50f5806
Update bang-bang.md
wca747 a0297e2
Update bang-bang.md
wca747 b29de3b
Update bang-bang.md
wca747 739dc2f
placeholder for PID control
wca747 1c3c0bd
removed PID placeholder
wca747 d6a49de
Update bang-bang.md
wca747 f812eac
Merge branch 'main' into main
wca747 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,46 @@ | ||
# 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). The controller compares the measured system state with user-defined min/max limits and toggles the input between on/off states as needed to keep the system within the specified range. Common everyday examples include water heaters and air conditioning controllers. | ||
|
||
##### Simple Example: Water Heater Control | ||
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: | ||
|
||
| System State | Action | | ||
| -------------- | ------------- | | ||
| Temperature is below desired range (<45°C) | Turn heater ON | | ||
| Temperature exceeds desired range (>50°C) | Turn heater OFF | | ||
|
||
Implementing just these two rules will keep the system temperature within the desired range. The overall system will oscillate between the two limits as the heater turns on and off: | ||
<p> | ||
<img class="center" src="res/bang_bang_temp_history.png" style="width:70%" /> | ||
</p> | ||
<p> | ||
<img class="center" src="res/bang_bang_control_history.png" style="width:70%" /> | ||
</p> | ||
|
||
An important factor to consider when designing a bang-bang controller is the frequency at which a given controller will toggle the system state. In the example above, with a wide allowable temperature band of 45-50°C, the heater would be powered every ~18 minutes to maintain the overall system. If tighter control over the output were desired (for example, limiting temperature to a narrow range of 45 - 45.2°C), a bang-bang controller can still be used to regulate the system, but the heater would have to toggle on/off much more frequently to keep the temperature in the specified range. Depending on the system being controlled, this rapid on/off cycling may be undesirable: | ||
|
||
<p> | ||
<img class="center" src="res/bang_temp_fast.png" style="width:70%" /> | ||
</p> | ||
<p> | ||
<img class="center" src="res/bang_control_fast.png" style="width:70%" /> | ||
</p> | ||
|
||
##### Pros: | ||
1. Very simple to implement. | ||
2. Can be used to control a system that has only binary on/off states. | ||
|
||
|
||
##### 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. This may be undesirable depending on the system being controlled (for example, excess wear and tear caused by rapidly turning a pump on and off.) | ||
|
||
##### 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. | ||
|
||
|
||
## License | ||
The text of this chapter was written by [wca747](https://github.com/wca747) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). | ||
|
||
[<p><img class="center" src="../cc/CC-BY-SA_icon.svg" /></p>](https://creativecommons.org/licenses/by-sa/4.0/) |
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.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.