你好,这是我的第一个 TikZ 代码:
\documentclass[]{article}
\usepackage{rotating}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\tikzset{
block/.style = {draw, rectangle,
minimum height=1cm,
minimum width=2cm},
input/.style = {coordinate,node distance=1cm},
output/.style = {coordinate,node distance=4cm},
arrow/.style={draw, -latex,node distance=2cm},
pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
sum/.style = {draw, circle, node distance=1cm},
gain/.style = {regular polygon, regular polygon sides=3,
draw, fill=white, text width=1em,
inner sep=1mm, outer sep=0mm,
shape border rotate=-90}
}
\begin{document}
\begin{sidewaysfigure}
\centering
\begin{tikzpicture}[auto, node distance=1cm,>=latex']
%DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, right=of input] (position_sum) {};
\node [block, right=of position_sum] (position_controller) {$C_{pos}(s)$};
\node [sum, right=of position_controller] (speed_sum) {};
\node [block, right=of speed_sum] (speed_controller) {$C_{vel}(s)$};
\node [sum, right=of speed_controller] (current_sum) {};
\node [block, right=of current_sum] (current_controller) {$C_{corr}(s)$};
\node [block, right=of current_controller] (azionamento) {$Azionamento$};
\node [gain, right= of azionamento] (Kt) {$K_{t}$};
\node [sum, right=of Kt, pin={[pinstyle]above:$-C_{R}(s)$},
node distance=3cm] (torque_sum) {};
\node [block, right=of torque_sum] (system) {$\frac{1}{sJ+f}$};
\node [block, right=of system] (integrator) {$\frac{1}{s}$};
\node [gain, right= of integrator] (tau) {$\tau$};
\node [output, right=of tau] (output) {};
\node at ($(speed_controller)!0.5!(system)+(0,-2)$) [block] (speed_feedback) {Trasduttore di velocit\`a};
%DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\draw [draw,->] (input) -- node {$\theta_{M}^{DES}(s)$} (position_sum);
\draw [->] (position_sum) -- node {$E_{p}(s)$}(position_controller);
\draw [->] (position_controller) -- node {$\omega_{M}^{DES}(s)$}(speed_sum);
\draw [->] (speed_sum) -- node {$E_{v}(s)$}(speed_controller);
\draw [->] (speed_controller) -- node {$I^{DES}(s)$}(current_sum);
\draw [->] (current_sum) -- (current_controller);
\draw [->] (current_controller) -- (azionamento);
\draw [->] (azionamento) -- node [name=current]{$I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{M}(s)$}(torque_sum);
\draw [->] (torque_sum) -- (system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}(integrator);
\draw [->] (integrator) -- node [name=motor_position] {$\theta_{M}(s)$}(tau);
\draw [->] (tau) -- node [name=tetaload] {$\theta_{C}(s)$}(output);
%DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (current) -- ++ (0,-2) -| node [pos=0.99] {$-$} (current_sum);
\draw [->] (motor_position) -- ++ (0,-6) -| node [pos=0.99] {$-$} (position_sum);
\draw [->] (motor_speed) |- (speed_feedback) ;
\draw [->] (speed_feedback) -| node[pos=0.99] {$-$} (speed_sum);
\end{tikzpicture}
\caption{Anello di controllo di un asse elettro-meccanico con accoppiamento rigido}
\label{fig:full_control_loop_rigido}
\end{sidewaysfigure}
\end{document}
最终的控制回路如下所示:
所以我不知道如何解决以下问题:
- 顶部的图像被剪切(我看不到我的控制循环的最后一部分,确切地说是 integra、tau 和输出节点);
- 单一“电流反馈”与速度译本(速度反馈);
- 箭头上方写的一些变量与一些块叠加;
- 我必须使用,
\begin{sidewaysfigure}
因为如果我使用,我的身材就会被完全“切割”\begin{figure}
。
我请求解决这四个问题(或至少 1、2、3),因为我确实是新手TikZ
。谢谢!
答案1
嗯,您的图表对于页面来说太大了。如果您调整节点之间的距离,减小节点inner sep
的字体大小和gain
,并删除minimum width
节点的block
,您至少可以让旋转后的版本适合页面,尽管它仍然比文本区域宽,因此您会收到警告overfull hbox
。
另一种可能是将其垂直布置而不是水平布置,在这种情况下它会很合适。
\documentclass{article}
\usepackage{rotating}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}
\tikzset{
pinstyle/.style={pin edge={to-,thin,black}},
block/.style = {draw, rectangle,
minimum height=1cm,
% minimum width=2cm
},
input/.style = {coordinate,node distance=1cm},
output/.style = {coordinate,node distance=4cm},
arrow/.style={draw, -latex,node distance=2cm},
pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
sum/.style = {draw, circle, node distance=1cm},
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}
\begin{sidewaysfigure}
\centering
\begin{tikzpicture}[auto,>=latex',every node/.append style={font=\scriptsize}]
%DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, right=of input] (position_sum) {};
\node [block, right=of position_sum] (position_controller) {$C_{\mathrm{pos}}(s)$};
\node [sum, right=15mm of position_controller] (speed_sum) {};
\node [block, right=of speed_sum] (speed_controller) {$C_{\mathrm{vel}}(s)$};
\node [sum, right=of speed_controller] (current_sum) {};
\node [block, right=5mm of current_sum] (current_controller) {$C_{\mathrm{corr}}(s)$};
\node [block, right=5mm of current_controller] (azionamento) {Azionamento};
\node [gain, right= of azionamento] (Kt) {$K_{t}$};
\node [sum, right=of Kt, pin={[pinstyle]above:$-C_{R}(s)$},
node distance=3cm] (torque_sum) {};
\node [block, right=5mm of torque_sum] (system) {$\frac{1}{sJ+f}$};
\node [block, right=of system] (integrator) {$\frac{1}{s}$};
\node [gain, right= of integrator] (tau) {$\tau$};
\node [output, right=1cm of tau] (output) {};
\node at ($(speed_controller)!0.5!(system)+(0,-2.5)$) [block] (speed_feedback) {Trasduttore di velocit\`a};
%DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\draw [->] (input) -- node {$\theta_{M}^{\mathrm{DES}}(s)$} (position_sum);
\draw [->] (position_sum) -- node {$E_{p}(s)$}(position_controller);
\draw [->] (position_controller) -- node {$\omega_{M}^{\mathrm{DES}}(s)$}(speed_sum);
\draw [->] (speed_sum) -- node {$E_{v}(s)$}(speed_controller);
\draw [->] (speed_controller) -- node {$I^{\mathrm{DES}}(s)$}(current_sum);
\draw [->] (current_sum) -- (current_controller);
\draw [->] (current_controller) -- (azionamento);
\draw [->] (azionamento) -- node [name=current]{$I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{M}(s)$}(torque_sum);
\draw [->] (torque_sum) -- (system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}(integrator);
\draw [->] (integrator) -- node [name=motor_position] {$\theta_{M}(s)$}(tau);
\draw [->] (tau) -- node [name=tetaload] {$\theta_{C}(s)$}(output);
%DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (current) -- ++ (0,-1.5) -| node [pos=0.99] {$-$} (current_sum);
\draw [->] (motor_position) -- ++ (0,-4) -| node [pos=0.99] {$-$} (position_sum);
\draw [->] (motor_speed) |- (speed_feedback) ;
\draw [->] (speed_feedback) -| node[pos=0.99] {$-$} (speed_sum);
\end{tikzpicture}
\caption{Anello di controllo di un asse elettro-meccanico con accoppiamento rigido}
\label{fig:full_control_loop_rigido}
\end{sidewaysfigure}
\begin{figure}
\centering
\begin{tikzpicture}[node distance=5mm, auto,>=latex',every node/.append style={font=\scriptsize},block/.append style={minimum width=2cm}]
%DEFINIZIONE BLOCCHI
\node [input, name=input] {};
\node [sum, below=of input] (position_sum) {};
\node [block, below=of position_sum] (position_controller) {$C_{\mathrm{pos}}(s)$};
\node [sum, below=of position_controller] (speed_sum) {};
\node [block, below=of speed_sum] (speed_controller) {$C_{\mathrm{vel}}(s)$};
\node [sum, below=of speed_controller] (current_sum) {};
\node [block, below=of current_sum] (current_controller) {$C_{\mathrm{corr}}(s)$};
\node [block, below=of current_controller] (azionamento) {Azionamento};
\node [gain, below= of azionamento] (Kt) {$K_{t}$};
\node [sum, below=of Kt, pin={[pinstyle]left:$-C_{R}(s)$}] (torque_sum) {};
\node [block, below=3mm of torque_sum] (system) {$\frac{1}{sJ+f}$};
\node [block, below=of system] (integrator) {$\frac{1}{s}$};
\node [gain, below=of integrator] (tau) {$\tau$};
\node [output, below=1cm of tau] (output) {};
\node at ($(speed_controller)!0.5!(system)+(4,0)$) [block] (speed_feedback) {Trasduttore di velocit\`a};
%DEFINIZIONE COLLEGAMENTI IN CATENA DIRETTA
\draw [->] (input) -- node {$\theta_{M}^{\mathrm{DES}}(s)$} (position_sum);
\draw [->] (position_sum) -- node {$E_{p}(s)$}(position_controller);
\draw [->] (position_controller) -- node {$\omega_{M}^{\mathrm{DES}}(s)$}(speed_sum);
\draw [->] (speed_sum) -- node {$E_{v}(s)$}(speed_controller);
\draw [->] (speed_controller) -- node {$I^{\mathrm{DES}}(s)$}(current_sum);
\draw [->] (current_sum) -- (current_controller);
\draw [->] (current_controller) -- (azionamento);
\draw [->] (azionamento) -- node [name=current]{$I(s)$}(Kt);
\draw [->] (Kt) -- node {$C_{M}(s)$}(torque_sum);
\draw [->] (torque_sum) -- (system);
\draw [->] (system) -- node [name=motor_speed] {$s\theta_{M}(s)$}(integrator);
\draw [->] (integrator) -- node [name=motor_position] {$\theta_{M}(s)$}(tau);
\draw [->] (tau) -- node [name=tetaload] {$\theta_{C}(s)$}(output);
%DEFINIZIONE COLLEGAMENTI FEEDBACK
\draw [->] (current) -- ++ (1.5,0) |- node [pos=0.99] {$-$} (current_sum);
\draw [->] (motor_position) -- ++ (7,0) |- node [pos=0.99] {$-$} (position_sum);
\draw [->] (motor_speed) -| (speed_feedback) ;
\draw [->] (speed_feedback) |- node[pos=0.99] {$-$} (speed_sum);
\end{tikzpicture}
\caption{Anello di controllo di un asse elettro-meccanico con accoppiamento rigido}
\label{fig:full_control_loop_rigido}
\end{figure}
\end{document}