1
0
jcktrue.dk/content/project/controllib/index.md
Jens True 737e4c9aa9
All checks were successful
continuous-integration/drone/push Build is passing
Typos
2021-07-21 22:55:24 +02:00

93 lines
2.9 KiB
Markdown

---
# Documentation: https://wowchemy.com/docs/managing-content/
title: "Control Library"
summary: "A library for quick and easy implementation of regulation and control loops. (PID)"
authors: []
tags: []
categories: []
date: 2021-07-21T20:49:38+02:00
# Optional external URL for project (replaces project detail page).
external_link: ""
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
caption: "Control loop"
focal_point: ""
preview_only: false
# Custom links (optional).
# Uncomment and edit lines below to show custom links.
# links:
# - name: Follow
# url: https://twitter.com
# icon_pack: fab
# icon: twitter
url_code: ""
url_pdf: ""
url_slides: ""
url_video: ""
# Slides (optional).
# Associate this project with Markdown slides.
# Simply enter your slide deck's filename without extension.
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
# Otherwise, set `slides = ""`.
slides: ""
---
{{% callout note %}}
Concept phase. No implementation yet.
{{% /callout %}}
# Concept
Implement commonly used algorithms used in control loops. This typically covers PID control loops and their supporting elements like filters, scaling, glitch detection and similar.
# Why
Control loops typically interacts with the real world. The real world is complex enough, without additional layers of code complexity. The goal of the project is to keep the implementation clear and easy to understand. Code that is easy to understand becomes easy to maintain.
# How
Implement in C++ taking advantage of object orientated features to present a clean API for the user. Should not rely on integer math and optimization. Floats and integers both have their pros and cons. Floating Point are avaible on most micro controllers and the user should not worry about premature optimization. Slow routines may be updated at a later time if the need arises.
The library should remain cross-platform to ensure the code may be used for embedded development and on the desktop. All the way from 8-bit Arduino to 64-bit Windows.
Try to let the final implementation reflect control loop diagrams as closely as possible.
# TDD
Unit test individual components to ensure their reliability before integration.
Compare with other implementations for correcteness taking into account floating point (in)accuracy.
# Features
- PID controller
- P/PI/PID
- Various clamping/anti-windup strategies.
- Filters
- Exponentional Moving Average
- Rolling average
- Kalman Filter
- FIR/IIR
- Detection
- Inside/Outside range, inhibit time, hysteresis, glitch protection
- Deadbands
- Ramp / Fade
- Expontential, Linear
- Generators
- Sine, Square, Triangle, Sawtooth
- Utils
- Linear scaling (Y=ax+b)
- Polyominal
- Map
- Limit
# Example
```mermaid
graph LR;
Input-->Map-->Filter-->Error-->PID-->Limit-->Output;
```