You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,19 @@ The figure should look more or less identical to the one above, except that we p
116
116
- Bumpless transfer when updating `K` is realized by updating the state `I`. See the docs for `set_K!` for more details.
117
117
- The total control signal $u(t)$ (PID + feed-forward) is limited by the integral anti-windup.
118
118
119
+
## Simulation of fixed-point arithmetic
120
+
If the controller is ultimately to be implemented on a platform without floating-point hardware, you can simulate how it will behave with fixed-point arithmetics using the `FixedPointNumbers` package. The following example modifies the first example above and shows how to simulate the controller using 16-bit fixed-point arithmetics with 10 bits for the fractional part:
121
+
```julia
122
+
using FixedPointNumbers
123
+
T = Fixed{Int16, 10} # 16-bit fixed-point with 10 bits for the fractional part
124
+
pid =DiscretePID(; K =T(K), Ts =T(Ts), Ti =T(Ti), Td =T(Td))
The fixed-point controller behaves roughly the same in this case, but artifacts are clearly visible. If the number of bits used for the fractional part is decreased, the controller will start to misbehave.
131
+
119
132
## See also
120
133
-[TrajectoryLimiters.jl](https://github.com/baggepinnen/TrajectoryLimiters.jl) To generate dynamically feasible reference trajectories with bounded velocity and acceleration given an instantaneous reference $r(t)$ which may change abruptly.
121
134
-[SymbolicControlSystems.jl](https://github.com/JuliaControl/SymbolicControlSystems.jl) For C-code generation of LTI systems.
0 commit comments