平均能量损失

平均能量损失

我使用left ofbelow of参数在 Tikz 中水平和垂直对齐块/节点。如何对齐节点/块两个都相对于两个已经定义的块/节点垂直和水平?基本上我希望我的新块有一个节点的 x 坐标和另一个节点的 Y 坐标。

代码和图像(根据从 SE 获得的示例修改)如下所示。目前,是LongBox3。但是,我也希望它belowof summing junction是。目前,我通过手动调整来实现这一点。有没有办法让节点/块从一个块继承 x 坐标,从另一个块继承 y 坐标?leftofLongbox2node distance

PS:我不想在我的图表中使用矩阵组织(正如 SE 中的许多对齐问题所建议的那样),因为完整的图表不适合行和列模式(我试图在我的参考文本中重现图表。因此,如果有帮助的话,我不想将块重新排列成行和列排列)。

本文末尾给出了一个 MWE,其节点数较少

我的框图

\documentclass[12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}

\begin{document}

\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=2em, minimum width=2em},
tmp/.style  = {coordinate}, 
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}}
}
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
    \node [input, name=rinput] (rinput) {};
    \node [sum, right of=rinput, node distance=2cm] (sum1) {};
    \node [block, right of=sum1, node distance=1cm] (controller) {ZZ};
    \node [block, below of=controller, node distance=1.5cm] (mingain) {$ABC$};
    \node [sum, right of=controller] (sum2) {};
    \node [sum, below of=sum2, node distance=1.5cm] (sum3) {};

    \node [block, right of=sum2, node distance = 3.5cm] (plant) {$\dot{x}=Ax+Bu$};
    \node [block, below of=plant] (longblock1) {Long Box1};
    \node [block, right of=longblock1, node distance = 6em] (smlblock) {$DEF$};
    \node [block, below of=longblock1, node distance = 1cm, xshift=0.5cm] (longblock2) {Long Box2};

    \node [output, right of=plant, node distance = 3cm] (output){};

下面相关行

    \node [block, below of=sum3, node distance = 1.5cm] (longblock3) {Long Box3};

其余代码

    \node [sum, left of=longblock3, node distance =2cm] (sum4) {};
    \node [block, left of=sum4, node distance =1.5cm] (model) {Box4};

    \node [tmp, above of=sum4, node distance=2cm](tmp1){};

    \draw [-latex] (rinput) -- node[pos=0.2]{GHI} (sum1);
    \draw [-latex] (sum1) -- (controller);
    \draw [-latex] (controller) -- (sum2);
    \draw [-latex] (sum2) -- node[pos=0.7, name=deltac]{JKL}(plant);
    \draw [-latex] (plant) -- node[name=measured]{MNO}(output);

    \draw [-latex] (deltac) |- (longblock1);
    \draw [-latex] (longblock1) -- (smlblock);
    \draw [-latex] (smlblock) |- (longblock2);
    \draw [-latex] (longblock2) -- node{PQR}(longblock3);
    \draw [-latex] (longblock3) -- node[xshift=1.5em]{S}(sum3);
    \draw [-latex] (sum3) -- node[xshift=1.5em, pos=0.7]{V}(sum2);

    \draw [-latex] (rinput) -| (model);
    \draw [-latex] (model) -- (sum4);
    \draw [-latex] (sum4) -- node{$Y$}(longblock3);

    \draw [-latex] (mingain) -- (sum3);

    \draw [-latex] (tmp1) -- node[pos=0.8]{$-$}(sum1);
    \draw [-latex] (tmp1) -- node[pos=0.8,xshift=-1.5em]{$-$}(sum4);
    \draw [-] (measured) |- (tmp1);
\end{tikzpicture}
\end{document}

平均能量损失

我希望块 5 与块 2 和 4 对齐没有采取矩阵式组织。

\documentclass[12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}

\begin{document}

\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=2em, minimum width=2em},
tmp/.style  = {coordinate}, 
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}}
}
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
    \node [block] (controller) {2};
    \node [block, right of=controller, node distance=1.5cm] (mingain) {3};
    \node [block, below of=mingain] (sum2) {4};
    \node [sum, below of=controller] (sum3) {5};

\end{tikzpicture}
\end{document}

在此处输入图片描述

我尝试将行改为\node [sum, below of=controller] (sum3) {5};\node [sum, below of=controller, left of=sum2] (sum3) {5};但没有效果。

答案1

您可以使用\node [sum] (sum3) at (controller |- sum2) {5};,它将 放置sum3在 的 x 坐标controller和 的 y 坐标处sum2

\documentclass[12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,calc}

\begin{document}

\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=2em, minimum width=2em},
tmp/.style  = {coordinate}, 
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}}
}
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
    \node [block] (controller) {2};
    \node [block, right of=controller, node distance=1.5cm] (mingain) {3};
    \node [block, below of=mingain] (sum2) {4};
    \node [sum] (sum3) at (controller |- sum2) {5};

\end{tikzpicture}
\end{document}

相关内容