-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9fa270
commit f273581
Showing
13 changed files
with
433 additions
and
135 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
\documentclass{standalone} % run wit shell escape | ||
|
||
\usepackage{tikz} | ||
\usetikzlibrary{arrows} | ||
\usepackage{verbatim} | ||
|
||
\usepackage{tikz} | ||
\usepackage{color} | ||
\definecolor{honeydew}{rgb}{0.94, 1.0, 0.94} | ||
\definecolor{ivory}{rgb}{1.0, 1.0, 0.94} | ||
|
||
|
||
\usetikzlibrary{shapes,arrows} | ||
\begin{document} | ||
|
||
|
||
\tikzstyle{block} = [draw, fill=honeydew!70, rectangle, line width=0.5mm, | ||
minimum height=3em, minimum width=5em] | ||
\tikzstyle{sum} = [draw, fill=ivory!20, circle, node distance=1cm, line width=0.5mm] | ||
\tikzstyle{input} = [coordinate] | ||
\tikzstyle{output} = [coordinate] | ||
\tikzstyle{pinstyle} = [pin edge={to-,thick,black}] | ||
|
||
\tikzset{ | ||
circ/.style={draw, circle, fill=ivory!70} | ||
} | ||
|
||
|
||
% The block diagram code is probably more verbose than necessary | ||
\begin{tikzpicture}[auto, node distance=1cm,>=latex'] | ||
\node [block, node distance=1.5cm, label=process] (Gp) {$g_p(s)$}; | ||
\node [block, left of=Gp, node distance=3cm, label=controller] (Gc) {$g_c(s)$}; | ||
\node [circ, , line width=0.5mm, label={[label distance=-4.75mm]270:$-$},label={[label distance=-4.75mm]180:$+$}, minimum size=8mm, left of=Gc, node distance=2.5cm] (comparator) {}; | ||
\node [input, node distance=2cm, left of=comparator] (Ysp) {}; | ||
\node [circ, line width=0.5mm, label={[label distance=-4.75mm]90:$+$},label={[label distance=-4.75mm]180:$+$}, minimum size=8mm, right of=Gp, node distance=2.5cm] (sum) {}; | ||
% \node [sum, right of=process, node distance=2.5cm] (sum) {}; | ||
% \node [block, right of=controller, pin={[pinstyle]above:D}, | ||
% node distance=3cm] (system) {System}; | ||
\node [block, above of=sum, node distance=1.75cm, label={[label distance=0cm]180:process}] (Gd) {$g_d(s)$}; | ||
\node [input, name=DV, above of=Gd, node distance=1.5cm] {}; | ||
\node [output, name=output, right of=sum, node distance=1.5cm] {}; | ||
\node [below of=comparator, node distance=1.5cm] (ptbelow) {}; | ||
\draw [->, line width=0.5mm] (Gc) -- node[name=h] {} (Gp); | ||
\node [block, below of=h, node distance=1.75cm, label=sensor] (Gm) {$g_m(s)$}; | ||
|
||
% \draw [->] (input) -- node[name=u] {$u$} (system); | ||
% \node [output, right of=system] (output) {}; | ||
% | ||
% \draw [draw,->] (input) -- system {$r$} (sum); | ||
|
||
\draw [->, line width=0.5mm] (Gc) -- node {$U(s)$} (Gp); | ||
\draw [->, line width=0.5mm] (Gp) -- node {} (sum); | ||
\draw [->, line width=0.5mm] (Gd) -- node {} (sum); | ||
\draw [->, line width=0.5mm] (sum) -- node[name=y] {$Y(s)$} (output); | ||
\draw [->, line width=0.5mm] (DV) -- node {$D(s)$} (Gd); | ||
\draw [->, line width=0.5mm] (comparator) -- node {$E(s)$} (Gc); | ||
\draw [->, line width=0.5mm] (Ysp) -- node {$Y_{sp}(s)$} (comparator); | ||
\draw [->, line width=0.5mm] (y) |- (Gm); | ||
\draw [->, line width=0.5mm] (Gm) -| node {$Y_m(s)$} (comparator); | ||
|
||
% \draw [->] (system) -- node [name=y] {$y$}(output); | ||
\end{tikzpicture} | ||
|
||
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
convert -density 300 simple_servo.pdf simple_servo.png | ||
convert simple_servo.png -trim simple_servo.png | ||
muhfile="full_feedback_control_system" | ||
convert -density 300 $muhfile.pdf $muhfile.png | ||
convert $muhfile.png -trim $muhfile.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,75 @@ | ||
@doc raw""" | ||
gc = PID(Kc, τI, τD, α=0.0) | ||
pc = PController(Kc) | ||
Construct Proportional-Integral-Derivative (PID) controller transfer function, $g_c(s)$. | ||
Construct a Proportional (P) controller by specifying the controller gain defined under the following transfer function representation: | ||
$$g_c(s)=K_c \bigl[1+\frac{\tau_I}{s}+\tau_D s \frac{1}{\alpha \tau_D s + 1}\bigr]$$ | ||
$$g_c(s)=K_c$$ | ||
# Arguments | ||
* `Kc::Float64`: controller gain | ||
# Example | ||
```julia | ||
pc = PController(1.0) # specify P controller gain | ||
gc = TransferFunction(pc) # construct transfer function with this P-controller gain | ||
``` | ||
""" | ||
mutable struct PController | ||
Kc::Float64 | ||
end | ||
|
||
TransferFunction(pc::PController) = TransferFunction([pc.Kc], [1.0]) | ||
|
||
@doc raw""" | ||
pic = PIController(Kc, τI) | ||
Construct a Proportional-Integral (PI) controller by specifying the controller gain and integral time constant defined under the following transfer function representation: | ||
$$g_c(s)=K_c \bigl[1+\frac{1}{\tau_I s}\bigr]$$ | ||
# Arguments | ||
* `Kc::Float64`: controller gain | ||
* `τI::Float64`: integral time constant | ||
* `τD::Float64`: derivative time constant | ||
* `α::Float64`: derivative filter | ||
# Returns | ||
PID controller transfer function `gc::TransferFunction` that takes error signal as input and outputs the manipulated variable. | ||
# Example | ||
```julia | ||
pic = PIController(1.0, 3.0) # specify PI controller params | ||
gc = TransferFunction(pic) # construct transfer function with these PI-controller params | ||
``` | ||
""" | ||
function PID(Kc::Float64, τI::Float64, τD::Float64; α::Float64=0.0) | ||
return Kc * (1 + τI / s + τD * s / (α * τD * s + 1)) | ||
mutable struct PIController | ||
Kc::Float64 | ||
τI::Float64 | ||
end | ||
|
||
TransferFunction(pic::PIController) = pic.Kc * (1 + 1 / (pic.τI * s)) | ||
|
||
mutable struct PIDController | ||
Kc::Float64 | ||
τI::Float64 | ||
τD::Float64 | ||
α::Float64 | ||
end | ||
|
||
@doc raw""" | ||
gc = PI(Kc, τI) | ||
pidc = PIDController(Kc, τI, τD, α=0.0) | ||
Construct Proportional-Integral (PI) controller transfer function, $g_c(s)$. | ||
Construct a Proportional-Integral-Derivative (PID) controller by specifying the controller gain, integral time constant, derivative time constant, and derivative filter defined under the following transfer function representation: | ||
$$g_c(s)=K_c \bigl[1+\frac{\tau_I}{s}\bigr]$$ | ||
$$g_c(s)=K_c \bigl[1+\frac{1}{\tau_I s}+\tau_D s \frac{1}{\alpha \tau_D s + 1}\bigr]$$ | ||
# Arguments | ||
* `Kc::Float64`: controller gain | ||
* `τI::Float64`: integral time constant | ||
* `τD::Float64`: derivative time constant | ||
* `α::Float64`: derivative filter | ||
# Returns | ||
PI controller transfer function `gc::TransferFunction` that takes error signal as input and outputs the manipulated variable. | ||
# Example | ||
```julia | ||
pidc = PIDController(1.0, 3.0, 0.1) # specify PID controller params | ||
gc = TransferFunction(pidc) # construct transfer function with these PID-controller params | ||
``` | ||
""" | ||
PI(Kc::Float64, τI::Float64) = Kc * (1 + τI / s) | ||
PIDController(Kc::Float64, τI::Float64, τD::Float64; α::Float64=0.0) = PIDController(Kc, τI, τD, α) | ||
|
||
TransferFunction(pidc::PIDController) = pidc.Kc * (1 + 1.0 / (pidc.τI * s) + pidc.τD * s / (pidc.α * pidc.τD * s + 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f273581
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
f273581
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request updated: JuliaRegistries/General/7102
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: