% 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}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@x=0cm
	}
	\anchor{ne}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
	}
	\anchor{nw}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@x=-\pgf@x
	}
	\anchor{e}{%
		\ifpgf@circuit@bipole@reversed\else\southwest\northeast\fi
		\pgf@y=0cm
   }
	\anchor{s}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@x=0cm
   }
	\anchor{se}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@x=-\pgf@x
   }
	\anchor{sw}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
   }
	\anchor{w}{
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@y=0cm
	}
	\anchor{north}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@x=0cm
	}
	\anchor{east}{%
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@y=0cm
   }
	\anchor{south}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@x=0cm
   }
	\anchor{west}{
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@y=0cm
	}
	\anchor{right}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@y=0cm
	}
	\anchor{above}{
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@x=0cm
	}
	\anchor{left}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@y=0cm
   }
	\anchor{below}{%
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@x=0cm                    
   }
	\anchor{a}{%
		\ifpgf@circuit@bipole@reversed\southwest\else\northeast\fi
		\pgf@y=0cm
   }
	\anchor{b} {
		\ifpgf@circuit@bipole@reversed\northeast\else\southwest\fi
		\pgf@y=0cm
	}
	\savedanchor{\textanchor}{%
		\pgf@y=\ht\pgfnodeparttextbox
		\pgf@x=-.5\wd\pgfnodeparttextbox
   }
	\anchor{text}{%
		\textanchor
   }
	\anchorborder{%
		\def\pgf@temp{false}
		\ifpgf@circuit@bipole@reversed\pgf@temp
			\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
		
		#6
			
		\pgfsetlinewidth{\pgfstartlinewidth}
	}
	}
}

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

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

		\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 

		\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
		\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}}
		\pgfusepath{draw} 
}



%% Variable resistor
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vresistor/height}}{vresistor}{\ctikzvalof{bipoles/vresistor/height}}{\ctikzvalof{bipoles/vresistor/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vresistor/width}\pgf@circ@Rlen
		\divide \pgf@circ@res@step by 12
		\def\myfrac{.5}

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

		\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 
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}}
		\advance\pgf@circ@res@other by 2\pgf@circ@res@step 
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}}
		\advance\pgf@circ@res@other by 2\pgf@circ@res@step
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}}
		\advance\pgf@circ@res@other by 2\pgf@circ@res@step
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}}
		\advance\pgf@circ@res@other by 2\pgf@circ@res@step
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@up}}
		\advance\pgf@circ@res@other by 2\pgf@circ@res@step
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\myfrac\pgf@circ@res@down}}
		\advance\pgf@circ@res@other by \pgf@circ@res@step
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
		\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}
		
}

%% 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}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.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@step}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\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}
}


%% Battery 1

\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@left}{.5\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}

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



		\pgfusepath{draw}
}



%% cute inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/cuteinductor/height}}{cuteinductor}{\ctikzvalof{bipoles/cuteinductor/height}}{\ctikzvalof{bipoles/cuteinductor/width}}{
	\pgf@circ@res@step=\ctikzvalof{bipoles/cuteinductor/width}\pgf@circ@Rlen
	\divide \pgf@circ@res@step by \ctikzvalof{bipoles/cuteinductor/coils} %divide by number of coils
	\divide \pgf@circ@res@step by 2 %div by two for arcs

	\def\pgf@circ@coilsmall@width{\ctikzvalof{bipoles/cuteinductor/coil aspect}\pgf@circ@res@step}
	
	\advance \pgf@circ@res@step by \pgf@circ@coilsmall@width %adjust for overlapping lower arc

	\def\pgf@circ@coilwide@width{\pgf@circ@res@step}	
		
	\pgf@circ@res@other = \ctikzvalof{bipoles/cuteinductor/coil height}\pgf@circ@Rlen
	\pgf@circ@res@temp =\ctikzvalof{bipoles/cuteinductor/lower coil height}\pgf@circ@Rlen

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+0.5\pgfstartlinewidth}{-0.5\pgfstartlinewidth}}
	\foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
	{
		\pgfpatharc{180}{0}{\pgf@circ@coilwide@width and 	\pgf@circ@res@other}
		\pgfpatharc{0}{-180}{\pgf@circ@coilsmall@width and  \pgf@circ@res@temp}
	}
	\pgfpatharc{180}{0}{\pgf@circ@coilwide@width and  \pgf@circ@res@other}
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\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
	\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}{-0.5\pgfstartlinewidth}}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-0.5\pgfstartlinewidth}}
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfusepath{stroke}	
}




%% 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}}

	
	\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]{$-$}

	\pgfusepath{draw}
}



%% 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
}


% 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}
}

%% 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 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}}
			\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]{$-$}
			\pgfusepath{draw}		
}


%% 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{draw}}
	\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@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}}
		\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-.8\pgf@circ@res@left}{.8\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\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.2\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{.8\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-.8\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-.8\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}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\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-.8\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw,fill}
	
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}}
		\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}}
		\pgfusepath{draw}
		
	\endpgfscope
}

%% 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@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{\pgf@circ@res@up}}
		\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-.8\pgf@circ@res@left}{.8\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\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.2\pgf@circ@res@left}{\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-1.2\pgf@circ@res@left}{.8\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-.8\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-.8\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{}{\ctikzvalof{bipoles/varcap/height}}{emptyvarcap}{\ctikzvalof{bipoles/varcap/height}}{\ctikzvalof{bipoles/varcap/width}}{

	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfscope
		\pgftransformxshift{\pgf@circ@res@left}
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\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-.8\pgf@circ@res@left}{0pt}}
		\pgfusepath{draw}
	
		\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{\pgf@circ@res@right-.8\pgf@circ@res@left}{\pgf@circ@res@up}}
		\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}}
		\pgfusepath{draw}
		
	\endpgfscope
}

%% SPST

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/interr/height 2}}{spst}{\ctikzvalof{bipoles/interr/height}}{\ctikzvalof{bipoles/interr/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}}
			\pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@left}{.9\pgf@circ@res@up}}
            \pgfpatharc{65}{25}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/interr/width}\pgf@circ@Rlen}
			%\pgfsetarrowsend{latex'}
			\pgfusepath{draw}
			
			\pgfpathmoveto{\pgfpoint{.1\pgf@circ@res@right}{-.25\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{.14\pgf@circ@res@right}{-.35\pgf@circ@res@up}}
            \pgfsetarrowsend{latex'}
			\pgfusepath{draw}	

}

%% Closing SPST

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/interr/height 2}}{cspst}{\ctikzvalof{bipoles/interr/height}}{\ctikzvalof{bipoles/interr/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}}
			\pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@left}{.9\pgf@circ@res@up}}
            \pgfpatharc{65}{25}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/interr/width}\pgf@circ@Rlen}
			%\pgfsetarrowsend{latex'}
			\pgfusepath{draw}

}

%% Opening SPST

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/interr/height 2}}{ospst}{\ctikzvalof{bipoles/interr/height}}{\ctikzvalof{bipoles/interr/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}}
			\pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@right}{.1\pgf@circ@res@down}}
            \pgfpatharc{15}{50}{\pgfkeysvalueof{/tikz/circuitikz/bipoles/interr/width}\pgf@circ@Rlen}
            %\pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
			\pgfusepath{draw}
			
			\pgfpathmoveto{\pgfpoint{.85\pgf@circ@res@left}{1.25\pgf@circ@res@up}}
			\pgfpathlineto{\pgfpoint{.87\pgf@circ@res@left}{1.26\pgf@circ@res@up}}
            \pgfsetarrowsend{latex'}
			\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}}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Ammeter

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ammeter/height}}{ammeter}{\ctikzvalof{bipoles/ammeter/height}}{\ctikzvalof{bipoles/ammeter/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}

	\pgfsetarrowsend{latex}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	\pgfsetarrowsend{}

	
	\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}{\textbf{A}}{}{}
}

%% Ohmmeter – contributed by Ralf Farkas

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/ohmmeter/height}}{ohmmeter}{\ctikzvalof{bipoles/ohmmeter/height}}{\ctikzvalof{bipoles/ohmmeter/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}

	\pgfsetarrowsend{latex}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	\pgfsetarrowsend{}

	
	\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}{\boldmath$\Omega$}{}{}
}

%% Voltmeter

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/voltmeter/height}}{voltmeter}{\ctikzvalof{bipoles/voltmeter/height}}{\ctikzvalof{bipoles/voltmeter/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}

	\pgfsetarrowsend{latex}
	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
	\pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
	\pgfusepath{draw}
	\pgfsetarrowsend{}

	
	\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}{\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 cute inductor

\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vcuteinductor/height}}{vcuteinductor}{\ctikzvalof{bipoles/vcuteinductor/height}}{\ctikzvalof{bipoles/vcuteinductor/width}}{
	\pgf@circ@res@step=\ctikzvalof{bipoles/vcuteinductor/width}\pgf@circ@Rlen
	\divide \pgf@circ@res@step by \ctikzvalof{bipoles/vcuteinductor/coils} %divide by number of coils
	\divide \pgf@circ@res@step by 2 %div by two for arcs

	\def\pgf@circ@coilsmall@width{\ctikzvalof{bipoles/vcuteinductor/coil aspect}\pgf@circ@res@step}
	
	\advance \pgf@circ@res@step by \pgf@circ@coilsmall@width %adjust for overlapping lower arc

	\def\pgf@circ@coilwide@width{\pgf@circ@res@step}	
		
	\pgf@circ@res@other = \ctikzvalof{bipoles/vcuteinductor/coil height}\pgf@circ@Rlen
	\pgf@circ@res@temp =\ctikzvalof{bipoles/vcuteinductor/lower coil height}\pgf@circ@Rlen

	\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+0.5\pgfstartlinewidth}{-0.5\pgfstartlinewidth}}
	\foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
	{
		\pgfpatharc{180}{0}{\pgf@circ@coilwide@width and 	\pgf@circ@res@other}
		\pgfpatharc{0}{-180}{\pgf@circ@coilsmall@width and  \pgf@circ@res@temp}
	}
	\pgfpatharc{180}{0}{\pgf@circ@coilwide@width and  \pgf@circ@res@other}
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\pgfusepath{stroke}	
	
\pgfscope
		\pgfsetarrowsend{latex'}
		\pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{1.5\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{2.5\pgf@circ@res@up}}
		\pgfusepath{draw}
	\endpgfscope
}


%% 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
	\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}{-0.5\pgfstartlinewidth}}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpatharc{180}{0}{\pgf@circ@res@step and  \pgf@circ@res@other}
	\pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
	\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
	\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
}




%% 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}
}

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


%% Easily usable styles

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

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


%% The output routine

\def\drawpoles{
	\pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \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] {} }
		\fi
	\fi
	\pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} \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] {} }
		\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/length}
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/height}\pgf@y
		\pgf@y=.5\pgf@y
		\pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/bipoles/buffer/width}\pgf@x
		\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/bipoles/length}
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@y
		\pgf@y=.5\pgf@y
		\pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@x
		\pgf@x=.5\pgf@x
	  }
	  \anchor{south}{
		\northwest
		\pgf@y=-\pgf@y
	  }
	  \savedanchor\left{%
	  	\pgf@y=0pt
	  }
	  \savedanchor\inOne{%
		\pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@y
		\pgf@y=.5\pgf@y
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/input height}\pgf@y
		\pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@x
		\pgf@x=.5\pgf@x
	  }	  
	  \anchor{-}{
		\inOne
	  }
	  \anchor{+}{
		\inOne
		\pgf@y=-\pgf@y
	  }
	  \savedanchor\up{%
		\pgf@y= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@y=\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/height}\pgf@y
		\pgf@y=.5\pgf@y
		\pgf@x= \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
		\pgf@x=-\pgfkeysvalueof{/tikz/circuitikz/tripoles/plain amp/width}\pgf@x
		\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 

		% 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 
		
		% 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
		
		% 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
		\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}
}

%% 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 

		% 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
		\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 

		% 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
		\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 

		% 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					
		\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 

		% 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					
		\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
		
		% 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
		
		% 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@box
			\ctikzvalof{bipoles/twoport/width}
		%\else
		%	\ctikzvalof{bipoles/amp/width}
		%\fi
	}{amp}{
		%\ifpgf@circuit@box
			\ctikzvalof{bipoles/twoport/width}
		%\else
		%	\ctikzvalof{bipoles/amp/width}
	%	\fi
	}{
	%	\ifpgf@circuit@box
			\ctikzvalof{bipoles/twoport/width}
	%	\else
	%		\ctikzvalof{bipoles/amp/width}
	%	\fi
	}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@Rlen


		% draw outer box
		%\ifpgf@circuit@box
		%	\pgfnode{box}{center}{}{pgf@box}{\pgfusepath{draw}}
		%\fi
		% draw outer box
		% 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}
		
		% 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
		
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0.75\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.63\pgf@circ@res@right}{0}}
		\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.75\pgf@circ@res@down}}
		\pgfpathclose
		\pgfusepath{draw}
}


%% variable amplifier
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vamp/width}}{vamp}{\ctikzvalof{bipoles/vamp/width}}{\ctikzvalof{bipoles/vamp/width}}{
		\pgf@circ@res@step = \ctikzvalof{bipoles/vamp/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 

		% 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
		
		\pgfsetdash{}{0pt}	% always draw solid line for inner symbol
		\pgfsetlinewidth{\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0.75\pgf@circ@res@up}}
		\pgfpathlineto{\pgfpoint{0.63\pgf@circ@res@right}{0}}
		\pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.75\pgf@circ@res@down}}
		\pgfpathclose
		\pgfusepath{draw}
		
		\pgfsetarrowsend{latex}
		\pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
		\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.7\pgf@circ@res@up}}
		\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 

		% 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
		\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 

		% 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
		\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 

		% 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
		\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 

		% 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
		\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 

		% 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 

		% 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 

		% 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
		\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}
}






\endinput
