%% This is file `tikzlibrarycircuits.ee.IEC.relay.code.tex'
%% Version: 1.3
%% Version date: 2022-08-07
%% 
%% Copyright (C) 2018-2022 by Luis Paulo Laus, laus@utfpr.edu.br
%%
%% This package can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or (at your option) any later version,
%% with `The Package' referring to the software
%% `tikzlibrarycircuits.ee.IEC.relay.code.tex'
%% and its accompanying documentation and `The Copyright Holder'
%% referring to the person Luis Paulo Laus.
%% 
%% 
%% IMPORTANT NOTICE: 
%% 
%% For error reports, comments or suggestions in case of UNCHANGED 
%% versions send mail to:
%% laus@utfpr.edu.br
%% 
%%
%% Change History:
%% 1.0: 05 February 2018: Original Version
%% 1.1: 19 February 2018: new annotations: delayed activation,
%%                        delayed deactivation, delayed both, 
%%                        touch switch, magnetic switch,
%%                        static switch, polarized relay, 
%%                        remanent, electronic, pulse counter,
%%                        counter switch, var level switch,
%%                        pedal operated, lever operated,
%%                        key operated, removable handle,
%%                        crank operated, pressure switch and
%%                        protected manually operated;
%%                        new symbol: mechanical interlock;
%%                        fix annotations separation.
%% 1.2: 13 June 2018:     new shape for mechanical interlock;
%%                        new symbol for horn, var horn,
%%                        buzzer, loud speaker
%%                        new annotations: emergency pull
%%                        switch, var emergency pull switch,
%%                        emergency turn switch, var emergency
%%                        turn switch, var remanent, thermal,
%%                        unaffected by alternating current,
%%                        mechanically resonant
%% 1.3: 07 August 2022: new anchor for contacts (tip);
%%                       new annotations: closing momentarily,
%%                       early or late
%% 
%% 
\usetikzlibrary{circuits.ee.IEC}
\usepgflibrary{shapes.geometric}

\makeatletter

%% if contacts are activated or not, default is not
\newif\ifcontact@activated
\contact@activatedfalse

\def\tikz@lib@relay@lar@plain[#1]#2\pgf@stop{\tikzset{label={[label position=357,every term/.try,#1]#2}}}
\def\tikz@lib@relay@lbr@plain[#1]#2\pgf@stop{\tikzset{label={[label position=183,every term'/.try,#1]#2}}}
\def\tikz@lib@relay@lal@plain[#1]#2\pgf@stop{\tikzset{label={[label position=63,every term''/.try,#1]#2}}}

\pgfdeclareshape{magnetic sensor IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
    \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=\pgf@xa%
    \advance\pgf@x by .5\pgf@xb%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
    \pgf@y=\pgf@ya%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
    \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-\pgf@xa%
    \advance\pgf@x by -.5\pgf@xb%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
    \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-\pgf@ya%
    \advance\pgf@y by-\pgf@yb%
  }

  \inheritsavedanchors[from=circle ee]
  \inheritanchor[from=circle ee]{center}
  \inheritanchor[from=circle ee]{south}
  \inheritanchor[from=circle ee]{east}
  \inheritanchor[from=circle ee]{west}
  \inheritanchor[from=circle ee]{south east}
  \inheritanchor[from=circle ee]{south west}
  \inheritanchor[from=circle ee]{input}
  \inheritanchor[from=circle ee]{output}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \anchor{mid}{\centerpoint\advance\pgf@y by-\radius}

  \anchorborder{%
    \ifdim\pgf@y<0pt%
      \pgf@xa=\pgf@x%
      \pgf@ya=\pgf@y%
      \edef\pgf@marshal{%
        \noexpand\pgfpointborderellipse
        {\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}
        {\noexpand\pgfqpoint{\radius}{\radius}}%
      }%
      \pgf@marshal%
    \else%
      % tricky... simplify to the origin...
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\northeast}%
      \advance\pgf@y by0.5pt%
      \pgf@xa=\pgf@x%
      \pgf@ya=\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
    \fi%
  }
  
  \backgroundpath{
    \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
    \pgf@xa=\pgf@x
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
    \pgfpatharc{0}{180}{\pgf@xa}
    \pgfusepathqstroke
  }
}

\pgfdeclareshape{thermic sensor IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
    \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=\pgf@xa%
    \advance\pgf@x by .5\pgf@xb%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
    \pgf@y=\pgf@ya%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/outer xsep}}%
    \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-\pgf@xa%
    \advance\pgf@x by -.5\pgf@xb%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
    \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-\pgf@ya%
    \advance\pgf@y by-\pgf@yb%
  }
  \savedanchor\centerpoint{%
    \pgf@x=0pt%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}%
    \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-\pgf@ya%
    \advance\pgf@y by-\pgf@yb%
  }

  \anchor{center}{\pgfpointorigin}
  \anchor{mid}{\centerpoint}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \anchor{input}{%
    \pgf@process{\southwest}%
    \pgf@y=0pt%
  }
  \anchor{output}{%
    \pgf@process{\northeast}%
    \pgf@y=0pt%
  }

  \anchorborder{%
    \ifdim\pgf@y<0pt%
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\southwest}%
      \pgf@xa=-\pgf@x%
      \pgf@ya=-\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
    \else%
      % tricky... simplify to the origin...
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\northeast}%
      \advance\pgf@y by0.5pt%
      \pgf@xa=\pgf@x%
      \pgf@ya=\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
    \fi%
  }
  
  \backgroundpath{
    \pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
    \pgf@xa=\pgf@x
    \pgf@xb=-\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
    \pgfusepathqstroke
  }
}

% af:=30*PI/180; a:=1/3; l:=a+2/cos(af); x:=l*cos(af)-1; y:=l*sin(af);c:=tan(af); float([x,y,c, l]);
\pgfdeclareshape{make contact IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=.5\pgf@xa%
    \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-.5\pgf@xa%
    \pgf@y=0pt%
  }
  \savedanchor\centerpoint{%
    \pgf@x=0pt
    \ifcontact@activated
      \pgf@y=0pt%
    \else
      \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
      \pgf@y=0.5773503\pgf@ya%
    \fi
  }
  \savedanchor\tippoint{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \ifcontact@activated
      \pgf@x=0.8164663\pgf@xa \pgf@y=0pt
    \else
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
      \pgf@x=0.6443375\pgf@xa  \pgf@y=1.321367\pgf@ya
    \fi
  }

  \anchor{center}{\pgfpointorigin}
  \anchor{mid}{\centerpoint}
  \anchor{tip}{\tippoint}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \anchor{input}{\southwest}
  \anchor{output}{%
    \pgf@process{\northeast}%
    \pgf@xa=\pgf@x%
    \pgf@process{\southwest}%
    \pgf@x=\pgf@xa%
  }

  \anchorborder{%
    \ifdim\pgf@y<0pt%
      % tricky... simplify to the origin...
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\southwest}%
      \advance\pgf@y by-0.5pt%
      \pgf@xa=\pgf@x%
      \pgf@ya=\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
    \else%
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\northeast}%
      \pgf@xa=\pgf@x%
      \pgf@ya=1.321367\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
    \fi%
  }
  
  \backgroundpath{
    \pgf@process{\northeast}
    \pgf@xa=-\pgf@x
    \ifcontact@activated
      \pgf@xb=\pgf@x \pgf@yb=0pt
    \else
      \pgf@xb=1.288675\pgf@x \pgf@yb=1.321367\pgf@y
    \fi
    % Fixed point
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
    % Moving point
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
    \pgfusepathqstroke
  }
}


% af:=arctan(1/3); a:=1-2*tan(af); l:=a+2/cos(af); x:=l*cos(af)-1; y:=-l*sin(af); c:=-tan(af); float([x,y,c]);
% af:=arctan(1/3); a:=1-2*tan(af); l:=a+2/cos(af); af:=arctan(2/3); x:=l*cos(af)-1; y:=l*sin(af); c:=-tan(af); float([x,y,c]);
\pgfdeclareshape{break contact IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=.5\pgf@xa%
    \pgf@y=0pt%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-.5\pgf@xa%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-\pgf@ya%
  }
  \savedanchor\centerpoint{%
    \pgf@x=0pt
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
    \ifcontact@activated
      \pgf@y=-0.666667\pgf@ya%
    \else
      \pgf@y=-0.333333\pgf@ya%
    \fi
  }
  \savedanchor\tippoint{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
    \ifcontact@activated
      \pgf@x=0.515733\pgf@xa \pgf@y=-1.354311\pgf@ya
    \else
      \pgf@x=0.658114\pgf@xa \pgf@y=-0.772076\pgf@ya
    \fi
  }

  \anchor{center}{\pgfpointorigin}
  \anchor{mid}{\centerpoint}
  \anchor{tip}{\tippoint}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \anchor{input}{%
    \pgf@process{\southwest}%
    \pgf@xa=\pgf@x%
    \pgf@process{\northeast}%
    \pgf@x=\pgf@xa%
  }
  \anchor{output}{\northeast}

  \anchorborder{%
    \ifdim\pgf@y<0pt%
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\southwest}%
      \pgf@xa=\pgf@x%
      \pgf@ya=1.354311\pgf@y% maximum distance used to prevent jump
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
    \else%
      % tricky... simplify to the origin...
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\southwest}%
      \pgf@xa=-\pgf@x%
      \pgf@ya=-0.488067\pgf@y% 1.321367-0.5-0.333333
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{\pgf@xa}{\pgf@ya}}}%
    \fi%
  }

  \backgroundpath{
    \pgf@process{\southwest}
    \pgf@xa=-\pgf@x \pgf@ya=\pgf@y
    \ifcontact@activated
      \pgf@xb=-1.031466\pgf@x \pgf@yb=1.354311\pgf@y
    \else
      \pgf@xb=-1.316228\pgf@x \pgf@yb=0.772076\pgf@y
    \fi
    % Fixed
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{0pt}}
    \pgfusepathqstroke
    % Moving
    \pgfpathmoveto{\pgfqpoint{-\pgf@xa}{0pt}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
    \pgfusepathqstroke
  }
}


% af:=arctan(2/3); a:=2*tan(af)-1; l:=a+2/cos(af); x:=l*cos(af)-1; y:=l*sin(af); c:=tan(af); float([x,y/2,c/2]);
\pgfdeclareshape{change over contact IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=.5\pgf@xa%
    \pgfmathsetlength\pgf@y{\pgfkeysvalueof{/pgf/minimum height}}%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-.5\pgf@xa%
    \pgf@y=0pt%
  }
  \savedanchor\centerpoint{%
    \pgf@x=0pt
    \ifcontact@activated
      \pgf@y=0pt
    \else
      \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
      \pgf@y=0.333333\pgf@ya%
    \fi
  }
  \savedanchor\tippoint{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \ifcontact@activated
      \pgf@x=0.868517\pgf@xa \pgf@y=0pt
    \else
      \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
      \pgf@x=0.638675\pgf@xa \pgf@y=0.759117\pgf@ya
    \fi
  }

  \anchor{center}{\pgfpointorigin}
  \anchor{mid}{\centerpoint}
  \anchor{tip}{\tippoint}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \anchor{input}{\southwest}
  \anchor{output}{%
    \pgf@process{\northeast}%
    \pgf@xa=\pgf@x%
    \pgf@process{\southwest}%
    \pgf@x=\pgf@xa%
  }
  \anchor{output 2}{% alias for output
    \pgf@process{\northeast}%
    \pgf@xa=\pgf@x%
    \pgf@process{\southwest}%
    \pgf@x=\pgf@xa%
  }
  \anchor{output 1}{\northeast}% the third, normally closed, terminal

  \anchorborder{%
    \ifdim\pgf@y<0pt%
      % tricky... simplify to the origin...
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\southwest}%
      \advance\pgf@y by-0.5pt%
      \pgf@xa=\pgf@x%
      \pgf@ya=\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\pgfqpoint{-\pgf@xa}{-\pgf@ya}}}%
    \else%
      \pgf@xc=\pgf@x%
      \pgf@yc=\pgf@y%
      \pgf@process{\pgfpointborderrectangle{\pgfqpoint{\pgf@xc}{\the\pgf@yc}}{\northeast}}%
    \fi%
  }
  
  \backgroundpath{
    \pgf@process{\northeast}
    \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \ifcontact@activated
      \pgf@xb=\pgf@x \pgf@yb=0pt
    \else
      \pgf@xb=1.27735\pgf@x \pgf@yb=0.759117\pgf@y
    \fi
    % Fixed
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xa}{.5\pgf@ya}}
    \pgfusepathqstroke
    % Moving
    \pgfpathmoveto{\pgfqpoint{-\pgf@xa}{0pt}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
    \pgfusepathqstroke
  }
}


\pgfdeclareshape{proximity sensor coil IEC relay}
{
  \inheritsavedanchors[from=rectangle ee]
  \inheritanchor[from=rectangle ee]{center}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \inheritanchor[from=rectangle ee]{input}
  \inheritanchor[from=rectangle ee]{output}
  \inheritanchorborder[from=rectangle ee]
  \backgroundpath{
    \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
    \pgf@xa=-\pgf@x \pgf@ya=-\pgf@y
    \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{0pt}}
    \pgfpathlineto{\pgfqpoint{0pt}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{\pgf@xb}{0pt}}
    \pgfpathlineto{\pgfqpoint{0pt}{\pgf@yb}}
    \pgfpathclose
  }
  \foregroundpath{
    \pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
    \pgf@xa=-\pgf@x \pgf@ya=-\pgf@y
    \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfqpoint{0.75\pgf@xa}{0.25\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{0.75\pgf@xb}{0.25\pgf@ya}}
    \pgfpathmoveto{\pgfqpoint{0.75\pgf@xa}{0.25\pgf@yb}}
    \pgfpathlineto{\pgfqpoint{0.75\pgf@xb}{0.25\pgf@yb}}
    \pgfusepathqstroke
  }
}


% w= 0.8; h = w/2*tan(60*PI/180);
\pgfdeclareshape{mechanical interlock IEC relay}
{
  \savedanchor\northeast{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=.5\pgf@xa%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=.5\pgf@ya%
  }
  \savedanchor\southwest{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=-.5\pgf@xa%
    \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/minimum height}}%
    \pgf@y=-.5\pgf@ya%
  }
  \savedanchor\savedoutput{%
    \pgfmathsetlength\pgf@xa{\pgfkeysvalueof{/pgf/minimum width}}%
    \pgf@x=.25\pgf@xa%
    \pgf@y=0pt%
  }

  \anchor{center}{\pgfpointorigin}
  \anchor{mid}{\pgfpointorigin}
  \inheritanchor[from=rectangle ee]{north}
  \inheritanchor[from=rectangle ee]{south}
  \inheritanchor[from=rectangle ee]{east}
  \inheritanchor[from=rectangle ee]{west}
  \inheritanchor[from=rectangle ee]{north east}
  \inheritanchor[from=rectangle ee]{north west}
  \inheritanchor[from=rectangle ee]{south east}
  \inheritanchor[from=rectangle ee]{south west}
  \anchor{output}{\savedoutput}
  \anchor{input}{%
    \pgf@process{\savedoutput}%
    \pgf@x=-\pgf@x%
  }
  \anchor{east}{\savedoutput}
  \anchor{west}{%
    \pgf@process{\savedoutput}%
    \pgf@x=-\pgf@x%
  }

  \anchorborder{%
    \pgf@xa=\pgf@x%
    \pgf@process{\savedoutput}%
    \ifdim\pgf@xa<0pt%
      \pgf@x=-\pgf@x%
    \fi%
  }
  
  \backgroundpath{
    \pgf@process{\northeast}
    \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{-\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfqpoint{0pt}{-\pgf@ya}}
    \pgfpathclose
  }
}

\makeatother

\tikzset{
  circuit declare symbol=fuse,
  circuit declare symbol=horn,
  circuit declare symbol=buzzer,
  circuit declare symbol=loud speaker,
  circuit declare symbol=magnetic sensor,
  circuit declare symbol=thermic sensor,
  circuit declare symbol=change over contact,
  circuit declare symbol=relay coil,
  circuit declare symbol=proximity sensor coil,
  circuit declare symbol=mechanical interlock,
  % annotations for contact
  % 0.5773503+0.8+0.3+0.9+0.3+0.7-1.321367
  circuit declare annotation={manually operated}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.8\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.9\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.7\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0) -- ++(-1\tikzcircuitssizeunit,0)}] ()
  },
  % 0.5773503+0.8+0.3+0.9+0.3+0.7-0.2+0.5-1.321367
  circuit declare annotation={protected manually operated}{2.5559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.8\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.9\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.7\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0) -- ++(-1\tikzcircuitssizeunit,0) ++(-.5\tikzcircuitssizeunit,-.2\tikzcircuitssizeunit) -- ++ (.3\tikzcircuitssizeunit,0) -- ++ (0,.5\tikzcircuitssizeunit) -- ++ (1.4\tikzcircuitssizeunit,0) -- ++ (0,-.5\tikzcircuitssizeunit) -- ++ (.3\tikzcircuitssizeunit,0) }] ()
  },
  % 0.5773503+0.8+0.3+0.9+0.3+0.7-1.321367
  circuit declare annotation={push button}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.8\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.9\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.7\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.5\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,-0.5\tikzcircuitssizeunit)}] ()
  },
  % thick 0.8pt (0.114286), 0.5773503+1.25+2*0.114286-1.321367
  circuit declare annotation={var push button}{0.7345553\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line to,->] ++(0,1.25\tikzcircuitssizeunit)
     ++(-0.7\tikzcircuitssizeunit,1.25\tikzcircuitssizeunit+1.5*\pgflinewidth) edge[circuit symbol lines/.try,line to,line width=1.5*\pgflinewidth] ++(1.4\tikzcircuitssizeunit,0)
  },
  % 0.5773503+0.6+0.3+0.6+0.3+0.6+0.6-1.321367
  circuit declare annotation={pull switch}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0.6\tikzcircuitssizeunit) -- ++(0,-0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={turn switch}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.6\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)}] ()
  },
  % 0.5773503+0.6+0.3+0.6+0.45+0.45+0.6226497+0.9-sqrt(0.9^2-0.8^2)-1.321367
  circuit declare annotation={emergency switch}{2.766322437\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line join=bevel,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit)  -- ++(0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit) -- ++(0,0.6226497\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,line join=bevel,to path={++(0.8\tikzcircuitssizeunit,3.0226497\tikzcircuitssizeunit) arc[start angle=27, delta angle=126, radius=0.9\tikzcircuitssizeunit] --cycle}] ()
  },
  circuit declare annotation={emergency pull switch}{4.566322437\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line join=bevel,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit)  -- ++(0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit) -- ++(0,0.6226497\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0.6\tikzcircuitssizeunit) -- ++(0,-0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) } ] () edge[circuit symbol open/.try,line join=bevel,to path={++(0.8\tikzcircuitssizeunit,4.8226497\tikzcircuitssizeunit) arc[start angle=27, delta angle=126, radius=0.9\tikzcircuitssizeunit] --cycle}] ()
  },
  circuit declare annotation={var emergency pull switch}{2.766322437\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line join=bevel,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit)  -- ++(0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit) -- +(0,0.6226497\tikzcircuitssizeunit) ++(0,-1.5\tikzcircuitssizeunit) -- ++(0.6\tikzcircuitssizeunit,0) ++(0.3\tikzcircuitssizeunit,0) -- ++(0.6\tikzcircuitssizeunit,0) ++(0.3\tikzcircuitssizeunit,0) -- ++(0.6\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0.6\tikzcircuitssizeunit) -- ++(0,-0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,line join=bevel,to path={++(0.8\tikzcircuitssizeunit,3.0226497\tikzcircuitssizeunit) arc[start angle=27, delta angle=126, radius=0.9\tikzcircuitssizeunit] --cycle}] ()
  },
  circuit declare annotation={emergency turn switch}{4.566322437\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line join=bevel,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit)  -- ++(0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit) -- ++(0,0.6226497\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.6\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) } ] () edge[circuit symbol open/.try,line join=bevel,to path={++(0.8\tikzcircuitssizeunit,4.8226497\tikzcircuitssizeunit) arc[start angle=27, delta angle=126, radius=0.9\tikzcircuitssizeunit] --cycle}] ()
  },
  circuit declare annotation={var emergency turn switch}{2.766322437\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,line join=bevel,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit)  -- ++(0.75\tikzcircuitssizeunit,0.45\tikzcircuitssizeunit) -- +(0,0.6226497\tikzcircuitssizeunit) ++(0,-1.5\tikzcircuitssizeunit) -- ++(0.6\tikzcircuitssizeunit,0) ++(0.3\tikzcircuitssizeunit,0) -- ++(0.6\tikzcircuitssizeunit,0) ++(0.3\tikzcircuitssizeunit,0) -- ++(0.6\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,-0.6\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) -- ++(0,0.6\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,line join=bevel,to path={++(0.8\tikzcircuitssizeunit,3.0226497\tikzcircuitssizeunit) arc[start angle=27, delta angle=126, radius=0.9\tikzcircuitssizeunit] --cycle}] ()
  },
  % 0.5773503+1.4+1+1-1.321367
  circuit declare annotation={thermal switch}{2.6559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={--++(0,1.4\tikzcircuitssizeunit)--++(\tikzcircuitssizeunit,0)--++(0,\tikzcircuitssizeunit)--++(-\tikzcircuitssizeunit,0)--++(0,\tikzcircuitssizeunit)}] ()
  },
  % 0.5773503+2.6+0.4-1.321367
  circuit declare annotation={roller}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol open/.try,to path={++(0,2.6\tikzcircuitssizeunit) circle(0.4\tikzcircuitssizeunit)}] () edge[circuit symbol lines/.try,to path={-- ++(0,0.7\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.7\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.6\tikzcircuitssizeunit)}] () 
  },
  % 0.5773503+0.5+0.3+0.5+0.85+0.85-1.321367
  circuit declare annotation={removable handle}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol open/.try,to path={-- ++(0,0.5\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(-0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit)-- ++(-0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit) -- cycle}] ()
  },
  % 0.5773503+0.5+0.3+0.5+0.85+0.85-1.321367
  circuit declare annotation={proximity switch}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol open/.try,to path={-- ++(0,0.5\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(-0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit)-- ++(-0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit) -- cycle (\tikzlastnode.mid) ++(-0.65\tikzcircuitssizeunit,1.95\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0) ++(0,0.4\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0)}] ()
  },
  % 0.5773503+0.5+0.3+0.5+0.85+0.85-1.321367
  circuit declare annotation={touch switch}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol open/.try,line join=bevel,to path={-- ++(0,0.5\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(-0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit)-- ++(-0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit) -- cycle (\tikzlastnode.mid) ++(-0.65\tikzcircuitssizeunit,1.95\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0) ++(0,0.4\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0) ++(-0.2\tikzcircuitssizeunit,0.65\tikzcircuitssizeunit) -- ++(1.7\tikzcircuitssizeunit,0)}] ()
  },
  % 0.5773503+3.4226497+1-1.321367
  circuit declare annotation={magnetic switch}{3.678633\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol open/.try,to path={-- ++(0,0.5\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(-0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,0.85\tikzcircuitssizeunit)-- ++(0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit)-- ++(-0.85\tikzcircuitssizeunit,-0.85\tikzcircuitssizeunit) -- cycle (\tikzlastnode.mid) ++(-0.65\tikzcircuitssizeunit,1.95\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0) ++(0,0.4\tikzcircuitssizeunit) --+(1.3\tikzcircuitssizeunit,0)}] () edge[circuit symbol filled/.try,to path={++(0.5\tikzcircuitssizeunit,3.4226497\tikzcircuitssizeunit) -- ++(0.5\tikzcircuitssizeunit,0) -- ++(0,1\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) -- ++(0,-1\tikzcircuitssizeunit) -- ++(0.5\tikzcircuitssizeunit,0) -- ++(0,0.5\tikzcircuitssizeunit) -- ++(1\tikzcircuitssizeunit,0) --cycle}] ()
  },
  % 0.5773503+3+1-1.321367
  circuit declare annotation={level switch}{3.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.9\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.8\tikzcircuitssizeunit) ++(.5\tikzcircuitssizeunit,\tikzcircuitssizeunit) -- ++(.5\tikzcircuitssizeunit,0)}] () edge[circuit symbol open/.try,to path={++(0,2\tikzcircuitssizeunit) arc[start angle=-53, delta angle=106, radius=1.25\tikzcircuitssizeunit] arc[start angle=127, delta angle=106, radius=1.25\tikzcircuitssizeunit] --cycle}] ()
  },
  circuit declare annotation={var level switch}{3.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.9\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.8\tikzcircuitssizeunit) ++(.5\tikzcircuitssizeunit,\tikzcircuitssizeunit) -- ++(.5\tikzcircuitssizeunit,0)}] () edge[circuit symbol open/.try,to path={++(0,3\tikzcircuitssizeunit) ellipse({0.5\tikzcircuitssizeunit} and {\tikzcircuitssizeunit})}] ()
  },
  % 0.5773503+2+2-1.321367
  circuit declare annotation={counter switch}{3.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.9\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- +(0,0.8\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(-\tikzcircuitssizeunit,2\tikzcircuitssizeunit) --++(0,2\tikzcircuitssizeunit) -- ++(2\tikzcircuitssizeunit,0) --++(0,-2\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(0,3\tikzcircuitssizeunit)  circle(0.4\tikzcircuitssizeunit)}] ()
  },
  % 0.5773503+0.9+0.3+0.8+2-1.321367
  circuit declare annotation={pressure switch}{3.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.9\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- +(0,0.8\tikzcircuitssizeunit) node[left,draw,minimum size=2\tikzcircuitssizeunit,rotate=270,circuit symbol open/.try]{P}}] ()
  },
  % 0.5773503+2+0.577350+0.433013-1.321367
  circuit declare annotation={pedal operated}{2.2663463\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.6\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.5\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.588671\tikzcircuitssizeunit) (\tikzlastnode.mid) ++(0.5\tikzcircuitssizeunit,2\tikzcircuitssizeunit) -- ++(150:1.154701\tikzcircuitssizeunit) -- ++(60:.5\tikzcircuitssizeunit)}] ()
  },
  % 0.5773503+3-1.321367; 8/10*(tan(60*PI/180)-1); print(Unquoted, float(%)); dd:=3-8/10*(1-1/tan(60*PI/180)); print(Unquoted, float(%)); -8/10+2/10*sin(60*PI/180); print(Unquoted, float(%)); 2+2/10+2/10*cos(60*PI/180); print(Unquoted, float(%)); float((dd-0.3-0.3-0.7-0.7)); print(Unquoted, float(%));
  circuit declare annotation={lever operated}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.7\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.7\tikzcircuitssizeunit)  ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.66188\tikzcircuitssizeunit) (\tikzlastnode.mid) +(0.585641\tikzcircuitssizeunit,3\tikzcircuitssizeunit) -- +(-0.626795\tikzcircuitssizeunit, 2.3\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,to path={++(-.8\tikzcircuitssizeunit,2.2\tikzcircuitssizeunit) circle(0.2\tikzcircuitssizeunit)}] ()
  },
  % 0.5773503+3-1.321367;
  circuit declare annotation={key operated}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.7\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.8\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.3\tikzcircuitssizeunit)}] () edge[circuit symbol open/.try,to path={++(.4\tikzcircuitssizeunit,2.6\tikzcircuitssizeunit) circle(0.4\tikzcircuitssizeunit) (\tikzlastnode.mid) ++(0,2.8\tikzcircuitssizeunit) -- ++(0,-0.4\tikzcircuitssizeunit) -- ++(-0.8\tikzcircuitssizeunit,-0.2\tikzcircuitssizeunit) -- ++(0,0.8\tikzcircuitssizeunit) -- cycle}] ()
  },
  % 0.5773503+0.9+0.3+0.8+1-1.321367
  circuit declare annotation={crank operated}{2.2559833\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.mid) edge[circuit symbol lines/.try,to path={-- ++(0,0.9\tikzcircuitssizeunit) ++(0,0.3\tikzcircuitssizeunit) -- ++(0,0.8\tikzcircuitssizeunit)  -- ++(-\tikzcircuitssizeunit,0)  -- ++(0,\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={position switch}{0pt}
  {
    [transform shape]
    [-]
    edge[circuit symbol wires/.try,to path={let \p1=(\tikzlastnode.mid), \p2=($(\tikzlastnode.mid) - (\tikzlastnode.input)$), \n2 = {veclen(\x2,\y2)}, \p2= ($0.5*\tikzcircuitssizeunit/\n2*(\p2)$) in ($(\p1)+(\p2)$) -- ++(-\y2,\x2) -- ($(\p1)-(\p2)$)}] ()
  },
  circuit declare annotation={early or late}{0pt}
  {
    [transform shape]
    [-]
    edge[cap=round,circuit symbol wires/.try,to path={let \p1=(\tikzlastnode.tip), \p2=($(\tikzlastnode.tip) - (\tikzlastnode.input)$), \n2 = {veclen(\x2,\y2)}, \p2= ($0.5\tikzcircuitssizeunit/\n2*(\p2)$) in (\p1) -- ++(\y2,-\x2)}] ()
  },
  circuit declare annotation={closing momentarily}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.output) edge[cap=round,circuit symbol lines/.try,to path={-- ++(0.5\tikzcircuitssizeunit,0.3333333\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={circuit breaker}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.output) edge[circuit symbol lines/.try,to path={++(0.4\tikzcircuitssizeunit,0.4\tikzcircuitssizeunit) -- ++(-0.8\tikzcircuitssizeunit,-0.8\tikzcircuitssizeunit) ++(0.8\tikzcircuitssizeunit,0) -- ++(-0.8\tikzcircuitssizeunit,0.8\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={static switch}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.input) edge[circuit symbol lines/.try,to path={++(0,\tikzcircuitssizeunit) -- ++(0,-2\tikzcircuitssizeunit)}] ()
  },
  % 1.8+0.8-1.321367
  circuit declare annotation={delayed activation}{1.278633\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    edge[circuit symbol lines/.try,to path={(\tikzlastnode.south west) ++(1.8\tikzcircuitssizeunit,1.8\tikzcircuitssizeunit) arc[start angle=0, delta angle=180, radius=0.8\tikzcircuitssizeunit] let \p1=(\tikzlastnode.mid), \p2=($(\tikzlastnode.mid) - (\tikzlastnode.input)$),  \p2= ($0.2*\tikzcircuitssizeunit/\x2*(\p2)$) in ($(\p1)+(\p2)$) -- ($(\tikzlastnode.south west) + (1.2\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$) ($(\p1)-(\p2)$) -- ($(\tikzlastnode.south west) + (0.8\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$)} ] ()
  },
  % 3.4-1.321367
  circuit declare annotation={delayed deactivation}{2.078633\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    edge[circuit symbol lines/.try,to path={(\tikzlastnode.south west) ++(0.2\tikzcircuitssizeunit,3.4\tikzcircuitssizeunit) arc[start angle=180, delta angle=180, radius=0.8\tikzcircuitssizeunit] let \p1=(\tikzlastnode.mid), \p2=($(\tikzlastnode.mid) - (\tikzlastnode.input)$),  \p2= ($0.2*\tikzcircuitssizeunit/\x2*(\p2)$) in ($(\p1)+(\p2)$) -- ($(\tikzlastnode.south west) + (1.2\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$) ($(\p1)-(\p2)$) -- ($(\tikzlastnode.south west) + (0.8\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$)}] ()
  },
  circuit declare annotation={delayed both}{2.078633\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    edge[circuit symbol lines/.try,to path={(\tikzlastnode.south west) ++(0.2\tikzcircuitssizeunit,3.4\tikzcircuitssizeunit) arc[start angle=180, delta angle=180, radius=0.8\tikzcircuitssizeunit] (\tikzlastnode.south west) ++(1.8\tikzcircuitssizeunit,1.8\tikzcircuitssizeunit) arc[start angle=0, delta angle=180, radius=0.8\tikzcircuitssizeunit] let \p1=(\tikzlastnode.mid), \p2=($(\tikzlastnode.mid) - (\tikzlastnode.input)$),  \p2= ($0.2*\tikzcircuitssizeunit/\x2*(\p2)$) in ($(\p1)+(\p2)$) -- ($(\tikzlastnode.south west) + (1.2\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$) ($(\p1)-(\p2)$) -- ($(\tikzlastnode.south west) + (0.8\tikzcircuitssizeunit,2.574597\tikzcircuitssizeunit)$)} ] ()
  },
  % annotations for relay coil
  circuit declare annotation={solenoid valve}{2.5\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.south) edge[circuit symbol open/.try,every relay coil/.try,to path={-- ++(0,-.5\tikzcircuitssizeunit) ++(0,-.3\tikzcircuitssizeunit) -- ++(0,-.5\tikzcircuitssizeunit) ++(0,-.3\tikzcircuitssizeunit) -- ++(0,-.4\tikzcircuitssizeunit) --++(\tikzcircuitssizeunit,-0.5\tikzcircuitssizeunit)  --++(0,\tikzcircuitssizeunit) --++(-2\tikzcircuitssizeunit,-\tikzcircuitssizeunit)  --++(0,\tikzcircuitssizeunit) --++(\tikzcircuitssizeunit,-0.5\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={pulse counter}{2\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.south) edge[circuit symbol open/.try,every relay coil/.try,to path={++(-\tikzcircuitssizeunit,.5\pgflinewidth) --++(0,-2\tikzcircuitssizeunit) -- ++(2\tikzcircuitssizeunit,0) --++(0,2\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(0,.5\pgflinewidth-\tikzcircuitssizeunit)  circle(0.4\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={slow operating}{1\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(-2\tikzcircuitssizeunit,\tikzcircuitssizeunit) ++(0,-\tikzcircuitssizeunit) -- ++(2\tikzcircuitssizeunit,\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={slow releasing}{1\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[every relay coil/.try,circuit symbol filled/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth)
--++(0,\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-\tikzcircuitssizeunit) --cycle}] ()
  },
  circuit declare annotation={slow operating and slow releasing}{2\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(-2\tikzcircuitssizeunit,\tikzcircuitssizeunit) ++(0,-\tikzcircuitssizeunit) -- ++(2\tikzcircuitssizeunit,\tikzcircuitssizeunit)}] () edge[every relay coil/.try,circuit symbol filled,to path={++(\tikzcircuitssizeunit,\tikzcircuitssizeunit-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-\tikzcircuitssizeunit) --cycle}] ()
  },
  circuit declare annotation={high speed}{1\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(0,-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) --++(\tikzcircuitssizeunit,0) -- ++(0,-\tikzcircuitssizeunit) --++(-2\tikzcircuitssizeunit,0) --++(0,\tikzcircuitssizeunit) --++(\tikzcircuitssizeunit,0)}] ()
  },
  circuit declare annotation={mechanically latched}{1.73\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,1.73\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-1.73\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,line join=bevel,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(-\tikzcircuitssizeunit,1.73\tikzcircuitssizeunit) --++(-\tikzcircuitssizeunit,-1.73\tikzcircuitssizeunit) --cycle}] ()
  },
  circuit declare annotation={alternating current}{2\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) -- ++(0,2\tikzcircuitssizeunit) --++(-2\tikzcircuitssizeunit,0) --++(0,-2\tikzcircuitssizeunit) --++(2\tikzcircuitssizeunit,0)
    (\tikzlastnode.north) ++(0,\tikzcircuitssizeunit-.5\pgflinewidth) arc [start angle=135, end angle=225, radius=0.5\tikzcircuitssizeunit]
    (\tikzlastnode.north) ++(0,\tikzcircuitssizeunit-.5\pgflinewidth) arc [start angle=-45, end angle=45, radius=0.5\tikzcircuitssizeunit]}] () 
  },
  circuit declare annotation={polarized}{1\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol filled/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) -- ++(-0.5\tikzcircuitssizeunit,0) --++(0,-0.5\tikzcircuitssizeunit) -- ++(-1\tikzcircuitssizeunit,0) --++(0,0.5\tikzcircuitssizeunit) -- ++(-0.5\tikzcircuitssizeunit,0)  --++(0,-\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(0.5\tikzcircuitssizeunit,-.5\pgflinewidth+0.5\tikzcircuitssizeunit) --++(0,0.5\tikzcircuitssizeunit) --++(-\tikzcircuitssizeunit,0) --++(0,-0.5\tikzcircuitssizeunit) --cycle}] ()
  },
  circuit declare annotation={remanent}{1\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(-2\tikzcircuitssizeunit,\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={var remanent}{1.5\tikzcircuitssizeunit}
  {
    [transform shape]
    [-]
    (\tikzlastnode.north) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,1.5\tikzcircuitssizeunit) -- ++(-2\tikzcircuitssizeunit,0) --++(0,-1.5\tikzcircuitssizeunit) --cycle}] () edge[circuit symbol open/.try,every relay coil/.try,to path={++(.5\tikzcircuitssizeunit,-.5\pgflinewidth) --++(0,.5\tikzcircuitssizeunit) --++(-\tikzcircuitssizeunit,.5\tikzcircuitssizeunit) --++(0,.5\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={electronic}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.center) edge[circuit symbol open/.try,every relay coil/.try,to path={-- +(0,\tikzcircuitssizeunit) ++(0.5\tikzcircuitssizeunit,0) -- ++(-\tikzcircuitssizeunit,0) ++(.3\tikzcircuitssizeunit,0) -- +(-.5\tikzcircuitssizeunit,-.5\tikzcircuitssizeunit) ++(.4\tikzcircuitssizeunit,0) -- +(.5\tikzcircuitssizeunit,-.5\tikzcircuitssizeunit)}] ()
  },
  circuit declare annotation={thermal}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.center) edge[circuit symbol open/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,0) -- ++(-.5\tikzcircuitssizeunit,0) -- ++(0,-\tikzcircuitssizeunit) -- ++(-\tikzcircuitssizeunit,0) -- ++(0,\tikzcircuitssizeunit) -- ++(-.5\tikzcircuitssizeunit,0)}] ()
  },
  circuit declare annotation={unaffected by alternating current}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.center) edge[circuit symbol filled/.try,every relay coil/.try,to path={++(\tikzcircuitssizeunit,2\tikzcircuitssizeunit) --++(-.5\tikzcircuitssizeunit,0) -- ++(0,-4\tikzcircuitssizeunit) -- ++(.5\tikzcircuitssizeunit,0)--cycle}] () edge[circuit symbol filled/.try,every relay coil/.try,to path={++(-\tikzcircuitssizeunit,2\tikzcircuitssizeunit) --++(.5\tikzcircuitssizeunit,0) -- ++(0,-4\tikzcircuitssizeunit) -- ++(-.5\tikzcircuitssizeunit,0)--cycle}] ()
  },
  circuit declare annotation={mechanically resonant}{0pt}
  {
    [transform shape]
    [-]
    (\tikzlastnode.south) edge[circuit symbol lines/.try,every relay coil/.try,to path={++(0,.5\pgflinewidth) --++(0,-.6\tikzcircuitssizeunit) ++(0,-.4\tikzcircuitssizeunit) --++(0,-\tikzcircuitssizeunit) ++(0,-.4\tikzcircuitssizeunit)  --++(0,-\tikzcircuitssizeunit)
    (\tikzlastnode.south) ++(0,-1.5\tikzcircuitssizeunit+.5\pgflinewidth) arc [start angle=200, end angle=340, radius=0.5\tikzcircuitssizeunit]
    (\tikzlastnode.south) ++(0,-1.5\tikzcircuitssizeunit+.5\pgflinewidth) arc [start angle=20, end angle=160, radius=0.5\tikzcircuitssizeunit]}] ()
  }
}

\tikzset{
  magnetic sensor IEC relay graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 1 height 1,
    transform shape,
    shape=magnetic sensor IEC relay,
    outer sep=0pt,
    cap=round},
  thermic sensor IEC relay graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 1 height 1,
    transform shape,
    shape=thermic sensor IEC relay,
    outer sep=0pt,
    cap=round},
  make contact IEC relay graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2 height 1,
    transform shape,
    shape=make contact IEC relay,
    outer sep=0pt,
    cap=round},
  break contact IEC relay graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2 height 1,
    transform shape,
    shape=break contact IEC relay,
    outer sep=0pt,
    cap=round},
  change over contact IEC relay graphic/.style={
    circuit symbol wires,
    circuit symbol size=width 2 height 2,
    transform shape,
    shape=change over contact IEC relay,
    outer sep=0pt,
    cap=round},
  relay coil IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 2 height 4,
    shape=rectangle ee,
    transform shape},
  proximity sensor coil IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 1.6 height 1.6,
    shape=proximity sensor coil IEC relay,
    transform shape},
  % modifications
  resistor IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 3 height 1,
    shape=rectangle ee,
    transform shape
  },
  inductor IEC relay graphic/.style={
    circuit symbol filled,
    circuit symbol size=width 3 height 1,
    transform shape,
    shape=rectangle ee
  },
  bulb IEC relay graphic/.style={
    circuit symbol lines,
    circuit symbol size=width 2 height 2,
    shape=generic circle IEC,
    /pgf/generic circle IEC/before background={
      \pgfpathmoveto{\pgfpointpolar{-135}{1pt}}
      \pgfpathlineto{\pgfpointpolar{45}{1pt}}
      \pgfpathmoveto{\pgfpointpolar{-45}{1pt}}
      \pgfpathlineto{\pgfpointpolar{135}{1pt}}
      \pgfusepathqstroke
    },
    transform shape
  },
  fuse IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 3 height 1,
    shape=rectangle ee,
    append after command={%
      \bgroup
        edge[circuit symbol wires, to path={%
          (\tikzlastnode.input) -- (\tikzlastnode.output)
        }] ()
      \egroup%
    },
    transform shape
  },
  horn IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 2 height 2,
    shape=rectangle ee,
    append after command={%
      \bgroup
        edge[circuit symbol open, to path={%
          (0.3333\tikzcircuitssizeunit,-\tikzcircuitssizeunit) --  (0.8956\tikzcircuitssizeunit,-4.4689\tikzcircuitssizeunit)  --  (-1\tikzcircuitssizeunit,-5\tikzcircuitssizeunit)  --  (-0.3333\tikzcircuitssizeunit,-\tikzcircuitssizeunit) -- cycle}] ()
      \egroup%
    },
    transform shape
  },
  var horn IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 2 height 2,
    shape=rectangle ee,
    append after command={%
      \bgroup
        edge[circuit symbol open, to path={%
          (0.5\tikzcircuitssizeunit,-\tikzcircuitssizeunit) --  (\tikzcircuitssizeunit,-2\tikzcircuitssizeunit)  --  (-\tikzcircuitssizeunit,-2\tikzcircuitssizeunit)  --  (-0.5\tikzcircuitssizeunit,-\tikzcircuitssizeunit) -- cycle}] ()
      \egroup%
    },
    transform shape
  },
  buzzer IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 2 height 2,
    shape=rectangle ee,
    append after command={%
      \bgroup
        edge[circuit symbol lines, to path={%
          (\tikzcircuitssizeunit,-\tikzcircuitssizeunit) --  (-\tikzcircuitssizeunit,-2\tikzcircuitssizeunit)}] ()
      \egroup%
    },
    transform shape
  },
  loud speaker IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 3 height 2,
    shape=rectangle ee,
    append after command={%
      \bgroup
        edge[circuit symbol open, to path={%
          (1.5\tikzcircuitssizeunit,-\tikzcircuitssizeunit) --  (3.5\tikzcircuitssizeunit,-2.5\tikzcircuitssizeunit) --  (-3.5\tikzcircuitssizeunit,-2.5\tikzcircuitssizeunit) -- (-1.5\tikzcircuitssizeunit,-\tikzcircuitssizeunit) -- cycle}] ()
      \egroup%
    },
    transform shape
  },
  mechanical interlock IEC relay graphic/.style={
    circuit symbol open,
    circuit symbol size=width 0.8 height 0.69282032,
    inner sep=0pt,
    shape=mechanical interlock IEC relay,
    transform shape
  }
}


\makeatletter
\tikzset{
  circuit ee IEC relay/.style=
  {
    circuit ee IEC,
    % modifications
    set resistor graphic                        = resistor IEC relay graphic,
    set bulb graphic                            = bulb IEC relay graphic,
    % additions
    set fuse graphic                            = fuse IEC relay graphic,
    set horn graphic                            = horn IEC relay graphic,
    set buzzer graphic                          = buzzer IEC relay graphic,
    set loud speaker graphic                    = loud speaker IEC relay graphic,
    set magnetic sensor graphic                 = magnetic sensor IEC relay graphic,
    set thermic sensor graphic                  = thermic sensor IEC relay graphic,
    set make contact graphic                    = make contact IEC relay graphic,
    set break contact graphic                   = break contact IEC relay graphic,
        % change-over break before make contact
    set change over contact graphic             = change over contact IEC relay graphic,
    set relay coil graphic                      = relay coil IEC relay graphic,
    set proximity sensor coil graphic           = proximity sensor coil IEC relay graphic,
    set mechanical interlock graphic            = mechanical interlock IEC relay graphic,
    % terminal info
    term/.code={\pgfutil@ifnextchar[\tikz@lib@relay@lar@plain{\tikz@lib@relay@lar@plain[]}##1\pgf@stop},
    term'/.code={\pgfutil@ifnextchar[\tikz@lib@relay@lbr@plain{\tikz@lib@relay@lbr@plain[]}##1\pgf@stop},
    term''/.code={\pgfutil@ifnextchar[\tikz@lib@relay@lal@plain{\tikz@lib@relay@lal@plain[]}##1\pgf@stop},
    every term/.style={font=\scriptsize},
    every term'/.style={font=\scriptsize},
    every term''/.style={font=\scriptsize},
    activated/.is if=contact@activated,
    every circuit ee IEC relay/.try
  }
}
\makeatother

\endinput