
出力を integrator というブロックに接続する矢印の開始点を揃えようとしていますY
。矢印がブロックから出る矢印の中央N
(Y の文字の真下) から始まるようにしたいのですが、どうすれば実現できますか?
次の図のようになることを望みます:
y
文字の真下から始まって測定ブロックに向かう矢印のように。
私が書いたコードは次のとおりです (テスト ファイルなので、ギリシャ文字はすべて無視してください)。
\documentclass{article}
\usepackage[LGR]{fontenc} % specific font
\usepackage[utf8]{inputenc} % κωδικοποίηση γραμμάτων για να εμφανίζονται κατανοητά ελληνικά γράμματα
\usepackage[greek]{babel} % πακέτο των ελληνικών γραμμάτων
\usepackage{tikz} % πακέτο για control systems diagram
\usetikzlibrary{shapes,arrows} % πακέτο απαραίτητο για control systems block diagrams
\usepackage{verbatim}
\tikzset{
% pinstyle/.style={pin edge={to-,thin,black}}, % you have another one below
gain/.style = {
regular polygon, regular polygon sides=3,
draw, fill=white, text width=1em,
inner sep=0mm, outer sep=0mm,
shape border rotate=-90
},
}
\begin{document}
% \textlatin --> Χρησιμοποιείται για να εισάγουμε κείμενο με λατινικούς χαρακτήρες στα σημεία που επιθυμούμε.
\textlatin{This is a test file created by Teo Protoulis. What about continuing the document? Where does the paragraph change?}
\section{Εισαγωγή}
Για να δούμε αν αναγνωρίζει και τα ελληνικά γράμματα! Α, πάρα πολύ ωραία! Μπορούμε να γραουμε και στα ελληνικά.
\section{Πρώτο Μέρος}
Στο πρώτο μέρος θα γράψουμε κάποιες συνήθεις διαφορικές εξισώσεις έτσι για να εξασκηθούμε πάνω στο \textlatin{LaTex}:
\[\ddot{y}+a_1\dot{y}+a_2y=b_0u\]
Αυτή είναι η διαφορική εξίσωση που περιγράφει το σύστημα μας. Στη συνέχεια παρατίθεται ο \textlatin{PID} ελεγκτής που χρησιμοποιήθηκε προκειμένου να επιτύχουμε \textlatin{reference tracking}:
\[C(s) = K_p+K_d\frac{Ns}{s+N}+K_i\frac{1}{s}\]
Παρατηρούμε ότι το μονοπάτι της παραγώγου σχεδιάστηκε χρησιμοποιώντας την παρακάτω λογική:
\bigskip % intentionally leave empty line
\bigskip
\begin{center}
\tikzstyle{block} = [draw, rectangle,
minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
\node [input,name=e] {};
\node [block,name=derivative gain,right of=e] {\latintext{Derivative Gain}};
\node [input,name=input,right of=derivative gain,node distance=1.5cm] {};
\node [sum,right of=input] (sum) {};
\node [block,right of=sum,node distance=3cm, name=static gain] (static gain) {N};
\node [block, below of=static gain, name=integrator] (integrator) {\latintext{Integrator}};
\node [output,right of=static gain,node distance=3cm] (output) {};
\draw [->] (e) -- node {$e$} (derivative gain);
\draw [->] (derivative gain) |- node[pos=0.89] {$+$} node [near end] {} (sum);
\draw [->] (static gain) -- node [name=y] {$Y$} (output);
\draw [->] (sum) -- node [name=error] {$error$} (static gain);
\draw [->] (output) |- (integrator);
\draw [->] (integrator) -| node[pos=0.95] {$-$}
node [near end] {} (sum);
\end{tikzpicture}
\end{center}
\end{document}
答え1
あなたと使用
\draw [->] (y|-output) |- (integrator);
ここで、 はx 座標が、 y 座標が の(y|-output)
点です。y
output
これは、いくつかのトピック外の変更 ( なし\tikzstyle
、 の使用positioning
、arrows
による置き換えarrows.meta
など)が加えられた完全なコードです。
\documentclass{article}
\usepackage[greek]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows.meta,positioning}
\begin{document}
\begin{center}
\tikzset{block/.style={draw, rectangle,
minimum height=3em, minimum width=6em},
sum/.style={draw, circle, node distance=1cm},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={pin edge={to-,thin,black}},}
\begin{tikzpicture}[auto, node distance=1.2cm,>=Latex]
\node [input,name=e] {};
\node [block,name=derivative gain,right=of e] {\latintext{Derivative Gain}};
\node [sum,right=2cm of derivative gain] (sum) {};
\node [block,right=of sum,node distance=3cm, name=static gain] (static gain) {N};
\node [block, below=of static gain, name=integrator] (integrator) {\latintext{Integrator}};
\node [output,right=of static gain,node distance=3cm] (output) {};
\draw [->] (e) -- node {$e$} (derivative gain);
\draw [->] (derivative gain) |- node[pos=0.89] {$+$} node [near end] {} (sum);
\draw [->] (static gain) -- node [name=y] {$Y$} (output);
\draw [->] (y|-output) |- (integrator);
\draw [->] (sum) -- node [name=error] {\latintext{error}} (static gain);
\draw [->] (integrator) -| node[pos=0.95] {$-$}
node [near end] {} (sum);
\end{tikzpicture}
\end{center}
\end{document}
答え2
追加のTikZライブラリchains
とを使用するとquotes
、文字Yの座標はノード名で決定されます。
\documentclass{article}
\usepackage[greek]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning,
quotes}
\begin{document}
\begin{center}
\begin{tikzpicture}[auto,
node distance = 6mm and 12mm,
start chain = going right,
arr/.style = {-Latex},
block/.style = {draw, minimum height=3em, minimum width=6em},
sum/.style = {circle, draw, node contents={}},
]
\begin{scope}[nodes={on chain, join=by arr}]
\coordinate (in);
\node (n1) [block] {\latintext{Derivative Gain}};
\node (n2) [sum];
\node (n3) [block] {$N$};
\coordinate (out);
\end{scope}
\node (n4) [block, below=of n3] {\latintext{Integrator}};
%
\path (in) to ["$e$"] (n1)
(n1) to [pos=0.85,"$+$"] (n2)
(n2) to ["\latintext{error}"] (n3)
(n3) to ["$Y$"{name=y}] (out);
\draw[arr] (n3.north) ++ (0,1) node[above] {\latintext{Integrator}} -- (n3);
\draw[arr] (y) |- (n4);
\draw[arr] (n4) -| (n2) node[pos=0.95] {$-$};
\end{tikzpicture}
\end{center}
\end{document}