BinaryController Icon
Examples.BinaryController
BangBangController(; name, R = 1.25, v0 = 70.0)A bang-bang controller system with hydraulic actuation for wheel speed control.
Parameters
R: Wheel radius in meters (default: 1.25)v0: Initial velocity in m/s (default: 70.0)
Variables
u(t): Control input signaltire_torque(t): External tire torque inputy(t): Output torque signalomega(t): Angular velocity output (rad/s)
Description
Implements a bang-bang (on-off) controller that compares the input signal against zero using greater-than and less-than comparisons. The controller drives a hydraulic actuator which produces force integrated over time. The system includes:
- Bang-bang control logic (greater/equal and lesser/equal comparisons)
- Hydraulic actuator with state space dynamics
- Double integration with saturation limiters
- Feedback from tire torque
- Angular velocity computation based on initial velocity v0 and wheel radius R
The controller output is limited between 0 and 1000, and the angular velocity is initialized to v0/R.
Usage
PrimitiveComponents.Examples.BinaryController()
Connectors
y- This connector represents a real signal as an output from a component (RealOutput)u- This connector represents a real signal as an input to a component (RealInput)
Behavior
Behavior of this component cannot be rendered because it includes path variables.
Source
"""
BangBangController(; name, R = 1.25, v0 = 70.0)
A bang-bang controller system with hydraulic actuation for wheel speed control.
# Parameters
- `R`: Wheel radius in meters (default: 1.25)
- `v0`: Initial velocity in m/s (default: 70.0)
# Variables
- `u(t)`: Control input signal
- `tire_torque(t)`: External tire torque input
- `y(t)`: Output torque signal
- `omega(t)`: Angular velocity output (rad/s)
# Description
Implements a bang-bang (on-off) controller that compares the input signal against zero
using greater-than and less-than comparisons. The controller drives a hydraulic actuator
which produces force integrated over time. The system includes:
- Bang-bang control logic (greater/equal and lesser/equal comparisons)
- Hydraulic actuator with state space dynamics
- Double integration with saturation limiters
- Feedback from tire torque
- Angular velocity computation based on initial velocity v0 and wheel radius R
The controller output is limited between 0 and 1000, and the angular velocity is
initialized to v0/R.
"""
component BinaryController
sub = BlockComponents.Add(k1 = 1.0, k2 = -1.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 680, "y1": 430, "x2": 830, "y2": 580, "rot": 0}
},
"tags": []
}
}
gt = PrimitiveComponents.Compare.GreaterOrEqual() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 240, "x2": 570, "y2": 390, "rot": 0}
},
"tags": []
}
}
lt = PrimitiveComponents.Compare.LesserOrEqual() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 430, "y1": 600, "x2": 560, "y2": 730, "rot": 0}
},
"tags": []
}
}
zer = BlockComponents.Constant(k = 0.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 450, "x2": 250, "y2": 550, "rot": 0}
},
"tags": []
}
}
y = Dyad.RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 920, "y1": 460, "x2": 1000, "y2": 540, "rot": 0}
},
"tags": []
}
}
u = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 460, "x2": 80, "y2": 540, "rot": 0}
},
"tags": []
}
}
relations
connect(gt.y, sub.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 575.5, "y": 315}, {"x": 575.5, "y": 460}], "E": 2}],
"renderStyle": "standard"
}
}
connect(lt.y, sub.u2) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 570.5, "y": 665}, {"x": 570.5, "y": 550}], "E": 2}],
"renderStyle": "standard"
}
}
connect(u, gt.u1) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 40, "y": 268.5}], "E": 2}]
}
}
connect(u, lt.u1) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 40, "y": 540},
{"x": 60, "y": 540},
{"x": 60, "y": 710},
{"x": 387.4, "y": 710},
{"x": 387.4, "y": 624.7}
],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(sub.y, y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 892, "y": 505}, {"x": 892, "y": 500}], "E": 2}],
"renderStyle": "standard"
}
}
connect(zer.y, gt.u2, lt.u2) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 336, "y": 500}], "E": -1},
{"S": -1, "M": [{"x": 336, "y": 349.5}], "E": 2},
{"S": 3, "M": [{"x": 336, "y": 694.9}], "E": -1}
],
"junctions": [{"x": 336, "y": 500}],
"renderStyle": "standard"
}
}
metadata {
"Dyad": {
"icons": {"default": "dyad://PrimitiveComponents/BinaryController.svg"},
"doc": {"behavior": false}
}
}
end
Flattened Source
"""
BangBangController(; name, R = 1.25, v0 = 70.0)
A bang-bang controller system with hydraulic actuation for wheel speed control.
# Parameters
- `R`: Wheel radius in meters (default: 1.25)
- `v0`: Initial velocity in m/s (default: 70.0)
# Variables
- `u(t)`: Control input signal
- `tire_torque(t)`: External tire torque input
- `y(t)`: Output torque signal
- `omega(t)`: Angular velocity output (rad/s)
# Description
Implements a bang-bang (on-off) controller that compares the input signal against zero
using greater-than and less-than comparisons. The controller drives a hydraulic actuator
which produces force integrated over time. The system includes:
- Bang-bang control logic (greater/equal and lesser/equal comparisons)
- Hydraulic actuator with state space dynamics
- Double integration with saturation limiters
- Feedback from tire torque
- Angular velocity computation based on initial velocity v0 and wheel radius R
The controller output is limited between 0 and 1000, and the angular velocity is
initialized to v0/R.
"""
component BinaryController
sub = BlockComponents.Add(k1 = 1.0, k2 = -1.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 680, "y1": 430, "x2": 830, "y2": 580, "rot": 0}
},
"tags": []
}
}
gt = PrimitiveComponents.Compare.GreaterOrEqual() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 420, "y1": 240, "x2": 570, "y2": 390, "rot": 0}
},
"tags": []
}
}
lt = PrimitiveComponents.Compare.LesserOrEqual() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 430, "y1": 600, "x2": 560, "y2": 730, "rot": 0}
},
"tags": []
}
}
zer = BlockComponents.Constant(k = 0.0) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 150, "y1": 450, "x2": 250, "y2": 550, "rot": 0}
},
"tags": []
}
}
y = Dyad.RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 920, "y1": 460, "x2": 1000, "y2": 540, "rot": 0}
},
"tags": []
}
}
u = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 460, "x2": 80, "y2": 540, "rot": 0}
},
"tags": []
}
}
relations
connect(gt.y, sub.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 575.5, "y": 315}, {"x": 575.5, "y": 460}], "E": 2}],
"renderStyle": "standard"
}
}
connect(lt.y, sub.u2) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 570.5, "y": 665}, {"x": 570.5, "y": 550}], "E": 2}],
"renderStyle": "standard"
}
}
connect(u, gt.u1) {
"Dyad": {
"renderStyle": "standard",
"edges": [{"S": 1, "M": [{"x": 40, "y": 268.5}], "E": 2}]
}
}
connect(u, lt.u1) {
"Dyad": {
"edges": [
{
"S": 1,
"M": [
{"x": 40, "y": 540},
{"x": 60, "y": 540},
{"x": 60, "y": 710},
{"x": 387.4, "y": 710},
{"x": 387.4, "y": 624.7}
],
"E": 2
}
],
"renderStyle": "standard"
}
}
connect(sub.y, y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 892, "y": 505}, {"x": 892, "y": 500}], "E": 2}],
"renderStyle": "standard"
}
}
connect(zer.y, gt.u2, lt.u2) {
"Dyad": {
"edges": [
{"S": 1, "M": [{"x": 336, "y": 500}], "E": -1},
{"S": -1, "M": [{"x": 336, "y": 349.5}], "E": 2},
{"S": 3, "M": [{"x": 336, "y": 694.9}], "E": -1}
],
"junctions": [{"x": 336, "y": 500}],
"renderStyle": "standard"
}
}
metadata {
"Dyad": {
"icons": {"default": "dyad://PrimitiveComponents/BinaryController.svg"},
"doc": {"behavior": false}
}
}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses