diff --git a/_unittest/example_models/choke_json_file/choke_1winding_1Layer.json b/_unittest/example_models/choke_json_file/choke_1winding_1Layer.json index 22dd93bdc73..8094f7e28da 100644 --- a/_unittest/example_models/choke_json_file/choke_1winding_1Layer.json +++ b/_unittest/example_models/choke_json_file/choke_1winding_1Layer.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_1winding_1Layer_Corrected.json b/_unittest/example_models/choke_json_file/choke_1winding_1Layer_Corrected.json index d7b9d275443..a9bafc98403 100644 --- a/_unittest/example_models/choke_json_file/choke_1winding_1Layer_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_1winding_1Layer_Corrected.json @@ -1 +1 @@ -{"Mid Winding": {"Turns": 111, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.961666666666659}, "Layer": {"Double": false, "Simple": true, "Triple": false}, "Number of Windings": {"4": false, "1": true, "3": false, "2": false}, "Similar Layer": {"Different": false, "Similar": true}, "Inner Winding": {"Turns": 111, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.961666666666659}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Circle": true, "Octagon": false, "Hexagon": false}, "Outer Winding": {"Turns": 111, "Wire Diameter": 1, "Name": "Winding", "Outer Radius": 50.55, "Inner Radius": 19.45, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.961666666666659, "Height": 21.1}, "Layer Type": {"Separate": true, "Linked": false}, "Core": {"Name": "Core", "Outer Radius": 50, "Inner Radius": 20, "Chamfer": 0.80000000000000004, "Height": 20}} \ No newline at end of file +{"Number of Windings": {"1": true, "2": false, "3": false, "4": false}, "Layer": {"Simple": true, "Double": false, "Triple": false}, "Layer Type": {"Separate": true, "Linked": false}, "Similar Layer": {"Similar": true, "Different": false}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Hexagon": false, "Octagon": false, "Circle": true}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 19.45, "Outer Radius": 50.55, "Height": 21.1, "Wire Diameter": 1, "Turns": 111, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.96166666666666}, "Mid Winding": {"Turns": 111, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.96166666666666}, "Inner Winding": {"Turns": 111, "Coil Pit(deg)": 1.621, "Occupation(%)": 99.96166666666666}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked.json b/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked.json index 4be4ecff2d3..06d0a367968 100644 --- a/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked.json +++ b/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked_Corrected.json b/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked_Corrected.json index 9c0d834e4b2..951826aeba0 100644 --- a/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_1winding_3Layer_Linked_Corrected.json @@ -1 +1 @@ -{"Mid Winding": {"Turns": 104, "Coil Pit(deg)": 1.731, "Occupation(%)": 100.01333333333334}, "Layer": {"Double": false, "Simple": false, "Triple": true}, "Number of Windings": {"4": false, "1": true, "3": false, "2": false}, "Similar Layer": {"Different": true, "Similar": false}, "Inner Winding": {"Turns": 111, "Coil Pit(deg)": 1.622, "Occupation(%)": 100.02333333333334}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Circle": true, "Octagon": false, "Hexagon": false}, "Outer Winding": {"Turns": 98, "Wire Diameter": 1, "Name": "Winding", "Outer Radius": 52.75, "Inner Radius": 17.25, "Coil Pit(deg)": 1.836, "Occupation(%)": 99.96, "Height": 25.5}, "Layer Type": {"Separate": false, "Linked": true}, "Core": {"Name": "Core", "Outer Radius": 50, "Inner Radius": 20, "Chamfer": 0.80000000000000004, "Height": 20}} \ No newline at end of file +{"Number of Windings": {"1": true, "2": false, "3": false, "4": false}, "Layer": {"Simple": false, "Double": false, "Triple": true}, "Layer Type": {"Separate": false, "Linked": true}, "Similar Layer": {"Similar": false, "Different": true}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Hexagon": false, "Octagon": false, "Circle": true}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 17.25, "Outer Radius": 52.75, "Height": 25.5, "Wire Diameter": 1, "Turns": 98, "Coil Pit(deg)": 1.836, "Occupation(%)": 99.96}, "Mid Winding": {"Turns": 104, "Coil Pit(deg)": 1.731, "Occupation(%)": 100.01333333333334}, "Inner Winding": {"Turns": 111, "Coil Pit(deg)": 1.622, "Occupation(%)": 100.02333333333334}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common.json b/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common.json index 80621d5ecd6..4df257b3513 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common_Corrected.json b/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common_Corrected.json index 98bdb8d5b96..916e838bf80 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_1Layer_Common_Corrected.json @@ -1 +1 @@ -{"Mid Winding": {"Turns": 10, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113}, "Layer": {"Double": false, "Simple": true, "Triple": false}, "Number of Windings": {"4": false, "1": false, "3": false, "2": true}, "Similar Layer": {"Different": false, "Similar": true}, "Inner Winding": {"Turns": 10, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113}, "Mode": {"Differential": false, "Common": true}, "Wire Section": {"None": false, "Circle": false, "Octagon": true, "Hexagon": false}, "Outer Winding": {"Turns": 10, "Wire Diameter": 1, "Name": "Winding", "Outer Radius": 50.55, "Inner Radius": 19.45, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113, "Height": 21.1}, "Layer Type": {"Separate": true, "Linked": false}, "Core": {"Name": "Core", "Outer Radius": 50, "Inner Radius": 20, "Chamfer": 0.80000000000000004, "Height": 20}} \ No newline at end of file +{"Number of Windings": {"1": false, "2": true, "3": false, "4": false}, "Layer": {"Simple": true, "Double": false, "Triple": false}, "Layer Type": {"Separate": true, "Linked": false}, "Similar Layer": {"Similar": true, "Different": false}, "Mode": {"Differential": false, "Common": true}, "Wire Section": {"None": false, "Hexagon": false, "Octagon": true, "Circle": false}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 19.45, "Outer Radius": 50.55, "Height": 21.1, "Wire Diameter": 1, "Turns": 10, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113}, "Mid Winding": {"Turns": 10, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113}, "Inner Winding": {"Turns": 10, "Coil Pit(deg)": 1.621, "Occupation(%)": 18.011111111111113}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common.json b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common.json index eb813d881b9..d0565e1e98c 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common_Corrected.json b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common_Corrected.json index 4ec84e4d998..402ec6e5dbc 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Common_Corrected.json @@ -1 +1 @@ -{"Mid Winding": {"Turns": 25, "Coil Pit(deg)": 1.7998, "Occupation(%)": 99.9888888888889}, "Layer": {"Double": true, "Simple": false, "Triple": false}, "Number of Windings": {"4": true, "1": false, "3": false, "2": false}, "Similar Layer": {"Different": true, "Similar": false}, "Inner Winding": {"Turns": 20, "Coil Pit(deg)": 3.8227, "Occupation(%)": 84.948888888888888}, "Mode": {"Differential": false, "Common": true}, "Wire Section": {"None": false, "Circle": true, "Octagon": false, "Hexagon": false}, "Outer Winding": {"Turns": 25, "Wire Diameter": 1, "Name": "Winding", "Outer Radius": 51.65, "Inner Radius": 18.35, "Coil Pit(deg)": 1.718, "Occupation(%)": 95.444444444444443, "Height": 23.3}, "Layer Type": {"Separate": true, "Linked": false}, "Core": {"Name": "Core", "Outer Radius": 50, "Inner Radius": 20, "Chamfer": 0.80000000000000004, "Height": 20}} \ No newline at end of file +{"Number of Windings": {"1": false, "2": true, "3": false, "4": false}, "Layer": {"Simple": false, "Double": true, "Triple": false}, "Layer Type": {"Separate": true, "Linked": false}, "Similar Layer": {"Similar": true, "Different": false}, "Mode": {"Differential": false, "Common": true}, "Wire Section": {"None": false, "Hexagon": true, "Octagon": false, "Circle": false}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 18.35, "Outer Radius": 51.65, "Height": 23.3, "Wire Diameter": 1, "Turns": 25, "Coil Pit(deg)": 1.718, "Occupation(%)": 47.72222222222222}, "Mid Winding": {"Turns": 25, "Coil Pit(deg)": 1.718, "Occupation(%)": 47.72222222222222}, "Inner Winding": {"Turns": 25, "Coil Pit(deg)": 1.718, "Occupation(%)": 47.72222222222222}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential.json b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential.json index e6b708002f7..0fa4163ee0d 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential_Corrected.json b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential_Corrected.json index 9275f110f25..ddac2db5d23 100644 --- a/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_2winding_2Layer_Linked_Differential_Corrected.json @@ -1 +1 @@ -{"Mid Winding": {"Turns": 14, "Coil Pit(deg)": 1.621, "Occupation(%)": 25.215555555555557}, "Layer": {"Double": true, "Simple": false, "Triple": false}, "Number of Windings": {"4": false, "1": false, "3": false, "2": true}, "Similar Layer": {"Different": true, "Similar": false}, "Inner Winding": {"Turns": 20, "Coil Pit(deg)": 0.10000000000000001, "Occupation(%)": 84.948888888888888}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Circle": false, "Octagon": false, "Hexagon": true}, "Outer Winding": {"Turns": 12, "Wire Diameter": 1, "Name": "Winding", "Outer Radius": 51.65, "Inner Radius": 18.35, "Coil Pit(deg)": 1.718, "Occupation(%)": 22.906666666666666, "Height": 23.3}, "Layer Type": {"Separate": false, "Linked": true}, "Core": {"Name": "Core", "Outer Radius": 50, "Inner Radius": 20, "Chamfer": 0.80000000000000004, "Height": 20}} \ No newline at end of file +{"Number of Windings": {"1": false, "2": true, "3": false, "4": false}, "Layer": {"Simple": false, "Double": true, "Triple": false}, "Layer Type": {"Separate": false, "Linked": true}, "Similar Layer": {"Similar": false, "Different": true}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Hexagon": true, "Octagon": false, "Circle": false}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 18.35, "Outer Radius": 51.65, "Height": 23.3, "Wire Diameter": 1, "Turns": 12, "Coil Pit(deg)": 1.718, "Occupation(%)": 22.906666666666666}, "Mid Winding": {"Turns": 14, "Coil Pit(deg)": 1.621, "Occupation(%)": 25.215555555555557}, "Inner Winding": {"Turns": 20, "Coil Pit(deg)": 0.1, "Occupation(%)": 84.94888888888889}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate.json b/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate.json index e82788ca1f6..40365242303 100644 --- a/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate.json +++ b/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate_Corrected.json b/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate_Corrected.json index 8a476933436..66989e21345 100644 --- a/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_3winding_3Layer_Separate_Corrected.json @@ -1 +1 @@ -{"Number of Windings": {"1": false, "2": false, "3": true, "4": false}, "Layer": {"Simple": false, "Double": false, "Triple": true}, "Layer Type": {"Separate": true, "Linked": false}, "Similar Layer": {"Similar": true, "Different": false}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": true, "Hexagon": false, "Octagon": false, "Circle": false}, "Core": {"Name": "Core", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Inner Radius": 17.25, "Outer Radius": 52.75, "Height": 25.5, "Wire Diameter": 1, "Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}, "Mid Winding": {"Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}, "Inner Winding": {"Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}} \ No newline at end of file +{"Number of Windings": {"1": false, "2": false, "3": true, "4": false}, "Layer": {"Simple": false, "Double": false, "Triple": true}, "Layer Type": {"Separate": true, "Linked": false}, "Similar Layer": {"Similar": true, "Different": false}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": true, "Hexagon": false, "Octagon": false, "Circle": false}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 17.25, "Outer Radius": 52.75, "Height": 25.5, "Wire Diameter": 1, "Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}, "Mid Winding": {"Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}, "Inner Winding": {"Turns": 15, "Coil Pit(deg)": 1.828, "Occupation(%)": 45.7}} \ No newline at end of file diff --git a/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked.json b/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked.json index 6280fd06877..7d1366b1948 100644 --- a/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked.json +++ b/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked.json @@ -30,6 +30,7 @@ }, "Core": { "Name": "Core", + "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, @@ -37,6 +38,7 @@ }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, diff --git a/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked_Corrected.json b/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked_Corrected.json index 26af042a352..7ff81e930b7 100644 --- a/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked_Corrected.json +++ b/_unittest/example_models/choke_json_file/choke_4winding_3Layer_Linked_Corrected.json @@ -1 +1 @@ -{"Number of Windings": {"1": false, "2": false, "3": false, "4": true}, "Layer": {"Simple": false, "Double": false, "Triple": true}, "Layer Type": {"Separate": false, "Linked": true}, "Similar Layer": {"Similar": false, "Different": true}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Hexagon": false, "Octagon": true, "Circle": false}, "Core": {"Name": "Core", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Inner Radius": 16.7, "Outer Radius": 53.3, "Height": 26.6, "Wire Diameter": 1.2, "Turns": 1, "Coil Pit(deg)": 2.265, "Occupation(%)": 5.033333333333333}, "Mid Winding": {"Turns": 3, "Coil Pit(deg)": 2.099, "Occupation(%)": 13.993333333333334}, "Inner Winding": {"Turns": 4, "Coil Pit(deg)": 1.956, "Occupation(%)": 17.386666666666667}} \ No newline at end of file +{"Number of Windings": {"1": false, "2": false, "3": false, "4": true}, "Layer": {"Simple": false, "Double": false, "Triple": true}, "Layer Type": {"Separate": false, "Linked": true}, "Similar Layer": {"Similar": false, "Different": true}, "Mode": {"Differential": true, "Common": false}, "Wire Section": {"None": false, "Hexagon": false, "Octagon": true, "Circle": false}, "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 20, "Outer Radius": 50, "Height": 20, "Chamfer": 0.8}, "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 16.7, "Outer Radius": 53.3, "Height": 26.6, "Wire Diameter": 1.2, "Turns": 1, "Coil Pit(deg)": 2.265, "Occupation(%)": 5.033333333333333}, "Mid Winding": {"Turns": 3, "Coil Pit(deg)": 2.099, "Occupation(%)": 13.993333333333334}, "Inner Winding": {"Turns": 4, "Coil Pit(deg)": 1.956, "Occupation(%)": 17.386666666666667}} \ No newline at end of file diff --git a/_unittest/test_05_Mesh.py b/_unittest/test_05_Mesh.py index f3fad408078..dacb4c2ef58 100644 --- a/_unittest/test_05_Mesh.py +++ b/_unittest/test_05_Mesh.py @@ -43,7 +43,16 @@ def test_assign_surface_mesh_manual(self): surface = self.aedtapp.mesh.assign_surface_mesh_manual(o.id, 1e-6, aspect_ratio=3, meshop_name="Surface_Manual") assert "Surface_Manual" in [i.name for i in self.aedtapp.mesh.meshoperations] assert surface.props["SurfDev"] == 1e-6 - assert surface.props["AspectRatioChoice"] + assert surface.props["AspectRatioChoice"] == 2 + + cylinder_zx = self.aedtapp.modeler.create_cylinder( + self.aedtapp.PLANE.ZX, udp, 3, coax_dimension, 0, "surface_manual" + ) + surface_default_value = self.aedtapp.mesh.assign_surface_mesh_manual(cylinder_zx.id) + assert "Surface_Manual" in [i.name for i in self.aedtapp.mesh.meshoperations] + assert surface_default_value.props["SurfDev"] == "0.0001mm" + assert surface_default_value.props["NormalDev"] == "1" + assert surface_default_value.props["AspectRatioChoice"] == 1 def test_assign_surface_priority(self): surface = self.aedtapp.mesh.assign_surf_priority_for_tau(["surface", "surface_manual"], 1) diff --git a/_unittest/test_08_Primitives3D.py b/_unittest/test_08_Primitives3D.py index b5a06a358a5..43a9d12f534 100644 --- a/_unittest/test_08_Primitives3D.py +++ b/_unittest/test_08_Primitives3D.py @@ -1092,7 +1092,7 @@ def test_72_check_choke_values(self): @pyaedt_unittest_check_desktop_error def test_73_make_winding(self): chamfer = self.aedtapp.modeler._make_winding_follow_chamfer(0.8, 1.1, 2, 1) - winding_list = self.aedtapp.modeler._make_winding("Winding", "", "", 29.9, 52.1, 22.2, 2, 5, 15, chamfer, True) + winding_list = self.aedtapp.modeler._make_winding("Winding", "copper", 29.9, 52.1, 22.2, 5, 15, chamfer, True) assert isinstance(winding_list, list) assert isinstance(winding_list[0], Object3d) assert isinstance(winding_list[1], list) @@ -1102,8 +1102,7 @@ def test_74_make_double_linked_winding(self): chamfer = self.aedtapp.modeler._make_winding_follow_chamfer(0.8, 1.1, 2, 1) winding_list = self.aedtapp.modeler._make_double_linked_winding( "Double_Winding", - "", - "", + "copper", 27.7, 54.3, 26.6, @@ -1125,8 +1124,7 @@ def test_75_make_triple_linked_winding(self): chamfer = self.aedtapp.modeler._make_winding_follow_chamfer(0.8, 1.1, 2, 1) winding_list = self.aedtapp.modeler._make_triple_linked_winding( "Triple_Winding", - "", - "", + "copper", 25.5, 56.5, 31.0, diff --git a/codecov.yml b/codecov.yml index 3afe2600d6e..086d2f9ec4b 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,3 +12,8 @@ coverage: if_not_found: success if_ci_failed: error if_no_uploads: error + ignore: + - "examples" # ignore folders and all its contents + - "_unittest_ironpython" # ignore folders and all its contents + - "pyaedt/third_party/**/*.py" # ignore folders and all its contents + diff --git a/examples/02-HFSS/HFSS_Choke.py b/examples/02-HFSS/HFSS_Choke.py new file mode 100644 index 00000000000..497c3c45cd4 --- /dev/null +++ b/examples/02-HFSS/HFSS_Choke.py @@ -0,0 +1,213 @@ +""" +Choke +-------------- +This example shows how you can use PyAEDT to create an choke setup in HFSS. +""" + +import json +import tempfile +import os + +from pyaedt import generate_unique_name +from pyaedt import Desktop +from pyaedt import Hfss +from pyaedt.modules.Mesh import Mesh + +tmpfold = tempfile.gettempdir() + +temp_folder = os.path.join(tmpfold, generate_unique_name("Example")) +if not os.path.exists(temp_folder): + os.mkdir(temp_folder) + +############################################################################### +# Launch AEDT in Graphical Mode +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# This examples launches AEDT 2021.2 in graphical mode. + + +desktop = Desktop("2021.2", non_graphical=False, new_desktop_session=True) + +############################################################################### +# Launch HFSS in Graphical Mode +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# This examples launches HFSS 2021.2 in graphical mode. + +hfss = Hfss(solution_type="Terminal") + +############################################################################### +# Rules and information of use +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The dictionary values is containing the different parameters of the core and the windings which composed +# the choke. The main structure of the dictionary must not be changed, i.e the dictionary has primary keys +# ("Number of Windings", "Layer", "Layer Type", etc...) which have dictionaries as values, these dictionaries +# keys are the secondary keys of the dictionary values ("1", "2", "3", "4", "Simple", etc...). +# Neither the primary nor the secondary keys must be modified, only their values. +# The value type must be unchanged. For the dictionary from "Number of Windings" to "Wire Section" included, +# values must be boolean. Only one value by dictionary must be "True". If all values are "True" only the first one +# will remain so. If all values are "False", the first value will be choose as the correct one by default". +# For the dictionary from "Core" to "Inner Winding" included, values must be string or float or int. +# "Number of Windings" is to choose the number of windings around the core. +# "Layer" is to choose the number of layers of all windings. +# "Layer Type" is to choose if the layers of a winding are linked to each other or not. +# "Similar Layer" is to choose if the layers of a winding have the number of turns and +# the same spacing between turns or not. +# "Mode" is only useful for 2 windings to choose if they are in common or differential mode. +# "Wire Section" is to choose the wire section type and number of segments. +# "Core" is to design the core. +# "Outer Winding" is to design the first layer or outer layer of a winding and +# select the common parameter for all layers. +# "Mid Winding" is to select the turns and the turns spacing ("Coil Pit") +# for the second or mid layer if it is necessary. +# "Inner Winding" is to select the turns and the turns spacing ("Coil Pit") +# for the third or inner layer if it is necessary. +# "Occupation(%)" is only an informative parameter, it is useless to modify it. +# If you have doubt you can let parameters like they are it will work. + +values = { + "Number of Windings": {"1": False, "2": True, "3": False, "4": False}, + "Layer": {"Simple": False, "Double": True, "Triple": False}, + "Layer Type": {"Separate": False, "Linked": True}, + "Similar Layer": {"Similar": False, "Different": True}, + "Mode": {"Differential": False, "Common": True}, + "Wire Section": {"None": False, "Hexagon": True, "Octagon": False, "Circle": False}, + "Core": { + "Name": "Core", + "Material": "ferrite", + "Inner Radius": 20, + "Outer Radius": 30, + "Height": 10, + "Chamfer": 0.8, + }, + "Outer Winding": { + "Name": "Winding", + "Material": "copper", + "Inner Radius": 20, + "Outer Radius": 30, + "Height": 10, + "Wire Diameter": 1.5, + "Turns": 20, + "Coil Pit(deg)": 0.1, + "Occupation(%)": 0, + }, + "Mid Winding": {"Turns": 25, "Coil Pit(deg)": 0.1, "Occupation(%)": 0}, + "Inner Winding": {"Turns": 4, "Coil Pit(deg)": 0.1, "Occupation(%)": 0}, +} + +############################################################################### +# Convert dictionary to json file +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The PyAEDT methods ask the path of the json file as argument, so you can convert this dictionary in json file +# thanks to the following command. + +json_path = os.path.join(hfss.working_directory, "choke_example.json") + +with open(json_path, "w") as outfile: + json.dump(values, outfile) + +############################################################################### +# Verify the parameter of the json file +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The first method "check_choke_values" will take the json file path in argument and: +# - Check if the json file is correctly written (as it is explained in the rules) +# - Check inequations on windings parameters to avoid to have unintended intersection + +dictionary_values = hfss.modeler.check_choke_values(json_path, create_another_file=False) +print(dictionary_values) + +############################################################################### +# Generate the choke +# ~~~~~~~~~~~~~~~~~~ +# This second method "create_choke" will take the json file path in argument and generate the choke. + +list_object = hfss.modeler.create_choke(json_path) +print(list_object) +core = list_object[1] +first_winding_list = list_object[2] +second_winding_list = list_object[3] + + +############################################################################### +# Create Ground +# ------------- + +ground_radius = 1.2 * dictionary_values[1]["Outer Winding"]["Outer Radius"] +ground_position = [0, 0, first_winding_list[1][0][2] - 2] +ground = hfss.modeler.create_circle("XY", ground_position, ground_radius, name="GND", matname="copper") +coat = hfss.assign_coating(ground, isinfgnd=True) + +############################################################################### +# Create Lumped Ports +# ------------------- + +port_position_list = [ + [first_winding_list[1][0][0], first_winding_list[1][0][1], first_winding_list[1][0][2] - 1], + [first_winding_list[1][-1][0], first_winding_list[1][-1][1], first_winding_list[1][-1][2] - 1], + [second_winding_list[1][0][0], second_winding_list[1][0][1], second_winding_list[1][0][2] - 1], + [second_winding_list[1][-1][0], second_winding_list[1][-1][1], second_winding_list[1][-1][2] - 1], +] +port_dimension_list = [2, dictionary_values[1]["Outer Winding"]["Wire Diameter"]] +for position in port_position_list: + sheet = hfss.modeler.create_rectangle("XZ", position, port_dimension_list, name="sheet_port") + sheet.move([-dictionary_values[1]["Outer Winding"]["Wire Diameter"] / 2, 0, -1]) + hfss.create_lumped_port_to_sheet( + sheet.name, portname="port_" + str(port_position_list.index(position) + 1), reference_object_list=[ground] + ) + +############################################################################### +# Create Mesh Operation +# --------------------- + +cylinder_height = 2.5 * dictionary_values[1]["Outer Winding"]["Height"] +cylinder_position = [0, 0, first_winding_list[1][0][2] - 4] +mesh_operation_cylinder = hfss.modeler.create_cylinder( + "XY", cylinder_position, ground_radius, cylinder_height, numSides=36, name="mesh_cylinder" +) +mesh = Mesh(hfss) +mesh.assign_length_mesh([mesh_operation_cylinder], maxlength=15, maxel=None, meshop_name="choke_mesh") + + +############################################################################### +# Create Boundaries +# ----------------- +# A region with openings is needed to run the analysis. + +region = hfss.modeler.create_region(pad_percent=1000) + + +############################################################################### +# Create the Setup +# ---------------- +# A setup with a sweep will be used to run the simulation. Depending on your computing machine, +# simulation can take time. + +setup = hfss.create_setup("MySetup") +setup.props["Frequency"] = "50MHz" +setup.props["MaximumPasses"] = 10 +hfss.create_linear_count_sweep( + setupname=setup.name, + unit="MHz", + freqstart=0.1, + freqstop=100, + num_of_freq_points=100, + sweepname="sweep1", + sweep_type="Interpolating", + save_fields=False, +) + +############################################################################### +# Save the project +# ---------------- + +hfss.save_project(os.path.join(temp_folder, "My_HFSS_Choke.aedt")) + + +############################################################################### +# Close AEDT +# ~~~~~~~~~~ +# After the simulaton is completed, you can close AEDT or release it using the +# :func:`pyaedt.Desktop.release_desktop` method. +# All methods provide for saving the project before exiting. + + +if os.name != "posix": + desktop.release_desktop() diff --git a/examples/02-Maxwell/Maxwell3D_Choke.py b/examples/02-Maxwell/Maxwell3D_Choke.py new file mode 100644 index 00000000000..22cfc21e506 --- /dev/null +++ b/examples/02-Maxwell/Maxwell3D_Choke.py @@ -0,0 +1,205 @@ +""" +Choke +-------------- +This example shows how you can use PyAEDT to create an choke setup in Maxwell3D. +""" + +import json +import tempfile +import os + +from pyaedt import generate_unique_name +from pyaedt import Desktop +from pyaedt import Maxwell3d +from pyaedt.modules.Mesh import Mesh + +tmpfold = tempfile.gettempdir() + +temp_folder = os.path.join(tmpfold, generate_unique_name("Example")) +if not os.path.exists(temp_folder): + os.mkdir(temp_folder) + +############################################################################### +# Launch AEDT in Graphical Mode +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# This examples launches AEDT 2021.2 in graphical mode. + + +desktop = Desktop("2021.2", non_graphical=False, new_desktop_session=True) + +############################################################################### +# Launch HFSS in Graphical Mode +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# This examples launches HFSS 2021.2 in graphical mode. + +m3d = Maxwell3d(solution_type="EddyCurrent") + +############################################################################### +# Rules and information of use +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The dictionary values is containing the different parameters of the core and the windings which composed +# the choke. The main structure of the dictionary must not be changed, i.e the dictionary has primary keys +# ("Number of Windings", "Layer", "Layer Type", etc...) which have dictionaries as values, these dictionaries +# keys are the secondary keys of the dictionary values ("1", "2", "3", "4", "Simple", etc...). +# Neither the primary nor the secondary keys must be modified, only their values. +# The value type must be unchanged. For the dictionary from "Number of Windings" to "Wire Section" included, +# values must be boolean. Only one value by dictionary must be "True". If all values are "True" only the first one +# will remain so. If all values are "False", the first value will be choose as the correct one by default". +# For the dictionary from "Core" to "Inner Winding" included, values must be string or float or int. +# "Number of Windings" is to choose the number of windings around the core. +# "Layer" is to choose the number of layers of all windings. +# "Layer Type" is to choose if the layers of a winding are linked to each other or not. +# "Similar Layer" is to choose if the layers of a winding have the number of turns and +# the same spacing between turns or not. +# "Mode" is only useful for 2 windings to choose if they are in common or differential mode. +# "Wire Section" is to choose the wire section type and number of segments. +# "Core" is to design the core. +# "Outer Winding" is to design the first layer or outer layer of a winding and +# select the common parameter for all layers. +# "Mid Winding" is to select the turns and the turns spacing ("Coil Pit") +# for the second or mid layer if it is necessary. +# "Inner Winding" is to select the turns and the turns spacing ("Coil Pit") +# for the third or inner layer if it is necessary. +# "Occupation(%)" is only an informative parameter, it is useless to modify it. +# If you have doubt you can let parameters like they are it will work. + +values = { + "Number of Windings": {"1": False, "2": False, "3": True, "4": False}, + "Layer": {"Simple": False, "Double": False, "Triple": True}, + "Layer Type": {"Separate": False, "Linked": True}, + "Similar Layer": {"Similar": False, "Different": True}, + "Mode": {"Differential": True, "Common": False}, + "Wire Section": {"None": False, "Hexagon": False, "Octagon": True, "Circle": False}, + "Core": { + "Name": "Core", + "Material": "ferrite", + "Inner Radius": 100, + "Outer Radius": 143, + "Height": 25, + "Chamfer": 0.8, + }, + "Outer Winding": { + "Name": "Winding", + "Material": "copper", + "Inner Radius": 100, + "Outer Radius": 143, + "Height": 25, + "Wire Diameter": 5, + "Turns": 2, + "Coil Pit(deg)": 4, + "Occupation(%)": 0, + }, + "Mid Winding": {"Turns": 7, "Coil Pit(deg)": 4, "Occupation(%)": 0}, + "Inner Winding": {"Turns": 10, "Coil Pit(deg)": 4, "Occupation(%)": 0}, +} + +############################################################################### +# Convert dictionary to json file +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The PyAEDT methods ask the path of the json file as argument, so you can convert this dictionary in json file +# thanks to the following command. + +json_path = os.path.join(m3d.working_directory, "choke_example.json") + +with open(json_path, "w") as outfile: + json.dump(values, outfile) + +############################################################################### +# Verify the parameter of the json file +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# The first method "check_choke_values" will take the json file path in argument and: +# - Check if the json file is correctly written (as it is explained in the rules) +# - Check inequations on windings parameters to avoid to have unintended intersection + +dictionary_values = m3d.modeler.check_choke_values(json_path, create_another_file=False) +print(dictionary_values) + +############################################################################### +# Generate the choke +# ~~~~~~~~~~~~~~~~~~ +# This second method "create_choke" will take the json file path in argument and generate the choke. + +list_object = m3d.modeler.create_choke(json_path) +print(list_object) +core = list_object[1] +first_winding_list = list_object[2] +second_winding_list = list_object[3] +third_winding_list = list_object[4] + +############################################################################### +# Assign Excitation +# ----------------- + +first_winding_faces = m3d.modeler.get_object_faces(first_winding_list[0].name) +second_winding_faces = m3d.modeler.get_object_faces(second_winding_list[0].name) +third_winding_faces = m3d.modeler.get_object_faces(third_winding_list[0].name) +m3d.assign_current([first_winding_faces[-1]], amplitude=1000, phase="0deg", swap_direction=False, name="phase_1_in") +m3d.assign_current([first_winding_faces[-2]], amplitude=1000, phase="0deg", swap_direction=True, name="phase_1_out") +m3d.assign_current([second_winding_faces[-1]], amplitude=1000, phase="120deg", swap_direction=False, name="phase_2_in") +m3d.assign_current([second_winding_faces[-2]], amplitude=1000, phase="120deg", swap_direction=True, name="phase_2_out") +m3d.assign_current([third_winding_faces[-1]], amplitude=1000, phase="240deg", swap_direction=False, name="phase_3_in") +m3d.assign_current([third_winding_faces[-2]], amplitude=1000, phase="240deg", swap_direction=True, name="phase_3_out") + +############################################################################### +# Assign Matrix +# ------------- + +m3d.assign_matrix(["phase_1_in", "phase_2_in", "phase_3_in"], matrix_name="current_matrix") + +############################################################################### +# Create Mesh Operation +# --------------------- + +mesh = Mesh(m3d) +mesh.assign_skin_depth( + [first_winding_list[0], second_winding_list[0], third_winding_list[0]], + 0.20, + triangulation_max_length="10mm", + meshop_name="skin_depth", +) +mesh.assign_surface_mesh_manual( + [first_winding_list[0], second_winding_list[0], third_winding_list[0]], + surf_dev=None, + normal_dev="30deg", + meshop_name="surface_approx", +) + +############################################################################### +# Create Boundaries +# ----------------- +# A region with openings is needed to run the analysis. + +region = m3d.modeler.create_air_region(x_pos=100, y_pos=100, z_pos=100, x_neg=100, y_neg=100, z_neg=0) + +############################################################################### +# Create the Setup +# ---------------- +# A setup with a sweep will be used to run the simulation. Depending on your computing machine, +# simulation can take time. + +setup = m3d.create_setup("MySetup") +print(setup.props) +setup.props["Frequency"] = "100kHz" +setup.props["PercentRefinement"] = 15 +setup.props["MaximumPasses"] = 10 +setup.props["HasSweepSetup"] = True +setup.add_eddy_current_sweep(range_type="LinearCount", start=100, end=1000, count=12, units="kHz", clear=True) + + +############################################################################### +# Save the project +# ---------------- + +m3d.save_project(os.path.join(temp_folder, "My_Maxwell3d_Choke.aedt")) + + +############################################################################### +# Close AEDT +# ~~~~~~~~~~ +# After the simulaton is completed, you can close AEDT or release it using the +# :func:`pyaedt.Desktop.release_desktop` method. +# All methods provide for saving the project before exiting. + + +if os.name != "posix": + desktop.release_desktop() diff --git a/examples/03-Circuit/EMIT_Example.py b/examples/03-Circuit/EMIT_Example.py index 5f238ff826c..6ec91f79cae 100644 --- a/examples/03-Circuit/EMIT_Example.py +++ b/examples/03-Circuit/EMIT_Example.py @@ -13,7 +13,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Change NonGraphical Boolean to False to open AEDT in graphical mode # With NewThread = False, an existing instance of AEDT will be used, if -# available. This example will use AEDT 2022R1 +# available. This example will use AEDT 2022R1. However this example is supposed to work +# on AEDT 2022R2 and on. + NonGraphical = False NewThread = False desktop_version = "2022.1" diff --git a/examples/03-Circuit/EMIT_HFSS_Example.py b/examples/03-Circuit/EMIT_HFSS_Example.py index 40bba7707bc..8147150ef6c 100644 --- a/examples/03-Circuit/EMIT_HFSS_Example.py +++ b/examples/03-Circuit/EMIT_HFSS_Example.py @@ -12,23 +12,22 @@ # Import required modules from pyaedt.generic.filesystem import Scratch -# Setup paths for module imports -from _unittest.conftest import scratch_path - from pyaedt import Emit from pyaedt import Desktop + ############################################################################### # Initialization Settings # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Change NonGraphical Boolean to False to open AEDT in graphical mode # With NewThread = False, an existing instance of AEDT will be used, if -# available. This example will use AEDT 2022.2 +# available. This example will use AEDT 2022.1 However this example is supposed to work +# on AEDT 2022R2 and on. NonGraphical = False NewThread = True -desktop_version = "2022.2" - +desktop_version = "2022.1" +scratch_path = tempfile.gettempdir() ############################################################################### # Launch AEDT and EMIT Design @@ -38,9 +37,8 @@ # to create a new instance of AEDT or try to connect to existing instance of # it. d = Desktop(desktop_version, NonGraphical, NewThread) -tmpfold = tempfile.gettempdir() -temp_folder = os.path.join(tmpfold, ("EmitHFSSExample")) +temp_folder = os.path.join(scratch_path, ("EmitHFSSExample")) if not os.path.exists(temp_folder): os.mkdir(temp_folder) @@ -60,7 +58,7 @@ Examples/EMIT directory under the EDT installation. You can not run this example. """ print(msg) - d.force_close_desktop() + d.release_desktop(True, True) exit() my_project = os.path.join(temp_folder, example_aedt) diff --git a/pyaedt/application/Analysis.py b/pyaedt/application/Analysis.py index d70f2a96440..70fb94050de 100644 --- a/pyaedt/application/Analysis.py +++ b/pyaedt/application/Analysis.py @@ -369,6 +369,8 @@ def existing_analysis_sweeps(self): setuptype = self.design_solutions.default_adaptive if setuptype: sweep_list.append(el + " : " + setuptype) + else: + sweep_list.append(el) try: sweeps = list(self.oanalysis.GetSweeps(el)) except: diff --git a/pyaedt/application/Analysis3D.py b/pyaedt/application/Analysis3D.py index 654c966dbfb..db29e34ef64 100644 --- a/pyaedt/application/Analysis3D.py +++ b/pyaedt/application/Analysis3D.py @@ -438,9 +438,9 @@ def export_3d_model(self, fileName, filePath, fileFormat=".step", object_list=No fileFormat : str, optional Format of the file. The default is ``".step"``. object_list : list, optional - List of objects to export. The default is ``[]``. + List of objects to export. The default is ``None``. removed_objects : list, optional - The default is ``[]``. + The default is ``None``. Returns ------- diff --git a/pyaedt/application/AnalysisNexxim.py b/pyaedt/application/AnalysisNexxim.py index 698a3b65221..41ac15b5768 100644 --- a/pyaedt/application/AnalysisNexxim.py +++ b/pyaedt/application/AnalysisNexxim.py @@ -181,7 +181,7 @@ def get_all_return_loss_list(self, excitation_names=None, excitation_name_prefix Parameters ---------- excitation_names : list, optional - List of excitations. The default is ``[]``, in which case + List of excitations. The default is ``None``, in which case the return losses for all excitations are to be provided. For example ``["1", "2"]``. excitation_name_prefix : string, optional diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 17cad609b9b..07e66009412 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -1149,7 +1149,10 @@ def export_profile(self, setup_name, variation_string="", file_path=None): """ if not file_path: file_path = os.path.join(self.working_directory, generate_unique_name("Profile") + ".prop") - self.odesign.ExportProfile(setup_name, variation_string, file_path) + try: + self.odesign.ExportProfile(setup_name, variation_string, file_path) + except: + self.odesign.ExportProfile(setup_name, variation_string, file_path, True) self.logger.info("Exported Profile to file {}".format(file_path)) return file_path diff --git a/pyaedt/application/MessageManager.py b/pyaedt/application/MessageManager.py index 8de8182c1e6..70828ea7e33 100644 --- a/pyaedt/application/MessageManager.py +++ b/pyaedt/application/MessageManager.py @@ -146,7 +146,10 @@ def _log_on_screen(self, val): def logger(self): """Aedt Logger object.""" if self._log_on_file: - return logging.getLogger(__name__) + try: + return logging.getLogger(__name__) + except: + return None else: return None # pragma: no cover diff --git a/pyaedt/application/design_solutions.py b/pyaedt/application/design_solutions.py index 2b53dcccf6f..fbf38142d3d 100644 --- a/pyaedt/application/design_solutions.py +++ b/pyaedt/application/design_solutions.py @@ -33,7 +33,7 @@ "options": "XY", "report_type": "EddyCurrent", "default_setup": 7, - "default_adaptive": "LastAdaptive", + "default_adaptive": None, }, "Transient": { "name": "Transient", @@ -47,7 +47,7 @@ "options": "XY", "report_type": "Electrostatic", "default_setup": 8, - "default_adaptive": "LastAdaptive", + "default_adaptive": None, }, "ElectricTransient": { "name": "ElectricTransient", @@ -61,7 +61,7 @@ "options": "XY", "report_type": None, "default_setup": 9, - "default_adaptive": "LastAdaptive", + "default_adaptive": None, }, }, "Maxwell 3D": { @@ -70,7 +70,7 @@ "options": None, "report_type": "Magnetostatic", "default_setup": 6, - "default_adaptive": "LastAdaptive", + "default_adaptive": None, }, "EddyCurrent": { "name": "EddyCurrent", @@ -91,7 +91,7 @@ "options": None, "report_type": "Electrostatic", "default_setup": 8, - "default_adaptive": "LastAdaptive", + "default_adaptive": None, }, "DCConduction": { "name": None, diff --git a/pyaedt/circuit.py b/pyaedt/circuit.py index 22c7eda0972..e9129208e8f 100644 --- a/pyaedt/circuit.py +++ b/pyaedt/circuit.py @@ -763,10 +763,10 @@ def export_touchstone(self, solutionname, sweepname, filename=None, variation=No which exports the file to the working directory. variation : list, optional List of all parameter variations. For example, ``["$AmbientTemp", "$PowerIn"]``. - The default is ``[]``. + The default is ``None``. variations_value : list, optional List of all parameter variation values. For example, ``["22cel", "100"]``. - The default is ``[]``. + The default is ``None``. Returns ------- diff --git a/pyaedt/common_rpc.py b/pyaedt/common_rpc.py index a9c0fb9ad5a..4b12ff583d5 100644 --- a/pyaedt/common_rpc.py +++ b/pyaedt/common_rpc.py @@ -195,7 +195,7 @@ def connect(server_name, aedt_client_port): return "Error. No connection. Check if AEDT is running and if the port number is correct." -def client(server_name, server_port=18000, beta_options=None): +def client(server_name, server_port=18000, beta_options=None, use_aedt_relative_path=False): """Starts an rpyc client and connects to a remote machine. Parameters @@ -206,7 +206,8 @@ def client(server_name, server_port=18000, beta_options=None): Port that the rpyc server is running on. beta_options : list, optional List of beta options to apply to the new service. The default is ``None``. - + use_aedt_relative_path : bool, optional + Whether to use aedt executable full path or relative path call. Needed in case linux environment is defined. Returns ------- rpyc object. @@ -253,7 +254,7 @@ def client(server_name, server_port=18000, beta_options=None): if not c: print("Failing to connect to {} on port {}. Check the settings".format(server_name, server_port)) return False - port = c.root.start_service(server_name, beta_options) + port = c.root.start_service(server_name, beta_options, use_aedt_relative_path=use_aedt_relative_path) if not port: return "Error connecting to the server. Check the server name and port and retry." print("Connecting to a new session of AEDT on port {}. Wait.".format(port)) @@ -363,7 +364,9 @@ def _download_dir(remotepath, localpath, server_name, server_port=18000): _download_file(rfn, lfn, server_name, server_port=18000) -def launch_ironpython_server(aedt_path, non_graphical=False, port=18000, launch_client=True): +def launch_ironpython_server( + aedt_path, non_graphical=False, port=18000, launch_client=True, use_aedt_relative_path=False +): """Start a process in IronPython and launch the rpc server on the specified port given an AEDT path on Linux. .. warning:: @@ -382,6 +385,9 @@ def launch_ironpython_server(aedt_path, non_graphical=False, port=18000, launch_ Port number. The default is ``18000``. launch_client : bool, optional Whether to launch the client. The default is ``True.`` + use_aedt_relative_path : bool, optional + Whether to use aedt executable full path or relative path call. Needed in case linux environment is defined. + aedt_path parameter is still needed since it is necessary to retrieve ipy64.exe full path. Returns ------- @@ -422,5 +428,5 @@ def launch_ironpython_server(aedt_path, non_graphical=False, port=18000, launch_ print("Known issues are in the returned list and dictionary.") print("For these known issues, using the method client.convert_remote_object is recommended.") if proc and launch_client: - return client(server_name=socket.getfqdn(), server_port=port1) + return client(server_name=socket.getfqdn(), server_port=port1, use_aedt_relative_path=use_aedt_relative_path) return False diff --git a/pyaedt/edb.py b/pyaedt/edb.py index 52792183e3b..15a69bf98cf 100644 --- a/pyaedt/edb.py +++ b/pyaedt/edb.py @@ -486,12 +486,19 @@ def import_layout_pcb( command += ".exe" if not working_dir: working_dir = os.path.dirname(input_file) - cmd_translator = '"{}" "{}" "{}"'.format(command, input_file, os.path.join(working_dir, aedb_name)) - cmd_translator += ' -l="{}"'.format(os.path.join(working_dir, "Translator.log")) + if os.name == "posix": + cmd_translator = "{} {} {}".format(command, input_file, os.path.join(working_dir, aedb_name)) + cmd_translator += " -l={}".format(os.path.join(working_dir, "Translator.log")) + else: + cmd_translator = '"{}" "{}" "{}"'.format(command, input_file, os.path.join(working_dir, aedb_name)) + cmd_translator += ' -l="{}"'.format(os.path.join(working_dir, "Translator.log")) if not use_ppe: cmd_translator += " -ppe=false" if control_file and input_file[-3:] == "gds": - cmd_translator += ' -c="{}"'.format(control_file) + if os.name == "posix": + cmd_translator += " -c={}".format(control_file) + else: + cmd_translator += ' -c="{}"'.format(control_file) p = subprocess.Popen(cmd_translator) p.wait() if not os.path.exists(os.path.join(working_dir, aedb_name)): diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 1ac493a7757..06f30c47858 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1451,14 +1451,14 @@ def assign_em_losses( String containing the frequency to map. The default is ``None``. The value must be ``None`` for Eigenmode analysis. surface_objects : list, optional - List of objects in the source that are metals. The default is ``[]``. + List of objects in the source that are metals. The default is ``None``. source_project_name : str, optional Name of the source project. The default is ``None``, in which case the source from the same project is used. paramlist :list, optional - List of all parameters in the EM to map. The default is ``[]``. + List of all parameters in the EM to map. The default is ``None``. object_list : list, optional - List of objects. The default is ``[]``. + List of objects. The default is ``None``. Returns ------- @@ -1758,7 +1758,7 @@ def export_summary( variation : str, optional The default is ``""``. variationlist : list, optional - The default is ``[]``. + The default is ``None``. Returns ------- diff --git a/pyaedt/modeler/Primitives3D.py b/pyaedt/modeler/Primitives3D.py index 11129524690..66d0422be5b 100644 --- a/pyaedt/modeler/Primitives3D.py +++ b/pyaedt/modeler/Primitives3D.py @@ -1634,6 +1634,8 @@ def create_choke(self, json_file): list list of point coordinates of the winding. for each winding. + [bool, core_obj, [first_winding_obj, first_winding_point_list], + [second_winding_obj, second_winding_point_list], etc...] Examples -------- @@ -1664,12 +1666,14 @@ def create_choke(self, json_file): sep_layer = values["Layer Type"]["Separate"] name_core = values["Core"]["Name"] + material_core = values["Core"]["Material"] in_rad_core = values["Core"]["Inner Radius"] out_rad_core = values["Core"]["Outer Radius"] height_core = values["Core"]["Height"] chamfer = values["Core"]["Chamfer"] name_wind = values["Outer Winding"]["Name"] + material_wind = values["Outer Winding"]["Material"] in_rad_wind = values["Outer Winding"]["Inner Radius"] out_rad_wind = values["Outer Winding"]["Outer Radius"] height_wind = values["Outer Winding"]["Height"] @@ -1684,15 +1688,14 @@ def create_choke(self, json_file): chamf = self._make_winding_follow_chamfer(chamfer, sr, w_dia, 1) returned_list = [ - self._make_core(name_core, "(255 0 0)", "", in_rad_core, out_rad_core, height_core, chamfer), + self._make_core(name_core, material_core, in_rad_core, out_rad_core, height_core, chamfer), ] if values["Layer"]["Double"]: if values["Layer Type"]["Linked"]: list_object = self._make_double_linked_winding( name_wind, - "(255 0 0)", - "", + material_wind, in_rad_wind, out_rad_wind, height_wind, @@ -1709,8 +1712,7 @@ def create_choke(self, json_file): else: list_object = self._make_double_winding( name_wind, - "(255 0 0)", - "", + material_wind, in_rad_wind, out_rad_wind, height_wind, @@ -1729,8 +1731,7 @@ def create_choke(self, json_file): if values["Layer Type"]["Linked"]: list_object = self._make_triple_linked_winding( name_wind, - "(255 0 0)", - "", + material_wind, in_rad_wind, out_rad_wind, height_wind, @@ -1749,8 +1750,7 @@ def create_choke(self, json_file): else: list_object = self._make_triple_winding( name_wind, - "(255 0 0)", - "", + material_wind, in_rad_wind, out_rad_wind, height_wind, @@ -1769,7 +1769,7 @@ def create_choke(self, json_file): print("make_triple_winding") else: list_object = self._make_winding( - name_wind, "(255 0 0)", "", in_rad_wind, out_rad_wind, height_wind, w_dia, teta, turns, chamf, sep_layer + name_wind, material_wind, in_rad_wind, out_rad_wind, height_wind, teta, turns, chamf, sep_layer ) print("make_winding") list_duplicated_object = [] @@ -1790,7 +1790,9 @@ def create_choke(self, json_file): if values["Mode"]["Common"] and number_duplication == 2: if type(list_object[0]) == list: for i in range(len(list_object)): - duplication = self.create_polyline(position_list=list_object[i][1], name=name_wind) + duplication = self.create_polyline( + position_list=list_object[i][1], name=name_wind, matname=material_wind + ) duplication.mirror([0, 0, 0], [-1, 0, 0]) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -1799,7 +1801,9 @@ def create_choke(self, json_file): list_duplicated_object.append([duplication, duplication_points]) else: - duplication = self.create_polyline(position_list=list_object[1], name=name_wind) + duplication = self.create_polyline( + position_list=list_object[1], name=name_wind, matname=material_wind + ) duplication.mirror([0, 0, 0], [-1, 0, 0]) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties(type=section, width=w_dia, num_seg=segment_number) @@ -1808,7 +1812,9 @@ def create_choke(self, json_file): if type(list_object[0]) == list: for j in range(number_duplication - 1): for i in range(len(list_object)): - duplication = self.create_polyline(position_list=list_object[i][1], name=name_wind) + duplication = self.create_polyline( + position_list=list_object[i][1], name=name_wind, matname=material_wind + ) duplication.rotate("Z", (j + 1) * 360 / number_duplication) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -1817,7 +1823,9 @@ def create_choke(self, json_file): list_duplicated_object.append([duplication, duplication_points]) else: for j in range(number_duplication - 1): - duplication = self.create_polyline(position_list=list_object[1], name=name_wind) + duplication = self.create_polyline( + position_list=list_object[1], name=name_wind, matname=material_wind + ) duplication.rotate("Z", (j + 1) * 360 / number_duplication) duplication_points = self.get_vertices_of_line(duplication.name) success = duplication.set_crosssection_properties( @@ -1830,7 +1838,7 @@ def create_choke(self, json_file): return returned_list @pyaedt_function_handler() - def _make_winding(self, name, color, mat, in_rad, out_rad, height, dia, teta, turns, chamf, sep_layer): + def _make_winding(self, name, material, in_rad, out_rad, height, teta, turns, chamf, sep_layer): teta_r = radians(teta) points_list1 = [ @@ -1844,7 +1852,7 @@ def _make_winding(self, name, color, mat, in_rad, out_rad, height, dia, teta, tu [in_rad * cos(teta_r), in_rad * sin(teta_r), -height / 2 + chamf], [in_rad * cos(teta_r), in_rad * sin(teta_r), height / 2 - chamf], ] - polyline = self.create_polyline(position_list=points_list1, name="Polyline1") + polyline = self.create_polyline(position_list=points_list1, name=name, matname=material) union_polyline1 = [polyline.name] if turns > 1: union_polyline2 = polyline.duplicate_around_axis( @@ -1863,7 +1871,7 @@ def _make_winding(self, name, color, mat, in_rad, out_rad, height, dia, teta, tu list_positions.pop() list_positions.insert(0, [list_positions[0][0], list_positions[0][1], -height]) list_positions.append([list_positions[-1][0], list_positions[-1][1], -height]) - true_polyline = self.create_polyline(position_list=list_positions, name=name) + true_polyline = self.create_polyline(position_list=list_positions, name=name, matname=material) true_polyline.rotate("Z", 180 - (turns - 1) * teta) list_positions = self.get_vertices_of_line(true_polyline.name) return [true_polyline, list_positions] @@ -1874,8 +1882,7 @@ def _make_winding(self, name, color, mat, in_rad, out_rad, height, dia, teta, tu def _make_double_linked_winding( self, name, - color, - mat, + material, in_rad, out_rad, height, @@ -1890,8 +1897,7 @@ def _make_double_linked_winding( ): list_object = self._make_double_winding( name, - color, - mat, + material, in_rad, out_rad, height, @@ -1916,9 +1922,9 @@ def _make_double_linked_winding( points_in_wind[-1] = [points_in_wind[-2][0], points_in_wind[-2][1], points_out_wind[1][2]] points_in_wind.append([points_in_wind[-3][0], points_in_wind[-3][1], points_out_wind[0][2]]) - outer_polyline = self.create_polyline(position_list=points_out_wind, name="Winding") + outer_polyline = self.create_polyline(position_list=points_out_wind, name=name, matname=material) outer_polyline.rotate("Z", 180 - (turns - 1) * teta) - inner_polyline = self.create_polyline(position_list=points_in_wind, name="Winding2") + inner_polyline = self.create_polyline(position_list=points_in_wind, name=name, matname=material) inner_polyline.rotate("Z", 180 - (turns_in_wind - 1) * teta_in_wind) outer_polyline.mirror([0, 0, 0], [0, -1, 0]) outer_polyline.rotate("Z", turns_in_wind * teta_in_wind - turns * teta) @@ -1928,15 +1934,14 @@ def _make_double_linked_winding( for i in range(len(list_polyline)): list_positions = list_positions + self.get_vertices_of_line(list_polyline[i]) self.delete(list_polyline) - true_polyline = self.create_polyline(position_list=list_positions, name="Final_Winding") + true_polyline = self.create_polyline(position_list=list_positions, name=name, matname=material) return [true_polyline, list_positions] @pyaedt_function_handler() def _make_triple_linked_winding( self, name, - color, - mat, + material, in_rad, out_rad, height, @@ -1953,8 +1958,7 @@ def _make_triple_linked_winding( ): list_object = self._make_triple_winding( name, - color, - mat, + material, in_rad, out_rad, height, @@ -1988,11 +1992,11 @@ def _make_triple_linked_winding( points_in_wind[-1] = [points_in_wind[-2][0], points_in_wind[-2][1], points_mid_wind[1][2]] points_in_wind.append([points_in_wind[-3][0], points_in_wind[-3][1], points_mid_wind[0][2]]) - outer_polyline = self.create_polyline(position_list=points_out_wind, name="Winding") + outer_polyline = self.create_polyline(position_list=points_out_wind, name=name, matname=material) outer_polyline.rotate("Z", 180 - (turns - 1) * teta) - mid_polyline = self.create_polyline(position_list=points_mid_wind, name="Winding2") + mid_polyline = self.create_polyline(position_list=points_mid_wind, name=name, matname=material) mid_polyline.rotate("Z", 180 - (turns_mid_wind - 1) * teta_mid_wind) - inner_polyline = self.create_polyline(position_list=points_in_wind, name="Winding3") + inner_polyline = self.create_polyline(position_list=points_in_wind, name=name, matname=material) inner_polyline.rotate("Z", 180 - (turns_in_wind - 1) * teta_in_wind) mid_polyline.mirror([0, 0, 0], [0, -1, 0]) @@ -2005,15 +2009,14 @@ def _make_triple_linked_winding( for i in range(len(list_polyline)): list_positions = list_positions + self.get_vertices_of_line(list_polyline[i]) self.primitives.delete(list_polyline) - true_polyline = self.create_polyline(position_list=list_positions, name="Final_Winding") + true_polyline = self.create_polyline(position_list=list_positions, name=name, matname=material) return [true_polyline, list_positions] @pyaedt_function_handler() def _make_double_winding( self, name, - color, - mat, + material, in_rad, out_rad, height, @@ -2033,15 +2036,13 @@ def _make_double_winding( out_rad_in_wind = out_rad - sr * w_dia height_in_wind = height - 2 * sr * w_dia list_object = [ - self._make_winding(name, color, mat, in_rad, out_rad, height, w_dia, teta, turns, chamf, sep_layer), + self._make_winding(name, material, in_rad, out_rad, height, teta, turns, chamf, sep_layer), self._make_winding( name, - color, - mat, + material, in_rad_in_wind, out_rad_in_wind, height_in_wind, - w_dia, teta_in_wind, turns_in_wind, chamf_in_wind, @@ -2054,8 +2055,7 @@ def _make_double_winding( def _make_triple_winding( self, name, - color, - mat, + material, in_rad, out_rad, height, @@ -2081,15 +2081,13 @@ def _make_triple_winding( height_in_wind = height - 4 * sr * w_dia height_mid_wind = height - 2 * sr * w_dia list_object = [ - self._make_winding(name, color, mat, in_rad, out_rad, height, w_dia, teta, turns, chamf, sep_layer), + self._make_winding(name, material, in_rad, out_rad, height, teta, turns, chamf, sep_layer), self._make_winding( name, - color, - mat, + material, in_rad_mid_wind, out_rad_mid_wind, height_mid_wind, - w_dia, teta_mid_wind, turns_mid_wind, chamf_mid_wind, @@ -2097,12 +2095,10 @@ def _make_triple_winding( ), self._make_winding( name, - color, - mat, + material, in_rad_in_wind, out_rad_in_wind, height_in_wind, - w_dia, teta_in_wind, turns_in_wind, chamf_in_wind, @@ -2112,10 +2108,9 @@ def _make_triple_winding( return list_object @pyaedt_function_handler() - def _make_core(self, name, color, mat, in_rad, out_rad, height, chamfer): - tool = self.create_cylinder("Z", [0, 0, -height / 2], in_rad, height, 0, "Tool") - core = self.create_cylinder("Z", [0, 0, -height / 2], out_rad, height, 0, name) - core.color = color + def _make_core(self, name, material, in_rad, out_rad, height, chamfer): + tool = self.create_cylinder("Z", [0, 0, -height / 2], in_rad, height, 0, "Tool", matname=material) + core = self.create_cylinder("Z", [0, 0, -height / 2], out_rad, height, 0, name=name, matname=material) core.subtract(tool, False) for n in core.edges: n.chamfer(chamfer) @@ -2150,9 +2145,10 @@ def check_choke_values(self, json_file, create_another_file=True): "Similar Layer": {"Similar": True, "Different": False}, "Mode": {"Differential": True, "Common": False}, "Wire Section": {"None": False, "Hexagon": False, "Octagon": True, "Circle": False}, - "Core": {"Name": "Core", "Inner Radius": 11, "Outer Radius": 17, "Height": 7, "Chamfer": 0.8}, - "Outer Winding": {"Name": "Winding", "Inner Radius": 12, "Outer Radius": 16, "Height": 8, - "Wire Diameter": 1, "Turns": 10, "Coil Pit(deg)": 9, "Occupation(%)": 0}, + "Core": {"Name": "Core", "Material": "ferrite", "Inner Radius": 11, "Outer Radius": 17, "Height": 7, + "Chamfer": 0.8}, + "Outer Winding": {"Name": "Winding", "Material": "copper", "Inner Radius": 12, "Outer Radius": 16, + "Height": 8, "Wire Diameter": 1, "Turns": 10, "Coil Pit(deg)": 9, "Occupation(%)": 0}, "Mid Winding": {"Turns": 8, "Coil Pit(deg)": 0.1, "Occupation(%)": 0}, "Inner Winding": {"Turns": 12, "Coil Pit(deg)": 0.1, "Occupation(%)": 0} } @@ -2172,9 +2168,17 @@ def check_choke_values(self, json_file, create_another_file=True): "Similar Layer": {"Similar": True, "Different": False}, "Mode": {"Differential": True, "Common": False}, "Wire Section": {"None": False, "Hexagon": False, "Octagon": True, "Circle": False}, - "Core": {"Name": "Core", "Inner Radius": 11, "Outer Radius": 17, "Height": 7, "Chamfer": 0.8}, + "Core": { + "Name": "Core", + "Material": "ferrite", + "Inner Radius": 11, + "Outer Radius": 17, + "Height": 7, + "Chamfer": 0.8, + }, "Outer Winding": { "Name": "Winding", + "Material": "copper", "Inner Radius": 12, "Outer Radius": 16, "Height": 8, @@ -2233,6 +2237,21 @@ def check_choke_values(self, json_file, create_another_file=True): self.logger.warning("Core Name must be a non-null string. A default name Core has been set.") values["Core"]["Name"] = "Core" + try: + core_material = str(values["Core"]["Material"]) + if len(core_material) > 0: + if self.materials.checkifmaterialexists(core_material): + values["Core"]["Material"] = core_material + else: + self.logger.error( + "%s is not in the material library." + " It can be add using the method add_material" % core_material + ) + values["Core"]["Material"] = "ferrite" + except: + self.logger.warning("Core Material must be a non-null string. A default material Core has been set.") + values["Core"]["Material"] = "ferrite" + try: winding_name = str(values["Outer Winding"]["Name"]) if len(winding_name) > 0: @@ -2241,6 +2260,23 @@ def check_choke_values(self, json_file, create_another_file=True): self.logger.warning("Outer Winding Name must be a non-null string. A default name Winding has been set.") values["Outer Winding"]["Name"] = "Winding" + try: + winding_material = str(values["Outer Winding"]["Material"]) + if len(winding_material) > 0: + if self.materials.checkifmaterialexists(winding_material): + values["Outer Winding"]["Material"] = winding_material + else: + self.logger.error( + "%s is not in the material library." + " It can be add using the method add_material" % winding_material + ) + values["Outer Winding"]["Material"] = "copper" + except: + self.logger.warning( + "Outer Winding Material must be a non-null string." " A default material Winding has been set." + ) + values["Outer Winding"]["Material"] = "copper" + in_rad_core, are_inequations_checkable = self._check_value_type( values["Core"]["Inner Radius"], float, diff --git a/pyaedt/modeler/PrimitivesEmit.py b/pyaedt/modeler/PrimitivesEmit.py index 79d403f1b5c..d42b3b9298d 100644 --- a/pyaedt/modeler/PrimitivesEmit.py +++ b/pyaedt/modeler/PrimitivesEmit.py @@ -417,7 +417,7 @@ def get_prop_nodes(self, property_filter=None): Args: property_filter (dict, optional): Only return nodes with all - the property name,value pairs of this dict. Defaults to {} + the property name, value pairs of this dict. Defaults to ``None`` which returns all nodes. Returns: diff --git a/pyaedt/modeler/PrimitivesMaxwellCircuit.py b/pyaedt/modeler/PrimitivesMaxwellCircuit.py index f5060ffbb02..273f8601d3f 100644 --- a/pyaedt/modeler/PrimitivesMaxwellCircuit.py +++ b/pyaedt/modeler/PrimitivesMaxwellCircuit.py @@ -67,7 +67,7 @@ def create_resistor(self, compname=None, value=50, location=None, angle=0, use_i value : float, optional Value for the resistor. The default is ``50``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle of rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional @@ -110,7 +110,7 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i value : float, optional Value for the inductor. The default is ``50``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional @@ -189,7 +189,7 @@ def create_diode(self, compname=None, location=None, angle=0, use_instance_id_ne compname : str, optional Name of the diode. The default is ``None``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle of rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional diff --git a/pyaedt/modeler/PrimitivesNexxim.py b/pyaedt/modeler/PrimitivesNexxim.py index a3b53e096b6..8a338096b56 100644 --- a/pyaedt/modeler/PrimitivesNexxim.py +++ b/pyaedt/modeler/PrimitivesNexxim.py @@ -540,7 +540,7 @@ def create_capacitor(self, compname=None, value=50, location=None, angle=0, use_ value : float, optional Capacitor value. The default is ``50``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional @@ -584,7 +584,7 @@ def create_voltage_dc(self, compname=None, value=1, location=None, angle=0, use_ value : float, optional Voltage value. The default is ``50``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional @@ -780,7 +780,7 @@ def create_coupling_inductors( value : float, optional Value for the coupling inductor. The default is ``1``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional diff --git a/pyaedt/modeler/PrimitivesTwinBuilder.py b/pyaedt/modeler/PrimitivesTwinBuilder.py index 195b5048cb7..744fb258711 100644 --- a/pyaedt/modeler/PrimitivesTwinBuilder.py +++ b/pyaedt/modeler/PrimitivesTwinBuilder.py @@ -130,7 +130,7 @@ def create_inductor(self, compname=None, value=50, location=None, angle=0, use_i value : float, optional Value for the inductor. The default is ``50``. location : list of float, optional - Position on the X axis and Y axis. + Position on the X axis and Y axis. The default is ``None``. angle : float, optional Angle rotation in degrees. The default is ``0``. use_instance_id_netlist : bool, optional diff --git a/pyaedt/modules/Mesh.py b/pyaedt/modules/Mesh.py index f305585b533..d1e52a15d2e 100644 --- a/pyaedt/modules/Mesh.py +++ b/pyaedt/modules/Mesh.py @@ -348,11 +348,11 @@ def assign_surface_mesh_manual(self, names, surf_dev=None, normal_dev=None, aspe Parameters ---------- - names : list + names : list or str or :class:`pyaedt.modeler.Object3d.FacePrimitive` List of faces to apply the surface mesh to. - surf_dev : float, optional - Surface deviation. The default is ``None``. - normal_dev : float, optional + surf_dev : float or str, optional + Surface deviation. The default is ``None``. Allowed values are float, number with units or `"inf"`. + normal_dev : float or str, optional Normal deviation. The default is ``None``. aspect_ratio : int, optional Aspect ratio. The default is ``None``. @@ -382,9 +382,10 @@ def assign_surface_mesh_manual(self, names, surf_dev=None, normal_dev=None, aspe aspect_ratio_enable = 2 if not surf_dev: + surf_dev_enable = 0 + surf_dev = "0.0001mm" + elif surf_dev == "inf": surf_dev_enable = 1 - surf_dev = "0.001" - if not normal_dev: normal_dev_enable = 1 normal_dev = "1" diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index b21d837a6e0..059a465e2f2 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -2699,9 +2699,10 @@ def export_field_file_on_grid( self.ofieldsreporter.CopyNamedExprToStack(quantity_name) if isvector: self.ofieldsreporter.CalcOp("Smooth") - self.ofieldsreporter.EnterScalar(0) - self.ofieldsreporter.CalcOp("AtPhase") - self.ofieldsreporter.CalcOp("Mag") + if phase: + self.ofieldsreporter.EnterScalar(0) + self.ofieldsreporter.CalcOp("AtPhase") + self.ofieldsreporter.CalcOp("Mag") units = self.modeler.model_units ang_units = "deg" if gridtype == "Cartesian": diff --git a/pyaedt/rpc/rpyc_services.py b/pyaedt/rpc/rpyc_services.py index e269f9cd4b7..f07864ed696 100644 --- a/pyaedt/rpc/rpyc_services.py +++ b/pyaedt/rpc/rpyc_services.py @@ -767,7 +767,7 @@ def on_disconnect(self, connection): # (to finalize the service, if needed) pass - def exposed_start_service(self, hostname, beta_options=None): + def exposed_start_service(self, hostname, beta_options=None, use_aedt_relative_path=False): """Starts a new Pyaedt Service and start listen. Returns @@ -802,14 +802,19 @@ def exposed_start_service(self, hostname, beta_options=None): lines = f1.readlines() for line in lines: f.write(line) + if not use_aedt_relative_path: + aedt_exe = os.path.join(ansysem_path, executable) + else: + aedt_exe = executable if non_graphical: ng_feature = "-features=SF6694_NON_GRAPHICAL_COMMAND_EXECUTION,SF159726_SCRIPTOBJECT" if beta_options: for option in range(beta_options.__len__()): if beta_options[option] not in ng_feature: ng_feature += "," + beta_options[option] + command = [ - os.path.join(ansysem_path, executable), + aedt_exe, ng_feature, "-ng", "-RunScriptAndExit", @@ -821,7 +826,7 @@ def exposed_start_service(self, hostname, beta_options=None): for option in range(beta_options.__len__()): if beta_options[option] not in ng_feature: ng_feature += "," + beta_options[option] - command = [os.path.join(ansysem_path, executable), ng_feature, "-RunScriptAndExit", dest_file] + command = [aedt_exe, ng_feature, "-RunScriptAndExit", dest_file] print(command) subprocess.Popen(command) return port diff --git a/pyaedt/third_party/ironpython/rpyc_27/utils/server.py b/pyaedt/third_party/ironpython/rpyc_27/utils/server.py index 99a6bd99b0d..feb3eeb77f9 100644 --- a/pyaedt/third_party/ironpython/rpyc_27/utils/server.py +++ b/pyaedt/third_party/ironpython/rpyc_27/utils/server.py @@ -21,7 +21,7 @@ from pyaedt.third_party.ironpython.rpyc_27.lib.compat import poll, get_exc_errno signal = safe_import("signal") -gevent = safe_import("gevent") +#gevent = safe_import("gevent") class Server(object):