https://github.com/ziteh/pid-simulator
A simple PID controller simulator
https://github.com/ziteh/pid-simulator
Last synced: 5 months ago
JSON representation
A simple PID controller simulator
- Host: GitHub
- URL: https://github.com/ziteh/pid-simulator
- Owner: ziteh
- License: mit
- Archived: true
- Created: 2022-04-23T09:35:34.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-29T05:04:18.000Z (almost 3 years ago)
- Last Synced: 2025-09-23T19:43:58.806Z (5 months ago)
- Language: Julia
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PID Simulator
A simple PID controller simulator.
The PID comput code in the [`pid_compute.jl`](/pid_compute.jl).
## Usage
1. Start Julia REPL.
2. Change the working dircetory to this folder:
```julia-repl
julia> cd("PATH_TO_THIS_FOLDER")
```
3. Check the current working directory:
```julia-repl
julia> pwd()
"CURRENT_WORKING_DIR"
```
### Demo
Run `pid_demo.jl`:
```julia-repl
julia> include("pid_demo.jl")
--- PID Simulator Demo ---
1st config:
kp: 0.400000, ki: 0.900000, Kd: 0.500000, max: 55.000000, min: -55.000000
2nd config:
kp: 1.500000, ki: 0.200000, Kd: 0.500000, max: 55.000000, min: -55.000000
Done!
```

### Plot
Include `pid_plot.jl` first:
```julia-repl
julia> include("pid_plot.jl")
```
Run `plot()` function with specified `kp=1.5`, `ki=0.2` and `kd=0.3`:
```julia-repl
julia> plot(1.5, 0.2, 0.3)
```
Run `plot()` function with specified `kp`, `ki`, `kd` and `max=25`, `min=-25`:
```julia-repl
julia> plot(1.5, 0.2, 0.3, 25, -25)
```
Run `plot()` function with specified `kp`, `ki`, `kd`, `max`, `min` and `system_model`:
```julia-repl
julia> plot(1.5, 0.2, 0.3, 25, -25, system_model=(i,b)->i+b*0.7+5)
```
## Environment
- Julia `v1.6.6` LTS 64-bit
- Plots