Examples.LaneChangeCarPlant ​
Kinematic bicycle model of a car for lane changes: lateral position y, speed v and heading psi (degrees), driven by the acceleration a and the steering angle delta (degrees). Unlike the DyadControlSystems lane-change tutorial, which treats v tan(delta) / L directly as a heading rate in degrees per second, the heading rate here is converted consistently to degrees.
Usage ​
MPCComponents.Examples.LaneChangeCarPlant(L=2.9, y0=0.0, v0=8.333333333333334, psi0=0.0, deg=57.29577951308232)
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
L | Distance between the axles | – | 2.9 |
y0 | – | 0.0 | |
v0 | – | 8.333333333333334 | |
psi0 | – | 0.0 |
Connectors ​
a- This connector represents a real signal as an input to a component (RealInput)delta- This connector represents a real signal as an input to a component (RealInput)y_out- This connector represents a real signal as an output from a component (RealOutput)v_out- This connector represents a real signal as an output from a component (RealOutput)psi_out- This connector represents a real signal as an output from a component (RealOutput)
Variables ​
| Name | Description | Units |
|---|---|---|
y | – | |
v | – | |
psi | – |
Behavior ​
Behavior of this component cannot be rendered because it includes path variables.
Source ​
"""
Kinematic bicycle model of a car for lane changes: lateral position `y`, speed `v` and heading `psi`
(degrees), driven by the acceleration `a` and the steering angle `delta` (degrees). Unlike the
DyadControlSystems lane-change tutorial, which treats `v tan(delta) / L` directly as a heading rate in
degrees per second, the heading rate here is converted consistently to degrees.
"""
component LaneChangeCarPlant
"Acceleration"
a = RealInput() {
"Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 240, "y2": 340}}}
}
"Steering angle (degrees)"
delta = RealInput() {
"Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 680, "y2": 780}}}
}
"Lateral position"
y_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 170, "y2": 270}}}
}
"Speed"
v_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 450, "y2": 550}}}
}
"Heading (degrees)"
psi_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 750, "y2": 850}}}
}
"Distance between the axles"
parameter L::Real = 2.9
parameter y0::Real = 0.0
parameter v0::Real = 8.333333333333334
parameter psi0::Real = 0.0
"Degrees per radian"
final parameter deg::Real = 57.29577951308232
variable y::Real
variable v::Real
variable psi::Real
relations
initial y = y0
initial v = v0
initial psi = psi0
der(y) = v * sin(psi / deg)
der(v) = a
der(psi) = deg * v / L * tan(delta / deg)
y_out = y
v_out = v
psi_out = psi
metadata {
"Dyad": {
"icons": {"default": "dyad://MPCComponents/LaneChangeCarPlant.svg"},
"doc": {"behavior": false}
}
}
endFlattened Source
"""
Kinematic bicycle model of a car for lane changes: lateral position `y`, speed `v` and heading `psi`
(degrees), driven by the acceleration `a` and the steering angle `delta` (degrees). Unlike the
DyadControlSystems lane-change tutorial, which treats `v tan(delta) / L` directly as a heading rate in
degrees per second, the heading rate here is converted consistently to degrees.
"""
component LaneChangeCarPlant
"Acceleration"
a = RealInput() {
"Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 240, "y2": 340}}}
}
"Steering angle (degrees)"
delta = RealInput() {
"Dyad": {"placement": {"diagram": {"x1": -100, "x2": 0, "y1": 680, "y2": 780}}}
}
"Lateral position"
y_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 170, "y2": 270}}}
}
"Speed"
v_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 450, "y2": 550}}}
}
"Heading (degrees)"
psi_out = RealOutput() {
"Dyad": {"placement": {"diagram": {"x1": 1000, "x2": 1100, "y1": 750, "y2": 850}}}
}
"Distance between the axles"
parameter L::Real = 2.9
parameter y0::Real = 0.0
parameter v0::Real = 8.333333333333334
parameter psi0::Real = 0.0
"Degrees per radian"
final parameter deg::Real = 57.29577951308232
variable y::Real
variable v::Real
variable psi::Real
relations
initial y = y0
initial v = v0
initial psi = psi0
der(y) = v * sin(psi / deg)
der(v) = a
der(psi) = deg * v / L * tan(delta / deg)
y_out = y
v_out = v
psi_out = psi
metadata {
"Dyad": {
"icons": {"default": "dyad://MPCComponents/LaneChangeCarPlant.svg"},
"doc": {"behavior": false}
}
}
endTest Cases ​
No test cases defined.
Related ​
Examples
Experiments
Analyses