Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Component] Magnetic circuits #740

Open
mxxmxn opened this issue Sep 12, 2023 · 4 comments
Open

[New Component] Magnetic circuits #740

mxxmxn opened this issue Sep 12, 2023 · 4 comments

Comments

@mxxmxn
Copy link
Contributor

mxxmxn commented Sep 12, 2023

Magnetic circuits are widely used in the teaching of basic electrical engineering.

Basically, these circuits are similar to electrical circuits. They consist mainly of coils wound around a high permeability core and resistors represented by air gaps or interposed materials.

A simple example:

\begin{tikzpicture}
  \draw[double=lightgray, double distance=1cm,line cap=rect]
  (3,0)-- ++(0,-.9) -- ++(-3,0) -- ++(0,3) -- ++(3,0) -- ++(0,-.9);
  \pgfpathcurvebetweentime{0}{1}
      {\pgfpoint{-1cm}{1.03cm}}
      {\pgfpoint{-.5cm}{1.03cm}}
      {\pgfpoint{-.51cm}{1.03cm}}
      {\pgfpoint{0cm}{1cm}}
  \pgfpathcurvebetweentime{.5}{.89}
      {\pgfpoint{0cm}{1.1cm}}
      {\pgfpoint{-2.2cm}{1.05cm}}
      {\pgfpoint{2.2cm}{.95cm}}
      {\pgfpoint{0cm}{.9cm}}
  \pgfpathcurvebetweentime{.11}{.89}
      {\pgfpoint{0cm}{.9cm}}
      {\pgfpoint{-2.2cm}{.85cm}}
      {\pgfpoint{2.2cm}{.75cm}}
      {\pgfpoint{0cm}{.7cm}}
  \pgfpathcurvebetweentime{.11}{.89}
      {\pgfpoint{0cm}{.7cm}}
      {\pgfpoint{-2.2cm}{.65cm}}
      {\pgfpoint{2.2cm}{.55cm}}
      {\pgfpoint{0cm}{.5cm}}
  \pgfpathcurvebetweentime{.5}{1}
      {\pgfpoint{0cm}{.5cm}}
      {\pgfpoint{-.5cm}{.47cm}}
      {\pgfpoint{-.51cm}{.47cm}}
      {\pgfpoint{-1cm}{.47cm}}
  \pgfusepath{stroke}
\end{tikzpicture}

Is the implementation of these magnetic circuits desired?
If so, how could this be implemented?

@Rmano
Copy link
Collaborator

Rmano commented Sep 12, 2023

Yes, I kind of remember those. My feeling is that what you drawn is more a physical diagram than a circuit, and so probably plain TikZ and pics are better suited to draw it. If I am not wrong, the following step was to draw an equivalent electrical circuit, for which I think there are all the necessary components already.

But, as in the case of #683, I am not opposed to add them, especially as an additional loadable module, if someone contribute it. Although using the to for the solid part of the circuit would need a different to-path routine, which is not trivial.

@mxxmxn
Copy link
Contributor Author

mxxmxn commented Sep 19, 2023

Since these are components like any other circuit, I think the syntax could be used very well for this. Especially since drawing these magnetic circuits can sometimes be difficult.
In general, I just wanted to know if this is something that would fit circuitikz. It will probably take a long time to implement, if I can do it at all.
Can you possibly give me an example of a loadable module in circuitikz?

@Rmano
Copy link
Collaborator

Rmano commented Sep 19, 2023

There is (still) no interface for a loadable module... 😳 I'd like to add it, but I never found time.

For now, you can just think of a simple input-able file (so, with all the definitions together) supposing it is read after the package is loaded.

@Rmano
Copy link
Collaborator

Rmano commented Sep 19, 2023

Additional comment: where I see the main problem is managing the "connection" between sides of the magnetic circuit.

When implementing a to-path routine, you have no look-ahead to the circuit. The to-path routine of circuitikz simply draws two line segments with the current width with the component in the middle, rotated by the correct quantity in order to be aligned. The poles (-o, etc.) are specified in the parameters because they do not depend on the rest of the circuit. If you specify them twice, in two adjacent branches, they simply overwrite each other, so the most recent "wins".

Here you have to manage the end-of-to behavior, which is different if the branch continues in the same direction, or does a 90-degree "curve", or even splits into two... I don't say it's not doable, but the interface must be well thought-out (it's interesting anyway, a pity I have very little time now, at least till December I am quite class-swamped).

@Rmano Rmano changed the title Magnetic circuits [New Component] Magnetic circuits Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants