重现示例中的图片

重现示例中的图片

图片示例

\documentclass[landscape,a5paper,11pt]{article}
\usepackage[utf8x]{inputenc} % utf8 encoding
\usepackage[T1]{fontenc} % use T1 fonts
\usepackage{amsmath} % nice math symbols
\usepackage{bm} % bold math
\usepackage{color} % change text color        
\usepackage{tikz}
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\usetikzlibrary{decorations.pathmorphing} % for snake lines
\usetikzlibrary{matrix} % for block alignment
\usetikzlibrary{arrows} % for arrow heads
\usetikzlibrary{calc} % for manimulation of coordinates
%====================================================================
% TikZ styles for drawing
\tikzstyle{block} = [draw,rectangle,thick,minimum height=2em,minimum width=2em]
\tikzstyle{sum} = [draw, circle, label distance=0mm, label= 170:$+$, label=260:$-$, thick, minimum size=8mm ]
\tikzstyle{connector} = [->,thick]
\tikzstyle{line} = [thick]
\tikzstyle{branch} = [circle,inner sep=0pt,minimum size=1mm,fill=black,draw=black]
\tikzstyle{inp} = [draw=white]
\tikzstyle{abc_dq} = [draw,rectangle,thick,minimum height=6em,minimum width=2em]
%====================================================================
\begin{document}
\begin{tikzpicture}[scale=1, auto, >=stealth']
%----------------------------------------------------------------
%----------------------------------------------------------------
\small
% node placement with matrix library: 6x10 array
\matrix[ampersand replacement=\&, row sep=0.01cm, column sep=0.75cm] 
{ 
%----------------------------------------------------------------
% row 1
\& \& \node[inp](n1_3){$I_d^*$}; 
\& \node[sum] (n1_4) {}; 
\& \node[block] (n1_5) {PI};
\& \& \node[sum] (n1_8) {}; 
\& \& \& \& \\
%----------------------------------------------------------------
% row 2
\node[inp](n2_1){$I_{abc}$}; 
\& \& \& \node [branch] (n2_4) {};
\& \node [block] (n2_5) {$\omega L$}; 
\& \node[sum] (n2_6) {};
\& \& \\
%----------------------------------------------------------------
% row 3    
\& \& 
\node[abc_dq](n3_3){}; 
\& \& \& \& \& \& \& 
\node[abc_dq](n3_9){};\& \node[inp](n3_10){Switching pulses};\\   
%----------------------------------------------------------------
% row 4
\node[inp](n4_1){$V_{abc}$};     
\& \& \&\node [branch] (n4_4) {}; \&\node [block] (n4_5) {$\omega L$}; \& \& \& \& \& \& \\
%----------------------------------------------------------------    
% row 5  
\& \node[block](n5_2){PLL};\& 
\& \& \& \& \& \& \& \node[inp](n5_9){$\omega$}; \& \\ 
%----------------------------------------------------------------
% row 6
\& \& \node[inp](n6_3){$I_q^*$};\& \node[sum] (n6_4) {}; \& 
\node[block] (n6_5) {PI}; \& 
\& \node[sum] (n6_7) {}; \& \& \& \& \\ 
%----------------------------------------------------------------     
};    
%----------------------------------------------------------------
% now link the nodes
\draw [connector] (n1_3) -- (n1_4);
\draw [connector] (n1_4) -- (n1_5);
\draw [connector] (n1_5) -- (n1_8);
\draw [connector] (n1_8) -- ++(0.5,0cm) |- ++(0.5,0cm) |- (n3_9);
\draw [connector] (n2_1)-- ++(0.5,0cm) |- ++(0.5,0cm) |- (n3_3);
\draw [connector] (n3_3) -| (n2_4);
\draw [connector] (n2_4) -- (n2_5);
\draw [connector] (n2_4) -- (n1_4);
\draw [connector] (n2_5) -- (n2_6);
\draw [connector] (n2_6) -| (n6_7);
\draw [connector] (n4_1) -- ++(0.5,0cm) |- ++(0.5,0cm) |- (n3_3);
\draw [connector] (n3_3) -| (n2_6);
\draw [connector] (n3_3) -| (n4_4);
\draw [connector] (n4_5) -| (n1_8);
\draw [connector] (n4_1) |- (n5_2);
\draw [connector] (n5_2) -| (n3_3);
\draw [connector] (n4_4) -- (n6_4);
\draw [connector] (n4_4) -- (n4_5);
\draw [connector] (n6_3) -- (n6_4);
\draw [connector] (n6_4) -- (n6_5);
\draw [connector] (n6_5) -- (n6_7);
\draw [connector] (n6_7) -- ++(0.5,0cm) |- ++(0.5,0cm) |- (n3_9);
\draw [connector] (n3_9) -- (n3_10);
\draw [connector] (n5_9) -- (n3_9);
\end{tikzpicture}
\end{document}

我已在上面附加了一个最小工作示例,它提供了下面的图片。

在此处输入图片描述

以下是我面临的一些挑战:

  1. 添加来自输入 iabc 和 vabc 的三行,
  2. 在 abc/dq 块中,我想要画一条对角线,并在一侧写上 abc,在另一侧写上 dq。

对代码的任何修改或必要的更新都将受到赞赏。

答案1

矩阵完成后,只需在 tikzpicture 内添加以下内容。

% abc/dq block
\draw[thick] (n3_3.south west) -- (n3_3.north east);
\node[below right,inner sep=2pt] at(n3_3.north west) {abc};
\node[above left,inner sep=2pt] at(n3_3.south east) {dq};
% draw three lines 
\coordinate (A) at ($(n3_3.west) + (-1,0)$);
\draw ($(A)+(-.3cm,-.5cm)$) -- ($(A)+(.1cm,.5cm)$);
\draw ($(A)+(-.2cm,-.5cm)$) -- ($(A)+(.2cm,.5cm)$);
\draw ($(A)+(-.1cm,-.5cm)$) -- ($(A)+(.3cm,.5cm)$);

有时您可能想将节点移出矩阵网格。我将下面的示例与 (n4_1) 对齐,因为它就在那里。我本来可以使用偏移距离。

% draw lines off grid
\coordinate (B) at ($(n3_3.north west)!.25!(n3_3.south west)$);
\node[inp] (C) at (n4_1 |- B) {$I_{abc}$};
\draw[connector] (C) -- (B);

电路

相关内容