Circuitikz를 사용하여 이 전기 회로를 그리는 데 도움이 필요합니다.

Circuitikz를 사용하여 이 전기 회로를 그리는 데 도움이 필요합니다.

저는 Circuitikz를 처음 사용합니다. 그래서 실험실 보고서를 위한 작은 회로를 그리는 데 도움이 필요합니다. 누군가가 나를 도와주면 정말 감사하겠습니다. 회로는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

나는 이것을 할 수 있었다:

\begin{circuitikz}
    % Variable Voltage Source
    \draw (0,0) to[american voltage source, v=$V_s$] (0,3);
    
    % Draw node
    \node at (1,3) [circle, draw, fill=black, inner sep=0pt, minimum size=3pt] {};
    
    % Connect to node
    \draw (0,3) to[short] (1,3);

    % Open circuit
    \draw (1,4) -- (2,3) to[short, *-*] (2,3);
    
    % Ammeter
    \draw (2,3) -- (2.5,3) to[ammeter, l=A] (4,3) -- (5,3);
    
    \draw (5,3) -- (5,0);
      
    \draw (0,0) to[short] (0,-2);

    \draw (0,-2) to[voltmeter] (5,-2);

    \draw (5,0) to[short] (5,-2);

    \draw (0,0) to[lamp, *-*] (5,0);
\end{circuitikz}

결과는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

이거 괜찮아? 아니면 개선될 수 있나요?

답변1

저는 이 코드를 사용하겠습니다. 매뉴얼의 튜토리얼 부분에 있는 예제를 살펴보면 상대 좌표, 명명된 좌표, 수직 "트릭" -||-.

\documentclass[border=2mm]{standalone}
% always select a type of voltage orientation
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}
    % Variable Voltage Source
    % you are using an american symbol with european (arrow) voltage notation, without
    % specifying a direction style. Avoid the horrible double marking of the voltage
    % better use relative movements, name the generator for future reference
    \draw (0,0) coordinate(start)
        to[american voltage source, l=$V_s$, name=vv] ++(0,2)
        % continue the drawing with the switch:
        |- ++(1,1) to[nos=L, *-*] ++(1,0)
        % Ammeter: the newer rmeterwa symbol is, in my opinion, better
        to[rmeterwa, t=A] ++(3,0)
        % move to the same vertical position than start
        coordinate(upper left) -- (upper left |- start)
        % close with the lamp
        coordinate(start lamp) to [lamp, *-*] (start);
    % using one path gives better "corner" junctions, as above.
    % now add the voltmeter
    \draw (start) -- ++(0,-2) coordinate(start v)
        to[rmeterwa, t=V] (start v -| start lamp) -- (start lamp);
    % add a tunable arrow to the generator, to show it's variable
    \ctikztunablearrow[color=gray]{2}{1.2}{-30}{vv}
\end{circuitikz}
\end{document}

여기에 이미지 설명을 입력하세요

회로의 모든 숫자는 상대적이며 명명된 좌표를 사용하여 연결됩니다. 따라서 도면이 너무 넓다고 판단되면 ++(3,0)전류계를 ++(2,0)다음과 같이 변경할 수 있습니다.

여기에 이미지 설명을 입력하세요

코드의 다른 부분을 건드리지 않고.

관련 정보