upb-lea / FEM_Magnetics_Toolbox

An Open-Source FEM Magnetics Toolbox for Power Electronic Magnetic Components
https://upb-lea.github.io/FEM_Magnetics_Toolbox/
GNU General Public License v3.0
66 stars 11 forks source link

Color missmatch in integrated transformer with interleaving #31

Closed gituser789 closed 1 year ago

gituser789 commented 1 year ago

Describe the bug Color missmatch of primary and secondary winding color in interleaving in case of more than one layer of same turn

To Reproduce Steps to reproduce the behavior:

import femmt as fmt
import os

example_results_folder = '/home/user/xxxxxx/'

working_directory = os.path.join(example_results_folder, "integrated-transformer")
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)

core_database = fmt.core_database()
core = core_database["PQ 40/40"]

# 2. set core parameters
core = fmt.Core(window_h=core["window_h"], window_w=core["window_w"], core_inner_diameter=core["core_inner_diameter"],
                mu_rel=3000, phi_mu_deg=12,
                sigma=0.6)
geo.set_core(core)

# 2.1 set stray path parameters
stray_path = fmt.StrayPath(start_index=0, length=geo.core.core_inner_diameter / 2 + geo.core.window_w - 0.001)
geo.set_stray_path(stray_path)

# 3. set air gap parameters
air_gaps = fmt.AirGaps(fmt.AirGapMethod.Percent, core)
air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.001, 25)
air_gaps.add_air_gap(fmt.AirGapLegPosition.CenterLeg, 0.001, 30)
geo.set_air_gaps(air_gaps)

# 4. set insulations
insulation = fmt.Insulation()
insulation.add_core_insulations(0.001, 0.001, 0.001, 0.001)
insulation.add_winding_insulations([0.0002, 0.0002], 0.0001)
geo.set_insulation(insulation)

# 5. create winding window and virtual winding windows (vww)
# For an integrated transformer it is not necessary to set horizontal and vertical split factors
# since this is determined by the stray_path
winding_window = fmt.WindingWindow(core, insulation, stray_path, air_gaps)
top, bot = winding_window.split_window(fmt.WindingWindowSplit.HorizontalSplit)

litz_database = fmt.litz_database()
litz_prim = litz_database["1.4x200x0.071"]
litz_sec = litz_database["2.0x800x0.05"]

# 6. set conductor parameters
winding1 = fmt.Conductor(0, fmt.Conductivity.Copper)
winding1.set_litz_round_conductor(litz_prim["conductor_radii"], litz_prim["strands_numbers"], litz_prim["strand_radii"], None, fmt.ConductorArrangement.Square)

winding2 = fmt.Conductor(1, fmt.Conductivity.Copper)
winding2.set_litz_round_conductor(litz_sec["conductor_radii"], litz_sec["strands_numbers"], litz_sec["strand_radii"], None, fmt.ConductorArrangement.Square)

# 7. add conductor to vww and add winding window to MagneticComponent
top.set_interleaved_winding(winding1, 28, winding2, 7, fmt.InterleavedWindingScheme.HorizontalAlternating, 0.0005)
bot.set_interleaved_winding(winding1, 0, winding2, 6, fmt.InterleavedWindingScheme.HorizontalAlternating, 0.0005)
geo.set_winding_window(winding_window)

# 8. start simulation with given frequency, currents and phases
geo.create_model(freq=250000, visualize_before=True)
geo.single_simulation(freq=250000, current=[8.0, 4.0], phi_deg=[0, 180])

Expected behavior primary winding is always orange, secondary winding is always brown

Screenshots image

Desktop (please complete the following information): current develop version