使用 tikz 绘制框图

使用 tikz 绘制框图

有人能帮我画一下这个框图吗?

在此处输入图片描述

\documentclass[10pt,a4paper]{article}
% \usepackage[turkish]{babel}
% \usepackage[latin5]{inputenc}
% \usepackage[T1]{fontenc}
\usepackage{graphicx}                      % Figures [draft]
\usepackage{float,graphpap}                % Figures 
\usepackage{curves}                        % Figures
\usepackage{longtable,array}               % Tables
\usepackage{amsmath,amssymb, amsthm}       % Equations
\usepackage[usenames,dvipsnames]{color}    % Colors
\usepackage{tocloft}                       % Table of Contents
\usepackage{enumitem}
\usepackage[numbers,sort&compress]{natbib} %

\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning} 

\textwidth      = 170mm 
\textheight     = 247mm %297-20*2-10 footskip + 1 vofffset
\parindent      = 0.0mm

\voffset        = -5.4mm
\topmargin      =  0.0mm
\headheight     =  0.0mm
\headsep        =  0.0mm

\hoffset        =  0.0mm
\oddsidemargin  = -5.4mm
\evensidemargin = -5.4mm
\marginparsep   =  0.0mm
\marginparwidth =  0.0mm

\pagenumbering{arabic}
\setlength{\footskip}{0.0in}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ****** Definition for EPS Inclusion *****************

\newcommand{\seteps}[4]{\hspace*{#1}\relax{
\includegraphics*[width=#2, height=#3]{#4}\par}
}

\newcommand{\centereps}[3]{\relax{\par\centering
\includegraphics*[width=#1, height=#2]{#3}\par}
}


% Two dimensional column vector
\newcommand{\colvectwo}[2]{\!\left[\!\!\!\begin{array}{c} #1 \\ #2 \end{array}\!\!\!\right]\!}
% Three dimensional column vector
\newcommand{\colvec}[3]{\!\left[\!\!\begin{array}{c} #1 \\ #2 \\ #3 \end{array}\!\!\right]\!}
% Three dimensional row vector
\newcommand{\rowvec}[3]{\!\left[\!\!\begin{array}{cccc} #1 & #2 & #3 \end{array}\!\!\right]\!}


\tikzstyle{block} = [draw, rectangle, inner sep = 0cm, minimum height=1.0cm, minimum width=1.0cm, very thick]
\tikzstyle{summer} = [draw, circle, inner sep = 0.0cm, minimum width=3mm, very thick, draw]  

\begin{document}
\pagestyle{empty}

\begin{center}
\begin{tikzpicture}[auto, >=latex', node distance = 2.0cm]
    \node[inner sep=0pt] at (0,0) (u) {}; % invisible node
    \node[summer, name=summer1, right of=u, node distance = 1.5cm] {};
    \node[block,  name=J,       right of=summer1] {\Large $1/J_i$};
    \node[block,  name=int1,    right of=J, node distance = 3.0cm] {\Large $\int$};
    \node[inner sep=0pt, right of=int1, node distance = 2.5cm] (q) {}; % invisible node
    \node[summer, name=summer2, above of=q] {};
    \node[inner sep=0pt, right of=summer2] (d) {}; % invisible node
    \node[block,  name=b,       above of=J] {\Large $b_i$};
    \node[summer, name=summer3, above of=summer1] {};
    \node[inner sep=0pt] at ($(summer2.west)!.5!(b.east)$) (theta_junc) {}; % invisible node
    \node[block,  name=int2,    above of=theta_junc] {\Large $\int$};
    \node[block,  name=k,       above of=b] {\Large $k_i$};
    
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (u) -- node {$u_i$} (summer1);
    \node[inner sep=0pt, red] at ($(summer1.east)!.5!(J.west)+(0,-3mm)$) {\footnotesize($Nm$)};
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (summer1) -- (J);
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (J) -- node {$\dot{q}_i$} (int1);
    \node[inner sep=0pt, red] at ($(J)!.5!(int1)+(0,-3mm)$) {\footnotesize($rad/s^2$)};
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (int1) -| (summer2);
    \node[inner sep=0pt]      at ($(int1)!.5!(q)+(0,+2mm)$) {$q_i$};
    \node[inner sep=0pt, red] at ($(int1)!.5!(q)+(0,-3mm)$) {\footnotesize($rad/s$)};
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (d) -- node[pos=1.05, yshift=2mm, rotate=90] {$-$} (summer2);
    \node[inner sep=0pt]      at ($(d)!.5!(summer2)+(0,+2mm)$) {$q_o$};
    \node[inner sep=0pt, red] at ($(d)!.5!(summer2.east)+(0,-3mm)$) {\footnotesize($rad/s$)};
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (summer2) -- node[] {$\dot{\theta}_i$} (b);
    \draw[->, >={Stealth[length=2mm]}, very thick] (b) -- (summer3);
    \draw[->, >={Stealth[length=2mm]}, very thick] (summer3) --  node[pos=0.95, yshift=0mm] {$-$}(summer1);
    \node[inner sep=0pt]      at ($(summer3.south)!.5!(summer1.north)+(3mm,0mm)$) {$\tau_d$};
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (theta_junc) -- (int2);
    
    \draw[->, >={Stealth[length=2mm]}, very thick] (int2) -- (k);
    \node[inner sep=0pt]      at ($(int2.west)!.5!(k.east)+(0,+2mm)$) {$\theta_i$};
    \node[inner sep=0pt, red] at ($(int2.west)!.5!(k.east)+(0,-3mm)$) {\footnotesize($rad$)};
    \draw[->, >={Stealth[length=2mm]}, very thick] (k) -| (summer3);
    
    %\path[draw,->, very thick]  ($(Po.east)!0.5!(y)$) --  ($(Po.east)!0.5!(y) + (0, -3cm)$) -| node[pos=0.98, xshift=6mm] {$-$} (summer-outer);    
\end{tikzpicture}
\end{center}

\begin{align*}
    \tau_d  = b_i \dot{\theta}_i + k_i \theta_i
            = -b_i q_o + b_i q_i + k_i \theta_i 
\end{align*}
\end{document}

答案1

重写图像代码并根据文档示例制作 MWE(最小工作示例)。

编辑: 哎呀,我忘了求和器的符号 :-(。现在添加:

在此处输入图片描述

\documentclass[border=3.141592]{standalone}
%\documentclass[a4paper]{article}
% \usepackage[turkish]{babel}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                chains,
                decorations.markings,
                positioning,
                babel}

\tikzset{
    box/.style = {rectangle, draw, thick, minimum size=1cm,
                  font=\large, on chain},
    sum/.style = {circle, draw, thick, 
                  minimum width=3mm, inner sep = 0pt,
                  node contents={}},
every edge/.style = {draw, semithick, ->}
        }

\begin{document}
    \begin{tikzpicture}[auto, 
            > = Straight Barb, 
node distance = 4mm and 7mm,
  start chain = going below,
every path/.style = semithick
                        ]

\node (n1) [box]    {$B_{01}$};
\node (n2) [box]    {$\frac{1}{sJ_1}$};
\node (n3) [box]    {$B_{12}$};
\node (n4) [box]    {$\frac{1}{sJ_2}$};
\node (n5) [box]    {$B_{23}$};
\node (n6) [box]    {$\frac{1}{sJ_3}$};
%
\node (s11) [sum,left=of n2];
\node (s12) [sum,left=of n4];
\node (s13) [sum,left=of n6];
\node (s21) [sum,right=of n3];
\node (s22) [sum,right=of n5];
%%
\draw[<-] (s11.west) -- ++ (-1,0) node[above right] {$T_1$};
\draw[<-] (s12.west) -- ++ (-1,0) node[above right] {$T_2$};
\draw[<-] (s13.west) -- ++ (-1,0) node[above right] {$T_3$};
%
\draw[->] (n2.east) -- ++ (2,0) node[above left] {$\dot{\theta}_1$};
\draw[->] (n4.east) -- ++ (2,0) node[above left] {$\dot{\theta}_2$};
\draw[->] (n6-|s22) -- ++ (1,0) node[above left] {$\dot{\theta}_3$};
%
\draw   (s11) edge (n2)  (s12) edge (n4)  (s13) edge (n6)
        (s21) edge (n3)  (s22) edge (n5);
%
\draw[->]   (n1)  -| (s11) node[above right] {$-$};
\draw[<->]  (s11) -- (s12) node[above right] {$-$};
\draw[<->]  (s12) -- (s13) node[above right] {$-$};
\draw   (n3) -- (n3-|s11)   (n5) -- (n5-|s12);
%
\draw[->]   (s21) |- (n1);
\draw[<->]  (s22) -- (s21) node[below left] {$-$};
\draw[->]   (n6)  -| (s22) node[below left] {$-$};
    \end{tikzpicture}
\end{document}

相关内容