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

drawing the insulation for integrated transformer with stray path #139

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Abujazar
Copy link
Contributor

@Abujazar Abujazar commented Oct 10, 2024

The test file should be adapted for two files, in test_transformer_integrated_core_fixed_loss_angle and test_transformer_stacked_center_tapped. This is because the insulation will appear as
'dictionary_item_removed': [root['simulation_settings']['insulation']['top_section_core_insulations'], root['simulation_settings']['insulation']['bottom_section_core_insulations']], instead of ['insulation']['core_insulations']],

In addition, these is a difference in the digit in test_inductor_core_material_database, which I can solve it yet. The fixture is shown on the left.
material_problem

@gituser789
Copy link
Contributor

Found bug with overlapping insulation and conductors.
image

import femmt as fmt
import os


def basic_example_transformer_stacked(onelab_folder: str = None, show_visual_outputs: bool = True,
                                      is_test: bool = False):
    """
    Run the example code for the stacked transformer.

    :param onelab_folder: onelab folder path
    :type onelab_folder: str
    :param show_visual_outputs: True to show visual outputs (simulation results)
    :type show_visual_outputs: bool
    :param is_test: True for pytest usage. Defaults to False.
    :type is_test: bool
    """
 
    example_results_folder = os.path.join(os.path.dirname(__file__), "example_results")
    if not os.path.exists(example_results_folder):
        os.mkdir(example_results_folder)

    working_directory = os.path.join(example_results_folder, os.path.splitext(os.path.basename(__file__))[0])
    if not os.path.exists(working_directory):
        os.mkdir(working_directory)

    # 1. chose simulation type
    geo = fmt.MagneticComponent(component_type=fmt.ComponentType.IntegratedTransformer,
                                working_directory=working_directory, verbosity=fmt.Verbosity.ToConsole, is_gui=is_test)

    # This line is for automated pytest running on GitHub only. Please ignore this line!
    if onelab_folder is not None:
        geo.file_data.onelab_folder_path = onelab_folder

    # 2. set core parameters
    core_dimensions = fmt.dtos.StackedCoreDimensions(core_inner_diameter=0.02, window_w=0.02, window_h_top=0.01,
                                                     window_h_bot=0.03)
    core = fmt.Core(core_type=fmt.CoreType.Stacked, core_dimensions=core_dimensions, mu_r_abs=3100, phi_mu_deg=12,
                    sigma=0.6,
                    permeability_datasource=fmt.MaterialDataSource.Custom,
                    permittivity_datasource=fmt.MaterialDataSource.Custom)
    geo.set_core(core)

    # 3. set air gap parameters
    air_gaps = fmt.AirGaps(fmt.AirGapMethod.Stacked, core)
    air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.002, stacked_position=fmt.StackedPosition.Top)
    air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.001, stacked_position=fmt.StackedPosition.Bot)
    geo.set_air_gaps(air_gaps)

    # 4. set insulations
    insulation = fmt.Insulation(flag_insulation=True)
    # insulation.add_core_insulations(0.001, 0.001, 0.001, 0.001)  # [bot, top, left, right]
    insulation.add_top_section_core_insulations(0.002, 0.002, 0.001, 0.001)
    insulation.add_bottom_section_core_insulations(0.002, 0.002, 0.001, 0.001)
    insulation.add_winding_insulations([[0.0001, 0.001],
                                        [0.001, 0.0002]])
    geo.set_insulation(insulation)

    winding_window_top, winding_window_bot = fmt.create_stacked_winding_windows(core, insulation)

    vww_top = winding_window_top.split_window(fmt.WindingWindowSplit.NoSplit)
    vww_bot = winding_window_bot.split_window(fmt.WindingWindowSplit.NoSplit)

    # 6. set conductor parameters
    winding1 = fmt.Conductor(0, fmt.Conductivity.Copper)
    winding1.set_litz_round_conductor(None, 100, 70e-6, 0.5, fmt.ConductorArrangement.Square)

    winding2 = fmt.Conductor(1, fmt.Conductivity.Copper)
    winding2.set_solid_round_conductor(1e-3, fmt.ConductorArrangement.Square)
    # winding2.set_litz_round_conductor(None, 120, 70e-6, 0.5, fmt.ConductorArrangement.Square)

    # 7. add conductor to vww and add winding window to MagneticComponent
    vww_top.set_interleaved_winding(winding1, 16, winding2, 0, fmt.InterleavedWindingScheme.HorizontalAlternating)
    vww_bot.set_interleaved_winding(winding1, 40, winding2, 20, fmt.InterleavedWindingScheme.HorizontalAlternating)

    geo.set_winding_windows([winding_window_top, winding_window_bot])

    # 8. start simulation with given frequency, currents and phases
    geo.create_model(freq=250000, pre_visualize_geometry=show_visual_outputs)
    geo.single_simulation(freq=250000, current=[2.0, 4.0], phi_deg=[0, 180],
                          show_fem_simulation_results=show_visual_outputs)


if __name__ == "__main__":
    basic_example_transformer_stacked(show_visual_outputs=True)

@gituser789
Copy link
Contributor

image
Also happens with the outer insulation

    insulation.add_top_section_core_insulations(0.0005, 0.0005, 0.001, 0.002)
    insulation.add_bottom_section_core_insulations(0.0005, 0.0005, 0.001, 0.003)

@gituser789
Copy link
Contributor

image
And with the inner insulation too

    insulation.add_top_section_core_insulations(0.0005, 0.0005, 0.0001, 0.003)
    insulation.add_bottom_section_core_insulations(0.0005, 0.0005, 0.001, 0.003)

@Abujazar
Copy link
Contributor Author

Abujazar commented Jan 2, 2025

Not all the cases of split window when we have stray path are clear. We may discuss this later

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

Successfully merging this pull request may close these issues.

2 participants