1

I have the following block diagram

enter image description here Can someone help me with red marked things on my figure?

Here is my current code:

\usepackage{tikz} \usepackage{float} \usetikzlibrary{shapes,arrows} \usetikzlibrary{arrows,calc,positioning} \usetikzlibrary{fit,positioning,arrows} \tikzset{ block/.style = {draw, rectangle, minimum height=1cm, minimum width=2cm}, input/.style = {coordinate,node distance=1cm}, output/.style = {coordinate,node distance=6cm}, arrow/.style={draw, -latex,node distance=2cm}, pinstyle/.style = {pin edge={latex-, black,node distance=2cm}}, sum/.style = {draw, circle, node distance=1cm}, } \begin{figure}[h] \centering \begin{center} \begin{tikzpicture}[auto, node distance=1cm,>=latex', scale=0.77, transform shape] \node [input, name=input] {}; \node [sum, right=of input, line width=0.25mm,] (sum) {}; \node [draw=black, line width=0.25mm, minimum width=2.5cm, minimum height=1.4cm, right=1.1cm of sum] (controller){}; \node [draw=black,line width=0.25mm, minimum width=2.5cm, minimum height=1.4cm, right=1.1cm of controller] (plant2){}; \node [draw=black,line width=0.25mm, minimum width=2.5cm, minimum height=1.4cm, right=1.1cm of plant2] (plant){}; \node [draw=black,line width=0.25mm, minimum width=2.5cm, minimum height=1.4cm, above=1.1cm of plant] (GP){}; \node [draw=black, line width=0.25mm, minimum width=2.5cm, minimum height=1.4cm, right=1.1cm of plant] (plant1){}; \node [minimum width=2.5cm, line width=0.25mm, minimum height=1.4cm, output, right=of plant] (output) {}; \node at ($(controller)!0.9!(plant)+(0,-2.7)$) [block, line width=0.25mm] (feedback) {}; \draw [draw,->, line width=0.25mm] (input) -- node {$\boldsymbol{r}$} (sum); \draw [->,line width=0.25mm] (sum) -- (controller); \draw [->,line width=0.25mm] (GP) -- (plant); \draw [->,line width=0.25mm] (controller) -- node {$\boldsymbol{v}$} (plant2); \draw [->,line width=0.25mm] (plant2) -- node {$\boldsymbol{v}$} (plant); \draw [->,line width=0.25mm] (GP) -| ($ (GP.west)!0.6!(plant2.north) $) -| node[pos=0, swap] {} (plant2); %\draw [->] (feedback) -- node {} (plant); \draw [->,line width=0.25mm] (feedback) |- ($ (feedback.north)!.5!(plant.south) $) -| node[pos=0, swap] {} (plant2); %\draw [->] (feedback) -- node {} (plant); \draw [->,line width=0.25mm] (plant) -- node {$\boldsymbol{u}$} (plant1); \draw [->,line width=0.25mm] (plant1) -- node [name=y] {$\boldsymbol{x}$}(output); \draw [->,line width=0.25mm] (y) |- (feedback) ; \draw [->,line width=0.25mm] (y) |- (GP) ; \draw [->,line width=0.25mm] (feedback) -| node[pos=0.99] {$-$} (sum); \end{tikzpicture} \end{center} \end{figure} 
2
  • Please extend your code fragment to complete compilable small document with your diagram. For compiling it at least we need to know your styles definitions. Commented Jun 16, 2022 at 18:53
  • Sorry, added @Zarko Commented Jun 16, 2022 at 18:59

1 Answer 1

2
\documentclass[border=3.141592]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, calc, chains, positioning, quotes} \usepackage{bm} \begin{document} \begin{tikzpicture}[ node distance = 11mm and 7mm, start chain = A going right, arr/.style = {-Stealth, semithick}, box/.style = {draw, text width=22mm, minimum height=11mm, align=center}, dot/.style = {circle, fill, inner sep=1.2pt, node contents={}}, sum/.style = {circle, draw, minimum size=6mm, node contents={}}, every edge/.style = {draw, arr} ] \begin{scope}[nodes={on chain=A}] \coordinate (in); % A-1 \node [sum]; % A-2 \node [box] {A-3}; \node [box] {A-4}; \node [box] {A-5}; \node [box] {A-6}; \node [dot]; % A-7 \coordinate (out); % A-8 \end{scope} \node [box, above=of A-5] (A-9) {A-9: o}; \node [box, below=of {$(A-4.south east)!0.5!(A-5.south west)$}] (A-10) {A-10: f}; % \path (in) edge ["$\bm{r}$"] (A-2) (A-2) edge (A-3) (A-3) edge ["$\bm{v}$"] (A-4) (A-4) edge ["$\bm{v}$"] (A-5) (A-5) edge ["$\bm{u}$"] (A-6) (A-6) edge [pos=0.25,"$\bm{x}$"] (out) % <--- red x label ([xshift=-2mm] A-9.south) edge ["$t$" '] ([xshift=-2mm] A-5.north) % <--- red lines in your MWE (A-9) edge (A-5) ([xshift=+2mm] A-9.south) edge ["$t$"] ([xshift=+2mm] A-5.north) % <--- red lines in your MWE ; \begin{scope}[every path/.style ={arr}] \draw (A-7) |- (A-9); \draw (A-9) -| node[pos=0.25,above] {$t$} (A-4); % <--- red lines from observer \draw (A-7) |- (A-10); \draw (A-10) -| (A-2.south) node[pos=0.98,left] {$-$}; % \draw ([xshift=-2mm] A-10.north) -- ++ (0,5mm) -| (A-4); % <--- red lines from feedback \draw ([xshift=+2mm] A-10.north) -- ++ (0,5mm) -| (A-5); % <--- red lines from feedback \end{scope} \end{tikzpicture} \end{document} 

enter image description here

Edit: Added are variables t at red lines and comments to code, which define red lines in your sketch.

In proposed solution I do the following editing steps (code I wrote before you edited question)

  • at all nodes use defined style box, i.e. block in your code and than delete all local definition of nodes style. By this code become far more shorter and clearer. Beside this, image has now uniform style of nodes (real content od nodes, which can influence on this decision, is still unknown)
  • Since nodes with exception for observer (does top nodes present it?) are in chain, for their positions I suggest to use chains library and by this remove repeating of right=of <node name> and make code further shorter
  • Because chain is named as A, the nodes in it are numbered as A-1, A-2 etc. This enable to remove nodes names needed for drawing arrows, however, you still can gives them names as you have (for example I preserve name of for first and last node (now replaced by coordinates).
  • In drawing arrows between nodes I prefer to use edge quotes. Code is a bit shorter, but require to ad quotes library in document preamble
  • that writing of arrows between nodes are used edges. Their style is also defined in tikzpicture options. By its use code for drawing arrows is further shortened.

That is all.

Changes in MWE should be evident from comparison of both MWE. Yes, in editing of your code fragment are done a lot of changes. If after this descriptions something is still not clear, don0t hesitate ask for explanation.

Changes, which added red lines in your images are now marked by % <--- <description>

Also is corrected proposed MWE, now contain variables, which you write at red arrows, too.

Edit (2): Added is lost output arrows with label x, labels u and v are moved to the same place as they are in the your sketch, and \boldsymbolis replaced with\bm` which is defined in the package of the same name.

In boxes are added their names. This may help you to identify coordinates of arrows.

It may happen, that in MWE are still some errors, for example wrong labels (be aware that you have two v what is -- to my opinion -- wrong), which now should be able to correct yourself ;-)

6
  • I decided to accept your answer, but can you maybe edit my code? Commented Jun 16, 2022 at 19:44
  • @elsa, actually I did. I remove all repetition of nodes style and used only one, defined in picture preamble. As further simplification of code, I add positioning of nodes in chain. At drawing arrows, I employ edge quotes, which enable a bit shorter code. Well, I rename block to box, what you can simple revert. Please, tell me, how you expect that your code be edited? That I will see what I can do. BTW, I will add `% <---% to code parts which deal with your red lines. Commented Jun 16, 2022 at 20:09
  • Where is your x line? @Zarko Commented Jun 17, 2022 at 14:05
  • 1
    @elsa, let me see: ups, missed is complete line. Corrected now. Also are corrected positions of edge quotes v and u )be aware that v is on tow place, what is wrong). Now I also replace \boldsymbol with \bm which is defined in the package of the same name. Commented Jun 17, 2022 at 14:36
  • 1
    @elsa, I did. Jus now. I should add to previous comment "Will be corrected ASAP" ... Commented Jun 17, 2022 at 14:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.