% Copyright 2007-2009 by Massimo Redaelli
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/LICENSE for more details.

%% Generic macro for defining a bipole shape
% #1 - additional anchors
% #2 - lower y-size of the bipole (from the center).
% #3 - #shape is the name of the shape
% #4 - upper y-size of the bipole (from the center)
% #5 - width of the bipole
% #6 - macros drawing the bipole


\long\def\pgfcircdeclarebipole#1#2#3#4#5#6{
	\pgfdeclareshape{#3shape}{
	
	\savedanchor{\northeast}{
		\pgf@y=#4\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@x=#5\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
	}
	\savedanchor{\northeastborder}{
		\pgf@y=#4\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
		\pgf@x=#5\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
		\pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
	}
	\savedanchor{\southwestborder}{
		\pgf@y=-#2\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
		\pgf@x=-#5\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
		\pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
	}
	\savedanchor{\southwest}{
		\pgf@y=-#2\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@x=-#5\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
	}
	\savedanchor{\centerpoint}{
		\pgf@circ@res@down=-#2\pgf@circ@Rlen
		\pgf@circ@res@up=#4\pgf@circ@Rlen
		\pgfpointorigin
		\pgf@y=\pgf@circ@res@up
		\advance\pgf@y by\pgf@circ@res@down
		\pgf@y=.5\pgf@y
	}
	\anchor{center}{\pgfpointorigin}
	\anchor{n}{
		\northeast
		\pgf@x=0cm
	}
	\anchor{ne}{
		\northeast
	}
	\anchor{nw}{
		\northeast
		\pgf@x=-\pgf@x
	}
	\anchor{e}{%
		\northeast
		\pgf@y=0cm
   }
	\anchor{s}{%
		\southwest
		\pgf@x=0cm
   }
	\anchor{se}{%
		\southwest
		\pgf@x=-\pgf@x
   }
	\anchor{sw}{%
		\southwest
   }
	\anchor{w}{
		\southwest
		\pgf@y=0cm
	}
	\anchor{north}{
		\northeast
		\pgf@x=0cm
	}
	\anchor{east}{%
		\northeast
		\pgf@y=0cm
   }
	\anchor{south}{%
		\southwest
		\pgf@x=0cm
   }
	\anchor{west}{
		\southwest
		\pgf@y=0cm
	}
	\anchor{right}{
		\northeast
		\pgf@y=0cm
	}
	\anchor{above}{
		\northeast
		\pgf@x=0cm
	}
	\anchor{left}{%
		\southwest
		\pgf@y=0cm
   }
	\anchor{below}{%
		\southwest
		\pgf@x=0cm                    
   }
	\anchor{a}{%
		\northeast
		\pgf@y=0cm
   }
	\anchor{b} {
		\southwest
		\pgf@y=0cm
	}
	\savedanchor{\textanchor}{%
		\pgf@y=\ht\pgfnodeparttextbox
		\pgf@x=-.5\wd\pgfnodeparttextbox
   }
	\anchor{text}{%
		\textanchor
   }
	\anchorborder{%
		\ifpgf@circuit@bipole@inverted
			\pgf@circ@res@left=-\pgf@x
			\pgf@circ@res@right=-\pgf@y
		\else
			\pgf@circ@res@left=\pgf@x
			\pgf@circ@res@right=\pgf@y
		\fi
		\ifdim\pgf@circ@res@right>0cm
			\pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder}
		\else
	  		\southwestborder	
	  	\pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
		\fi
	}
	
	#1
	
	\backgroundpath{	
		\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}
		
		\northeast
		\pgf@circ@res@up = \pgf@y 
		\pgf@circ@res@zero = 0cm
		\pgf@circ@res@left = -\pgf@x
		\pgf@circ@res@right = \pgf@x
		\southwest
		\pgf@circ@res@down = \pgf@y

 		\pgfstartlinewidth=\pgflinewidth
		\pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
		#6
			
		\pgfsetlinewidth{\pgfstartlinewidth}
	}
	}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Standard bipole shapes declarations

%% Resistor
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/resistor/height}}{resistor}{\ctikzvalof{bipoles/resistor/height}}{\ctikzvalof{bipoles/resistor/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments
	\pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
	\divide \pgf@circ@res@step by 12
	
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
	\pgf@circ@res@other = \pgf@circ@res@left
	\advance\pgf@circ@res@other by \pgf@circ@res@step 
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step 
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by \pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
	\pgfsetbeveljoin
	\pgfusepath{draw}
}



%% Variable resistor
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vresistor/height}}{vresistor}{\ctikzvalof{bipoles/vresistor/height}}{\ctikzvalof{bipoles/vresistor/width}}{		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments
	\pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
	\divide \pgf@circ@res@step by 12
	
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
	
	\pgf@circ@res@other = \pgf@circ@res@left
	\advance\pgf@circ@res@other by \pgf@circ@res@step 
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step 
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by \pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
	\pgfsetbeveljoin
	\pgfusepath{draw}
	
	\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
		\pgfusepath{draw}
	\endpgfscope
}



%% Capacitor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/capacitor/height}}{capacitor}{\ctikzvalof{bipoles/capacitor/height}}{\ctikzvalof{bipoles/capacitor/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/capacitor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 5

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
}


%% Polar Capacitor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/pcapacitor/height}}{polarcapacitor}{\ctikzvalof{bipoles/pcapacitor/height}}{\ctikzvalof{bipoles/pcapacitor/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/pcapacitor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 5

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
				
		\pgfscope
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
			\pgftransformrotate{-90}
			\pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
			\pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
			\pgfusepath{draw}
		\endpgfscope
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
}

%% Electrolytic Capacitor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ecapacitor/height}}{ecapacitor}{\ctikzvalof{bipoles/ecapacitor/height}}{\ctikzvalof{bipoles/ecapacitor/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/ecapacitor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 5
		\pgfsetrectcap
		% % % Draw plus pole
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfsetfillcolor{white} 
		\pgfusepath{draw,fill}
		% % Draw minus pole
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
				 \pgfsetfillcolor{black} 
				\pgfusepath{draw,fill}
		\pgfsetfillcolor{black} 
		% % plus pole annotation
		\pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
		{\pgfkeysvalueof{/tikz/circuitikz/bipoles/ecapacitor/font} $+$}	
}

%% Battery

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery/height}}{battery}{\ctikzvalof{bipoles/battery/height}}{\ctikzvalof{bipoles/battery/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 6

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}

		\pgfusepath{draw}
}


%% Battery 1 % poles with equl thickness

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery1/height}}{battery1}{\ctikzvalof{bipoles/battery1/height}}{\ctikzvalof{bipoles/battery1/width}}{
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
		\pgfusepath{draw}

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
}

%% Battery 2 % negative pole thicker

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/battery2/height}}{battery2}{\ctikzvalof{bipoles/battery2/height}}{\ctikzvalof{bipoles/battery2/width}}{
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
		\pgfusepath{draw}

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfsetlinewidth{3\pgflinewidth}
		\pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
		\pgfusepath{draw}
}


%% cute inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cuteinductor/lower coil height}}{cuteinductor}{\ctikzvalof{bipoles/cuteinductor/height}}{\ctikzvalof{bipoles/cuteinductor/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments

	\pgfmathsetlength{\pgf@circ@res@other}%width of small coil
	{0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}


	\pgfmathsetlength{\pgf@circ@res@step}
		{(\ctikzvalof{bipoles/cuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
	\foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
	{
		\pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
		\pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
	}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
	\pgfsetbuttcap
	\pgfsetbeveljoin
	\pgfusepath{stroke}
}

%% variable cute inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vcuteinductor/lower coil height}}{vcuteinductor}{\ctikzvalof{bipoles/vcuteinductor/height}}{\ctikzvalof{bipoles/vcuteinductor/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments	
	
	\pgfmathsetlength{\pgf@circ@res@other}%width of small coil
	{0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}


	\pgfmathsetlength{\pgf@circ@res@step}
		{(\ctikzvalof{bipoles/vcuteinductor/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}

	\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
	\foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
	{
		\pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
		\pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
	}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
	\pgfsetbuttcap
	\pgfsetbeveljoin
	\pgfusepath{stroke}
}

%% american inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/americaninductor/height 2}}{americaninductor}{\ctikzvalof{bipoles/americaninductor/height}}{\ctikzvalof{bipoles/americaninductor/width}}{
	\pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@Rlen
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}	
	\pgftransformationadjustments
	\advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
	\divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
	\divide \pgf@circ@res@step by 2
	\pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@Rlen

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
	\foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
	{
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	}
	\pgfsetbuttcap
	\pgfsetbeveljoin
	\pgfusepath{stroke}
}

%% variable american inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vamericaninductor/height 2}}{vamericaninductor}{\ctikzvalof{bipoles/vamericaninductor/height}}{\ctikzvalof{bipoles/vamericaninductor/width}}{
	\pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@Rlen
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments
	\advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
	\divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
	\divide \pgf@circ@res@step by 2
	\pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@Rlen

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
	\foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
	{
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	}
	\pgfsetbuttcap
	\pgfsetbeveljoin
	\pgfusepath{stroke}

	\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}


%% Independent voltage source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsource/height}}{vsource}{\ctikzvalof{bipoles/vsource/height}}{\ctikzvalof{bipoles/vsource/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}
}


%% Independent voltage source - American style

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAM}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}
	\ifpgf@circ@oldvoltagedirection
		\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$+$}
		\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$-$}
	\else
		\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$}
		\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$}
	\fi
}



%% Independent sinusoidal voltage source
 
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourcesin/height}}{vsourcesin}{\ctikzvalof{bipoles/vsourcesin/height}}{\ctikzvalof{bipoles/vsourcesin/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}		
		
		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope
}

% Triangle Voltage source - contributed by Ralf Farkas
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourcetri/height}}{vsourcetri}{\ctikzvalof{bipoles/vsourcetri/height}}{\ctikzvalof{bipoles/vsourcetri/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}		
		
		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
			\pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope
}


% Square Voltage source -  contributed by Alistair Kwan
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourcesquare/height}}{vsourcesquare}{\ctikzvalof{bipoles/vsourcesquare/height}}{\ctikzvalof{bipoles/vsourcesquare/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}
	\pgf@circ@res@up = .5\pgf@circ@res@up
	\pgfscope
		\pgftransformrotate{90}
		\pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
		\pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}

% Triangle Voltage source - contributed by Ralf Farkas
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourcetri/height}}{vsourcetri}{\ctikzvalof{bipoles/vsourcetri/height}}{\ctikzvalof{bipoles/vsourcetri/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}		
		
		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
			\pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope
}


%% Empty Source
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/esource/height}}{esource}{\ctikzvalof{bipoles/esource/height}}{\ctikzvalof{bipoles/esource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
	\pgfusepath{draw}
}

%% PV Source
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/pvsource/height}}{pvsource}{\ctikzvalof{bipoles/pvsource/height}}{\ctikzvalof{bipoles/pvsource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
	\pgfusepath{draw}

	\pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
	\pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}

	\pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
	\pgfusepath{draw}

	%Arrow Part
	\pgfscope
	\pgfsetarrowsend{latex}
	\pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
	\pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
	\pgfusepath{draw}
	\pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
	\pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
	\pgfusepath{draw}
	\endpgfscope

}

%% Empty Source
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/esource/height}}{esource}{\ctikzvalof{bipoles/esource/height}}{\ctikzvalof{bipoles/esource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
	\pgfusepath{draw}
}

%% DC Current Source with open shape
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/dcisource/height}}{dcisource}{\ctikzvalof{bipoles/dcisource/height}}{\ctikzvalof{bipoles/dcisource/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpointorigin}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}}\pgfpatharc{0}{90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0}}\pgfpatharc{0}{-90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}\pgfpatharc{180}{270}{0.85\pgf@circ@res@right and \pgf@circ@res@up}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}\pgfpatharc{180}{90}{0.85\pgf@circ@res@right and \pgf@circ@res@up}	
	\pgfusepath{draw}

	\pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}
	\pgfscope

	\pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
	\endpgfscope
}

%% DC-Voltage source
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/dcvsource/height}}{dcvsource}{\ctikzvalof{bipoles/dcvsource/height}}{\ctikzvalof{bipoles/dcvsource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	\pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
	\pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
	\pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
	\pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
	\pgfusepath{draw}	
}


%% Independent current source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/isource/height}}{isource}{\ctikzvalof{bipoles/isource/height}}{\ctikzvalof{bipoles/isource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
	\pgfusepath{draw}
}

%% Independent double oo source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/oosource/height}}{oosource}{\ctikzvalof{bipoles/oosource/height}}{\ctikzvalof{bipoles/oosource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
		{\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
	\pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
		{\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}	
	\pgfusepath{draw}
}


%% Independent current source - American

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/isourceam/height}}{isourceAM}{\ctikzvalof{bipoles/isourceam/height}}{\ctikzvalof{bipoles/isourceam/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}

	\pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}
	\pgfscope
		\pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
		\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
	\endpgfscope
}


%% Independent sinusoidal current source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/isource/height}}{isourcesin}{\ctikzvalof{bipoles/isource/height}}{\ctikzvalof{bipoles/isource/width}}{
	\pgfpointorigin
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfusepath{draw}
	
		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope

}


%% Controlled voltage source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsource/height}}{cvsource}{\ctikzvalof{bipoles/cvsource/height}}{\ctikzvalof{bipoles/cvsource/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfusepath{draw}		
}




%% Controlled voltage source - American
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourceam/height}}{cvsourceAM}{\ctikzvalof{bipoles/cvsourceam/height}}{\ctikzvalof{bipoles/cvsourceam/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfusepath{draw}

	\ifpgf@circ@oldvoltagedirection
		\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$+$}
		\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$-$}
	\else
		\pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{$-$}
		\pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{$+$}
	\fi
}


%% Controlled sinusoidal voltage source
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourcesin/height}}{cvsourcesin}{\ctikzvalof{bipoles/cvsourcesin/height}}{\ctikzvalof{bipoles/cvsourcesin/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

		\pgfscope
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfusepath{draw}		
		\endpgfscope	

		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope
}



%% Controlled sinusoidal current source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cvsourcesin/height}}{cisourcesin}{\ctikzvalof{bipoles/cvsourcesin/height}}{\ctikzvalof{bipoles/cvsourcesin/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

		\pgfscope
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfusepath{draw}		
		\endpgfscope	

		\pgf@circ@res@up = .5\pgf@circ@res@up
		\pgfscope
			\pgftransformrotate{90}
			\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
			\pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
			\pgfusepath{draw}
		\endpgfscope
}




%% Controlled current source

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisource/height}}{cisource}{\ctikzvalof{bipoles/cisource/height}}{\ctikzvalof{bipoles/cisource/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfusepath{draw}		
}




%% Controlled current source - American

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cisourceam/height}}{cisourceAM}{\ctikzvalof{bipoles/cisourceam/height}}{\ctikzvalof{bipoles/cisourceam/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	
			\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
			\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
			\pgfusepath{draw}		

	\pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}
	\pgfscope
		\pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
		\pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
	\endpgfscope
}

%% Black generic diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fulldiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% Black Zener diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fullzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}

%% Black alternative zigzag Zener diode
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fullzzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfscope
        \pgftransformxshift{\pgf@circ@res@left}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
        \pgfusepath{draw,fill}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}}
        \pgfusepath{draw}
    \endpgfscope
}

%% Black Schottky diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fullsdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope

}

%% Black tunnel diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fulltdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}

%% Black light emitting diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fulllediode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}

			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetarrowsend{latex'}
			\pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
			\pgfusepath{draw}
			\pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
			\pgfusepath{draw}

}

%% Black photodiode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{fullpdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}

			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetarrowsstart{latex'}
			\pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
			\pgfusepath{draw}
			\pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
			\pgfusepath{draw}
}

%% Black varcap

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/varcap/height}}{fullvarcap}{\ctikzvalof{bipoles/varcap/height}}{\ctikzvalof{bipoles/varcap/width}}{
	\pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
	\pgfsetlinewidth{\pgf@circ@res@temp}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
	\pgfusepath{draw,fill}
	%
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
}

%% Empty generic diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptydiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{


	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% Empty Zener diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptyzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.6\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}

%% Empty alternative zigzag Zener diode
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptyzzdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfscope
        \pgftransformxshift{\pgf@circ@res@left}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
        \pgfusepath{draw}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-1.8\pgf@circ@res@left}{\pgf@circ@res@down-0.5\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-0.2\pgf@circ@res@left}{\pgf@circ@res@up-0.5\pgf@circ@res@down}}
        \pgfusepath{draw}
    \endpgfscope
}
%% Empty Schottky diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptysdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{.6\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.4\pgf@circ@res@left}{.6\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope

}

%% Empty tunnel diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptytdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.6\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}

%% Empty light emitting diode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptylediode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{
		
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}

			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetarrowsend{latex'}
			\pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
			\pgfusepath{draw}
			\pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
			\pgfusepath{draw}
}

%% Empty photodiode

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/diode/height}}{emptypdiode}{\ctikzvalof{bipoles/diode/height}}{\ctikzvalof{bipoles/diode/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
	\endpgfscope
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}

			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetarrowsstart{latex'}
			\pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
			\pgfusepath{draw}
			\pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
			\pgfusepath{draw}
}

%% Empty varcap

\pgfcircdeclarebipole{
	\anchor{strokepathstart}{
			\northeast
				\pgf@y=0cm
				\advance\pgf@x by -\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth
				\advance\pgf@x by -\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgflinewidth
	}
	\anchor{strokepathend}{
		\northeast
		\pgf@y=0cm
	}	
	}{\ctikzvalof{bipoles/varcap/height}}{emptyvarcap}{\ctikzvalof{bipoles/varcap/height}}{\ctikzvalof{bipoles/varcap/width}}{
	\pgf@circ@res@temp=\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
	\pgfsetlinewidth{\pgf@circ@res@temp}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
	\pgfusepath{draw}
	%
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
}

%% (Closing) SPST
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spst/depth}}{cspst}{\ctikzvalof{bipoles/spst/height}}{\ctikzvalof{bipoles/spst/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
	\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	
	\pgfsetarrowsstart{latex'}
	\pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0\pgf@circ@res@down}}
	\pgfpatharcto{1.2\pgf@circ@res@right}{1.2\pgf@circ@res@right}{0}{0}{1}{\pgfpoint{.9\pgf@circ@res@left}{.9\pgf@circ@res@up}}
	\pgfsetbeveljoin
	\pgfusepath{draw}
}

%% Opening SPST
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spst/depth}}{ospst}{\ctikzvalof{bipoles/spst/height}}{\ctikzvalof{bipoles/spst/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
	\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	
	\pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
	\pgfpatharcto{1.1\pgf@circ@res@right}{1.1\pgf@circ@res@right}{0}{0}{1}{\pgfpoint{.7\pgf@circ@res@left}{.9\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@left}{1\pgf@circ@res@up}}
	\pgfsetarrowsend{latex'}
	\pgfsetbeveljoin
	\pgfusepath{draw}
}

%% Normal open Switch
\pgfcircdeclarebipole{}{0}{nos}{\ctikzvalof{bipoles/nos/height}}{\ctikzvalof{bipoles/nos/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
	\pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfsetbuttcap
	\pgfusepath{draw}
}

%% Normal closed Switch
\pgfcircdeclarebipole{}{0}{ncs}{\ctikzvalof{bipoles/ncs/height}}{\ctikzvalof{bipoles/ncs/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
	\pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	\pgfsetlinewidth{\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
	\pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
	\pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfusepath{draw}
}

%% Push Button
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/pushbutton/height 2}}{pushbutton}{\ctikzvalof{bipoles/pushbutton/height}}{\ctikzvalof{bipoles/pushbutton/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
	\pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	
	\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
	\pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
	\pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
	\pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
}

% % METERINGSHAPE
\long\def\drawmeteringcircle{
	\def\pgf@circ@temp{right}
	\ifx\tikz@res@label@pos\pgf@circ@temp
		\pgf@circ@res@step=-1.2\pgf@circ@res@up
	\else
		\def\pgf@circ@temp{below}
		\ifx\tikz@res@label@pos\pgf@circ@temp
			\pgf@circ@res@step=-1.2\pgf@circ@res@up
		\else
			\pgf@circ@res@step=1.2\pgf@circ@res@up
		\fi
	\fi
	%draw connections to circle
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}		
	\pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}
	%draw circle
	\pgfscope
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
		\pgfusepath{draw}
	\endpgfscope
	%draw arrow
	\pgfscope
		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}
%AMPEREMETER
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ammeter/height}}{ammeter}{\ctikzvalof{bipoles/ammeter/height}}{\ctikzvalof{bipoles/ammeter/width}}{
	\drawmeteringcircle
	\pgfnode{circle}{center}{\textbf{A}}{}{}
}
%OHMMETER
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ohmmeter/height}}{ohmmeter}{\ctikzvalof{bipoles/ohmmeter/height}}{\ctikzvalof{bipoles/ohmmeter/width}}{
	\drawmeteringcircle
	\pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
}
%VOLTMETER
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/voltmeter/height}}{voltmeter}{\ctikzvalof{bipoles/voltmeter/height}}{\ctikzvalof{bipoles/voltmeter/width}}{
	\drawmeteringcircle
	\pgfnode{circle}{center}{\textbf{V}}{}{}
		
}

%% Short circuit

\pgfcircdeclarebipole{}{0}{short}{0}{0}{ }

%% Open circuit

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/open/height}}{open}{\ctikzvalof{bipoles/open/height}}{\ctikzvalof{bipoles/open/width}}{

}

%% Generic bipole - used as resistor by some (bleah)

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/generic/height}}{generic}{\ctikzvalof{bipoles/generic/height}}{\ctikzvalof{bipoles/generic/width}}{

		%\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		%\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw} 
}


%% fuse

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/fuse/height}}{fuse}{\ctikzvalof{bipoles/fuse/height}}{\ctikzvalof{bipoles/fuse/width}}{

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
		\pgfusepath{draw}
		
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw} 
}



%% Generic bipole, filled - used as inductor by some (bleah)

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/fullgeneric/height}}{fullgeneric}{\ctikzvalof{bipoles/fullgeneric/height}}{\ctikzvalof{bipoles/fullgeneric/width}}{

		%\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		%\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw,fill} 
}


%% Generic asymmetric bipole 

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ageneric/height}}{ageneric}{\ctikzvalof{bipoles/ageneric/height}}{\ctikzvalof{bipoles/ageneric/width}}{
		%\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		%\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw} 

			\pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
			\pgfusepath{stroke,fill}		
}


%% asymmetric fuse

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/afuse/height}}{afuse}{\ctikzvalof{bipoles/afuse/height}}{\ctikzvalof{bipoles/afuse/width}}{

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
		\pgfusepath{draw}
		
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw}
		
		\pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
			\pgfusepath{stroke,fill}		 
}




%% Memristor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/memristor/height}}{memristor}{\ctikzvalof{bipoles/memristor/height}}{\ctikzvalof{bipoles/memristor/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
		\pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
					
		\pgfusepath{draw} 

			\pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
			\pgfusepath{stroke,fill}		
}




%% Generic empty tunable

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/tgeneric/height}}{tgeneric}{\ctikzvalof{bipoles/tgeneric/height}}{\ctikzvalof{bipoles/tgeneric/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		\endpgfscope
}

%% Photoresistor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/photoresistor/height 2}}{photoresistor}{\ctikzvalof{bipoles/photoresistor/height}}{\ctikzvalof{bipoles/photoresistor/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
		\pgfusepath{draw}
		\endpgfscope
}




%% Thermistor
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/thermistor/height}}{thermistor}{\ctikzvalof{bipoles/thermistor/height}}{\ctikzvalof{bipoles/thermistor/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistor/main}\pgf@circ@res@up}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		%\pgfscope
		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		%\endpgfscope
}


%% Thermistor PTC
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/thermistorptc/height 2}}{thermistorptc}{\ctikzvalof{bipoles/thermistorptc/height}}{\ctikzvalof{bipoles/thermistorptc/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorptc/main}\pgf@circ@res@up}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
		\pgfusepath{draw}
		
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$}
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
		\pgfusepath{draw}
}

%% Thermistor NTC
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/thermistorntc/height 2}}{thermistorntc}{\ctikzvalof{bipoles/thermistorntc/height}}{\ctikzvalof{bipoles/thermistorntc/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/thermistorntc/main}\pgf@circ@res@up}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
		\pgfusepath{draw}
		
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\tiny$\vartheta$}
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
}

%% thermocouple
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/thermocouple/height 2}}{thermocouple}{\ctikzvalof{bipoles/thermocouple/height}}{\ctikzvalof{bipoles/thermocouple/width}}{
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
		\pgfusepath{draw}
}

%% Varistor
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/varistor/height}}{varistor}{\ctikzvalof{bipoles/varistor/height}}{\ctikzvalof{bipoles/varistor/width}}{
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\pgfkeysvalueof{/tikz/circuitikz/bipoles/varistor/main}\pgf@circ@res@up}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw}
		
		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\tiny\textsf{U}}}
}



%% Generic full tunable

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/tfullgeneric/height}}{tfullgeneric}{\ctikzvalof{bipoles/tfullgeneric/height}}{\ctikzvalof{bipoles/tfullgeneric/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfusepath{draw,fill}
		
		\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		\endpgfscope
}







%% Variable Capacitor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vcapacitor/height}}{vcapacitor}{\ctikzvalof{bipoles/vcapacitor/height}}{\ctikzvalof{bipoles/vcapacitor/width}}{
		%\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/width}\pgf@circ@Rlen
		\pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		\endpgfscope
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfusepath{draw}
}


%% Piezoelectric Element

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/piezoelectric/height}}{piezoelectric}{\ctikzvalof{bipoles/piezoelectric/height}}{\ctikzvalof{bipoles/piezoelectric/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 5

		%% Outer markings
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}

		%% Inner Box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left+4}{\pgf@circ@res@up-1}}{\pgfpoint{\pgf@circ@res@right-4}{\pgf@circ@res@down+1}}
		\pgfusepath{draw}

}





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Handling of terminals


%% Easily usable styles

\ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=empty}}
\ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=empty}}
\ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=none}}
\ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=empty}}
\ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=full}}
\ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=empty}}
\ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=diamond}}
\ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=none}}
\ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=full}}
\ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=none}}
\ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamond}}
\ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=full}}
\ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=full}}
\ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=diamond}}
\ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=diamond}}

\ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
\ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=full}}
\ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=empty}}
\ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamond}}
\ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
\ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=empty, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
\ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=full, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
\ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamond, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
\ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}

\tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}


%% The output routine

\def\drawpoles{
	\pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{diamond}  }
	\ifx\pgf@temp\pgf@circ@temp 
		 (\tikztostart) node[diamondpole] {} 
	\else 
		\pgfextra{ \def\pgf@temp{empty}  }
		\ifx\pgf@temp\pgf@circ@temp 
			 (\tikztostart) node[ocirc] {} 
		\else 
			\pgfextra{  \def\pgf@temp{full}  }
			\ifx\pgf@temp\pgf@circ@temp 
				(\tikztostart) node[circ] {} 
			\else 
				\pgfextra{ \def\pgf@temp{rectjoinfill} }
				\ifx\pgf@temp\pgf@circ@temp 
				 (\tikztostart) node[rectjoinfill] {} 
				\else 
				\fi
			\fi
		\fi
	\fi
	\pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \def\pgf@temp{diamond}  }
	\ifx\pgf@temp\pgf@circ@temp 
		 (\tikztotarget) node[diamondpole] {} 
	\else 
		\pgfextra{ \def\pgf@temp{empty}  }
		\ifx\pgf@temp\pgf@circ@temp 
			 (\tikztotarget) node[ocirc] {} 
		\else 
			\pgfextra{  \def\pgf@temp{full}  }
			\ifx\pgf@temp\pgf@circ@temp 
				(\tikztotarget) node[circ] {} 
			\else 
				\pgfextra{ \def\pgf@temp{rectjoinfill} }
				\ifx\pgf@temp\pgf@circ@temp 
				 (\tikztotarget) node[rectjoinfill] {} 
				\else 
				\fi
			\fi
		\fi
	\fi
}



%% Lamp

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/lamp/height}}{lamp}{\ctikzvalof{bipoles/lamp/height}}{\ctikzvalof{bipoles/lamp/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
	\pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
	\pgfusepath{draw}
}


\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/tline/height}
                        }{tline}{\ctikzvalof{bipoles/tline/height}
                                 }{\ctikzvalof{bipoles/tline/width}
                                   }    
          {
          \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
          \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
          \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0}}
                         {\pgfpoint{\pgf@circ@res@step}{0}}
                         {\pgfpoint{0}{-\pgf@circ@res@up}}
          \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
          \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
          \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
          \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
          \pgfusepath{draw}
}




%% SQUID added by Cor Molenaar 5 March 2010

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/squid/height}}{squid}{\ctikzvalof{bipoles/squid/height}}{\ctikzvalof{bipoles/squid/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}

	\pgfusepath{draw}
}



% Generic barrier added by Cor Molenaar 5 March 2010

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/barrier/height}}{barrier}{\ctikzvalof{bipoles/barrier/height}}{\ctikzvalof{bipoles/barrier/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
	\pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}

	\pgfusepath{draw}
}


% Contributed by Danilo Piazzalunga
 
\pgfdeclareshape{buffer}
	{
	  \anchor{center}{\pgfpointorigin}
	  \savedanchor\northwest{%
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
	  }
	  \anchor{south}{
		\northwest
		\pgf@y=-\pgf@y
	  }
	  \savedanchor\left{%
	  	\pgf@y=0pt
	  }
	  \anchor{in}{
		\northwest
		\pgf@y=0pt
	  }
	  \anchor{out}{
		\northwest
		\pgf@y=0pt
		\pgf@x=-\pgf@x
	  }
	  
	  \backgroundpath{			
			\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}	
			
			
			\northwest
			\pgf@circ@res@up = \pgf@y 
			\pgf@circ@res@down = -\pgf@y
			\pgf@circ@res@right = -\pgf@x
			\pgf@circ@res@left = \pgf@x
			
	\pgfscope
		\pgfsetlinewidth{2\pgflinewidth}
		\pgftransformxshift{.7\pgf@circ@res@left}
		\pgf@circ@res@step=\pgf@circ@res@right
		\advance\pgf@circ@res@step by -\pgf@circ@res@left
		\pgf@circ@res@step=.7\pgf@circ@res@step
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
		\pgfusepath{draw}
	\endpgfscope
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
		\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
	
		\pgfusepath{draw}
	  
	  }
	}





\pgfdeclareshape{plain amp}
	{
	  \anchor{center}{\pgfpointorigin}
	  \savedanchor\northwest{%
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
	  }
	  \anchor{south}{
		\northwest
		\pgf@y=-\pgf@y
	  }
	  \savedanchor\left{%
	  	\pgf@y=0pt
	  }
	  \savedanchor\inOne{%
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
	  }	  
	  \anchor{-}{
		\inOne
	  }
	  \anchor{+}{
		\inOne
		\pgf@y=-\pgf@y
	  }
	  \savedanchor\up{%
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@circ@Rlen
		\pgf@y=.5\pgf@y
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@circ@Rlen
		\pgf@x=.5\pgf@x
			\pgf@circ@res@up = \pgf@y 
			\pgf@circ@res@right = -\pgf@x
			\pgf@circ@res@left = \pgf@x
	    \pgfpointlineattime{
			\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/up pos}}{
			\pgfpoint{
				\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left}
				{\pgf@circ@res@up}}
			{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
	  }
	  \anchor{up}{
		\up
	  }
	  \anchor{down}{
		\up
		\pgf@y=-\pgf@y
	  }
	  \anchor{out}{
		\northwest
		\pgf@y=0pt
		\pgf@x=-\pgf@x
	  }
	  
	  \backgroundpath{			
			\pgfsetcolor{\pgfkeysvalueof{/tikz/circuitikz/color}}	
			
			
			\northwest
			\pgf@circ@res@up = \pgf@y 
			\pgf@circ@res@down = -\pgf@y
			\pgf@circ@res@right = -\pgf@x
			\pgf@circ@res@left = \pgf@x
			
	\pgfpathmoveto{\pgfpoint
		{\pgf@circ@res@left}
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left}
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@up}}
	

	\pgfpathmoveto{\pgfpoint
		{\pgf@circ@res@left}
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/port width}\pgf@circ@res@left}
		{\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@circ@res@down}}
		
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
	\pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
	
	\pgfusepath{draw}

						
	\pgfscope
		\pgfsetlinewidth{2\pgflinewidth}
		\pgftransformxshift{.7\pgf@circ@res@left}
		\pgf@circ@res@step=\pgf@circ@res@right
		\advance\pgf@circ@res@step by -\pgf@circ@res@left
		\pgf@circ@res@step=.7\pgf@circ@res@step
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
		\pgfusepath{draw}
	\endpgfscope
		
		
	  
	  }
	}
	
%% Generic two port box
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/twoport/height}}{twoport}{\ctikzvalof{bipoles/twoport/height}}{\ctikzvalof{bipoles/twoport/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi
		
		% draw inner symbol
		\pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
		
}

%% voltage controled oscillator
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vco/width}}{vco}{\ctikzvalof{bipoles/twoport/width}}{\ctikzvalof{bipoles/vco/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		% draw circle
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi

		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi
		
		% draw inner sine waves
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		
}

%% bandpass filter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bandpass/width}}{bandpass}{\ctikzvalof{bipoles/bandpass/width}}{\ctikzvalof{bipoles/bandpass/width}}{
		
		\pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi
		
		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
		\pgfusepath{draw}
}

%% bandstop filter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/bandstop/width}}{bandstop}{\ctikzvalof{bipoles/bandstop/width}}{\ctikzvalof{bipoles/bandstop/width}}{
	\pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@Rlen
	\divide \pgf@circ@res@step by 2

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgf@circ@res@other = \pgf@circ@res@left
	\advance\pgf@circ@res@other by \pgf@circ@res@step

	\ifpgf@circuit@dashed
	\pgfsetdash{{0.1cm}{0.1cm}}{0cm}
	\fi

	% draw outer box
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
	\pgfusepath{draw}

	\ifpgf@circuit@inputarrow
	{
		\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
		\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
		\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
	}
	\fi

	% rotate inner symbol
	\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
	\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
	\pgftransformrotate{270}
	\fi\fi
	\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
	\pgftransformrotate{180}
	\fi\fi
	\ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
	\pgftransformrotate{90}
	\fi\fi

	% draw inner symbol
	\pgfsetdash{}{0pt}% always draw solid line for inner symbol
	\pgfsetarrows{-}%never draw arrows
	\pgfsetlinewidth{\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfusepath{draw}

	\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfusepath{draw}
	\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
	\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
	\pgfusepath{draw}

	\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
	\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
	\pgfusepath{draw}
}

%% highpass filter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/highpass/width}}{highpass}{\ctikzvalof{bipoles/highpass/width}}{\ctikzvalof{bipoles/highpass/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
		\pgfusepath{draw}
}

%% lowpass filter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/lowpass/width}}{lowpass}{\ctikzvalof{bipoles/lowpass/width}}{\ctikzvalof{bipoles/lowpass/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
		\pgfusepath{draw}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
		\pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
		\pgfusepath{draw}
}

%% ADC
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/adc/width}}{adc}{\ctikzvalof{bipoles/adc/width}}{\ctikzvalof{bipoles/adc/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\texti{A}
		\def\textii{D}
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\def\texti{D}
			\def\textii{A}
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\def\texti{D}
			\def\textii{A}
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
			\def\texti{A}
			\def\textii{D}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows				
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}
		
		\pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
		\pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
}

%% DAC
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/dac/width}}{dac}{\ctikzvalof{bipoles/dac/width}}{\ctikzvalof{bipoles/dac/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\texti{D}
		\def\textii{A}
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\def\texti{A}
			\def\textii{D}
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225  % 134 degree, because >= 135 is not possible
			\def\texti{A}
			\def\textii{D}
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
			\def\texti{D}
			\def\textii{A}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows				
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
		\pgfusepath{draw}
		
		\pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
		\pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
}

%% DSP
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/dsp/width}}{dsp}{\ctikzvalof{bipoles/dsp/width}}{\ctikzvalof{bipoles/dsp/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgftext[center,x=0,y=0]{\textsf{DSP}}
}

%% FFT
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/fft/width}}{fft}{\ctikzvalof{bipoles/fft/width}}{\ctikzvalof{bipoles/fft/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgftext[center,x=0,y=0]{\textsf{FFT}}
}

%% Amplifier
\pgfcircdeclarebipole{}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{amp}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi		

		% draw outer box
		\ifpgf@circuit@boxed
			\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}	
			\pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}}
		\fi
		
		% draw input arrow
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi

		\ifpgf@circuit@boxed
			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetdash{}{0pt}	% draw solid line for inner symbol if no box is drawn
			\pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
		\else
			\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}	
		\fi
		
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
		\pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}

		\pgfpathclose
		\pgfusepath{draw}
		
		% draw inner text
		\pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
}


%% variable amplifier
\pgfcircdeclarebipole{}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{vamp}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{
		\ifpgf@circuit@boxed
			\ctikzvalof{bipoles/twoport/width}
		\else
			\ctikzvalof{bipoles/amp/width}
		\fi
	}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\ifpgf@circuit@boxed
			\pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}}
		\fi

		% draw input arrow
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi

		\ifpgf@circuit@boxed
			\pgfsetlinewidth{\pgfstartlinewidth}
			\pgfsetdash{}{0pt}	% draw solid line for inner symbol if no box is drawn
			\pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
		\else
			\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}	
		\fi
		

		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}

		\pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
		\pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}

		\pgfpathclose
		\pgfusepath{draw}
		
		% draw inner text
		\pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
		
		% draw arrow
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
		\pgfusepath{draw}
}

%% pi attenuator
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/piattenuator/width}}{piattenuator}{\ctikzvalof{bipoles/piattenuator/width}}{\ctikzvalof{bipoles/piattenuator/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% variable pi attenuator
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vpiattenuator/width}}{vpiattenuator}{\ctikzvalof{bipoles/vpiattenuator/width}}{\ctikzvalof{bipoles/vpiattenuator/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}

		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% T attenuator
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/tattenuator/width}}{tattenuator}{\ctikzvalof{bipoles/tattenuator/width}}{\ctikzvalof{bipoles/tattenuator/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% variable T attenuator
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vtattenuator/width}}{vtattenuator}{\ctikzvalof{bipoles/vtattenuator/width}}{\ctikzvalof{bipoles/vtattenuator/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 

		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi

		% draw inner symbol
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		\pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
		\pgfusepath{draw}
		
		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% phase shifter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/phaseshifter/width}}{phaseshifter}{\ctikzvalof{bipoles/phaseshifter/width}}{\ctikzvalof{bipoles/phaseshifter/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi
		
		% inner symbol
		\pgftext[center,x=0,y=0]{\Large$\varphi$}
}

%% variable phase shifter
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/phaseshifter/width}}{vphaseshifter}{\ctikzvalof{bipoles/vphaseshifter/width}}{\ctikzvalof{bipoles/vphaseshifter/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% rotate inner symbol
		\def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
		\ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
			\pgftransformrotate{270}
		\fi\fi
		\ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
			\pgftransformrotate{180}
		\fi\fi
		\ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
			\pgftransformrotate{90}
		\fi\fi
		
		% inner symbol
		\pgftext[center,x=0,y=0]{\Large$\varphi$}
		
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
		\pgfusepath{draw}
}

%% detector
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/detector/width}}{detector}{\ctikzvalof{bipoles/detector/width}}{\ctikzvalof{bipoles/detector/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 2

		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgf@circ@res@other = \pgf@circ@res@left
		\advance\pgf@circ@res@other by \pgf@circ@res@step 
		
		\ifpgf@circuit@dashed
			\pgfsetdash{{0.1cm}{0.1cm}}{0cm} 
		\fi	
		
		% draw outer box
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@inputarrow
			{
				\advance \pgf@circ@res@left by -.5\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth
				\pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
				\pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
			}
		\fi
		
		% draw inner stuff
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetarrows{-} %never draw arrows
		\pgfsetlinewidth{0.8\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
		\pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
		\pgfusepath{draw}
		
		\ifpgf@circuit@fulldiode
			\pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/generic/width}}
			\pgftransformscale{\pgfmathresult}
			\pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
		\else
			\pgfmathparse{2\pgf@circ@res@up / \pgf@circ@Rlen / \ctikzvalof{bipoles/resistor/width}}
			\pgftransformscale{\pgfmathresult}
			\pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
		\fi
		
}




%% european gas filled surge arrester

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/european gas filled surge arrester/height}}{european gas filled surge arrester}{\ctikzvalof{bipoles/european gas filled surge arrester/height}}{\ctikzvalof{bipoles/european gas filled surge arrester/width}}{

		%\pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
		%\divide \pgf@circ@res@step by 14

		\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
					
		\pgfusepath{draw} 
		
		\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
		\pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}	
				\pgfusepath{draw} 
	
		\endpgfscope
}




%% american gas filled surge arrester

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/american gas filled surge arrester/height}}{american gas filled surge arrester}{\ctikzvalof{bipoles/american gas filled surge arrester/height}}{\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
	%\def\pgf@circ@temp{right}
	%\ifx\tikz@res@label@pos\pgf@circ@temp
	%	\pgf@circ@res@step=-1.2\pgf@circ@res@up
	%\else
%		\def\pgf@circ@temp{below}
%		\ifx\tikz@res@label@pos\pgf@circ@temp
%			\pgf@circ@res@step=-1.2\pgf@circ@res@up
%		\else
%			\pgf@circ@res@step=1.2\pgf@circ@res@up
%		\fi
%	\fi

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}		
	\pgfpointorigin	\pgf@circ@res@other =  \pgf@x  \advance \pgf@circ@res@other by -\pgf@circ@res@up
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
	\pgfusepath{draw}

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

		\pgfscope
			\pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
			\pgfusepath{draw}		
		\endpgfscope	

	\pgfsetlinewidth{\pgfstartlinewidth}


	\pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfusepath{draw}

	\pgfnode{circle}{center}{}{}{}
	
	\pgfscope
		\pgfsetarrowsend{latex}
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
		\pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
		\pgfusepath{draw}	
		
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgfpathlineto{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
		\pgfusepath{draw}	
	\endpgfscope{}
	
	%\pgftransformshift{\pgfpoint{.25\pgf@circ@res@left}{.45\pgf@circ@res@down}}
	%\pgfnode{circ}{center}{}{}{}
	%\pgftransformshift{}
	\pgfcircle{\pgfpoint{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/american gas filled surge arrester/size}\pgf@circ@res@down}
	\pgfusepath{fill}
}

% % MECHANICAL SYMBOLS

%% mechanical capacitance - stiffness/spring

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/spring/height}}{spring}{\ctikzvalof{bipoles/spring/height}}{\ctikzvalof{bipoles/spring/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments

	\pgfmathsetlength{\pgf@circ@res@step}
	{(\ctikzvalof{bipoles/spring/width}*\pgf@circ@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
	
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
	\pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
	\pgf@circ@res@other = \pgf@circ@res@left
	\advance\pgf@circ@res@other by \pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step 
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
	\advance\pgf@circ@res@other by 2\pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\advance\pgf@circ@res@other by \pgf@circ@res@step
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
	\pgfsetbuttcap
	\pgfsetbeveljoin
	\pgfusepath{stroke}
}

%% mechanical inductance - mass
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/mass/box height}}{mass}{\ctikzvalof{bipoles/mass/height}}{\ctikzvalof{bipoles/mass/width}}{
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgftransformationadjustments
	\pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
		{\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}

\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
	\pgfsetrectcap
	\pgfsetmiterjoin
	\pgfusepath{stroke}
}

%% mechanical resistor - damper
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/damper/height}}{damper}{\ctikzvalof{bipoles/damper/height}}{\ctikzvalof{bipoles/damper/width}}{
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
	\pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
					{\pgf@circ@res@zero}}
	\pgfusepath{stroke}

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}

	\pgfsetrectcap
	\pgfsetmiterjoin
	\pgfusepath{stroke}
	
	\pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
						{.8\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
						{.8\pgf@circ@res@up}}
	\pgfsetbuttcap
	\pgfusepath{stroke}
	
}


