Skip to content

[New Component] Saturation Block #758

@Tipounk

Description

@Tipounk

Hello everyone,

I'm using circuit tikz to draw block diagrams (for electric systems control).
I wanted to define a new component myself which would be a saturation block :
image

It's widely used in power electronics to model the boundaries of a signal (for instance a maximum output current that the converter cannot exceed). It is used in simulation softwares like Simulink : https://fr.mathworks.com/help/simulink/slref/saturation.html

It is my first time defining a new component for Circuitikz so here what i've managed to do :

\makeatletter
 

  \ctikzset{bipoles/saturation/width/.initial=.7}
\def\pgfcirc@twoport@draw@satdraw{
    \pgfscope
        \pgfsetlinewidth{1.2\pgfstartlinewidth}
		\pgfpathmoveto{\pgfpointorigin}
		\pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{.4\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
		
		\pgfpathmoveto{\pgfpointorigin}
		\pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
		\pgfpathlineto{\pgfpoint{-0.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
        \pgfusepath{draw}
    \endpgfscope
}
%% saturation
\pgfcirc@define@twoports{blocks}
{}
{\ctikzvalof{bipoles/saturation/width}}
{saturation}
{\ctikzvalof{bipoles/saturation/width}}
{\ctikzvalof{bipoles/saturation/width}}
{
    \pgfcirc@twoport@draw@satdraw{0}
    %\pgftext[x=0.45\pgf@circ@res@left]{\ctikzvalof{bipoles/twoport/text}}
}
\pgfcirc@activate@bipole@simple{l}{saturation}
 
 \makeatother

I just wanted to add the possibility to put value or variable name for the upper and lower boundaries of the saturation like that :
image

I thought of adding new anchors but I don't know how to do that.

Also, if you're ok with that, can you tell me how I could add this new block, once finished to the new circuitikz release ?

Thank's for your help ;).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions