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

MirroredCoil Incorrectly creating two coils at Z instead of one at Z and -Z #108

Open
RoyZhenLongLim opened this issue Apr 1, 2024 · 0 comments

Comments

@RoyZhenLongLim
Copy link

The current code for Mirrored Coil in machine.py is wrong.
It creates two coils at Z (instead of one coil at +- Z)
The code below fixes the issue (made coil L be at -Z instead of Z)

def MirroredCoil(
    R, Z, current=0.0, turns=1, control=True, area=AreaCurrentLimit(), symmetric=True
):
    """
    Create a pair of coils, at +/- Z
    If symmetric = True then current is in the same direction (in series);
    if symmetric = False then current is in the opposite direction
    """
    return Circuit(
        [
            (
                "U",
                Coil(R, Z, current=current, turns=turns, control=control, area=area),
                1.0,
            ),
            (
                "L",
                Coil(R, -Z, current=current, turns=turns, control=control, area=area),
                1.0 if symmetric else -1.0,
            ),
        ]
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant