This is a PI controller block Diagram. How do I use this latex build this? Help
-
5Welcome! There are plenty of examples of circuit diagrams to get you started. For example, https://tex.stackexchange.com/q/32839/ should help. (I'm guessing what your diagram is about and I'm not at all sure my guess is correct, but you can find similar pages for different varieties of diagrams very easily.) Or maybe it is a flowchart? If so, search for that instead. If you want more help, post some code to show what you've tried and explain what the problem is. Do-it-for-me questions are liable to get closed. – cfr Nov 19 '23 at 04:42
-
1Typically, the purpose of a controller is to produce the input (to the plant), meaning your diagram should be more like [set point] -> (+) -> [C] -> [P} -> [feedback to (+)] and [output]. The way your diagram is written, the controller acts on the input to produce a second signal that's added to the output from the plant, which doesn't really make sense. – karlh Nov 19 '23 at 05:23
-
@cfr, a flow-chart is not intended by context: it's just (less ususal) electronics on a system level. That's why I deleted the flow-chart tag. – MS-SPO Nov 19 '23 at 10:50
1 Answers
Let me give you a helping hand as a beginner in 3 steps.
1. Finding ways to do it
A standard way, at least for me, is to serach for it on ctan via a search engine. Even with imperfect serach terms you'll quickly naviagte to existing packages, you may want to use.
E.g. using the search term ctan block diagram provides interesting images and a perhaps useful package:
List of packages: https://ctan.org/topic/diagram-block, where schemablock might be interesting enough.
Also from here you could follow either tags, like control, search for block diagram etc., using further restrictions in the search terms.
2. Plain-Tikz drawing
Your diagram is simple enough to do it directly in Tikz. However, it needs a trick here and there which may be challenging for a novice in Tikz. I suggest to read the tutorials in parallel in the pgfmanual, and to look up statements as needed.
There are many ways to even use plain-Tikz here. The most important one may be the documentclass used: standalone:
- it's nicer to use during development
- it enables things described next
\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary {shapes.geometric} % for nodes with triangular shape
\usetikzlibrary{arrows.meta} % provides many arrow tips
\begin{document}
\begin{tikzpicture}[ % self-defined styles
blk/.style={draw,minimum width=1cm,minimum height=15mm},
tri/.style={draw,shape=isosceles triangle, minimum height=12mm},
> = {Stealth},
]
% ~~~ coordinate ~~~~~~~~~
\coordinate (A) at (-4,0); % to simplify drawing the arrow
% ~~~ nodes ~~~~~~~~~~~~~~~~
\node[anchor=east] (IN) at (-5 , 0) {Input};
\node[tri] (P) at (-1.5 , 1) {$p$};
\node[tri] (K) at (-2.5,-1) {$k$};
\node[blk] (S) at ( 0 ,-1) {\Large{$\frac{1}{s}$}};
\node[blk] (O) at ( 3 , 0) {};
\node[anchor=west] (OUT) at ( 4.5, 0) {Output};
% ~~~ connections ~~~~~~~~~~~~~~~
\draw[->] (IN) -- (A);
\draw (A) |- (P);
\draw (A) |- (K);
\draw (K) -- (S);
\draw (S) -- ++(1.5,0) |- (O.210) node[shift=(220:.3)] {$+$};
\draw (P) -- ++(3.0,0) |- (O.150) node[shift=(140:.3)] {$+$};
\draw[->] (O) -- (OUT);
\end{tikzpicture}
\end{document}
3. Document using said drawing
There are many ways to use Tikz-diagrams in your main documents class, which, like:
- code it directly into your main.tex
- copy aboves result
\inputaboves result (after some deletions)
The process I'd like to show you here goes like this:
- create the diagram with Tikz, using
standalone - compile as
pdf, e.g. aspiTikz.pdf(repeat, when changed) - include it as drawing using package
graphicx
\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\begin{document}
This is one way to work with tikzpictures:
\begin{itemize}
\item create and compile a separate file using standalone class
\item including said pdf, see figure \ref{pi}
\end{itemize}
\begin{figure}
\includegraphics[width=\textwidth]{piTikz}
\caption{Some PI signal processing}\label{pi}
\end{figure}
\end{document}
- 11,519



