Sơ đồ với công tắc

Oct 23 2020

Tôi muốn làm sơ đồ này trong latex. Tôi biết cách vẽ hình chữ nhật và mũi tên (người dùng tikz cơ bản) nhưng làm nó đối xứng để đầu mũi tên nằm giữa tâm của hộp tiêu tốn rất nhiều thời gian (thường cần phải làm điều đó trên giấy trước tiên xác định tất cả các độ dài). Có cách nào nhanh hơn để thực hiện loại sơ đồ này không? Ngoài ra nếu bạn có thể giúp với bất kỳ phần nào của sơ đồ này, tôi có thể hoàn thành phần còn lại. Cảm ơn bạn

Trả lời

5 Rmano Oct 23 2020 at 00:17

Nếu bạn thấy mình phải thực hiện rất nhiều phép tính thủ công để duy trì sự đối xứng, tôi có hai gợi ý cho bạn:

  1. học cách sử dụng chính xác các tọa độ tương đối coordinatevà neo;
  2. học cách sử dụng thư viện calcTi k Z (không cần thiết ở đây, nhưng ...).

Một cách để xây dựng sơ đồ của bạn là cách sau (có thể được nén lại, nhưng tôi không muốn sử dụng thủ thuật hoặc những thứ tương tự khác --- mã phải đơn giản).

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
    \draw (0,0) coordinate(A) to[rmeterwa] ++(3,0) coordinate(B);
    % circuitikz manual page 105
    \node [cute spdt up arrow, anchor=in](sw-r) at (B){};
    \node [cute spdt up arrow, anchor=in, xscale=-1](sw-l) at (A){};
    \draw [dashed] (sw-l-in) -- (sw-l-out 2);
    \draw [dashed] (sw-r-in) -- (sw-r-out 2);
    \draw (sw-l.out 1) -- ++(-2,0);
    \draw (sw-l.out 2) to[generic, name=G] ++(-2,0);
    \node at (G.center) {D};
    % circuitikz manual page 71
    % put the adder midway between the switch and ++(2,0)
    \draw (sw-r.out 1) ++(1,0) node[adder, circuitikz/blocks/scale=0.5](ADD){} ++(1,0) coordinate(Aend);
    \draw (sw-r.out 1) -- (ADD.w) node[inputarrow]{} (ADD.e) -- (Aend) node[inputarrow]{};
    \draw (ADD.n) node[inputarrow, rotate=-90]{} -- ++(0,0.5);
\end{circuitikz}
\end{document}

5 Bernard Oct 23 2020 at 02:59

Một giải pháp pstricks với pst-circgói:

\documentclass[11pt, border=6pt, svgnames]{standalone}
\usepackage{pst-circ}

\usepackage{sansmath}

\begin{document}

\begin{pspicture}(-5,-1)(6.5,2.5)
\sffamily\psset{dash=4pt 3pt, linewidth=1pt, arrowinset=0, linejoin=1}%, 
\SpecialCoor
\pnodes{A}(0,0)(-1.5,0)(1.5,0)
\pnodes{B}(-5,0.75)(-2.5,0.75)(2.5,0.75)(6.4,0.75)
\pnodes{C}(-5,-0.75)(-2.5,-0.75)(2.5,-0.75)
\pnodes(0,0){O}(4.45,2.5){C}
\pcline(B0)(B1)
\resistor[labeloffset=0](C0)(C1){D}
\Ucc(A1)(A2){}
{\psset{linewidth=0.8pt}\psline{->}(0.9;-120)(0.9;60)
\psarc{->}(A1){0.75}{110}{170}\psarcn{->}(A2){0.75}{70}{10}}
{\psset{linewidth=1.5pt}\pcline{-*}(A1)(B1)\pcline[linestyle=dashed]{o-*}(A1)(C1)%
\pcline{-*}(A2)(B2)\pcline[linestyle=dashed]{o-*}(A2)(C2)}
\Ucc[labeloffset=0](B2)(B3){\Large\bfseries+}
\psline{->}(C)(4.45,1.25)\psline{->}(B2)(3.96,0.75)\psline{->}(5,0.75)(6.5,0.75)
\end{pspicture}

\end{document}