但我无法实现。我是 tikz 的初学者。
\documentclass[french, tikz,border=5]{standalone}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\DeclareMathSizes{10.95}{13}{8}{8}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{pgf}
\usetikzlibrary{positioning,arrows.meta,calc}
\tikzset{
block/.style={
shape=rectangle,
fill=black!30,
draw=black,
minimum width=1.15cm,
minimum height=1cm,
label=above:\strut#1
},
circ/.style={draw, circle, path picture={\draw
(path picture bounding box.south east) -- (path picture bounding box.north west) (path picture bounding box.south west) -- (path picture bounding box.north east);
}},
sum/.style args={+ #1 - #2}{
shape=circle,
fill=white,
draw=black,
minimum size=0.75cm,
label={#1:$+$},
label={#2:$-$}
},
sum/.default={+ 195 - 255},
flow/.style={
draw=black, very thick,
-Triangle
},
Delta (s)/.style args={"#1_#2" #3}{
insert path={
node [midway, #3=0.25cm] {$\Delta #1_{\scriptsize#2}(s)$}
}
}
}
\begin{document}
\begin{tikzpicture}[node distance=1.30cm]
\node [block=Régulateur de vitesse, right=of s2] (governor) {$\dfrac{1}{1+\tau_{rv}s}$};
\node [block=Turbine, right=of governor] (turbine) {$\dfrac{1}{1+\tau_{T}s}$};
\node[circ, label={[label distance=-4mm]90:$-$},label={[label distance=-4mm]180:$+$}, minimum size=8mm, right = of turbine] (s3) {};
\node[circ, label={[label distance=-4mm]-90:$-$},label={[label distance=-4mm]180:$-$}, minimum size=8mm, left =of governor] (s2) {};
\coordinate [above=of s3] (input);
\node [block=Générateur et charge, right=of s3] (power system) {$\dfrac{1}{2Hs+D}$};
\node [block= , below=1.5cm of turbine] (speed drop) {$\dfrac{1}{R}$};
\node [block, below=1.5cm of speed drop] (KI) {$\dfrac{K_I}{s}$};
\node [block, above=0.2cm of KI] (pro) {$K_P$};
\node[circ, label={[label distance=-4mm]-90:$+$},label={[label distance=-4mm]90:$+$}, minimum size=8mm, left = of KI] (s4) {};
\coordinate [right=2cm of power system] (end);
\draw [flow] (s2) -- (governor) node[midway, below] {$\Delta P_{rv}(s)$};
\draw [flow] (governor) -- (turbine) node[midway, below] {$\Delta P_{v}(s)$};
\draw [flow] (turbine) -- (s3) node[midway, below] {$\Delta P_{m}(s)$};
\draw [flow] (input) -- (s3) [Delta (s)={"P_L" right, near start}];
\draw [flow] (s3) -- (power system);
\draw [flow] (power system) -- (end) [Delta (s)={"\omega_" above, near end}];
\draw [flow] ($(power system.east)!1/4!(end)$) |- (speed drop)
node [midway, above left] {Boucle primaire};
\draw [flow] (speed drop) -| (s2);
\draw [flow] ($(power system.east)!1/2!(end)$) |- (KI)
node [midway, above left] {Boucle secondaire};
\draw [flow] (KI) -- (s4)
%\draw [flow](s4) -- (s4-|s2.south) --++ (-1,0) coordinate (a) -- (a|- s2.west) -- (s2) [Delta (s)={"P_{ref}" above=2cm of s2,left=0.25cm of s2}];
\end{tikzpicture}
\end{document}
答案1
您可以沿路径定位节点,这样可以节省代码中的行数。如果您不想要箭头,请添加-
到路径属性中,例如:
\draw[flow,-] ...
这是完整版本。
输出
代码
\documentclass[tikz,margin=10pt]{standalone}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{shapes,positioning,arrows.meta,calc}
\DeclareMathSizes{10.95}{13}{8}{8}
\tikzset{
block/.style={
shape=rectangle,
fill=black!30,
draw=black,
minimum width=1.15cm,
minimum height=1cm,
label=above:\strut#1
},
circ/.style={draw, circle, path picture={\draw
(path picture bounding box.south east) -- (path picture bounding box.north west) (path picture bounding box.south west) -- (path picture bounding box.north east);
}},
sum/.style args={+ #1 - #2}{
shape=circle,
fill=white,
draw=black,
minimum size=0.75cm,
label={#1:$+$},
label={#2:$-$}
},
sum/.default={+ 195 - 255},
flow/.style={
draw=black, very thick,
-Triangle
},
Delta (s)/.style args={"#1_#2" #3}{
insert path={
node [midway, #3=0.25cm] {$\Delta #1_{#2}(s)$}
}
}
}
\begin{document}
\begin{tikzpicture}[node distance=1.30cm]
\node [block=Régulateur de vitesse] (governor) {$\dfrac{1}{1+\tau_{rv}s}$};
\node [block=Turbine, right=of governor] (turbine) {$\dfrac{1}{1+\tau_{T}s}$};
\node[circ, label={[label distance=-4mm]90:$-$},label={[label distance=-4mm]180:$+$}, minimum size=8mm, right = of turbine] (s3) {};
\node[circ, label={[label distance=-4mm]-90:$-$},label={[label distance=-4mm]180:$-$}, minimum size=8mm, left =of governor] (s2) {};
\coordinate [above=of s3] (input);
\node [block=Générateur et charge, right=of s3] (power system) {$\dfrac{1}{2Hs+D}$};
\node [block= , below=1.5cm of turbine] (speed drop) {$\dfrac{1}{R}$};
\node [block, below=1.5cm of speed drop] (KI) {$\dfrac{K_I}{s}$};
%\node [block, above=0.2cm of KI] (pro) {$K_P$};
\node[circ, label={[label distance=-4mm]-90:$+$},label={[label distance=-4mm]90:$+$}, minimum size=8mm, left = of KI] (s4) {};
\coordinate [right=2cm of power system] (end);
\draw [flow] (s2) -- (governor) node[midway, below] {$\Delta P_{rv}(s)$};
\draw [flow] (governor) -- (turbine) node[midway, below] {$\Delta P_{v}(s)$};
\draw [flow] (turbine) -- (s3) node[midway, below] {$\Delta P_{m}(s)$};
\draw [flow] (input) -- (s3) [Delta (s)={"P_L" right, near start}];
\draw [flow] (s3) -- (power system);
\draw [flow] (power system) -- (end) [Delta (s)={"\omega_" above, near end}];
\draw [flow] ($(power system.east)!1/4!(end)$) |- (speed drop)
node [midway, above left] {Boucle primaire};
\draw [flow] (speed drop) -| (s2);
\draw [flow] ($(power system.east)!1/2!(end)$) |- (KI)
node [midway, above left] {Boucle secondaire};
\draw [flow,-] (KI) -- (s4);
\draw[flow,-] ($(KI.east)+(1.7cm,0)$) -- ++ (0,1.3) coordinate (temp) -- (temp-|s4) node[thin,block, midway] {$K_P$} -- (s4);
\draw[flow] (s4) -- ++ (-4,0) coordinate (tempp) -- (tempp|-s2) -- (s2);
\end{tikzpicture}
\end{document}