diff --git a/Tests/Data/Retrocompatibility/WmagHmag/Benchmark_old.json b/Tests/Data/Retrocompatibility/WmagHmag/Benchmark_old.json
new file mode 100644
index 000000000..44b56c7ae
--- /dev/null
+++ b/Tests/Data/Retrocompatibility/WmagHmag/Benchmark_old.json
@@ -0,0 +1,1947 @@
+{
+ "__class__": "MachineSIPMSM",
+ "__save_date__": "2023_04_17 14h38min25s ",
+ "__version__": "pyleecan_1.5.0",
+ "desc": null,
+ "frame": null,
+ "logger_name": null,
+ "name": "Benchmark",
+ "rotor": {
+ "Kf1": 0.95,
+ "L1": 0.14,
+ "Nrvd": null,
+ "Rext": 0.04,
+ "Rint": 0.0095,
+ "Wrvd": null,
+ "__class__": "LamSlotMag",
+ "axial_vent": [],
+ "bore": null,
+ "is_internal": true,
+ "is_stator": false,
+ "magnet": {
+ "Lmag": 0.14,
+ "Nseg": 1,
+ "__class__": "Magnet",
+ "mat_type": {
+ "HT": {
+ "Cp": 450.0,
+ "__class__": "MatHT",
+ "alpha": 0,
+ "lambda_x": 8.5,
+ "lambda_y": 8.5,
+ "lambda_z": 8.5
+ },
+ "__class__": "Material",
+ "desc": "MAGNET1 for SIPMSM",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": 252.0,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0,
+ "epsr": 1,
+ "rho": 1.6e-06
+ },
+ "is_isotropic": true,
+ "mag": {
+ "BH_curve": {
+ "__class__": "ImportMatrix",
+ "is_transpose": false
+ },
+ "Brm20": 1.24,
+ "LossData": {
+ "__class__": "ImportMatrix",
+ "is_transpose": false
+ },
+ "ModelBH": {
+ "Bmax": 2.31,
+ "Hmax": null,
+ "__class__": "ModelBH",
+ "delta": 100
+ },
+ "Wlam": 0,
+ "__class__": "MatMagnetics",
+ "alpha_Br": -0.001,
+ "is_BH_extrapolate": false,
+ "mur_lin": 1.05
+ },
+ "name": "MagnetPrius",
+ "path": "MagnetPrius.json",
+ "struct": {
+ "Ex": 15500000000,
+ "Ey": null,
+ "Ez": null,
+ "Gxy": null,
+ "Gxz": null,
+ "Gyz": null,
+ "__class__": "MatStructural",
+ "nu_xy": 0.3,
+ "nu_xz": null,
+ "nu_yz": null,
+ "rho": 7500.0
+ }
+ },
+ "type_magnetization": 0
+ },
+ "mat_type": {
+ "HT": {
+ "Cp": 1,
+ "__class__": "MatHT",
+ "alpha": 0.00393,
+ "lambda_x": 1,
+ "lambda_y": 1,
+ "lambda_z": 1
+ },
+ "__class__": "Material",
+ "desc": "Lamination M400-50A",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": 0.127,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0,
+ "epsr": 1,
+ "rho": 4.6e-07
+ },
+ "is_isotropic": false,
+ "mag": {
+ "BH_curve": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 0.0,
+ 0.0
+ ],
+ [
+ 100.0,
+ 0.5
+ ],
+ [
+ 150.0,
+ 0.7
+ ],
+ [
+ 180.0,
+ 0.8
+ ],
+ [
+ 200.0,
+ 0.9
+ ],
+ [
+ 250.0,
+ 1.0
+ ],
+ [
+ 300.0,
+ 1.05
+ ],
+ [
+ 350.0,
+ 1.1
+ ],
+ [
+ 450.0,
+ 1.15
+ ],
+ [
+ 550.0,
+ 1.2
+ ],
+ [
+ 650.0,
+ 1.225
+ ],
+ [
+ 750.0,
+ 1.25
+ ],
+ [
+ 850.0,
+ 1.275
+ ],
+ [
+ 950.0,
+ 1.3
+ ],
+ [
+ 1100.0,
+ 1.325
+ ],
+ [
+ 1250.0,
+ 1.35
+ ],
+ [
+ 1400.0,
+ 1.375
+ ],
+ [
+ 1550.0,
+ 1.4
+ ],
+ [
+ 1700.0,
+ 1.425
+ ],
+ [
+ 1900.0,
+ 1.45
+ ],
+ [
+ 2150.0,
+ 1.475
+ ],
+ [
+ 2450.0,
+ 1.5
+ ],
+ [
+ 2750.0,
+ 1.525
+ ],
+ [
+ 3150.0,
+ 1.55
+ ],
+ [
+ 3600.0,
+ 1.575
+ ],
+ [
+ 4100.0,
+ 1.6
+ ],
+ [
+ 4700.0,
+ 1.625
+ ],
+ [
+ 5250.0,
+ 1.65
+ ],
+ [
+ 6000.0,
+ 1.675
+ ],
+ [
+ 6700.0,
+ 1.7
+ ],
+ [
+ 7500.0,
+ 1.725
+ ],
+ [
+ 8650.0,
+ 1.75
+ ],
+ [
+ 9500.0,
+ 1.775
+ ],
+ [
+ 10750.0,
+ 1.8
+ ],
+ [
+ 14500.0,
+ 1.85
+ ],
+ [
+ 19500.0,
+ 1.9
+ ],
+ [
+ 25000.0,
+ 1.95
+ ],
+ [
+ 33000.0,
+ 2.0
+ ],
+ [
+ 44000.0,
+ 2.05
+ ],
+ [
+ 57000.0,
+ 2.1
+ ],
+ [
+ 74000.0,
+ 2.15
+ ],
+ [
+ 96000.0,
+ 2.2
+ ],
+ [
+ 130000.0,
+ 2.25
+ ],
+ [
+ 170000.0,
+ 2.3
+ ]
+ ]
+ },
+ "Brm20": 0,
+ "LossData": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0
+ ],
+ [
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 1.6,
+ 1.7,
+ 1.8,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4
+ ],
+ [
+ 0.02,
+ 0.09,
+ 0.19,
+ 0.31,
+ 0.46,
+ 0.62,
+ 0.81,
+ 1.01,
+ 1.24,
+ 1.49,
+ 1.76,
+ 2.09,
+ 2.46,
+ 2.96,
+ 3.57,
+ 4.38,
+ 5.02,
+ 5.47,
+ 0.07,
+ 0.26,
+ 0.54,
+ 0.88,
+ 1.27,
+ 1.73,
+ 2.24,
+ 2.8,
+ 3.44,
+ 4.15,
+ 4.95,
+ 5.85,
+ 6.88,
+ 8.18,
+ 9.82,
+ 0.16,
+ 0.64,
+ 1.35,
+ 2.25,
+ 3.33,
+ 4.58,
+ 6.03,
+ 7.68,
+ 9.58,
+ 11.7,
+ 14.2,
+ 17.0,
+ 20.2,
+ 23.8,
+ 28.3,
+ 0.48,
+ 1.8,
+ 3.77,
+ 6.29,
+ 9.37,
+ 13.1,
+ 17.5,
+ 22.7,
+ 28.8,
+ 35.9,
+ 44.2,
+ 53.8,
+ 64.9,
+ 77.4,
+ 91.7,
+ 2.12,
+ 7.49,
+ 15.3,
+ 25.7,
+ 39.0,
+ 56.1,
+ 77.1,
+ 103.1,
+ 135.0,
+ 173.3,
+ 218.8,
+ 272.4,
+ 334.6,
+ 405.6,
+ 488.4,
+ 8.34,
+ 30.1,
+ 62.7,
+ 109.0,
+ 172.0,
+ 256.0,
+ 367.0,
+ 509.0,
+ 685.0,
+ 899.0,
+ 1155.0,
+ 1453.0,
+ 1793.0,
+ 2130.0
+ ]
+ ]
+ },
+ "ModelBH": {
+ "Bmax": 2.31,
+ "Hmax": null,
+ "__class__": "ModelBH",
+ "delta": 100
+ },
+ "Wlam": 0.0005,
+ "__class__": "MatMagnetics",
+ "alpha_Br": 0,
+ "is_BH_extrapolate": false,
+ "mur_lin": 2500.0
+ },
+ "name": "M400-50A",
+ "path": "M400-50A.json",
+ "struct": {
+ "Ex": 215000000000.0,
+ "Ey": 215000000000.0,
+ "Ez": 80000000000.0,
+ "Gxy": 0.0,
+ "Gxz": 2000000000.0,
+ "Gyz": 2000000000.0,
+ "__class__": "MatStructural",
+ "nu_xy": 0.3,
+ "nu_xz": 0.03,
+ "nu_yz": 0.03,
+ "rho": 7650.0
+ }
+ },
+ "notch": [],
+ "skew": null,
+ "slot": {
+ "H0": 0.0,
+ "Hmag": 0.005,
+ "W0": 0.6048,
+ "Wmag": 0.6048,
+ "Zs": 10,
+ "__class__": "SlotM11",
+ "is_bore": true,
+ "wedge_mat": null
+ },
+ "yoke": null
+ },
+ "shaft": {
+ "Drsh": 0.019,
+ "Lshaft": 0.14,
+ "__class__": "Shaft",
+ "mat_type": {
+ "HT": {
+ "Cp": 1,
+ "__class__": "MatHT",
+ "alpha": 0.00393,
+ "lambda_x": 1,
+ "lambda_y": 1,
+ "lambda_z": 1
+ },
+ "__class__": "Material",
+ "desc": "Lamination M400-50A",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": 0.127,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0,
+ "epsr": 1,
+ "rho": 4.6e-07
+ },
+ "is_isotropic": false,
+ "mag": {
+ "BH_curve": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 0.0,
+ 0.0
+ ],
+ [
+ 100.0,
+ 0.5
+ ],
+ [
+ 150.0,
+ 0.7
+ ],
+ [
+ 180.0,
+ 0.8
+ ],
+ [
+ 200.0,
+ 0.9
+ ],
+ [
+ 250.0,
+ 1.0
+ ],
+ [
+ 300.0,
+ 1.05
+ ],
+ [
+ 350.0,
+ 1.1
+ ],
+ [
+ 450.0,
+ 1.15
+ ],
+ [
+ 550.0,
+ 1.2
+ ],
+ [
+ 650.0,
+ 1.225
+ ],
+ [
+ 750.0,
+ 1.25
+ ],
+ [
+ 850.0,
+ 1.275
+ ],
+ [
+ 950.0,
+ 1.3
+ ],
+ [
+ 1100.0,
+ 1.325
+ ],
+ [
+ 1250.0,
+ 1.35
+ ],
+ [
+ 1400.0,
+ 1.375
+ ],
+ [
+ 1550.0,
+ 1.4
+ ],
+ [
+ 1700.0,
+ 1.425
+ ],
+ [
+ 1900.0,
+ 1.45
+ ],
+ [
+ 2150.0,
+ 1.475
+ ],
+ [
+ 2450.0,
+ 1.5
+ ],
+ [
+ 2750.0,
+ 1.525
+ ],
+ [
+ 3150.0,
+ 1.55
+ ],
+ [
+ 3600.0,
+ 1.575
+ ],
+ [
+ 4100.0,
+ 1.6
+ ],
+ [
+ 4700.0,
+ 1.625
+ ],
+ [
+ 5250.0,
+ 1.65
+ ],
+ [
+ 6000.0,
+ 1.675
+ ],
+ [
+ 6700.0,
+ 1.7
+ ],
+ [
+ 7500.0,
+ 1.725
+ ],
+ [
+ 8650.0,
+ 1.75
+ ],
+ [
+ 9500.0,
+ 1.775
+ ],
+ [
+ 10750.0,
+ 1.8
+ ],
+ [
+ 14500.0,
+ 1.85
+ ],
+ [
+ 19500.0,
+ 1.9
+ ],
+ [
+ 25000.0,
+ 1.95
+ ],
+ [
+ 33000.0,
+ 2.0
+ ],
+ [
+ 44000.0,
+ 2.05
+ ],
+ [
+ 57000.0,
+ 2.1
+ ],
+ [
+ 74000.0,
+ 2.15
+ ],
+ [
+ 96000.0,
+ 2.2
+ ],
+ [
+ 130000.0,
+ 2.25
+ ],
+ [
+ 170000.0,
+ 2.3
+ ]
+ ]
+ },
+ "Brm20": 0,
+ "LossData": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0
+ ],
+ [
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 1.6,
+ 1.7,
+ 1.8,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4
+ ],
+ [
+ 0.02,
+ 0.09,
+ 0.19,
+ 0.31,
+ 0.46,
+ 0.62,
+ 0.81,
+ 1.01,
+ 1.24,
+ 1.49,
+ 1.76,
+ 2.09,
+ 2.46,
+ 2.96,
+ 3.57,
+ 4.38,
+ 5.02,
+ 5.47,
+ 0.07,
+ 0.26,
+ 0.54,
+ 0.88,
+ 1.27,
+ 1.73,
+ 2.24,
+ 2.8,
+ 3.44,
+ 4.15,
+ 4.95,
+ 5.85,
+ 6.88,
+ 8.18,
+ 9.82,
+ 0.16,
+ 0.64,
+ 1.35,
+ 2.25,
+ 3.33,
+ 4.58,
+ 6.03,
+ 7.68,
+ 9.58,
+ 11.7,
+ 14.2,
+ 17.0,
+ 20.2,
+ 23.8,
+ 28.3,
+ 0.48,
+ 1.8,
+ 3.77,
+ 6.29,
+ 9.37,
+ 13.1,
+ 17.5,
+ 22.7,
+ 28.8,
+ 35.9,
+ 44.2,
+ 53.8,
+ 64.9,
+ 77.4,
+ 91.7,
+ 2.12,
+ 7.49,
+ 15.3,
+ 25.7,
+ 39.0,
+ 56.1,
+ 77.1,
+ 103.1,
+ 135.0,
+ 173.3,
+ 218.8,
+ 272.4,
+ 334.6,
+ 405.6,
+ 488.4,
+ 8.34,
+ 30.1,
+ 62.7,
+ 109.0,
+ 172.0,
+ 256.0,
+ 367.0,
+ 509.0,
+ 685.0,
+ 899.0,
+ 1155.0,
+ 1453.0,
+ 1793.0,
+ 2130.0
+ ]
+ ]
+ },
+ "ModelBH": {
+ "Bmax": 2.31,
+ "Hmax": null,
+ "__class__": "ModelBH",
+ "delta": 100
+ },
+ "Wlam": 0.0005,
+ "__class__": "MatMagnetics",
+ "alpha_Br": 0,
+ "is_BH_extrapolate": false,
+ "mur_lin": 2500.0
+ },
+ "name": "M400-50A",
+ "path": "M400-50A.json",
+ "struct": {
+ "Ex": 215000000000.0,
+ "Ey": 215000000000.0,
+ "Ez": 80000000000.0,
+ "Gxy": 0.0,
+ "Gxz": 2000000000.0,
+ "Gyz": 2000000000.0,
+ "__class__": "MatStructural",
+ "nu_xy": 0.3,
+ "nu_xz": 0.03,
+ "nu_yz": 0.03,
+ "rho": 7650.0
+ }
+ }
+ },
+ "stator": {
+ "Kf1": 0.95,
+ "Ksfill": null,
+ "L1": 0.14,
+ "Nrvd": null,
+ "Rext": 0.073,
+ "Rint": 0.048,
+ "Wrvd": null,
+ "__class__": "LamSlotWind",
+ "axial_vent": [],
+ "bore": null,
+ "is_internal": false,
+ "is_stator": true,
+ "mat_type": {
+ "HT": {
+ "Cp": 1,
+ "__class__": "MatHT",
+ "alpha": 0.00393,
+ "lambda_x": 1,
+ "lambda_y": 1,
+ "lambda_z": 1
+ },
+ "__class__": "Material",
+ "desc": "Lamination M400-50A",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": 0.127,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0,
+ "epsr": 1,
+ "rho": 4.6e-07
+ },
+ "is_isotropic": false,
+ "mag": {
+ "BH_curve": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 0.0,
+ 0.0
+ ],
+ [
+ 100.0,
+ 0.5
+ ],
+ [
+ 150.0,
+ 0.7
+ ],
+ [
+ 180.0,
+ 0.8
+ ],
+ [
+ 200.0,
+ 0.9
+ ],
+ [
+ 250.0,
+ 1.0
+ ],
+ [
+ 300.0,
+ 1.05
+ ],
+ [
+ 350.0,
+ 1.1
+ ],
+ [
+ 450.0,
+ 1.15
+ ],
+ [
+ 550.0,
+ 1.2
+ ],
+ [
+ 650.0,
+ 1.225
+ ],
+ [
+ 750.0,
+ 1.25
+ ],
+ [
+ 850.0,
+ 1.275
+ ],
+ [
+ 950.0,
+ 1.3
+ ],
+ [
+ 1100.0,
+ 1.325
+ ],
+ [
+ 1250.0,
+ 1.35
+ ],
+ [
+ 1400.0,
+ 1.375
+ ],
+ [
+ 1550.0,
+ 1.4
+ ],
+ [
+ 1700.0,
+ 1.425
+ ],
+ [
+ 1900.0,
+ 1.45
+ ],
+ [
+ 2150.0,
+ 1.475
+ ],
+ [
+ 2450.0,
+ 1.5
+ ],
+ [
+ 2750.0,
+ 1.525
+ ],
+ [
+ 3150.0,
+ 1.55
+ ],
+ [
+ 3600.0,
+ 1.575
+ ],
+ [
+ 4100.0,
+ 1.6
+ ],
+ [
+ 4700.0,
+ 1.625
+ ],
+ [
+ 5250.0,
+ 1.65
+ ],
+ [
+ 6000.0,
+ 1.675
+ ],
+ [
+ 6700.0,
+ 1.7
+ ],
+ [
+ 7500.0,
+ 1.725
+ ],
+ [
+ 8650.0,
+ 1.75
+ ],
+ [
+ 9500.0,
+ 1.775
+ ],
+ [
+ 10750.0,
+ 1.8
+ ],
+ [
+ 14500.0,
+ 1.85
+ ],
+ [
+ 19500.0,
+ 1.9
+ ],
+ [
+ 25000.0,
+ 1.95
+ ],
+ [
+ 33000.0,
+ 2.0
+ ],
+ [
+ 44000.0,
+ 2.05
+ ],
+ [
+ 57000.0,
+ 2.1
+ ],
+ [
+ 74000.0,
+ 2.15
+ ],
+ [
+ 96000.0,
+ 2.2
+ ],
+ [
+ 130000.0,
+ 2.25
+ ],
+ [
+ 170000.0,
+ 2.3
+ ]
+ ]
+ },
+ "Brm20": 0,
+ "LossData": {
+ "__class__": "ImportMatrixVal",
+ "is_transpose": false,
+ "value": [
+ [
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 50.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 100.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 200.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 400.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 1000.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0,
+ 2500.0
+ ],
+ [
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 1.6,
+ 1.7,
+ 1.8,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4,
+ 1.5,
+ 0.1,
+ 0.2,
+ 0.3,
+ 0.4,
+ 0.5,
+ 0.6,
+ 0.7,
+ 0.8,
+ 0.9,
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+ 1.4
+ ],
+ [
+ 0.02,
+ 0.09,
+ 0.19,
+ 0.31,
+ 0.46,
+ 0.62,
+ 0.81,
+ 1.01,
+ 1.24,
+ 1.49,
+ 1.76,
+ 2.09,
+ 2.46,
+ 2.96,
+ 3.57,
+ 4.38,
+ 5.02,
+ 5.47,
+ 0.07,
+ 0.26,
+ 0.54,
+ 0.88,
+ 1.27,
+ 1.73,
+ 2.24,
+ 2.8,
+ 3.44,
+ 4.15,
+ 4.95,
+ 5.85,
+ 6.88,
+ 8.18,
+ 9.82,
+ 0.16,
+ 0.64,
+ 1.35,
+ 2.25,
+ 3.33,
+ 4.58,
+ 6.03,
+ 7.68,
+ 9.58,
+ 11.7,
+ 14.2,
+ 17.0,
+ 20.2,
+ 23.8,
+ 28.3,
+ 0.48,
+ 1.8,
+ 3.77,
+ 6.29,
+ 9.37,
+ 13.1,
+ 17.5,
+ 22.7,
+ 28.8,
+ 35.9,
+ 44.2,
+ 53.8,
+ 64.9,
+ 77.4,
+ 91.7,
+ 2.12,
+ 7.49,
+ 15.3,
+ 25.7,
+ 39.0,
+ 56.1,
+ 77.1,
+ 103.1,
+ 135.0,
+ 173.3,
+ 218.8,
+ 272.4,
+ 334.6,
+ 405.6,
+ 488.4,
+ 8.34,
+ 30.1,
+ 62.7,
+ 109.0,
+ 172.0,
+ 256.0,
+ 367.0,
+ 509.0,
+ 685.0,
+ 899.0,
+ 1155.0,
+ 1453.0,
+ 1793.0,
+ 2130.0
+ ]
+ ]
+ },
+ "ModelBH": {
+ "Bmax": 2.31,
+ "Hmax": null,
+ "__class__": "ModelBH",
+ "delta": 100
+ },
+ "Wlam": 0.0005,
+ "__class__": "MatMagnetics",
+ "alpha_Br": 0,
+ "is_BH_extrapolate": false,
+ "mur_lin": 2500.0
+ },
+ "name": "M400-50A",
+ "path": "M400-50A.json",
+ "struct": {
+ "Ex": 215000000000.0,
+ "Ey": 215000000000.0,
+ "Ez": 80000000000.0,
+ "Gxy": 0.0,
+ "Gxz": 2000000000.0,
+ "Gyz": 2000000000.0,
+ "__class__": "MatStructural",
+ "nu_xy": 0.3,
+ "nu_xz": 0.03,
+ "nu_yz": 0.03,
+ "rho": 7650.0
+ }
+ },
+ "notch": [],
+ "skew": null,
+ "slot": {
+ "H0": 0.0,
+ "H2": 0.02,
+ "W0": 0.3142,
+ "W2": 0.3142,
+ "Zs": 12,
+ "__class__": "SlotW22",
+ "is_bore": true,
+ "wedge_mat": null
+ },
+ "winding": {
+ "Lewout": 0.0,
+ "Nlayer": 2,
+ "Npcp": 1,
+ "Nslot_shift_wind": 0,
+ "Ntcoil": 1,
+ "__class__": "Winding",
+ "coil_pitch": 1,
+ "conductor": {
+ "Hwire": 0.001,
+ "Nwppc_rad": 10,
+ "Nwppc_tan": 5,
+ "Wins_coil": null,
+ "Wins_wire": 0.0005,
+ "Wwire": 0.001,
+ "__class__": "CondType11",
+ "alpha_ew": null,
+ "cond_mat": {
+ "HT": {
+ "Cp": 381.0,
+ "__class__": "MatHT",
+ "alpha": 1.6e-05,
+ "lambda_x": 385.0,
+ "lambda_y": 385.0,
+ "lambda_z": 385.0
+ },
+ "__class__": "Material",
+ "desc": "COPPER WINDING",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": 60.0,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0.00393,
+ "epsr": 1,
+ "rho": 1.73e-08
+ },
+ "is_isotropic": true,
+ "mag": null,
+ "name": "Copper1",
+ "path": "Copper1.json",
+ "struct": {
+ "Ex": 115000000000.0,
+ "Ey": 115000000000.0,
+ "Ez": 115000000000.0,
+ "Gxy": null,
+ "Gxz": null,
+ "Gyz": null,
+ "__class__": "MatStructural",
+ "nu_xy": null,
+ "nu_xz": null,
+ "nu_yz": null,
+ "rho": 8900.0
+ }
+ },
+ "ins_mat": {
+ "HT": {
+ "Cp": 671.0,
+ "__class__": "MatHT",
+ "alpha": 0,
+ "lambda_x": 0.2,
+ "lambda_y": 0.2,
+ "lambda_z": 0.2
+ },
+ "__class__": "Material",
+ "desc": "INSULATOR1",
+ "eco": {
+ "__class__": "MatEconomical",
+ "cost_unit": null,
+ "unit_name": "$"
+ },
+ "elec": {
+ "__class__": "MatElectrical",
+ "alpha": 0,
+ "epsr": 1,
+ "rho": 0
+ },
+ "is_isotropic": true,
+ "mag": null,
+ "name": "Insulator1",
+ "path": "Insulator1.json",
+ "struct": {
+ "Ex": null,
+ "Ey": null,
+ "Ez": null,
+ "Gxy": null,
+ "Gxz": null,
+ "Gyz": null,
+ "__class__": "MatStructural",
+ "nu_xy": null,
+ "nu_xz": null,
+ "nu_yz": null,
+ "rho": 1200.0
+ }
+ },
+ "type_winding_shape": null
+ },
+ "dual_tri_phase_shift": null,
+ "end_winding": {
+ "Lew_enforced": null,
+ "__class__": "EndWinding"
+ },
+ "is_aper_a": true,
+ "is_change_layer": false,
+ "is_permute_B_C": false,
+ "is_reverse_layer": false,
+ "is_reverse_wind": false,
+ "is_wye": null,
+ "p": 5,
+ "per_a": 2,
+ "qs": 3,
+ "type_connection": null,
+ "wind_mat": [
+ [
+ [
+ [
+ 1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ -1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ -1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ -1.0
+ ],
+ [
+ -1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ 1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ -1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ -1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ ],
+ [
+ [
+ 1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ -1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ -1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ [
+ 1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ -1.0,
+ 0.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ -1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 1.0,
+ 0.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ [
+ 0.0,
+ 0.0,
+ -1.0
+ ],
+ [
+ -1.0,
+ 0.0,
+ 0.0
+ ]
+ ]
+ ]
+ ]
+ },
+ "yoke": null
+ },
+ "type_machine": 7
+}
\ No newline at end of file
diff --git a/Tests/Functions/test_gmsh2.py b/Tests/Functions/test_gmsh2.py
index 78d8a2734..aa4d8927c 100644
--- a/Tests/Functions/test_gmsh2.py
+++ b/Tests/Functions/test_gmsh2.py
@@ -91,7 +91,7 @@ def test_gmsh_spm():
# Import the machine from a script
PMSM_A = load(join(DATA_DIR, "Machine", "SPMSM_001.json"))
- PMSM_A.rotor.slot = SlotM10(Wmag=15e-3, Hmag=3e-3, H0=0.0, W0=15e-3, Zs=8)
+ PMSM_A.rotor.slot = SlotM10(W1=15e-3, H1=3e-3, H0=0.0, W0=15e-3, Zs=8)
# PMSM_A.plot()
save_path = join(save_plot_path, "GMSH")
diff --git a/Tests/Functions/test_retrocompatibility.py b/Tests/Functions/test_retrocompatibility.py
index d3ff5c45c..cec153858 100644
--- a/Tests/Functions/test_retrocompatibility.py
+++ b/Tests/Functions/test_retrocompatibility.py
@@ -7,7 +7,11 @@
from numpy import array_equal
from pyleecan.definitions import DATA_DIR
from pyleecan.Functions.load import load
-from pyleecan.Functions.Load.retrocompatibility import is_before_version
+from pyleecan.Functions.Load.retrocompatibility import (
+ is_before_version,
+ convert_Wmag_Hmag,
+ is_Wmag_Hmag,
+)
from Tests import TEST_DATA_DIR
# 4: OP_matrix convertion (ndarray to object)
@@ -123,6 +127,16 @@
}
)
+Hmag_Wmag_list = list()
+Hmag_Wmag_list.append( # WindingCW1L
+ {
+ "ref": join(DATA_DIR, "Machine", "Benchmark.json"),
+ "old": join(
+ TEST_DATA_DIR, "Retrocompatibility", "WmagHmag", "Benchmark_old.json"
+ ),
+ }
+)
+
def test_save_OPM_None_retro():
"""Check that the OP_matrix convertion works with None"""
@@ -234,6 +248,67 @@ def test_load_opti(file_dict):
assert isinstance(designvar, type(ref.problem.design_var[ii])), msg
+@pytest.mark.parametrize("file_dict", Hmag_Wmag_list)
+def test_load_Hmag_Wmag(file_dict):
+ """Check that the Hmag_Wmag into Hmag_Wmag convertion works"""
+ ref = load(file_dict["ref"])
+ old = load(file_dict["old"])
+
+ # Check old file is converted to current version
+ assert ref.rotor.slot.W1 == old.rotor.slot.W1
+ assert ref.rotor.slot.H1 == old.rotor.slot.H1
+
+
+def test_fct_Hmag_Wmag():
+ """Check that Hmag/Wmag update works for all slots"""
+
+ for ii in range(7):
+ test_dict = {
+ "H0": 0.1,
+ "Hmag": 0.2,
+ "W0": 0.3,
+ "Wmag": 0.4,
+ "Zs": 10,
+ "__class__": "SlotM1" + str(ii),
+ "is_bore": True,
+ "wedge_mat": None,
+ }
+ assert is_Wmag_Hmag(test_dict)
+ updated_dict = convert_Wmag_Hmag(test_dict)
+ assert "Hmag" not in updated_dict
+ assert "Wmag" not in updated_dict
+ assert updated_dict["H1"] == 0.2
+ assert updated_dict["W1"] == 0.4
+
+ # SlotM18 case
+ test_dict = {
+ "Hmag": 0.2,
+ "Zs": 10,
+ "__class__": "SlotM18",
+ "is_bore": True,
+ "wedge_mat": None,
+ }
+ assert is_Wmag_Hmag(test_dict)
+ updated_dict = convert_Wmag_Hmag(test_dict)
+ assert "Hmag" not in updated_dict
+ assert updated_dict["H0"] == 0.2
+
+ # SlotM19 case
+ test_dict = {
+ "Hmag": 0.2,
+ "W0": 0.3,
+ "W1": 0.4,
+ "Zs": 10,
+ "__class__": "SlotM19",
+ "is_bore": True,
+ "wedge_mat": None,
+ }
+ assert is_Wmag_Hmag(test_dict)
+ updated_dict = convert_Wmag_Hmag(test_dict)
+ assert "Hmag" not in updated_dict
+ assert updated_dict["H0"] == 0.2
+
+
def test_before_version():
"""Check that we can detect previous version"""
assert is_before_version("1.2.3", "1.2.1")
@@ -249,12 +324,15 @@ def test_before_version():
if __name__ == "__main__":
test_save_OPM_None_retro()
- for file_dict in OPM_list:
- test_save_OPM_retro(file_dict)
+ # for file_dict in OPM_list:
+ # test_save_OPM_retro(file_dict)
# for file_dict in hole_list:
# test_save_load_hole_retro(file_dict)
# for file_dict in wind_list:
# test_save_load_wind_retro(file_dict)
+ for file_dict in Hmag_Wmag_list:
+ test_load_Hmag_Wmag(file_dict)
+
print("Done")
diff --git a/Tests/Functions/test_save_load.py b/Tests/Functions/test_save_load.py
index 0d83d72b7..5e0bbd480 100644
--- a/Tests/Functions/test_save_load.py
+++ b/Tests/Functions/test_save_load.py
@@ -56,7 +56,7 @@ def test_save_load_machine():
test_obj.stator.slot = SlotW10(Zs=10, H0=0.21, W0=0.23)
test_obj.stator.winding = Winding(qs=5, Nlayer=1, p=3)
test_obj.rotor = LamSlotMag(L1=0.55)
- test_obj.rotor.slot = SlotM11(W0=pi / 4, Wmag=pi / 4, Hmag=3)
+ test_obj.rotor.slot = SlotM11(W0=pi / 4, W1=pi / 4, H1=3)
test_obj.shaft = Shaft(Lshaft=0.65)
test_obj.frame = None
@@ -93,8 +93,8 @@ def test_save_load_machine():
assert type(result.rotor.slot) is SlotM11
assert result.rotor.slot.W0 == pi / 4
- assert result.rotor.slot.Wmag == pi / 4
- assert result.rotor.slot.Hmag == 3
+ assert result.rotor.slot.W1 == pi / 4
+ assert result.rotor.slot.H1 == 3
assert type(result.shaft) is Shaft
assert result.shaft.Lshaft == 0.65
@@ -312,7 +312,7 @@ def test_save_load_list():
test_obj_1.stator.slot = SlotW10(Zs=10, H0=0.21, W0=0.23)
test_obj_1.stator.winding = Winding(qs=5, p=3, Nlayer=1)
test_obj_1.rotor = LamSlotMag(L1=0.55)
- test_obj_1.rotor.slot = SlotM11(W0=pi / 4, Wmag=pi / 4, Hmag=3)
+ test_obj_1.rotor.slot = SlotM11(W0=pi / 4, W1=pi / 4, H1=3)
test_obj_1.shaft = Shaft(Lshaft=0.65)
test_obj_1.frame = None
@@ -352,7 +352,7 @@ def test_save_load_dict():
test_obj_1.stator.slot = SlotW10(Zs=10, H0=0.21, W0=0.23)
test_obj_1.stator.winding = Winding(qs=5, p=3)
test_obj_1.rotor = LamSlotMag(L1=0.55)
- test_obj_1.rotor.slot = SlotM11(W0=pi / 4, Wmag=pi / 4, Hmag=3)
+ test_obj_1.rotor.slot = SlotM11(W0=pi / 4, W1=pi / 4, H1=3)
test_obj_1.shaft = Shaft(Lshaft=0.65)
test_obj_1.frame = None
diff --git a/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark.py b/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark.py
index cd48e75e5..18eacb590 100644
--- a/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark.py
+++ b/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark.py
@@ -497,18 +497,18 @@ def test_Benchmark(self):
assert wid_slot.w_mag.c_type_magnetization.currentText() == "Radial"
assert wid_slot.lf_W0.value() is None
- assert wid_slot.lf_Wmag.value() is None
+ assert wid_slot.lf_W1.value() is None
assert wid_slot.lf_H0.value() is None
- assert wid_slot.lf_Hmag.value() is None
+ assert wid_slot.lf_H1.value() is None
wid_slot.lf_W0.setValue(0.6048)
wid_slot.lf_W0.editingFinished.emit()
- wid_slot.lf_Wmag.setValue(0.6048)
- wid_slot.lf_Wmag.editingFinished.emit()
+ wid_slot.lf_W1.setValue(0.6048)
+ wid_slot.lf_W1.editingFinished.emit()
wid_slot.lf_H0.setValue(0)
wid_slot.lf_H0.editingFinished.emit()
- wid_slot.lf_Hmag.setValue(0.005)
- wid_slot.lf_Hmag.editingFinished.emit()
+ wid_slot.lf_H1.setValue(0.005)
+ wid_slot.lf_H1.editingFinished.emit()
assert wid_slot.w_out.out_Wlam.text() == "Rotor width: 0.0305 [m]"
assert wid_slot.w_out.out_slot_height.text() == "Slot height: 0 [m]"
@@ -520,9 +520,9 @@ def test_Benchmark(self):
assert wid_slot.w_out.out_op_angle.text() == "Opening angle: 0.6048 [rad]"
assert self.widget.w_step.machine.rotor.slot.W0 == 0.6048
- assert self.widget.w_step.machine.rotor.slot.Wmag == 0.6048
+ assert self.widget.w_step.machine.rotor.slot.W1 == 0.6048
assert self.widget.w_step.machine.rotor.slot.H0 == 0
- assert self.widget.w_step.machine.rotor.slot.Hmag == 0.005
+ assert self.widget.w_step.machine.rotor.slot.H1 == 0.005
assert self.widget.w_step.machine.rotor.magnet.mat_type.name == "MagnetPrius"
self.widget.w_step.b_plot.clicked.emit()
diff --git a/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark_NS.py b/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark_NS.py
index 3143f9b8b..3901fafeb 100644
--- a/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark_NS.py
+++ b/Tests/GUI/Dialog/DMachineSetup/NewMachine/test_new_machine_Benchmark_NS.py
@@ -500,18 +500,18 @@ def test_Benchmark(self):
assert wid_slot.w_mag.c_type_magnetization.currentText() == "Radial"
assert wid_slot.lf_W0.value() is None
- assert wid_slot.lf_Wmag.value() is None
+ assert wid_slot.lf_W1.value() is None
assert wid_slot.lf_H0.value() is None
- assert wid_slot.lf_Hmag.value() is None
+ assert wid_slot.lf_H1.value() is None
wid_slot.lf_W0.setValue(0.6048)
wid_slot.lf_W0.editingFinished.emit()
- wid_slot.lf_Wmag.setValue(0.6048)
- wid_slot.lf_Wmag.editingFinished.emit()
+ wid_slot.lf_W1.setValue(0.6048)
+ wid_slot.lf_W1.editingFinished.emit()
wid_slot.lf_H0.setValue(0)
wid_slot.lf_H0.editingFinished.emit()
- wid_slot.lf_Hmag.setValue(0.005)
- wid_slot.lf_Hmag.editingFinished.emit()
+ wid_slot.lf_H1.setValue(0.005)
+ wid_slot.lf_H1.editingFinished.emit()
assert wid_slot.w_out.out_Wlam.text() == "Rotor width: 0.0305 [m]"
assert wid_slot.w_out.out_slot_height.text() == "Slot height: 0 [m]"
@@ -523,9 +523,9 @@ def test_Benchmark(self):
assert wid_slot.w_out.out_op_angle.text() == "Opening angle: 0.6048 [rad]"
assert self.widget.w_step.machine.rotor.slot.W0 == 0.6048
- assert self.widget.w_step.machine.rotor.slot.Wmag == 0.6048
+ assert self.widget.w_step.machine.rotor.slot.W1 == 0.6048
assert self.widget.w_step.machine.rotor.slot.H0 == 0
- assert self.widget.w_step.machine.rotor.slot.Hmag == 0.005
+ assert self.widget.w_step.machine.rotor.slot.H1 == 0.005
assert (
self.widget.w_step.machine.rotor.magnet_north.mat_type.name == "MagnetPrius"
)
@@ -568,18 +568,18 @@ def test_Benchmark(self):
assert wid_slot2.w_mag.c_type_magnetization.currentText() == "Parallel"
assert wid_slot2.lf_W0.value() is None
- assert wid_slot2.lf_Wmag.value() is None
+ assert wid_slot2.lf_W1.value() is None
assert wid_slot2.lf_H0.value() is None
- assert wid_slot2.lf_Hmag.value() is None
+ assert wid_slot2.lf_H1.value() is None
wid_slot2.lf_W0.setValue(0.6)
wid_slot2.lf_W0.editingFinished.emit()
- wid_slot2.lf_Wmag.setValue(0.6)
- wid_slot2.lf_Wmag.editingFinished.emit()
+ wid_slot2.lf_W1.setValue(0.6)
+ wid_slot2.lf_W1.editingFinished.emit()
wid_slot2.lf_H0.setValue(0)
wid_slot2.lf_H0.editingFinished.emit()
- wid_slot2.lf_Hmag.setValue(0.004)
- wid_slot2.lf_Hmag.editingFinished.emit()
+ wid_slot2.lf_H1.setValue(0.004)
+ wid_slot2.lf_H1.editingFinished.emit()
wid_slot2.lf_Rtopm.setValue(0.02)
wid_slot2.lf_Rtopm.editingFinished.emit()
@@ -593,9 +593,9 @@ def test_Benchmark(self):
assert wid_slot2.w_out.out_op_angle.text() == "Opening angle: 0.6 [rad]"
assert self.widget.w_step.machine.rotor.slot_south.W0 == 0.6
- assert self.widget.w_step.machine.rotor.slot_south.Wmag == 0.6
+ assert self.widget.w_step.machine.rotor.slot_south.W1 == 0.6
assert self.widget.w_step.machine.rotor.slot_south.H0 == 0
- assert self.widget.w_step.machine.rotor.slot_south.Hmag == 0.004
+ assert self.widget.w_step.machine.rotor.slot_south.H1 == 0.004
assert self.widget.w_step.machine.rotor.slot_south.Rtopm == 0.02
assert self.widget.w_step.machine.rotor.magnet_south.mat_type.name == "Magnet3"
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot10.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot10.py
index 4b7de389e..d3f6c2834 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot10.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot10.py
@@ -23,7 +23,7 @@ class TestPMSlot10(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
+ self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.test_obj.magnet = Magnet(type_magnetization=2)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
@@ -38,7 +38,9 @@ def setup_method(self):
self.material_dict = material_dict
- self.widget = PMSlot10(self.test_obj, material_dict=self.material_dict)
+ self.widget = PMSlot10(
+ self.test_obj, notch_obj=None, material_dict=self.material_dict
+ )
@classmethod
def setup_class(cls):
@@ -58,9 +60,9 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.w_mag.c_type_magnetization.currentIndex() == 2
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
def test_set_W0(self):
"""Check that the Widget allow to update W0"""
@@ -74,17 +76,17 @@ def test_set_W0(self):
assert self.widget.slot.W0 == 0.31
assert self.test_obj.slot.W0 == 0.31
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- assert self.widget.unit_Wmag.text() == "[m]"
+ assert self.widget.unit_W1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -98,40 +100,44 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM10(H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01)
- self.widget = PMSlot10(self.test_obj, material_dict=self.material_dict)
+ self.test_obj.slot = SlotM10(H0=0.005, H1=0.005, W0=0.01, W1=0.01)
+ self.widget = PMSlot10(
+ self.test_obj, notch_obj=None, material_dict=self.material_dict
+ )
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005063 [m]"
def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
# H0
- self.test_obj.slot = SlotM10(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10)
- self.widget = PMSlot10(self.test_obj, material_dict=self.material_dict)
+ self.test_obj.slot = SlotM10(H0=None, H1=0.10, W0=0.10, W1=0.10)
+ self.widget = PMSlot10(
+ self.test_obj, notch_obj=None, material_dict=self.material_dict
+ )
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM10(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM10(H0=0.10, H1=None, W0=0.10, W1=0.10)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM10(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10)
+ self.test_obj.slot = SlotM10(H0=0.10, H1=0.10, W0=None, W1=0.10)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM10(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
+ # W1
+ self.test_obj.slot = SlotM10(H0=0.10, H1=0.10, W0=0.10, W1=None)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
def test_set_material(self):
"""Check that you can change the material"""
@@ -155,88 +161,94 @@ def test_set_Wkey(self):
# test if widget is disabled if notch_obj=None
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
- self.material_dict = {LIB_KEY: list(), MACH_KEY: list()}
+ self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.mat1 = Material(name="Steel1")
- notch = Notch(self.mat1, None, None)
+ self.mat2 = Material(name="Steel2")
+ self.material_dict = {LIB_KEY: [self.mat2, self.mat1], MACH_KEY: list()}
+
+ # Empty notch
+ notch = Notch()
self.widget = PMSlot10(
- self.test_obj, material_dict=self.material_dict, notch_obj=None
+ self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
+ assert not self.widget.g_key.isChecked()
+ assert self.widget.unit_W1.isEnabled() == False
+ assert self.widget.in_W1.isEnabled() == False
+ assert self.widget.lf_W1.isEnabled() == False
- assert self.widget.unit_Wkey.isEnabled() == False
- assert self.widget.in_Wkey.isEnabled() == False
- assert self.widget.lf_Wkey.isEnabled() == False
- assert self.widget.unit_Wmag.isEnabled() == True
- assert self.widget.in_Wmag.isEnabled() == True
- assert self.widget.lf_Wmag.isEnabled() == True
-
+ # Notch with key
+ notch = Notch(key_mat=self.mat1)
self.widget = PMSlot10(
self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
assert self.widget.g_key.isChecked()
- assert self.widget.unit_Wkey.isEnabled() == True
- assert self.widget.in_Wkey.isEnabled() == True
- assert self.widget.lf_Wkey.isEnabled() == True
- assert self.widget.unit_Wmag.isHidden() == True
- assert self.widget.in_Wmag.isHidden() == True
- assert self.widget.lf_Wmag.isHidden() == True
+ assert self.widget.unit_W1.isEnabled() == True
+ assert self.widget.in_W1.isEnabled() == True
+ assert self.widget.lf_W1.isEnabled() == True
self.widget.g_key.setChecked(False)
- assert self.widget.unit_Wkey.isEnabled() == False
- assert self.widget.in_Wkey.isEnabled() == False
- assert self.widget.lf_Wkey.isEnabled() == False
+ assert self.widget.notch_obj.key_mat is None
+ assert self.widget.unit_W1.isEnabled() == False
+ assert self.widget.in_W1.isEnabled() == False
+ assert self.widget.lf_W1.isEnabled() == False
self.widget.g_key.setChecked(True)
+ assert self.widget.notch_obj.key_mat.name == "Steel1"
+ assert self.widget.w_key_mat.c_mat_type.currentIndex() == 1
+ assert self.widget.w_key_mat.c_mat_type.currentText() == "Steel1" # default
# Check Unit
- assert self.widget.unit_Wkey.text() == "[m]"
+ assert self.widget.unit_W1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Wkey.clear()
- QTest.keyClicks(self.widget.lf_Wkey, "0.61")
- self.widget.lf_Wkey.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.61")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.61
+ assert self.widget.slot.W1 == 0.61
def test_set_Hkey(self):
"""Check that the Widget allow to update Hkey"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
- self.material_dict = {LIB_KEY: list(), MACH_KEY: list()}
+ self.test_obj.slot = SlotM10(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.mat1 = Material(name="Steel1")
- notch = Notch(self.mat1, None, None)
+ self.mat2 = Material(name="Steel2")
+ self.material_dict = {LIB_KEY: [self.mat2, self.mat1], MACH_KEY: list()}
+ # Empty notch
+ notch = Notch()
self.widget = PMSlot10(
- self.test_obj, material_dict=self.material_dict, notch_obj=None
+ self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
+ assert not self.widget.g_key.isChecked()
+ assert self.widget.unit_H1.isEnabled() == False
+ assert self.widget.in_H1.isEnabled() == False
+ assert self.widget.lf_H1.isEnabled() == False
- assert self.widget.unit_Hkey.isEnabled() == False
- assert self.widget.in_Hkey.isEnabled() == False
- assert self.widget.lf_Hkey.isEnabled() == False
- assert self.widget.unit_Hmag.isEnabled() == True
- assert self.widget.in_Hmag.isEnabled() == True
- assert self.widget.lf_Hmag.isEnabled() == True
-
+ # Notch with key
+ notch = Notch(key_mat=self.mat1)
self.widget = PMSlot10(
self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
assert self.widget.g_key.isChecked()
- assert self.widget.unit_Hkey.isEnabled() == True
- assert self.widget.in_Hkey.isEnabled() == True
- assert self.widget.lf_Hkey.isEnabled() == True
- assert self.widget.unit_Hmag.isHidden() == True
- assert self.widget.in_Hmag.isHidden() == True
- assert self.widget.lf_Hmag.isHidden() == True
+ assert self.widget.unit_H1.isEnabled() == True
+ assert self.widget.in_H1.isEnabled() == True
+ assert self.widget.lf_H1.isEnabled() == True
+
self.widget.g_key.setChecked(False)
- assert self.widget.unit_Hkey.isEnabled() == False
- assert self.widget.in_Hkey.isEnabled() == False
- assert self.widget.lf_Hkey.isEnabled() == False
+ assert self.widget.notch_obj.key_mat is None
+ assert self.widget.unit_H1.isEnabled() == False
+ assert self.widget.in_H1.isEnabled() == False
+ assert self.widget.lf_H1.isEnabled() == False
self.widget.g_key.setChecked(True)
+ assert self.widget.notch_obj.key_mat.name == "Steel1"
+ assert self.widget.w_key_mat.c_mat_type.currentIndex() == 1
+ assert self.widget.w_key_mat.c_mat_type.currentText() == "Steel1" # default
# Check Unit
- assert self.widget.unit_Hkey.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hkey.clear()
- QTest.keyClicks(self.widget.lf_Hkey, "0.61")
- self.widget.lf_Hkey.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.61")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == 0.61
+ assert self.widget.slot.H1 == 0.61
if __name__ == "__main__":
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot11.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot11.py
index 3ad62caa5..08b12ae25 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot11.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot11.py
@@ -31,7 +31,7 @@ class TestPMSlot11(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM11(Zs=8, H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
+ self.test_obj.slot = SlotM11(Zs=8, H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.widget = PMSlot11(self.test_obj, material_dict=self.material_dict)
@classmethod
@@ -52,11 +52,11 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
assert self.widget.c_W0_unit.currentText() == "rad"
- assert self.widget.c_Wmag_unit.currentText() == "rad"
+ assert self.widget.c_W1_unit.currentText() == "rad"
def test_set_W0(self):
"""Check that the Widget allow to update W0"""
@@ -95,42 +95,42 @@ def test_change_unit_W0(self):
assert self.widget.lf_W0.value() == 0.13
assert self.test_obj.slot.W0 == pytest.approx(0.13 * pi / 180, rel=0.1)
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
assert self.widget.c_W0_unit.currentText() == "rad"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
- def test_set_Wmag_deg(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1_deg(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- self.widget.c_Wmag_unit.setCurrentIndex(1)
- assert self.widget.c_Wmag_unit.currentText() == "deg"
+ self.widget.c_W1_unit.setCurrentIndex(1)
+ assert self.widget.c_W1_unit.currentText() == "deg"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "45")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "45")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == pi / 4
- assert self.test_obj.slot.Wmag == pi / 4
+ assert self.widget.slot.W1 == pi / 4
+ assert self.test_obj.slot.W1 == pi / 4
- def test_change_unit_Wmag(self):
- """Check that the value of Wmag is updated if the unit is changed"""
- assert self.widget.lf_Wmag.value() == 0.14
- assert self.widget.c_Wmag_unit.currentText() == "rad"
+ def test_change_unit_W1(self):
+ """Check that the value of W1 is updated if the unit is changed"""
+ assert self.widget.lf_W1.value() == 0.14
+ assert self.widget.c_W1_unit.currentText() == "rad"
- self.widget.c_Wmag_unit.setCurrentIndex(1)
+ self.widget.c_W1_unit.setCurrentIndex(1)
- assert self.widget.c_Wmag_unit.currentText() == "deg"
+ assert self.widget.c_W1_unit.currentText() == "deg"
# Only objet is updated, widget value is the same
- assert self.widget.lf_Wmag.value() == 0.14
- assert self.test_obj.slot.Wmag == pytest.approx(0.14 * pi / 180, rel=0.1)
+ assert self.widget.lf_W1.value() == 0.14
+ assert self.test_obj.slot.W1 == pytest.approx(0.14 * pi / 180, rel=0.1)
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -144,21 +144,21 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM11(H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01)
+ self.test_obj.slot = SlotM11(H0=0.005, H1=0.005, W0=0.01, W1=0.01)
self.widget = PMSlot11(self.test_obj, material_dict=self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005 [m]"
@@ -166,136 +166,141 @@ def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.9)
# H0
- self.test_obj.slot = SlotM11(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10)
+ self.test_obj.slot = SlotM11(H0=None, H1=0.10, W0=0.10, W1=0.10)
self.widget = PMSlot11(self.test_obj, material_dict=self.material_dict)
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM11(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM11(H0=0.10, H1=None, W0=0.10, W1=0.10)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM11(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10)
+ self.test_obj.slot = SlotM11(H0=0.10, H1=0.10, W0=None, W1=0.10)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM11(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
- # Wmag < W0
- self.test_obj.slot = SlotM11(H0=0.10, Hmag=0.10, W0=0.10, Wmag=0.12)
- assert self.widget.check(self.test_obj) == "You must have Wmag <= W0"
- # Wmag < pi/p
- self.test_obj.slot = SlotM11(Zs=8, H0=0.10, Hmag=0.10, W0=pi / 4, Wmag=pi / 4)
+ # W1
+ self.test_obj.slot = SlotM11(H0=0.10, H1=0.10, W0=0.10, W1=None)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
+ # W1 < W0
+ self.test_obj.slot = SlotM11(H0=0.10, H1=0.10, W0=0.10, W1=0.12)
+ assert self.widget.check(self.test_obj) == "You must have W1 <= W0"
+ # W1 < pi/p
+ self.test_obj.slot = SlotM11(Zs=8, H0=0.10, H1=0.10, W0=pi / 4, W1=pi / 4)
assert (
self.widget.check(self.test_obj)
- == "You must have Wmag < pi/p (use ring magnet instead)"
+ == "You must have W1 < pi/p (use ring magnet instead)"
)
- self.test_obj.slot = SlotM11(Zs=12, H0=0.10, Hmag=0.10, W0=0.623, Wmag=0.623)
+ self.test_obj.slot = SlotM11(Zs=12, H0=0.10, H1=0.10, W0=0.623, W1=0.623)
assert (
self.widget.check(self.test_obj)
- == "You must have Wmag < pi/p (use ring magnet instead)"
+ == "You must have W1 < pi/p (use ring magnet instead)"
)
self.test_obj.slot = SlotM11(
- Zs=8, H0=0.10, Hmag=0.10, W0=(pi / 4) * 0.99, Wmag=(pi / 4) * 0.99
+ Zs=8, H0=0.10, H1=0.10, W0=(pi / 4) * 0.99, W1=(pi / 4) * 0.99
)
assert (
self.widget.check(self.test_obj)
- == "You must have Wmag < pi/p (use ring magnet instead)"
+ == "You must have W1 < pi/p (use ring magnet instead)"
)
self.test_obj.slot = SlotM11(
- Zs=8, H0=0.10, Hmag=0.10, W0=(pi / 4) * 0.98, Wmag=(pi / 4) * 0.98
+ Zs=8, H0=0.10, H1=0.10, W0=(pi / 4) * 0.98, W1=(pi / 4) * 0.98
)
assert self.widget.check(self.test_obj) is None
def test_set_Wkey(self):
"""Check that the Widget allow to update Wkey"""
+
+ # test if widget is disabled if notch_obj=None
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM11(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
- self.material_dict = {LIB_KEY: list(), MACH_KEY: list()}
+ self.test_obj.slot = SlotM11(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.mat1 = Material(name="Steel1")
- notch = Notch(self.mat1, None, None)
+ self.mat2 = Material(name="Steel2")
+ self.material_dict = {LIB_KEY: [self.mat2, self.mat1], MACH_KEY: list()}
+ # Empty notch
+ notch = Notch()
self.widget = PMSlot11(
- self.test_obj, material_dict=self.material_dict, notch_obj=None
+ self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
+ assert not self.widget.g_key.isChecked()
+ assert self.widget.c_W1_unit.isEnabled() == False
+ assert self.widget.in_W1.isEnabled() == False
+ assert self.widget.lf_W1.isEnabled() == False
- assert self.widget.c_Wkey_unit.isEnabled() == False
- assert self.widget.in_Wkey.isEnabled() == False
- assert self.widget.lf_Wkey.isEnabled() == False
- assert self.widget.c_Wmag_unit.isEnabled() == True
- assert self.widget.in_Wmag.isEnabled() == True
- assert self.widget.lf_Wmag.isEnabled() == True
-
+ # Notch with key
+ notch = Notch(key_mat=self.mat1)
self.widget = PMSlot11(
self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
-
- assert self.widget.c_Wmag_unit.isHidden() == True
- assert self.widget.in_Wmag.isHidden() == True
- assert self.widget.lf_Wmag.isHidden() == True
+ assert self.widget.g_key.isChecked()
+ assert self.widget.c_W1_unit.isEnabled() == True
+ assert self.widget.in_W1.isEnabled() == True
+ assert self.widget.lf_W1.isEnabled() == True
self.widget.g_key.setChecked(False)
- assert self.widget.c_Wkey_unit.isEnabled() == False
- assert self.widget.in_Wkey.isEnabled() == False
- assert self.widget.lf_Wkey.isEnabled() == False
+ assert self.widget.notch_obj.key_mat is None
+ assert self.widget.c_W1_unit.isEnabled() == False
+ assert self.widget.in_W1.isEnabled() == False
+ assert self.widget.lf_W1.isEnabled() == False
self.widget.g_key.setChecked(True)
- assert self.widget.g_key.isChecked()
- assert self.widget.c_Wkey_unit.isEnabled() == True
- assert self.widget.in_Wkey.isEnabled() == True
- assert self.widget.lf_Wkey.isEnabled() == True
+ assert self.widget.notch_obj.key_mat.name == "Steel1"
+ assert self.widget.w_key_mat.c_mat_type.currentIndex() == 1
+ assert self.widget.w_key_mat.c_mat_type.currentText() == "Steel1" # default
- self.widget.c_Wkey_unit.setCurrentIndex(0)
- assert self.widget.c_Wkey_unit.currentText() == "rad"
+ self.widget.c_W1_unit.setCurrentIndex(0)
+ assert self.widget.c_W1_unit.currentText() == "rad"
- self.widget.c_Wkey_unit.setCurrentIndex(1)
- assert self.widget.c_Wkey_unit.currentText() == "deg"
+ self.widget.c_W1_unit.setCurrentIndex(1)
+ assert self.widget.c_W1_unit.currentText() == "deg"
- self.widget.c_Wkey_unit.setCurrentIndex(0)
+ self.widget.c_W1_unit.setCurrentIndex(0)
# Change value in GUI
- self.widget.lf_Wkey.clear()
- QTest.keyClicks(self.widget.lf_Wkey, "0.61")
- self.widget.lf_Wkey.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.61")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.61
+ assert self.widget.slot.W1 == 0.61
def test_set_Hkey(self):
"""Check that the Widget allow to update Hkey"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM11(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
- self.material_dict = {LIB_KEY: list(), MACH_KEY: list()}
+ self.test_obj.slot = SlotM11(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
self.mat1 = Material(name="Steel1")
- notch = Notch(self.mat1, None, None)
+ self.mat2 = Material(name="Steel2")
+ self.material_dict = {LIB_KEY: [self.mat2, self.mat1], MACH_KEY: list()}
+ # Empty notch
+ notch = Notch()
self.widget = PMSlot11(
- self.test_obj, material_dict=self.material_dict, notch_obj=None
+ self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
+ assert not self.widget.g_key.isChecked()
+ assert self.widget.unit_H1.isEnabled() == False
+ assert self.widget.in_H1.isEnabled() == False
+ assert self.widget.lf_H1.isEnabled() == False
- assert self.widget.unit_Hkey.isEnabled() == False
- assert self.widget.in_Hkey.isEnabled() == False
- assert self.widget.lf_Hkey.isEnabled() == False
- assert self.widget.unit_Hmag.isEnabled() == True
- assert self.widget.in_Hmag.isEnabled() == True
- assert self.widget.lf_Hmag.isEnabled() == True
-
+ # Notch with key
+ notch = Notch(key_mat=self.mat1)
self.widget = PMSlot11(
self.test_obj, material_dict=self.material_dict, notch_obj=notch
)
-
assert self.widget.g_key.isChecked()
- assert self.widget.unit_Hkey.isEnabled() == True
- assert self.widget.in_Hkey.isEnabled() == True
- assert self.widget.lf_Hkey.isEnabled() == True
- assert self.widget.unit_Hmag.isHidden() == True
- assert self.widget.in_Hmag.isHidden() == True
- assert self.widget.lf_Hmag.isHidden() == True
+ assert self.widget.unit_H1.isEnabled() == True
+ assert self.widget.in_H1.isEnabled() == True
+ assert self.widget.lf_H1.isEnabled() == True
+
self.widget.g_key.setChecked(False)
- assert self.widget.unit_Hkey.isEnabled() == False
- assert self.widget.in_Hkey.isEnabled() == False
- assert self.widget.lf_Hkey.isEnabled() == False
+ assert self.widget.notch_obj.key_mat is None
+ assert self.widget.unit_H1.isEnabled() == False
+ assert self.widget.in_H1.isEnabled() == False
+ assert self.widget.lf_H1.isEnabled() == False
self.widget.g_key.setChecked(True)
+ assert self.widget.notch_obj.key_mat.name == "Steel1"
+ assert self.widget.w_key_mat.c_mat_type.currentIndex() == 1
+ assert self.widget.w_key_mat.c_mat_type.currentText() == "Steel1" # default
# Check Unit
- assert self.widget.unit_Hkey.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hkey.clear()
- QTest.keyClicks(self.widget.lf_Hkey, "0.61")
- self.widget.lf_Hkey.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.61")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == 0.61
+ assert self.widget.slot.H1 == 0.61
if __name__ == "__main__":
@@ -303,7 +308,7 @@ def test_set_Hkey(self):
a.setup_class()
a.setup_method()
a.test_change_unit_W0()
- a.test_change_unit_Wmag()
+ a.test_change_unit_W1()
a.test_check()
a.teardown_class()
print("Done")
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot12.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot12.py
index 031639031..34fd91dea 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot12.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot12.py
@@ -21,7 +21,7 @@ class TestPMSlot12(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM12(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15)
+ self.test_obj.slot = SlotM12(H0=0.10, W0=0.13, W1=0.14, H1=0.15)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -54,9 +54,9 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
def test_set_W0(self):
"""Check that the Widget allow to update W0"""
@@ -70,17 +70,17 @@ def test_set_W0(self):
assert self.widget.slot.W0 == 0.31
assert self.test_obj.slot.W0 == 0.31
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- assert self.widget.unit_Wmag.text() == "[m]"
+ assert self.widget.unit_W1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -94,21 +94,21 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM12(H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01)
+ self.test_obj.slot = SlotM12(H0=0.005, H1=0.005, W0=0.01, W1=0.01)
self.widget = PMSlot12(self.test_obj, self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005063 [m]"
@@ -116,18 +116,18 @@ def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
# H0
- self.test_obj.slot = SlotM12(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10)
+ self.test_obj.slot = SlotM12(H0=None, H1=0.10, W0=0.10, W1=0.10)
self.widget = PMSlot12(self.test_obj, self.material_dict)
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM12(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM12(H0=0.10, H1=None, W0=0.10, W1=0.10)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM12(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10)
+ self.test_obj.slot = SlotM12(H0=0.10, H1=0.10, W0=None, W1=0.10)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM12(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
+ # W1
+ self.test_obj.slot = SlotM12(H0=0.10, H1=0.10, W0=0.10, W1=None)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
def test_set_material(self):
"""Check that you can change the material"""
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot13.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot13.py
index 4c586d58d..67ea22213 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot13.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot13.py
@@ -21,7 +21,7 @@ class TestPMSlot13(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM13(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15, Rtopm=0.16)
+ self.test_obj.slot = SlotM13(H0=0.10, W0=0.13, W1=0.14, H1=0.15, Rtopm=0.16)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -54,9 +54,9 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
assert self.widget.lf_Rtopm.value() == 0.16
def test_set_W0(self):
@@ -71,17 +71,17 @@ def test_set_W0(self):
assert self.widget.slot.W0 == 0.31
assert self.test_obj.slot.W0 == 0.31
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- assert self.widget.unit_Wmag.text() == "[m]"
+ assert self.widget.unit_W1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -95,17 +95,17 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_set_Rtopm(self):
"""Check that the Widget allow to update Rtopm"""
@@ -121,9 +121,7 @@ def test_set_Rtopm(self):
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM13(
- H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01, Rtopm=0.02
- )
+ self.test_obj.slot = SlotM13(H0=0.005, H1=0.005, W0=0.01, W1=0.01, Rtopm=0.02)
self.widget = PMSlot13(self.test_obj, self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005063 [m]"
@@ -131,20 +129,20 @@ def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
# H0
- self.test_obj.slot = SlotM13(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM13(H0=None, H1=0.10, W0=0.10, W1=0.10, Rtopm=0.1)
self.widget = PMSlot13(self.test_obj, self.material_dict)
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM13(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM13(H0=0.10, H1=None, W0=0.10, W1=0.10, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM13(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM13(H0=0.10, H1=0.10, W0=None, W1=0.10, Rtopm=0.1)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM13(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
+ # W1
+ self.test_obj.slot = SlotM13(H0=0.10, H1=0.10, W0=0.10, W1=None, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
# Rtopm
- self.test_obj.slot = SlotM13(H0=0.10, Hmag=0.10, W0=0.10, Wmag=0.1, Rtopm=None)
+ self.test_obj.slot = SlotM13(H0=0.10, H1=0.10, W0=0.10, W1=0.1, Rtopm=None)
assert self.widget.check(self.test_obj) == "You must set Rtopm !"
def test_set_material(self):
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot14.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot14.py
index 1b5ccb34d..059c2a509 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot14.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot14.py
@@ -21,7 +21,7 @@ class TestPMSlot14(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM14(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15, Rtopm=0.16)
+ self.test_obj.slot = SlotM14(H0=0.10, W0=0.13, W1=0.14, H1=0.15, Rtopm=0.16)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -55,9 +55,9 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
assert self.widget.lf_Rtopm.value() == 0.16
def test_set_W0(self):
@@ -72,17 +72,17 @@ def test_set_W0(self):
assert self.widget.slot.W0 == 0.31
assert self.test_obj.slot.W0 == 0.31
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- assert self.widget.unit_Wmag.text() == "[rad]"
+ assert self.widget.unit_W1.text() == "[rad]"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -96,17 +96,17 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_set_Rtopm(self):
"""Check that the Widget allow to update Rtopm"""
@@ -122,9 +122,7 @@ def test_set_Rtopm(self):
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM14(
- H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01, Rtopm=0.02
- )
+ self.test_obj.slot = SlotM14(H0=0.005, H1=0.005, W0=0.01, W1=0.01, Rtopm=0.02)
self.widget = PMSlot14(self.test_obj, self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005 [m]"
@@ -132,20 +130,20 @@ def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
# H0
- self.test_obj.slot = SlotM14(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM14(H0=None, H1=0.10, W0=0.10, W1=0.10, Rtopm=0.1)
self.widget = PMSlot14(self.test_obj, self.material_dict)
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM14(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM14(H0=0.10, H1=None, W0=0.10, W1=0.10, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM14(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM14(H0=0.10, H1=0.10, W0=None, W1=0.10, Rtopm=0.1)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM14(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
+ # W1
+ self.test_obj.slot = SlotM14(H0=0.10, H1=0.10, W0=0.10, W1=None, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
# Rtopm
- self.test_obj.slot = SlotM14(H0=0.10, Hmag=0.10, W0=0.10, Wmag=0.1, Rtopm=None)
+ self.test_obj.slot = SlotM14(H0=0.10, H1=0.10, W0=0.10, W1=0.1, Rtopm=None)
assert self.widget.check(self.test_obj) == "You must set Rtopm !"
def test_set_material(self):
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot15.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot15.py
index 34230857e..8d4ae4954 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot15.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot15.py
@@ -21,7 +21,7 @@ class TestPMSlot15(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM15(H0=0.10, W0=0.13, Wmag=0.14, Hmag=0.15, Rtopm=0.16)
+ self.test_obj.slot = SlotM15(H0=0.10, W0=0.13, W1=0.14, H1=0.15, Rtopm=0.16)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -55,9 +55,9 @@ def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
assert self.widget.lf_H0.value() == 0.10
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H1.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
- assert self.widget.lf_Wmag.value() == 0.14
+ assert self.widget.lf_W1.value() == 0.14
assert self.widget.lf_Rtopm.value() == 0.16
def test_set_W0(self):
@@ -72,17 +72,17 @@ def test_set_W0(self):
assert self.widget.slot.W0 == 0.31
assert self.test_obj.slot.W0 == 0.31
- def test_set_Wmag(self):
- """Check that the Widget allow to update Wmag"""
+ def test_set_W1(self):
+ """Check that the Widget allow to update W1"""
# Check Unit
- assert self.widget.unit_Wmag.text() == "[m]"
+ assert self.widget.unit_W1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Wmag.clear()
- QTest.keyClicks(self.widget.lf_Wmag, "0.33")
- self.widget.lf_Wmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_W1.clear()
+ QTest.keyClicks(self.widget.lf_W1, "0.33")
+ self.widget.lf_W1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Wmag == 0.33
- assert self.test_obj.slot.Wmag == 0.33
+ assert self.widget.slot.W1 == 0.33
+ assert self.test_obj.slot.W1 == 0.33
def test_set_H0(self):
"""Check that the Widget allow to update H0"""
@@ -96,17 +96,17 @@ def test_set_H0(self):
assert self.widget.slot.H0 == 0.34
assert self.test_obj.slot.H0 == 0.34
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H1(self):
+ """Check that the Widget allow to update H1"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H1.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H1.clear()
+ QTest.keyClicks(self.widget.lf_H1, "0.36")
+ self.widget.lf_H1.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H1 == pytest.approx(0.36)
+ assert self.test_obj.slot.H1 == pytest.approx(0.36)
def test_set_Rtopm(self):
"""Check that the Widget allow to update Rtopm"""
@@ -122,9 +122,7 @@ def test_set_Rtopm(self):
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM15(
- H0=0.005, Hmag=0.005, W0=0.01, Wmag=0.01, Rtopm=0.02
- )
+ self.test_obj.slot = SlotM15(H0=0.005, H1=0.005, W0=0.01, W1=0.01, Rtopm=0.02)
self.widget = PMSlot15(self.test_obj, self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0.005 [m]"
@@ -132,20 +130,20 @@ def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
# H0
- self.test_obj.slot = SlotM15(H0=None, Hmag=0.10, W0=0.10, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM15(H0=None, H1=0.10, W0=0.10, W1=0.10, Rtopm=0.1)
self.widget = PMSlot15(self.test_obj, self.material_dict)
assert self.widget.check(self.test_obj) == "You must set H0 !"
- # Hmag
- self.test_obj.slot = SlotM15(H0=0.10, Hmag=None, W0=0.10, Wmag=0.10, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H1
+ self.test_obj.slot = SlotM15(H0=0.10, H1=None, W0=0.10, W1=0.10, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set H1 !"
# W0
- self.test_obj.slot = SlotM15(H0=0.10, Hmag=0.10, W0=None, Wmag=0.10, Rtopm=0.1)
+ self.test_obj.slot = SlotM15(H0=0.10, H1=0.10, W0=None, W1=0.10, Rtopm=0.1)
assert self.widget.check(self.test_obj) == "You must set W0 !"
- # Wmag
- self.test_obj.slot = SlotM15(H0=0.10, Hmag=0.10, W0=0.10, Wmag=None, Rtopm=0.1)
- assert self.widget.check(self.test_obj) == "You must set Wmag !"
+ # W1
+ self.test_obj.slot = SlotM15(H0=0.10, H1=0.10, W0=0.10, W1=None, Rtopm=0.1)
+ assert self.widget.check(self.test_obj) == "You must set W1 !"
# Rtopm
- self.test_obj.slot = SlotM15(H0=0.10, Hmag=0.10, W0=0.10, Wmag=0.1, Rtopm=None)
+ self.test_obj.slot = SlotM15(H0=0.10, H1=0.10, W0=0.10, W1=0.1, Rtopm=None)
assert self.widget.check(self.test_obj) == "You must set Rtopm !"
def test_set_material(self):
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot18.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot18.py
index 2ad55106c..b20760eca 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot18.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot18.py
@@ -21,7 +21,7 @@ class TestPMSlot18(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM18(Hmag=0.15)
+ self.test_obj.slot = SlotM18(H0=0.15)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -54,32 +54,32 @@ def teardown_class(cls):
def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H0.value() == 0.15
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H0(self):
+ """Check that the Widget allow to update H0"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H0.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H0.clear()
+ QTest.keyClicks(self.widget.lf_H0, "0.36")
+ self.widget.lf_H0.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H0 == pytest.approx(0.36)
+ assert self.test_obj.slot.H0 == pytest.approx(0.36)
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM18(Hmag=0.005)
+ self.test_obj.slot = SlotM18(H0=0.005)
self.widget = PMSlot18(self.test_obj, self.material_dict)
assert self.widget.w_out.out_slot_height.text() == "Slot height: 0 [m]"
def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- # Hmag
- self.test_obj.slot = SlotM18(Hmag=None)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H0
+ self.test_obj.slot = SlotM18(H0=None)
+ assert self.widget.check(self.test_obj) == "You must set H0 !"
def test_set_material(self):
"""Check that you can change the material"""
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot19.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot19.py
index 73e62ecfe..7023581ea 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot19.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_PMSlot19.py
@@ -21,7 +21,7 @@ class TestPMSlot19(object):
def setup_method(self):
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- self.test_obj.slot = SlotM19(W0=0.13, W1=0.14, Hmag=0.15)
+ self.test_obj.slot = SlotM19(W0=0.13, W1=0.14, H0=0.15)
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
material_dict[LIB_KEY] = [
@@ -55,7 +55,7 @@ def teardown_class(cls):
def test_init(self):
"""Check that the Widget spinbox initialise to the lamination value"""
- assert self.widget.lf_Hmag.value() == 0.15
+ assert self.widget.lf_H0.value() == 0.15
assert self.widget.lf_W0.value() == 0.13
assert self.widget.lf_W1.value() == 0.14
@@ -83,21 +83,21 @@ def test_set_W1(self):
assert self.widget.slot.W1 == 0.33
assert self.test_obj.slot.W1 == 0.33
- def test_set_Hmag(self):
- """Check that the Widget allow to update Hmag"""
+ def test_set_H0(self):
+ """Check that the Widget allow to update H0"""
# Check Unit
- assert self.widget.unit_Hmag.text() == "[m]"
+ assert self.widget.unit_H0.text() == "[m]"
# Change value in GUI
- self.widget.lf_Hmag.clear()
- QTest.keyClicks(self.widget.lf_Hmag, "0.36")
- self.widget.lf_Hmag.editingFinished.emit() # To trigger the slot
+ self.widget.lf_H0.clear()
+ QTest.keyClicks(self.widget.lf_H0, "0.36")
+ self.widget.lf_H0.editingFinished.emit() # To trigger the slot
- assert self.widget.slot.Hmag == pytest.approx(0.36)
- assert self.test_obj.slot.Hmag == pytest.approx(0.36)
+ assert self.widget.slot.H0 == pytest.approx(0.36)
+ assert self.test_obj.slot.H0 == pytest.approx(0.36)
def test_output_txt(self):
"""Check that the Output text is computed and correct"""
- self.test_obj.slot = SlotM19(Hmag=0.005, W0=0.01, W1=0.01)
+ self.test_obj.slot = SlotM19(H0=0.005, W0=0.01, W1=0.01)
self.widget = PMSlot19(
lamination=self.test_obj, material_dict=self.material_dict
)
@@ -106,14 +106,14 @@ def test_output_txt(self):
def test_check(self):
"""Check that the check is working correctly"""
self.test_obj = LamSlotMag(Rint=0.1, Rext=0.2)
- # Hmag
- self.test_obj.slot = SlotM19(Hmag=None, W0=0.10, W1=0.10)
- assert self.widget.check(self.test_obj) == "You must set Hmag !"
+ # H0
+ self.test_obj.slot = SlotM19(H0=None, W0=0.10, W1=0.10)
+ assert self.widget.check(self.test_obj) == "You must set H0 !"
# W0
- self.test_obj.slot = SlotM19(Hmag=0.10, W0=None, W1=0.10)
+ self.test_obj.slot = SlotM19(H0=0.10, W0=None, W1=0.10)
assert self.widget.check(self.test_obj) == "You must set W0 !"
# W1
- self.test_obj.slot = SlotM19(Hmag=0.10, W0=0.10, W1=None)
+ self.test_obj.slot = SlotM19(H0=0.10, W0=0.10, W1=None)
assert self.widget.check(self.test_obj) == "You must set W1 !"
def test_set_material(self):
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_SMSlot.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_SMSlot.py
index 1b61b43ce..87ad9091f 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_SMSlot.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_SMSlot.py
@@ -39,14 +39,12 @@ def setup_method(self):
# For comp_output compatibility
test_obj.stator = LamSlotWind(Rint=0.95, Rext=0.99)
test_obj.rotor = LamSlotMagNS(Rint=0.1, Rext=0.9)
- test_obj.rotor.slot = SlotM11(
- Zs=8, W0=pi / 24, H0=5e-3, Wmag=pi / 24, Hmag=3e-3
- )
+ test_obj.rotor.slot = SlotM11(Zs=8, W0=pi / 24, H0=5e-3, W1=pi / 24, H1=3e-3)
test_obj.rotor.slot_south = SlotM12(
W0=0.0122,
H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W1=0.0122,
+ H1=0.001,
Zs=36,
)
test_obj.rotor.magnet_north.mat_type.name = "test3"
diff --git a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_WSlotMag.py b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_WSlotMag.py
index 866155043..2e0e6f8db 100644
--- a/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_WSlotMag.py
+++ b/Tests/GUI/Dialog/DMachineSetup/PMSlot/test_WSlotMag.py
@@ -44,9 +44,7 @@ def setup_method(self):
# For comp_output compatibility
test_obj.stator = LamSlotWind(Rint=0.95, Rext=0.99)
test_obj.rotor = LamSlotMag(Rint=0.1, Rext=0.9)
- test_obj.rotor.slot = SlotM11(
- Zs=8, W0=pi / 24, H0=5e-3, Wmag=pi / 24, Hmag=3e-3
- )
+ test_obj.rotor.slot = SlotM11(Zs=8, W0=pi / 24, H0=5e-3, W1=pi / 24, H1=3e-3)
test_obj.rotor.magnet.mat_type.name = "test3"
material_dict = {LIB_KEY: list(), MACH_KEY: list()}
diff --git a/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py b/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py
index 517743ec6..a4c233538 100644
--- a/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py
+++ b/Tests/GUI/Dialog/DMachineSetup/test_notche_addition.py
@@ -203,7 +203,7 @@ def test_notch_addition(self):
assert notche_wid.w_notch.lf_W0.value() == W0
notche_wid.w_notch.lf_W0.editingFinished.emit()
- assert notche_wid.check() == "H0 must be higher than 0 or a key must be added"
+ assert notche_wid.check() == "H0 must be higher than 0"
# Removing the notches with null dimensions
b_remove = self.widget.w_step.notches_win.tab_notch.tabBar().tabButton(
diff --git a/Tests/Methods/Converter/test_add_notch.py b/Tests/Methods/Converter/test_add_notch.py
new file mode 100644
index 000000000..964967688
--- /dev/null
+++ b/Tests/Methods/Converter/test_add_notch.py
@@ -0,0 +1,75 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.NotchEvenDist import NotchEvenDist
+from pyleecan.Classes.SlotM19 import SlotM19
+
+
+notch_l = list()
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "PoleNotchDepth": 2,
+ "PoleNotchArc_Outer": 120,
+ "PoleNotchArc_Inner": 140,
+ }
+}
+notch_l.append(
+ {"other_dict": other_dict, "W1": 0.5176380902050414, "W0": 0.601411599008546}
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "PoleNotchDepth": 2,
+ "PoleNotchArc_Outer": 150,
+ "PoleNotchArc_Inner": 100,
+ }
+}
+notch_l.append(
+ {"other_dict": other_dict, "W1": 0.6428789306063232, "W0": 0.4328792278762058}
+)
+
+
+class TestComplexRuleNotch(object):
+ @pytest.mark.parametrize("test_dict", notch_l)
+ def test_add_notch(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.notch.append(NotchEvenDist())
+ machine.rotor.notch[0].notch_shape = SlotM19()
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="add_notch_slotM19", folder="MotorCAD")
+ p = 8 # number of pole
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / p) * (pi / 180), "m": 1}
+ )
+
+ # retreive expected values
+ W0 = test_dict["W0"]
+ W1 = test_dict["W1"]
+
+ # check the convertion
+ msg = f"{machine.rotor.notch[0].notch_shape.W1} expected {W1}"
+ assert machine.rotor.notch[0].notch_shape.W1 == pytest.approx(W1), msg
+ msg = f"{machine.rotor.notch[0].notch_shape.W0} expected {W0}"
+ assert machine.rotor.notch[0].notch_shape.W0 == pytest.approx(W0), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleNotch()
+ for test_dict in notch_l:
+ a.test_add_notch(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_inset_breadloaf_slotM12.py b/Tests/Methods/Converter/test_inset_breadloaf_slotM12.py
new file mode 100644
index 000000000..df2f092d2
--- /dev/null
+++ b/Tests/Methods/Converter/test_inset_breadloaf_slotM12.py
@@ -0,0 +1,67 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotM12 import SlotM12
+
+slotM12_test = list()
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 4,
+ "Magnet_Arc_[ED]": 120,
+ }
+}
+slotM12_test.append(
+ {"other_dict": other_dict, "W1": 0.5155675378442213, "W0": 0.5155675378442213}
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 40,
+ }
+}
+slotM12_test.append(
+ {"other_dict": other_dict, "W1": 0.1729169936113538, "W0": 0.1729169936113538}
+)
+
+
+class TestComplexRuleSlotM12(object):
+ @pytest.mark.parametrize("test_dict", slotM12_test)
+ def test_inset_breadloaf_slotM12(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.slot = SlotM12()
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="inset_breadloaf_slotM12", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # retreive expected values
+ W0 = test_dict["W0"]
+ W1 = test_dict["W1"]
+
+ # check the convertion
+ assert machine.rotor.slot.W1 == pytest.approx(W1)
+ assert machine.rotor.slot.W0 == pytest.approx(W0)
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotM12()
+ for test_dict in slotM12_test:
+ a.test_inset_breadloaf_slotM12(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_inset_parallel_slotM15.py b/Tests/Methods/Converter/test_inset_parallel_slotM15.py
new file mode 100644
index 000000000..c541aec08
--- /dev/null
+++ b/Tests/Methods/Converter/test_inset_parallel_slotM15.py
@@ -0,0 +1,68 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotM15 import SlotM15
+
+
+slotM12_test = list()
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 4,
+ "Magnet_Arc_[ED]": 120,
+ }
+}
+slotM12_test.append(
+ {"other_dict": other_dict, "W1": 0.5155675378442213, "Rtopm": 0.001}
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 40,
+ }
+}
+slotM12_test.append(
+ {"other_dict": other_dict, "W1": 0.1729169936113538, "Rtopm": 0.001}
+)
+
+
+class TestComplexRuleSlotM15(object):
+ @pytest.mark.parametrize("test_dict", slotM12_test)
+ def test_inset_parallel_slotM15(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.slot = SlotM15()
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="inset_breadloaf_slotM12", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # retreive expected values
+ Rtopm = test_dict["Rtopm"]
+ W1 = test_dict["W1"]
+
+ # check the convertion
+ assert machine.rotor.slot.W1 == pytest.approx(W1)
+ assert machine.rotor.slot.Rtopm == pytest.approx(Rtopm)
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotM15()
+ for test_dict in slotM12_test:
+ a.test_inset_parallel_slotM15(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_interior_U_shape_holeM61.py b/Tests/Methods/Converter/test_interior_U_shape_holeM61.py
new file mode 100644
index 000000000..cf961713e
--- /dev/null
+++ b/Tests/Methods/Converter/test_interior_U_shape_holeM61.py
@@ -0,0 +1,49 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineIPMSM import MachineIPMSM
+from pyleecan.Classes.LamHole import LamHole
+from pyleecan.Classes.HoleM61 import HoleM61
+
+
+class TestComplexRuleHoleM61(object):
+ def test_interior_U_shape_holeM61(self):
+ """test rule complex"""
+ # defined other_dict
+ other_dict = {
+ "[Dimensions]": {
+ "UShape_InnerDiameter_Array[0]": 4,
+ "UMagnet_Length_Outer_Array[0]": 0,
+ "UMagnet_Length_Inner_Array[0]": 0,
+ }
+ }
+
+ # Construct the machine in which the hole will be set
+ machine = MachineIPMSM()
+ machine.rotor = LamHole()
+ machine.rotor.hole.append(HoleM61())
+ machine.rotor.is_stator = False
+ machine.rotor.is_internal = True
+
+ # Define and apply the slot rule
+ rule = RuleComplex(
+ fct_name="interior_U_shape_holeM61",
+ folder="MotorCAD",
+ param_dict={"hole_id": 0},
+ )
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # check the convertion
+ assert machine.rotor.hole[0].W1 is None
+ assert machine.rotor.hole[0].W2 is None
+ assert machine.rotor.hole[0].H0 == pytest.approx(0.998)
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleHoleM61()
+ a.test_interior_U_shape_holeM61()
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_rules_equation.py b/Tests/Methods/Converter/test_rules_equation.py
new file mode 100644
index 000000000..d9b1857a3
--- /dev/null
+++ b/Tests/Methods/Converter/test_rules_equation.py
@@ -0,0 +1,129 @@
+import pytest
+
+from pyleecan.Classes.RuleEquation import RuleEquation
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotWind import LamSlotWind
+from pyleecan.Classes.SlotW11 import SlotW11
+
+
+class Test_converter_mot(object):
+ @staticmethod
+ def setup_class(cls):
+ # other_dict of Motror-CAD converter
+ cls.other_dict = {
+ "[Dimensions]": {
+ "Slot_tooth": 15,
+ "Slot_Opening": 12.5,
+ "Slot_Depth": 72,
+ "Slot_2": 6.75,
+ "Slot_3": 6.75,
+ "Slot_4": 3.25,
+ }
+ }
+
+ def test_rule_equation_0(self):
+ """test rule equation"""
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+ machine.stator.slot.W0 = 4
+
+ # Define and apply the slot rule
+ rule = RuleEquation(
+ param=[
+ {
+ "src": "other",
+ "path": ["[Dimensions]", "Slot_Depth"],
+ "variable": "y",
+ },
+ {
+ "src": "pyleecan",
+ "path": f"machine.stator.slot.H2",
+ "variable": "x",
+ },
+ {
+ "src": "pyleecan",
+ "path": f"machine.stator.slot.W0",
+ "variable": "b",
+ },
+ ],
+ unit_type="m",
+ equation="y/3 = b +2*x",
+ )
+
+ machine = rule.convert_to_P(
+ self.other_dict, machine, other_unit_dict={"m": 1 / 3}
+ )
+
+ # check the convertion
+ msg = f"{machine.stator.slot.H2}, should be equal at 2.0"
+ assert abs(machine.stator.slot.H2) == pytest.approx(2.0), msg
+
+ def test_rule_equation_1(self):
+ """test rule equation"""
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+ machine.stator.slot.W0 = 12.5
+ machine.stator.slot.H2 = 5.75
+
+ # Define and apply the slot rule
+ rule = RuleEquation(
+ param=[
+ {
+ "src": "other",
+ "path": ["[Dimensions]", "Slot_Depth"],
+ "variable": "d",
+ },
+ {
+ "src": "other",
+ "path": ["[Dimensions]", "Slot_2"],
+ "variable": "y",
+ },
+ {
+ "src": "other",
+ "path": ["[Dimensions]", "Slot_3"],
+ "variable": "e",
+ },
+ {
+ "src": "other",
+ "path": ["[Dimensions]", "Slot_4"],
+ "variable": "f",
+ },
+ {
+ "src": "pyleecan",
+ "path": f"machine.stator.slot.H2",
+ "variable": "a",
+ },
+ {
+ "src": "pyleecan",
+ "path": f"machine.stator.slot.W0",
+ "variable": "b",
+ },
+ {
+ "src": "pyleecan",
+ "path": f"machine.stator.slot.W1",
+ "variable": "x",
+ },
+ ],
+ unit_type="m",
+ equation="(y/3 - e )/f +d = b +2*x -a ",
+ )
+
+ machine = rule.convert_to_P(self.other_dict, machine, other_unit_dict={"m": 1})
+
+ # check the convertion
+ expected_value = 31.9326923076923
+ msg = f"{machine.stator.slot.W1} expected {expected_value}"
+ assert abs(machine.stator.slot.W1) == pytest.approx(expected_value), msg
+
+
+if __name__ == "__main__":
+ a = Test_converter_mot()
+ a.test_rule_equation_0()
+ a.test_rule_equation_1()
+ print("Done")
diff --git a/Tests/Methods/Converter/test_rules_simple.py b/Tests/Methods/Converter/test_rules_simple.py
new file mode 100644
index 000000000..531c2a5cc
--- /dev/null
+++ b/Tests/Methods/Converter/test_rules_simple.py
@@ -0,0 +1,87 @@
+import pytest
+from numpy import pi
+from pyleecan.Classes.RuleSimple import RuleSimple
+
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotWind import LamSlotWind
+from pyleecan.Classes.SlotW11 import SlotW11
+
+
+class Test_converter_mot(object):
+ @staticmethod
+ def setup_class(cls):
+ # other_dict of Motror-CAD converter
+ cls.other_dict = {
+ "[Dimensions]": {
+ "Slot_tooth": 15,
+ "Slot_Opening": 12.5,
+ "Slot_Depth": 90,
+ }
+ }
+
+ def test_rule_simple_0(self):
+ """test rule simple"""
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+
+ rule = RuleSimple(
+ other_key_list=["[Dimensions]", "Slot_Opening"],
+ P_obj_path=f"machine.stator.slot.W0",
+ unit_type="m",
+ scaling_to_P=1,
+ )
+ # rule simple to set slot.W0
+ machine = rule.convert_to_P(self.other_dict, machine, other_unit_dict={"m": 1})
+
+ # check the convertion
+ expected_value = 12.5
+ msg = f"{machine.stator.slot.W0}, should be equal at {expected_value}"
+ assert abs(machine.stator.slot.W0) == pytest.approx(expected_value), msg
+
+ def test_rule_simple_1(self):
+ """test rule simple"""
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+ rule = RuleSimple(
+ other_key_list=["[Dimensions]", "Slot_tooth"],
+ P_obj_path=f"machine.stator.slot.W2",
+ unit_type="m",
+ scaling_to_P=0.5,
+ )
+ # rule simple to set value, with conversion
+ machine = rule.convert_to_P(self.other_dict, machine, other_unit_dict={"m": 1})
+
+ # check the convertion
+ expected_value = 7.5
+ msg = f"{machine.stator.slot.W2}, should be equal at {expected_value}"
+ assert abs(machine.stator.slot.W2) == pytest.approx(expected_value), msg
+
+ def test_rule_simple_2(self):
+ """test rule simple"""
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+ rule = RuleSimple(
+ other_key_list=["[Dimensions]", "Slot_Depth"],
+ P_obj_path=f"machine.stator.slot.W1",
+ unit_type="deg",
+ scaling_to_P=0.5,
+ )
+ # rule simple to set value, with conversion
+ machine = rule.convert_to_P(
+ self.other_dict, machine, other_unit_dict={"deg": pi / 180}
+ )
+
+ # check the convertion
+ msg = f"{machine.stator.slot.W1}, should be equal at pi / 4"
+ assert abs(machine.stator.slot.W1) == pytest.approx(pi / 4), msg
+
+
+if __name__ == "__main__":
+ a = Test_converter_mot()
+ a.test_rule_simple_0()
+ a.test_rule_simple_1()
+ a.test_rule_simple_2()
+ print("Done")
diff --git a/Tests/Methods/Converter/test_set_pole_pair_number.py b/Tests/Methods/Converter/test_set_pole_pair_number.py
new file mode 100644
index 000000000..4c2fc2a07
--- /dev/null
+++ b/Tests/Methods/Converter/test_set_pole_pair_number.py
@@ -0,0 +1,75 @@
+import pytest
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.MachineIPMSM import MachineIPMSM
+from pyleecan.Classes.LamSlotWind import LamSlotWind
+from pyleecan.Classes.LamHole import LamHole
+from pyleecan.Classes.SlotW11 import SlotW11
+from pyleecan.Classes.HoleM50 import HoleM50
+
+
+class TestComplexRulePolePairNumber(object):
+ @staticmethod
+ def setup_class(cls):
+ # other_dict of Motror-CAD converter
+ cls.other_dict = {
+ "[Dimensions]": {
+ "Pole_Number": 6,
+ }
+ }
+
+ def test_set_pole_pair_number_SPMSM(self):
+ """test rule complex"""
+
+ machine = MachineSIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+ rule = RuleComplex(fct_name="set_pole_pair_number", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(self.other_dict, machine, other_unit_dict=None)
+
+ # check the convertion
+ pole_number = machine.get_pole_pair_number()
+ expected_value = 3
+ msg = f"{pole_number} expected {expected_value}"
+ assert pole_number == pytest.approx(expected_value), msg
+
+ other = rule.convert_to_other(self.other_dict, machine, other_unit_dict=None)
+ pole_number = other["[Dimensions]"]["Pole_Number"]
+ expected_value = 6
+ msg = f"{pole_number} expected {expected_value}"
+ assert pole_number == pytest.approx(expected_value), msg
+
+ def test_set_pole_pair_number_IPMSM(self):
+ """test rule complex"""
+
+ machine = MachineIPMSM()
+ machine.stator = LamSlotWind()
+ machine.stator.slot = SlotW11()
+
+ machine.rotor = LamHole()
+ machine.rotor.hole.append(HoleM50())
+ rule = RuleComplex(fct_name="set_pole_pair_number", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(self.other_dict, machine, other_unit_dict=None)
+
+ # check the convertion
+ pole_number = machine.get_pole_pair_number()
+ expected_value = 3
+ msg = f"{pole_number} expected {expected_value}"
+ assert pole_number == pytest.approx(expected_value), msg
+
+ other = rule.convert_to_other(self.other_dict, machine, other_unit_dict=None)
+ pole_number = other["[Dimensions]"]["Pole_Number"]
+ expected_value = 6
+ msg = f"{pole_number} expected {expected_value}"
+ assert pole_number == pytest.approx(6), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRulePolePairNumber()
+ a.test_set_pole_pair_number_SIPMSM()
+ a.test_set_pole_pair_number_IPMSM()
+ print("Done")
diff --git a/Tests/Methods/Converter/test_slotW11_H1.py b/Tests/Methods/Converter/test_slotW11_H1.py
new file mode 100644
index 000000000..3adf2acd5
--- /dev/null
+++ b/Tests/Methods/Converter/test_slotW11_H1.py
@@ -0,0 +1,44 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlot import LamSlot
+from pyleecan.Classes.SlotW11 import SlotW11
+
+
+class TestComplexRuleSlotW11(object):
+ def test_slotW11_H1(self):
+ """test rule complex"""
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.stator = LamSlot()
+ machine.stator.slot = SlotW11()
+
+ machine.stator.slot.W0 = 0.0024
+ machine.stator.slot.W3 = 0.079
+ machine.stator.slot.H0 = 0.0006
+ machine.stator.slot.H1 = 38
+ machine.stator.slot.H2 = 0.033118584
+ machine.stator.slot.R1 = 0.00423
+ machine.stator.slot.H1_is_rad = True
+ machine.stator.slot.is_cstt_tooth = True
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="slotW11_H1", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict={}, machine=machine, other_unit_dict={"deg": pi / 180}
+ )
+
+ # check the convertion
+ excepted_value = 0.01070256
+ msg = f"{machine.stator.slot.H1} expected {excepted_value}"
+ assert machine.stator.slot.H1 == pytest.approx(excepted_value), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotW11()
+ a.test_slotW11_H1()
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_slotW21_H1.py b/Tests/Methods/Converter/test_slotW21_H1.py
new file mode 100644
index 000000000..175b8d5f8
--- /dev/null
+++ b/Tests/Methods/Converter/test_slotW21_H1.py
@@ -0,0 +1,42 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlot import LamSlot
+from pyleecan.Classes.SlotW21 import SlotW21
+
+
+class TestComplexRuleSlotW21(object):
+ def test_slotW21_H1(self):
+ """test rule complex"""
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.stator = LamSlot()
+ machine.stator.slot = SlotW21()
+
+ machine.stator.slot.W0 = 0.0024
+ machine.stator.slot.W1 = 0.0044
+ machine.stator.slot.W2 = 0.0034
+ machine.stator.slot.H0 = 0.0006
+ machine.stator.slot.H1 = 45
+ machine.stator.slot.H2 = 0.033118584
+ machine.stator.slot.H1_is_rad = True
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="slotW21_H1", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict={}, machine=machine, other_unit_dict={"deg": pi / 180}
+ )
+
+ excepted_value = 0.001619775
+ msg = f"{machine.stator.slot.H1} expected {excepted_value}"
+ assert machine.stator.slot.H1 == pytest.approx(excepted_value), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotW21()
+ a.test_slotW21_H1()
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_slotW23_H1.py b/Tests/Methods/Converter/test_slotW23_H1.py
new file mode 100644
index 000000000..9931c4fd6
--- /dev/null
+++ b/Tests/Methods/Converter/test_slotW23_H1.py
@@ -0,0 +1,43 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlot import LamSlot
+from pyleecan.Classes.SlotW23 import SlotW23
+
+
+class TestComplexRuleSlotW23(object):
+ def test_slotW23_H1(self):
+ """test rule complex"""
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.stator = LamSlot()
+ machine.stator.slot = SlotW23()
+
+ machine.stator.slot.W0 = 0.0024
+ machine.stator.slot.W1 = 0.0044
+ machine.stator.slot.W2 = 0.0034
+ machine.stator.slot.H0 = 0.0006
+ machine.stator.slot.H1 = 45
+ machine.stator.slot.H2 = 0.033118584
+ machine.stator.slot.H1_is_rad = True
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="slotW23_H1", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict={}, machine=machine, other_unit_dict={"deg": pi / 180}
+ )
+
+ # check the convertion
+ excepted_value = 0.001619775
+ msg = f"{machine.stator.slot.H1} expected {excepted_value}"
+ assert machine.stator.slot.H1 == pytest.approx(excepted_value), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotW23()
+ a.test_slotW23_H1()
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_surface_breadloaf_slotM13.py b/Tests/Methods/Converter/test_surface_breadloaf_slotM13.py
new file mode 100644
index 000000000..1ca6e6cfb
--- /dev/null
+++ b/Tests/Methods/Converter/test_surface_breadloaf_slotM13.py
@@ -0,0 +1,126 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotM13 import SlotM13
+
+slotM13_test = list()
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 4,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 1,
+ }
+}
+
+slotM13_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5197086425658616,
+ "W0": 0.5197086425658616,
+ "Rtopm": 0.9726990498218554,
+ }
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 7,
+ }
+}
+
+slotM13_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5217791949266818,
+ "Rtopm": 0.8382690097619138,
+ }
+)
+
+
+# Magnet_Reduction = Magnet_Thickness max
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 8,
+ }
+}
+
+# Magnet_Reduction = 0, no reduction
+slotM13_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5217791949266818,
+ "Rtopm": 0.8195940784563265,
+ }
+)
+
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 0,
+ }
+}
+
+slotM13_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5217791949266818,
+ "Rtopm": 1.000000000000001,
+ }
+)
+
+
+class TestComplexRuleSlotM13(object):
+ @pytest.mark.parametrize("test_dict", slotM13_test)
+ def test_surface_breadloaf_slotM13(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.slot = SlotM13()
+
+ machine.rotor.slot.H0 = 0.01
+ machine.rotor.slot.H1 = 0.02
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="surface_breadloaf_slotM13", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # retreive expected values
+ W0 = test_dict["W0"]
+ W1 = test_dict["W1"]
+ Rtopm = test_dict["Rtopm"]
+
+ # check the convertion
+ msg = f"{machine.rotor.slot.W0} expected {W0}"
+ assert machine.rotor.slot.W0 == pytest.approx(W0), msg
+ msg = f"{machine.rotor.slot.W1} expected {W1}"
+ assert machine.rotor.slot.W1 == pytest.approx(W1), msg
+ msg = f"{machine.rotor.slot.Rtopm} expected {Rtopm}"
+ assert machine.rotor.slot.Rtopm == pytest.approx(Rtopm), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotM13()
+ for test_dict in slotM13_test:
+ a.test_surface_breadloaf_slotM13(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_surface_parallel_slotM15.py b/Tests/Methods/Converter/test_surface_parallel_slotM15.py
new file mode 100644
index 000000000..eeebe8d22
--- /dev/null
+++ b/Tests/Methods/Converter/test_surface_parallel_slotM15.py
@@ -0,0 +1,125 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotM15 import SlotM15
+
+
+slotM15_test = list()
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 4,
+ "Magnet_Arc_[ED]": 120,
+ "Magnet_Reduction": 1,
+ }
+}
+
+slotM15_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5197086425658616,
+ "W0": 0.5084631986262793,
+ "Rtopm": 0.9764715541024068,
+ }
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "Magnet_Reduction": 7,
+ }
+}
+
+slotM15_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5104022927682093,
+ "Rtopm": 0.8437532376408229,
+ }
+)
+
+# Magnet_Reduction = Magnet_Thickness max
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "Magnet_Reduction": 8,
+ }
+}
+
+# Magnet_Reduction = 0, no reduction
+slotM15_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5104022927682093,
+ "Rtopm": 0.8248165743381716,
+ }
+)
+
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "Magnet_Reduction": 0,
+ }
+}
+
+slotM15_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5217791949266818,
+ "W0": 0.5104022927682093,
+ "Rtopm": 1.0080000000000011,
+ }
+)
+
+
+class TestComplexRuleSlotM15(object):
+ @pytest.mark.parametrize("test_dict", slotM15_test)
+ def test_surface_parallel_slotM15(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.slot = SlotM15()
+
+ machine.rotor.slot.H0 = 0.01
+ machine.rotor.slot.H1 = 0.02
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="surface_parallel_slotM15", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # retreive expected values
+ W0 = test_dict["W0"]
+ W1 = test_dict["W1"]
+ Rtopm = test_dict["Rtopm"]
+
+ # check the convertion
+ msg = f"{machine.rotor.slot.W0} expected {W0}"
+ assert machine.rotor.slot.W0 == pytest.approx(W0), msg
+ msg = f"{machine.rotor.slot.W1} expected {W1}"
+ assert machine.rotor.slot.W1 == pytest.approx(W1), msg
+ msg = f"{machine.rotor.slot.Rtopm} expected {Rtopm}"
+ assert machine.rotor.slot.Rtopm == pytest.approx(Rtopm), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotM15()
+ for test_dict in slotM15_test:
+ a.test_surface_parallel_slotM15(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Converter/test_surface_radial_slotM14.py b/Tests/Methods/Converter/test_surface_radial_slotM14.py
new file mode 100644
index 000000000..d563bcb1f
--- /dev/null
+++ b/Tests/Methods/Converter/test_surface_radial_slotM14.py
@@ -0,0 +1,126 @@
+import pytest
+from numpy import pi
+
+from pyleecan.Classes.RuleComplex import RuleComplex
+from pyleecan.Classes.MachineSIPMSM import MachineSIPMSM
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotM14 import SlotM14
+
+
+slotM14_test = list()
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 4,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 1,
+ }
+}
+
+slotM14_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5084631986262793,
+ "W0": 0.5084631986262793,
+ "Rtopm": 0.97795161891461,
+ }
+)
+
+# Common values
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 7,
+ }
+}
+
+slotM14_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5104022927682093,
+ "W0": 0.5104022927682093,
+ "Rtopm": 0.8529842972222449,
+ }
+)
+
+# Magnet_Reduction = Magnet_Thickness max
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 8,
+ }
+}
+
+# Magnet_Reduction = 0, no reduction
+slotM14_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5104022927682093,
+ "W0": 0.5104022927682093,
+ "Rtopm": 0.8351690217446512,
+ }
+)
+
+other_dict = {
+ "[Dimensions]": {
+ "Magnet_Thickness": 8,
+ "Magnet_Arc_[ED]": 120,
+ "MagnetReduction": 0,
+ }
+}
+
+slotM14_test.append(
+ {
+ "other_dict": other_dict,
+ "W1": 0.5104022927682093,
+ "W0": 0.5104022927682093,
+ "Rtopm": 1.0079999999999996,
+ }
+)
+
+
+class TestComplexRuleSlotM14(object):
+ @pytest.mark.parametrize("test_dict", slotM14_test)
+ def test_surface_radial_slotM14(self, test_dict):
+ """test rule complex"""
+
+ # retreive other_dict
+ other_dict = test_dict["other_dict"]
+
+ # Construct the machine in which the slot will be set
+ machine = MachineSIPMSM()
+ machine.rotor = LamSlotMag()
+ machine.rotor.slot = SlotM14()
+
+ machine.rotor.slot.H0 = 0.01
+ machine.rotor.slot.H1 = 0.02
+
+ # Define and apply the slot rule
+ rule = RuleComplex(fct_name="surface_radial_slotM14", folder="MotorCAD")
+ # first rule complex use to define a slot
+ machine = rule.convert_to_P(
+ other_dict, machine, {"ED": (2 / 8) * (pi / 180), "m": 0.001}
+ )
+
+ # retreive expected values
+ W0 = test_dict["W0"]
+ W1 = test_dict["W1"]
+ Rtopm = test_dict["Rtopm"]
+
+ # check the convertion
+ msg = f"{machine.rotor.slot.W0} expected {W0}"
+ assert machine.rotor.slot.W0 == pytest.approx(W0), msg
+ msg = f"{machine.rotor.slot.W1} expected {W1}"
+ assert machine.rotor.slot.W1 == pytest.approx(W1), msg
+ msg = f"{machine.rotor.slot.Rtopm} expected {Rtopm}"
+ assert machine.rotor.slot.Rtopm == pytest.approx(Rtopm), msg
+
+
+if __name__ == "__main__":
+ a = TestComplexRuleSlotM14()
+ for test_dict in slotM14_test:
+ a.test_surface_radial_slotM14(test_dict)
+ print("Test Done")
diff --git a/Tests/Methods/Simulation/test_magelmer.py b/Tests/Methods/Simulation/test_magelmer.py
index 5a4df6c5c..fe7d11f6e 100644
--- a/Tests/Methods/Simulation/test_magelmer.py
+++ b/Tests/Methods/Simulation/test_magelmer.py
@@ -120,9 +120,9 @@ def test_ipm_Elmer():
def test_spm_Elmer():
# Import the machine from a script
PMSM_A = load(join(DATA_DIR, "Machine", "SPMSM_001.json"))
- PMSM_A.rotor.slot = SlotM10(Wmag=15e-3, Hmag=3e-3, H0=0.0, W0=15e-3, Zs=8)
+ PMSM_A.rotor.slot = SlotM10(W1=15e-3, H1=3e-3, H0=0.0, W0=15e-3, Zs=8)
# PMSM_A.rotor.slot = SlotMFlat(H0=0.0, W0=15e-3, Zs=8)
- # PMSM_A.rotor.slot.magnet = [MagnetType10(Wmag=15e-3, Hmag=3e-3)]
+ # PMSM_A.rotor.slot.magnet = [MagnetType10(W1=15e-3, H1=3e-3)]
mesh_dict["Lamination_Rotor_Bore_Radius_Ext"] = 20
# Create the Simulation
diff --git a/Tests/Methods/Slot/test_SlotM10_meth.py b/Tests/Methods/Slot/test_SlotM10_meth.py
index b15b66049..66e7e2fdd 100644
--- a/Tests/Methods/Slot/test_SlotM10_meth.py
+++ b/Tests/Methods/Slot/test_SlotM10_meth.py
@@ -12,7 +12,7 @@
Mag10_test = list()
# Internal Slot
lam = LamSlotMag(is_internal=True, Rext=0.1325)
-lam.slot = SlotM10(Hmag=5e-3, Wmag=10e-3, H0=5e-3, W0=10e-3, Zs=12)
+lam.slot = SlotM10(H1=5e-3, W1=10e-3, H0=5e-3, W0=10e-3, Zs=12)
Mag10_test.append(
{
"test_obj": lam,
@@ -27,7 +27,7 @@
# Outward Slot
lam = LamSlotMag(is_internal=False, Rint=0.1325)
-lam.slot = SlotM10(Hmag=5e-3, Wmag=10e-3, H0=5e-3, W0=10e-3, Zs=12)
+lam.slot = SlotM10(H1=5e-3, W1=10e-3, H0=5e-3, W0=10e-3, Zs=12)
Mag10_test.append(
{
"test_obj": lam,
diff --git a/Tests/Methods/Slot/test_SlotM11_meth.py b/Tests/Methods/Slot/test_SlotM11_meth.py
index f85ca2e3e..2dedc7e4d 100644
--- a/Tests/Methods/Slot/test_SlotM11_meth.py
+++ b/Tests/Methods/Slot/test_SlotM11_meth.py
@@ -15,7 +15,7 @@
Mag11_test = list()
# Internal Slot surface
lam = LamSlotMag(is_internal=True, Rext=0.5)
-lam.slot = SlotM11(Hmag=1, Wmag=pi / 4, H0=0, W0=pi / 4, Zs=4)
+lam.slot = SlotM11(H1=1, W1=pi / 4, H0=0, W0=pi / 4, Zs=4)
Mag11_test.append(
{
"test_obj": lam,
@@ -29,7 +29,7 @@
# Internal Slot inset
lam = LamSlotMag(is_internal=True, Rext=0.5)
-lam.slot = SlotM11(Hmag=20e-3, Wmag=pi / 4, H0=40e-3, W0=pi / 4, Zs=4)
+lam.slot = SlotM11(H1=20e-3, W1=pi / 4, H0=40e-3, W0=pi / 4, Zs=4)
Mag11_test.append(
{
"test_obj": lam,
@@ -43,7 +43,7 @@
# Outward Slot inset
lam = LamSlotMag(is_internal=False, Rint=0.1325)
-lam.slot = SlotM11(Hmag=8e-3, Wmag=pi / 12, H0=5e-3, W0=pi / 10, Zs=8)
+lam.slot = SlotM11(H1=8e-3, W1=pi / 12, H0=5e-3, W0=pi / 10, Zs=8)
Mag11_test.append(
{
"test_obj": lam,
diff --git a/Tests/Methods/Slot/test_SlotM12_meth.py b/Tests/Methods/Slot/test_SlotM12_meth.py
index 5e05a710d..fe56d9385 100644
--- a/Tests/Methods/Slot/test_SlotM12_meth.py
+++ b/Tests/Methods/Slot/test_SlotM12_meth.py
@@ -12,7 +12,7 @@
Mag12_test = list()
# Internal Slot
lam = LamSlotMag(is_internal=True, Rext=0.1325)
-lam.slot = SlotM12(H0=5e-3, W0=10e-3, Zs=12, Hmag=5e-3, Wmag=10e-3)
+lam.slot = SlotM12(H0=5e-3, W0=10e-3, Zs=12, H1=5e-3, W1=10e-3)
Mag12_test.append(
{
"test_obj": lam,
@@ -27,7 +27,7 @@
# Outward Slot
lam = LamSlotMag(is_internal=False, Rint=0.1325)
-lam.slot = SlotM12(H0=5e-3, W0=10e-3, Zs=12, Hmag=5e-3, Wmag=10e-3)
+lam.slot = SlotM12(H0=5e-3, W0=10e-3, Zs=12, H1=5e-3, W1=10e-3)
Mag12_test.append(
{
"test_obj": lam,
@@ -153,8 +153,8 @@ def test_comp_point_coordinate(self, test_dict):
ZM4 = point_dict["ZM4"]
W0 = test_obj.slot.W0
H0 = test_obj.slot.H0
- Wmag = test_obj.slot.Wmag
- Hmag = test_obj.slot.Hmag
+ W1 = test_obj.slot.W1
+ H1 = test_obj.slot.H1
assert abs(Z1 - Z4) == pytest.approx(W0, rel=DELTA)
assert abs(Z2 - Z3) == pytest.approx(W0, rel=DELTA)
@@ -162,12 +162,12 @@ def test_comp_point_coordinate(self, test_dict):
assert abs(Z3 - Z4) == pytest.approx(H0, rel=DELTA)
if test_obj.is_internal:
- assert ZM0 == pytest.approx(Z1.real + Hmag - H0, rel=DELTA)
+ assert ZM0 == pytest.approx(Z1.real + H1 - H0, rel=DELTA)
else:
- assert ZM0 == pytest.approx(Z1.real - Hmag + H0, rel=DELTA)
- assert abs(ZM1 - ZM4) == pytest.approx(Wmag, rel=DELTA)
- assert abs(ZM2 - ZM3) == pytest.approx(Wmag, rel=DELTA)
- assert abs(ZM0 - (Z2 + Z3) / 2) == pytest.approx(Hmag, rel=DELTA)
+ assert ZM0 == pytest.approx(Z1.real - H1 + H0, rel=DELTA)
+ assert abs(ZM1 - ZM4) == pytest.approx(W1, rel=DELTA)
+ assert abs(ZM2 - ZM3) == pytest.approx(W1, rel=DELTA)
+ assert abs(ZM0 - (Z2 + Z3) / 2) == pytest.approx(H1, rel=DELTA)
assert abs(ZM2) == pytest.approx(abs(ZM0), rel=DELTA)
assert abs(ZM3) == pytest.approx(abs(ZM0), rel=DELTA)
diff --git a/Tests/Methods/Slot/test_SlotM13_meth.py b/Tests/Methods/Slot/test_SlotM13_meth.py
index 753a108bb..bb69a4d77 100644
--- a/Tests/Methods/Slot/test_SlotM13_meth.py
+++ b/Tests/Methods/Slot/test_SlotM13_meth.py
@@ -10,7 +10,7 @@
Mag13_test = list()
# Internal Slot inset
lam = LamSlotMag(Rint=40e-3, Rext=90e-3, is_internal=True)
-lam.slot = SlotM13(Zs=8, W0=0.04, H0=0.02, Hmag=0.02, Wmag=0.04, Rtopm=0.04)
+lam.slot = SlotM13(Zs=8, W0=0.04, H0=0.02, H1=0.02, W1=0.04, Rtopm=0.04)
Mag13_test.append(
{
"test_obj": lam,
@@ -25,7 +25,7 @@
# external slot inset
lam = LamSlotMag(Rint=110e-3, Rext=200e-3, is_internal=False)
-lam.slot = SlotM13(Zs=4, W0=0.04, H0=0.025, Hmag=0.02, Wmag=0.04, Rtopm=0.04)
+lam.slot = SlotM13(Zs=4, W0=0.04, H0=0.025, H1=0.02, W1=0.04, Rtopm=0.04)
Mag13_test.append(
{
"test_obj": lam,
@@ -40,7 +40,7 @@
# Internal slot surface
lam = LamSlotMag(Rint=40e-3, Rext=90e-3, is_internal=True)
-lam.slot = SlotM13(Zs=4, W0=0.08, H0=0, Hmag=0.02, Wmag=0.08, Rtopm=0.0601)
+lam.slot = SlotM13(Zs=4, W0=0.08, H0=0, H1=0.02, W1=0.08, Rtopm=0.0601)
Mag13_test.append(
{
"test_obj": lam,
@@ -166,8 +166,8 @@ def test_comp_point_coordinate(self, test_dict):
ZM4 = point_dict["ZM4"]
W0 = test_obj.slot.W0
H0 = test_obj.slot.H0
- Wmag = test_obj.slot.Wmag
- Hmag = test_obj.slot.Hmag
+ W1 = test_obj.slot.W1
+ H1 = test_obj.slot.H1
assert abs(Z1 - Z4) == pytest.approx(W0, rel=DELTA)
assert abs(Z2 - Z3) == pytest.approx(W0, rel=DELTA)
@@ -175,9 +175,9 @@ def test_comp_point_coordinate(self, test_dict):
assert abs(Z3 - Z4) == pytest.approx(H0, rel=DELTA)
if test_obj.is_internal:
- assert ZM0 == pytest.approx(Z1.real + Hmag - H0, rel=DELTA)
+ assert ZM0 == pytest.approx(Z1.real + H1 - H0, rel=DELTA)
else:
- assert ZM0 == pytest.approx(Z1.real - Hmag + H0, rel=DELTA)
- assert abs(ZM1 - ZM4) == pytest.approx(Wmag, rel=DELTA)
- assert abs(ZM2 - ZM3) == pytest.approx(Wmag, rel=DELTA)
- assert abs(ZM0 - (Z2 + Z3) / 2) == pytest.approx(Hmag, rel=DELTA)
+ assert ZM0 == pytest.approx(Z1.real - H1 + H0, rel=DELTA)
+ assert abs(ZM1 - ZM4) == pytest.approx(W1, rel=DELTA)
+ assert abs(ZM2 - ZM3) == pytest.approx(W1, rel=DELTA)
+ assert abs(ZM0 - (Z2 + Z3) / 2) == pytest.approx(H1, rel=DELTA)
diff --git a/Tests/Methods/Slot/test_SlotM14_meth.py b/Tests/Methods/Slot/test_SlotM14_meth.py
index 4e1588851..e75eab0fd 100644
--- a/Tests/Methods/Slot/test_SlotM14_meth.py
+++ b/Tests/Methods/Slot/test_SlotM14_meth.py
@@ -11,7 +11,7 @@
Mag14_test = list()
# Internal Slot inset
lam = LamSlotMag(Rint=40e-3, Rext=90e-3, is_internal=True)
-lam.slot = SlotM14(Zs=4, W0=0.628, H0=0.02, Hmag=0.02, Wmag=0.628, Rtopm=0.04)
+lam.slot = SlotM14(Zs=4, W0=0.628, H0=0.02, H1=0.02, W1=0.628, Rtopm=0.04)
Mag14_test.append(
{
"test_obj": lam,
@@ -26,7 +26,7 @@
# Internal slot surface
lam = LamSlotMag(Rint=40e-3, Rext=90e-3, is_internal=True)
-lam.slot = SlotM14(Zs=8, W0=0.628, H0=0, Hmag=0.02, Wmag=0.628, Rtopm=0.05)
+lam.slot = SlotM14(Zs=8, W0=0.628, H0=0, H1=0.02, W1=0.628, Rtopm=0.05)
Mag14_test.append(
{
"test_obj": lam,
@@ -152,8 +152,8 @@ def test_comp_point_coordinate(self, test_dict):
ZM4 = point_dict["ZM4"]
W0 = test_obj.slot.W0
H0 = test_obj.slot.H0
- Wmag = test_obj.slot.Wmag
- Hmag = test_obj.slot.Hmag
+ W1 = test_obj.slot.W1
+ H1 = test_obj.slot.H1
Rbo = test_obj.get_Rbo()
assert abs(Z1) == pytest.approx(Rbo, rel=DELTA)
@@ -170,11 +170,11 @@ def test_comp_point_coordinate(self, test_dict):
assert angle(Z3) == pytest.approx(W0 / 2, rel=DELTA)
assert angle(ZM1) == pytest.approx(angle(ZM2), rel=DELTA)
- assert angle(ZM1) == pytest.approx(-Wmag / 2, rel=DELTA)
+ assert angle(ZM1) == pytest.approx(-W1 / 2, rel=DELTA)
assert angle(ZM3) == pytest.approx(angle(ZM4), rel=DELTA)
- assert angle(ZM3) == pytest.approx(Wmag / 2, rel=DELTA)
+ assert angle(ZM3) == pytest.approx(W1 / 2, rel=DELTA)
if test_obj.is_internal:
- assert ZM0 == pytest.approx(Rbo + Hmag - H0, rel=DELTA)
+ assert ZM0 == pytest.approx(Rbo + H1 - H0, rel=DELTA)
else:
- assert ZM0 == pytest.approx(Rbo - Hmag + H0, rel=DELTA)
+ assert ZM0 == pytest.approx(Rbo - H1 + H0, rel=DELTA)
diff --git a/Tests/Methods/Slot/test_SlotM15_meth.py b/Tests/Methods/Slot/test_SlotM15_meth.py
index 26097e7c2..d4c803850 100644
--- a/Tests/Methods/Slot/test_SlotM15_meth.py
+++ b/Tests/Methods/Slot/test_SlotM15_meth.py
@@ -14,7 +14,7 @@
# Internal Slot inset magnet with same top and bottom radius
lam = LamSlotMag(Rint=40 * mm, Rext=110 * mm, is_internal=True)
lam.slot = SlotM15(
- Zs=4, W0=80 * pi / 180, H0=10 * mm, Hmag=20 * mm, Wmag=100 * mm, Rtopm=100 * mm
+ Zs=4, W0=80 * pi / 180, H0=10 * mm, H1=20 * mm, W1=100 * mm, Rtopm=100 * mm
)
Mag15_test.append(
{
@@ -31,7 +31,7 @@
# Internal Slot inset magnet with same top and bottom radius
lam = LamSlotMag(Rint=40 * mm, Rext=110 * mm, is_internal=True)
lam.slot = SlotM15(
- Zs=4, W0=80 * pi / 180, H0=20 * mm, Hmag=20 * mm, Wmag=100 * mm, Rtopm=100 * mm
+ Zs=4, W0=80 * pi / 180, H0=20 * mm, H1=20 * mm, W1=100 * mm, Rtopm=100 * mm
)
Mag15_test.append(
{
@@ -48,7 +48,7 @@
# Internal slot surface magnet with same top and bottom radius
lam = LamSlotMag(Rint=40 * mm, Rext=100 * mm, is_internal=True)
lam.slot = SlotM15(
- Zs=4, W0=80 * pi / 180, H0=0 * mm, Hmag=20 * mm, Wmag=100 * mm, Rtopm=100 * mm
+ Zs=4, W0=80 * pi / 180, H0=0 * mm, H1=20 * mm, W1=100 * mm, Rtopm=100 * mm
)
Mag15_test.append(
{
@@ -65,7 +65,7 @@
# Internal slot surface magnet with different top and bottom radius
lam = LamSlotMag(Rint=40 * mm, Rext=100 * mm, is_internal=True)
lam.slot = SlotM15(
- Zs=4, W0=80 * pi / 180, H0=0 * mm, Hmag=20 * mm, Wmag=100 * mm, Rtopm=65 * mm
+ Zs=4, W0=80 * pi / 180, H0=0 * mm, H1=20 * mm, W1=100 * mm, Rtopm=65 * mm
)
Mag15_test.append(
{
@@ -192,8 +192,8 @@ def test_comp_point_coordinate(self, test_dict):
ZM4 = point_dict["ZM4"]
W0 = test_obj.slot.W0
H0 = test_obj.slot.H0
- Wmag = test_obj.slot.Wmag
- Hmag = test_obj.slot.Hmag
+ W1 = test_obj.slot.W1
+ H1 = test_obj.slot.H1
Rbo = test_obj.get_Rbo()
# Polar Slot
@@ -216,10 +216,10 @@ def test_comp_point_coordinate(self, test_dict):
# Parallel side
assert ZM1.imag == pytest.approx(ZM2.imag, rel=DELTA)
assert ZM3.imag == pytest.approx(ZM4.imag, rel=DELTA)
- assert ZM1.imag == pytest.approx(-Wmag / 2, rel=DELTA)
- assert ZM3.imag == pytest.approx(Wmag / 2, rel=DELTA)
- # Hmag def
+ assert ZM1.imag == pytest.approx(-W1 / 2, rel=DELTA)
+ assert ZM3.imag == pytest.approx(W1 / 2, rel=DELTA)
+ # H1 def
if test_obj.is_internal:
- assert ZM0 == pytest.approx(abs(Z2) + Hmag, rel=DELTA)
+ assert ZM0 == pytest.approx(abs(Z2) + H1, rel=DELTA)
else:
- assert ZM0 == pytest.approx(abs(Z2) - Hmag, rel=DELTA)
+ assert ZM0 == pytest.approx(abs(Z2) - H1, rel=DELTA)
diff --git a/Tests/Methods/Slot/test_SlotM18_meth.py b/Tests/Methods/Slot/test_SlotM18_meth.py
index 4c9d920d3..00c633f23 100644
--- a/Tests/Methods/Slot/test_SlotM18_meth.py
+++ b/Tests/Methods/Slot/test_SlotM18_meth.py
@@ -15,7 +15,7 @@
Mag18_test = list()
# Internal Lamination
lam = LamSlotMag(is_internal=True, Rext=0.5)
-lam.slot = SlotM18(Hmag=0.1, Zs=4)
+lam.slot = SlotM18(H0=0.1, Zs=4)
Mag18_test.append(
{
"test_obj": lam,
@@ -29,7 +29,7 @@
# External Lamination
lam = LamSlotMag(is_internal=False, Rint=0.1325)
-lam.slot = SlotM18(Hmag=2.5e-3, Zs=8)
+lam.slot = SlotM18(H0=2.5e-3, Zs=8)
Mag18_test.append(
{
"test_obj": lam,
@@ -55,10 +55,10 @@ def test_schematics(self, test_dict):
point_dict = test_obj.slot._comp_point_coordinate()
assert abs(point_dict["ZM1"] - point_dict["ZM2"]) == pytest.approx(
- test_obj.slot.Hmag
+ test_obj.slot.H0
)
assert abs(point_dict["ZM3"] - point_dict["ZM4"]) == pytest.approx(
- test_obj.slot.Hmag
+ test_obj.slot.H0
)
alpha = pi / test_obj.slot.Zs
assert angle(point_dict["Z1"]) == pytest.approx(-alpha)
diff --git a/Tests/Methods/Slot/test_SlotM19_meth.py b/Tests/Methods/Slot/test_SlotM19_meth.py
index 665193070..603bfe7ac 100644
--- a/Tests/Methods/Slot/test_SlotM19_meth.py
+++ b/Tests/Methods/Slot/test_SlotM19_meth.py
@@ -12,7 +12,7 @@
Mag19_test = list()
# Internal Slot
lam = LamSlotMag(is_internal=True, Rext=0.1325)
-lam.slot = SlotM19(W0=10e-3, Zs=4, Hmag=5e-3, W1=5e-3)
+lam.slot = SlotM19(W0=10e-3, Zs=4, H0=5e-3, W1=5e-3)
Mag19_test.append(
{
"test_obj": lam,
@@ -27,7 +27,7 @@
# Outward Slot
lam = LamSlotMag(is_internal=False, Rint=0.1325)
-lam.slot = SlotM19(W0=10e-3, Zs=4, Hmag=5e-3, W1=5e-3)
+lam.slot = SlotM19(W0=10e-3, Zs=4, H0=5e-3, W1=5e-3)
Mag19_test.append(
{
"test_obj": lam,
@@ -133,11 +133,11 @@ def test_comp_point_coordinate(self, test_dict):
Z4 = point_dict["Z4"]
W0 = test_obj.slot.W0
W1 = test_obj.slot.W1
- Hmag = test_obj.slot.Hmag
+ H0 = test_obj.slot.H0
Rbo = test_obj.slot.get_Rbo()
- msg = "Return " + str(Rbo - (Z2 + Z3) / 2) + "expected " + str(Hmag)
- assert abs(Rbo - (Z2 + Z3) / 2) == pytest.approx(Hmag, rel=DELTA), msg
+ msg = "Return " + str(Rbo - (Z2 + Z3) / 2) + "expected " + str(H0)
+ assert abs(Rbo - (Z2 + Z3) / 2) == pytest.approx(H0, rel=DELTA), msg
assert abs(Z1 - Z4) == pytest.approx(W1, rel=DELTA)
assert abs(Z2 - Z3) == pytest.approx(W0, rel=DELTA)
diff --git a/Tests/Methods/Slot/test_SlotW14_meth.py b/Tests/Methods/Slot/test_SlotW14_meth.py
index 3a1aa5011..9d7cea261 100644
--- a/Tests/Methods/Slot/test_SlotW14_meth.py
+++ b/Tests/Methods/Slot/test_SlotW14_meth.py
@@ -2,7 +2,7 @@
import pytest
from pyleecan.Classes.SlotW14 import SlotW14
-from numpy import ndarray, arcsin
+from numpy import arcsin, pi
from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Classes.Slot import Slot
from pyleecan.Methods.Slot.SlotW14 import S14_Rbo1CheckError
@@ -24,6 +24,7 @@
H3=25e-3,
W0=5e-3,
W3=10e-3,
+ H1_is_rad=False,
)
slotW14_test.append(
{
@@ -45,6 +46,7 @@
W0=5e-3,
W3=10e-3,
wedge_type=0,
+ H1_is_rad=False,
)
slotW14_test.append(
{
@@ -57,6 +59,72 @@
}
)
+# H1 rad
+lam = LamSlot(is_internal=False, Rint=0.1325)
+lam.slot = SlotW14(
+ H0=5e-3,
+ H1=0.01,
+ H3=25e-3,
+ W0=5e-3,
+ W3=10e-3,
+ wedge_type=0,
+ H1_is_rad=True,
+)
+slotW14_test.append(
+ {
+ "test_obj": lam,
+ "S_exp": 0.00043629885867586983,
+ "Aw": 0.10630161,
+ "SW_exp": 0.0004109465804555589,
+ "SO_exp": 2.5352278220310933e-05,
+ "H_exp": 0.0307307210,
+ }
+)
+
+lam = LamSlot(is_internal=False, Rint=0.1325)
+lam.slot = SlotW14(
+ H0=5e-3,
+ H1=0,
+ H3=25e-3,
+ W0=5e-3,
+ W3=10e-3,
+ wedge_type=0,
+ H1_is_rad=True,
+)
+slotW14_test.append(
+ {
+ "test_obj": lam,
+ "S_exp": 0.00043566418141197945,
+ "Aw": 0.10628246802,
+ "SW_exp": 0.0004107428061619,
+ "SO_exp": 2.4921375250004305e-05,
+ "H_exp": 0.0306850757,
+ }
+)
+
+lam = LamSlot(is_internal=False, Rint=0.1325)
+lam.slot = SlotW14(
+ H0=5e-3,
+ H1=pi / 4,
+ H3=25e-3,
+ W0=5e-3,
+ W3=10e-3,
+ wedge_type=1,
+ H1_is_rad=True,
+)
+slotW14_test.append(
+ {
+ "test_obj": lam,
+ "S_exp": 0.0005073025572861639,
+ "Aw": 0.1083080950696,
+ "SW_exp": 0.00043306999862850,
+ "SO_exp": 2.49213752500043e-05,
+ "H_exp": 0.03568270305258159,
+ "SWedge_exp": 4.931118340765717e-05,
+ }
+)
+
+
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW14(
H0=5e-3,
@@ -65,6 +133,7 @@
W0=5e-3,
W3=10e-3,
wedge_type=1,
+ H1_is_rad=False,
)
slotW14_test.append(
{
@@ -90,6 +159,7 @@
W0=5e-3,
W3=10e-3,
wedge_type=1,
+ H1_is_rad=False,
)
slotW14_test.append(
{
@@ -124,8 +194,9 @@ def test_schematics(self, test_dict):
assert abs(point_dict["Z1"] - point_dict["Z2"]) == pytest.approx(
test_obj.slot.H0
)
+
assert abs(point_dict["Z2"].real - point_dict["Z3"].real) == pytest.approx(
- test_obj.slot.H1
+ test_obj.slot.get_H1()
)
assert abs(point_dict["Z3"] - point_dict["Z4"]) == pytest.approx(
test_obj.slot.H3
@@ -134,7 +205,7 @@ def test_schematics(self, test_dict):
test_obj.slot.H0
)
assert abs(point_dict["Z8"].real - point_dict["Z7"].real) == pytest.approx(
- test_obj.slot.H1
+ test_obj.slot.get_H1()
)
assert abs(point_dict["Z7"] - point_dict["Z6"]) == pytest.approx(
test_obj.slot.H3
@@ -303,6 +374,37 @@ def test_check(self):
with pytest.raises(S14_Rbo1CheckError) as context:
lam.slot.check()
+ def test_get_H1(self):
+ """check conversion of H1"""
+
+ lam = LamSlot(is_internal=True, Rext=0.1325, is_stator=False)
+ lam.slot = SlotW14(
+ H0=1e-3,
+ H1=pi / 4,
+ H1_is_rad=True,
+ W0=12e-3,
+ W3=10e-3,
+ )
+
+ a = lam.slot.get_H1()
+ b = 0.0004373180612594603
+ msg = "Return " + str(a) + " expected " + str(b)
+ assert abs((a - b) / a - 0) < DELTA, msg
+
+ lam = LamSlot(is_internal=True, Rext=0.1325, is_stator=False)
+ lam.slot = SlotW14(
+ H0=1e-3,
+ H1=0,
+ H1_is_rad=True,
+ W0=12e-3,
+ W3=10e-3,
+ )
+
+ a = lam.slot.get_H1()
+ b = 0
+ msg = "Return " + str(a) + " expected " + str(b)
+ assert abs((a - b)) < DELTA, msg
+
if __name__ == "__main__":
a = Test_SlotW14_meth()
@@ -317,4 +419,5 @@ def test_check(self):
a.test_comp_angle_opening(test_dict)
a.test_comp_angle_active_eq(test_dict)
a.test_comp_surface_wedge(test_dict)
+ a.test_get_H1()
print("Done")
diff --git a/Tests/Methods/Slot/test_SlotW16_meth.py b/Tests/Methods/Slot/test_SlotW16_meth.py
index 2b183c99d..153adbc90 100644
--- a/Tests/Methods/Slot/test_SlotW16_meth.py
+++ b/Tests/Methods/Slot/test_SlotW16_meth.py
@@ -43,7 +43,7 @@
}
)
-# Small H0/W0/R1
+# Small H0/W0/R1
lam = LamSlot(is_internal=True, Rint=0.04, Rext=0.0746, is_stator=False)
lam.slot = SlotW16(Zs=76, H0=0.0008, H2=0.0172, R1=1e-6, W0=0.00001, W3=0.00299)
slotW16_test.append(
diff --git a/Tests/Plot/LamWind/test_Slot_28_plot.py b/Tests/Plot/LamWind/test_Slot_28_plot.py
index 868b33605..7f70bd792 100644
--- a/Tests/Plot/LamWind/test_Slot_28_plot.py
+++ b/Tests/Plot/LamWind/test_Slot_28_plot.py
@@ -154,4 +154,4 @@ def test_Lam_Wind_28_wind_22(self):
a = Test_Slot_28_plot()
a.test_Lam_Wind_28_wind_rad_tan()
a.test_Lam_Wind_28_wind_22()
- print("Done")
\ No newline at end of file
+ print("Done")
diff --git a/Tests/Plot/LamWind/test_notches_plot.py b/Tests/Plot/LamWind/test_notches_plot.py
index f87d4cc95..4aba4673e 100644
--- a/Tests/Plot/LamWind/test_notches_plot.py
+++ b/Tests/Plot/LamWind/test_notches_plot.py
@@ -33,10 +33,10 @@ def test_LamHole_notch():
def test_LamHole_2_notch(is_show_fig=False):
Toyota_Prius = load(join(DATA_DIR, "Machine", "Toyota_Prius.json"))
- slot1 = SlotM10(H0=0.005, Hmag=0, W0=0.004, Wmag=0, Zs=12)
+ slot1 = SlotM10(H0=0.005, H1=0, W0=0.004, W1=0, Zs=12)
# alpha=2*pi/Zs == alpha=0
notch1 = NotchEvenDist(alpha=2 * pi / 12, notch_shape=slot1)
- slot2 = SlotM10(H0=0.007, Hmag=0, W0=0.004, Wmag=0, Zs=12)
+ slot2 = SlotM10(H0=0.007, H1=0, W0=0.004, W1=0, Zs=12)
# Offset -1 slot pitch
notch2 = NotchEvenDist(alpha=-2 * pi / 48, notch_shape=slot2)
Toyota_Prius.stator.notch = [notch1, notch2]
diff --git a/Tests/Plot/Schematics/test_plot_machine_dimensions_mag.py b/Tests/Plot/Schematics/test_plot_machine_dimensions_mag.py
index a273b2c44..35766a62f 100644
--- a/Tests/Plot/Schematics/test_plot_machine_dimensions_mag.py
+++ b/Tests/Plot/Schematics/test_plot_machine_dimensions_mag.py
@@ -46,7 +46,7 @@ def test_Shaft_Rotor_Stator_mag(self):
rotor = LamSlotMag(
Rint=0.2, Rext=stator.Rint - airgap, is_stator=False, is_internal=True
)
- rotor.slot = SlotM11(Zs=8, W0=pi / 8, Wmag=pi / 8, H0=0, Hmag=0.05)
+ rotor.slot = SlotM11(Zs=8, W0=pi / 8, W1=pi / 8, H0=0, H1=0.05)
lam_list = [rotor, stator]
shaft = Shaft(Drsh=rotor.Rint * 2)
test_obj = MachineUD(frame=frame, lam_list=lam_list, shaft=shaft)
@@ -193,7 +193,7 @@ def test_Rotor_Stator_mag(self):
rotor = LamSlotMag(
Rint=0, Rext=stator.Rint - airgap, is_stator=False, is_internal=True
)
- rotor.slot = SlotM11(Zs=8, W0=pi / 8, Wmag=pi / 8, H0=0, Hmag=0.05)
+ rotor.slot = SlotM11(Zs=8, W0=pi / 8, W1=pi / 8, H0=0, H1=0.05)
lam_list = [rotor, stator]
test_obj = MachineUD(frame=frame, lam_list=lam_list)
# Plot
@@ -310,7 +310,7 @@ def test_Stator_Rotor_mag(self):
remove(file_path)
# Machine definition
rotor = LamSlotMag(Rint=0.55, Rext=1, is_stator=False, is_internal=False)
- rotor.slot = SlotM11(Zs=8, W0=pi / 8, Wmag=pi / 8, H0=0, Hmag=0.05)
+ rotor.slot = SlotM11(Zs=8, W0=pi / 8, W1=pi / 8, H0=0, H1=0.05)
airgap = 0.15
stator = Lamination(
Rint=0, Rext=rotor.Rint - airgap, is_stator=True, is_internal=True
diff --git a/Tests/Plot/Schematics/test_plot_schematics.py b/Tests/Plot/Schematics/test_plot_schematics.py
index 28d83049b..3557c5cf3 100644
--- a/Tests/Plot/Schematics/test_plot_schematics.py
+++ b/Tests/Plot/Schematics/test_plot_schematics.py
@@ -147,6 +147,12 @@
"is_default": 2,
}
)
+plot_test.append(
+ {
+ "test_obj": SlotM10(),
+ "type_add_active": 5,
+ }
+)
plot_test.append(
{
"test_obj": SlotM11(),
@@ -161,6 +167,12 @@
"is_default": 2,
}
)
+plot_test.append(
+ {
+ "test_obj": SlotM11(),
+ "type_add_active": 5,
+ }
+)
plot_test.append(
{
@@ -572,8 +584,8 @@ def test_slotCirc_old(self):
a = Test_plot_schematics()
# a.test_BoreFlower()
# a.test_BoreSinePole()
- a.test_plot(plot_test[53])
- a.test_plot_point(plot_test[53])
+ a.test_plot(plot_test[3])
+ a.test_plot_point(plot_test[3])
a.test_plot(plot_test[54])
a.test_plot_point(plot_test[54])
a.test_plot(plot_test[56])
diff --git a/Tests/Plot/test_Lam_Mag_inset_plot.py b/Tests/Plot/test_Lam_Mag_inset_plot.py
index 5a9842e74..31f9a60f4 100644
--- a/Tests/Plot/test_Lam_Mag_inset_plot.py
+++ b/Tests/Plot/test_Lam_Mag_inset_plot.py
@@ -39,7 +39,7 @@ def test_Lam_Mag_10_inset(self):
Wrvd=0.05,
)
rotor.magnet.Lmag = 0.5
- rotor.slot = SlotM10(Zs=4, W0=0.04, H0=0.02, Hmag=0.02, Wmag=0.04)
+ rotor.slot = SlotM10(Zs=4, W0=0.04, H0=0.02, H1=0.02, W1=0.04)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
rotor.axial_vent.append(VentilationCirc(Zh=4, Alpha0=0, D0=2.5e-3, H0=50e-3))
@@ -56,7 +56,7 @@ def test_Lam_Mag_10_inset(self):
Wrvd=0.05,
)
stator.magnet.Lmag = 0.5
- stator.slot = SlotM10(Zs=8, W0=0.04, Hmag=0.02, Wmag=0.04, H0=0.02)
+ stator.slot = SlotM10(Zs=8, W0=0.04, H1=0.02, W1=0.04, H0=0.02)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
stator.axial_vent.append(
@@ -76,8 +76,8 @@ def test_Lam_Mag_10_inset(self):
assert len(fig.axes[0].patches) == 22
fig.savefig(join(save_path, "test_Lam_Mag_10i_2-Stator.png"))
- rotor.slot.Hmag = rotor.slot.Hmag * 1.2
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
+ rotor.slot.H1 = rotor.slot.H1 * 1.2
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
assert len(fig.axes[0].patches) == 30
@@ -109,8 +109,8 @@ def test_Lam_Mag_10_inset_2_mag(self):
H0=0.02,
W3=2 * pi / 60,
magnet=[
- SlotM10(Lmag=0.5, Hmag=0.015, Wmag=0.03),
- SlotM10(Lmag=0.5, Hmag=0.015, Wmag=0.03),
+ SlotM10(Lmag=0.5, H1=0.015, W1=0.03),
+ SlotM10(Lmag=0.5, H1=0.015, W1=0.03),
],
)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
@@ -134,8 +134,8 @@ def test_Lam_Mag_10_inset_2_mag(self):
W3=2 * pi / 64,
H0=0.02,
magnet=[
- SlotM10(Lmag=0.5, Hmag=0.025, Wmag=0.03),
- SlotM10(Lmag=0.5, Hmag=0.025, Wmag=0.03),
+ SlotM10(Lmag=0.5, H1=0.025, W1=0.03),
+ SlotM10(Lmag=0.5, H1=0.025, W1=0.03),
],
)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
@@ -172,7 +172,7 @@ def test_Lam_Mag_11_inset(self):
)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
rotor.magnet.Lmag = 0.5
- rotor.slot = SlotM11(Zs=8, W0=pi / 8, H0=0.01, Hmag=0.01, Wmag=pi / 8)
+ rotor.slot = SlotM11(Zs=8, W0=pi / 8, H0=0.01, H1=0.01, W1=pi / 8)
stator = LamSlotMag(
Rint=115e-3,
@@ -187,8 +187,8 @@ def test_Lam_Mag_11_inset(self):
stator.slot = SlotM11(
Zs=4,
W0=pi / 4,
- Hmag=0.03,
- Wmag=pi / 4,
+ H1=0.03,
+ W1=pi / 4,
H0=0.02,
)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
@@ -203,8 +203,8 @@ def test_Lam_Mag_11_inset(self):
assert len(fig.axes[0].patches) == 6
fig.savefig(join(save_path, "test_Lam_Mag_11i_2-Stator.png"))
- rotor.slot.Hmag = rotor.slot.Hmag * 1.2
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
+ rotor.slot.H1 = rotor.slot.H1 * 1.2
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
assert len(fig.axes[0].patches) == 10
@@ -236,8 +236,8 @@ def test_Lam_Mag_11_inset_2_mag(self):
H0=0.01,
W3=pi / 18,
magnet=[
- SlotM11(Lmag=0.5, Hmag=0.01, Wmag=pi / 12),
- SlotM11(Lmag=0.5, Hmag=0.01, Wmag=pi / 12),
+ SlotM11(Lmag=0.5, H1=0.01, W1=pi / 12),
+ SlotM11(Lmag=0.5, H1=0.01, W1=pi / 12),
],
)
@@ -257,8 +257,8 @@ def test_Lam_Mag_11_inset_2_mag(self):
H0=0.02,
W3=2 * pi / 50,
magnet=[
- SlotM11(Lmag=0.35, Hmag=0.03, Wmag=pi / 10),
- SlotM11(Lmag=0.35, Hmag=0.03, Wmag=pi / 10),
+ SlotM11(Lmag=0.35, H1=0.03, W1=pi / 10),
+ SlotM11(Lmag=0.35, H1=0.03, W1=pi / 10),
],
)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
@@ -287,7 +287,7 @@ def test_Lam_Mag_12_inset(self):
Wrvd=0.05,
)
rotor.magnet.Lmag = 0.5
- rotor.slot = SlotM12(Zs=8, W0=0.04, H0=0.02, Hmag=0.02, Wmag=0.04)
+ rotor.slot = SlotM12(Zs=8, W0=0.04, H0=0.02, H1=0.02, W1=0.04)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
stator = LamSlotMag(
@@ -300,7 +300,7 @@ def test_Lam_Mag_12_inset(self):
Wrvd=0.05,
)
stator.magnet.Lmag = 0.5
- stator.slot = SlotM12(Zs=4, W0=0.04, H0=0.02, Hmag=0.03, Wmag=0.04)
+ stator.slot = SlotM12(Zs=4, W0=0.04, H0=0.02, H1=0.03, W1=0.04)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
rotor.plot(is_show_fig=False)
@@ -313,8 +313,8 @@ def test_Lam_Mag_12_inset(self):
assert len(fig.axes[0].patches) == 6
fig.savefig(join(save_path, "test_Lam_Mag_12i_2-Stator.png"))
- rotor.slot.Hmag = rotor.slot.Hmag * 1.2
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
+ rotor.slot.H1 = rotor.slot.H1 * 1.2
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
assert len(fig.axes[0].patches) == 10
@@ -340,7 +340,7 @@ def test_Lam_Mag_13_inset(self):
Wrvd=0.02,
)
rotor.magnet.Lmag = 0.5
- rotor.slot = SlotM13(Zs=8, W0=0.04, H0=0.02, Hmag=0.02, Wmag=0.04, Rtopm=0.04)
+ rotor.slot = SlotM13(Zs=8, W0=0.04, H0=0.02, H1=0.02, W1=0.04, Rtopm=0.04)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
stator = LamSlotMag(
@@ -353,7 +353,7 @@ def test_Lam_Mag_13_inset(self):
Wrvd=0.02,
)
stator.magnet.Lmag = 0.5
- stator.slot = SlotM13(Zs=4, W0=0.04, H0=0.025, Hmag=0.02, Wmag=0.04, Rtopm=0.04)
+ stator.slot = SlotM13(Zs=4, W0=0.04, H0=0.025, H1=0.02, W1=0.04, Rtopm=0.04)
stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
rotor.plot(is_show_fig=False)
@@ -366,8 +366,8 @@ def test_Lam_Mag_13_inset(self):
assert len(fig.axes[0].patches) == 6
fig.savefig(join(save_path, "test_Lam_Mag_13i_2-Stator.png"))
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
- rotor.slot.Hmag = rotor.slot.Hmag * 1.4
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
+ rotor.slot.H1 = rotor.slot.H1 * 1.4
rotor.slot.Rtopm = rotor.slot.Rtopm * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
@@ -394,7 +394,7 @@ def test_Lam_Mag_14_inset(self):
Wrvd=0.02,
)
rotor.magnet.Lmag = 0.5
- rotor.slot = SlotM14(Zs=4, W0=0.628, H0=0.02, Hmag=0.02, Wmag=0.628, Rtopm=0.04)
+ rotor.slot = SlotM14(Zs=4, W0=0.628, H0=0.02, H1=0.02, W1=0.628, Rtopm=0.04)
rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)
stator = Lamination(
@@ -413,7 +413,7 @@ def test_Lam_Mag_14_inset(self):
assert len(fig.axes[0].patches) == 6
fig.savefig(join(save_path, "test_Lam_Mag_14i_1-Rotor.png"))
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
assert len(fig.axes[0].patches) == 6
@@ -435,8 +435,8 @@ def test_Lam_Mag_15_inset(self):
Zs=4,
W0=80 * pi / 180,
H0=10 * mm,
- Hmag=20 * mm,
- Wmag=100 * mm,
+ H1=20 * mm,
+ W1=100 * mm,
Rtopm=100 * mm,
)
@@ -445,7 +445,7 @@ def test_Lam_Mag_15_inset(self):
assert len(fig.axes[0].patches) == 6
fig.savefig(join(save_path, "test_Lam_Mag_15i_1-Rotor.png"))
- rotor.slot.Wmag = rotor.slot.Wmag * 0.5
+ rotor.slot.W1 = rotor.slot.W1 * 0.5
rotor.slot.Rtopm = rotor.slot.Rtopm * 0.5
rotor.plot(is_show_fig=False)
fig = plt.gcf()
diff --git a/Tests/Validation/Magnetics/test_FEMM_LamMagNS.py b/Tests/Validation/Magnetics/test_FEMM_LamMagNS.py
index bf6d3c68d..dba80d2b7 100644
--- a/Tests/Validation/Magnetics/test_FEMM_LamMagNS.py
+++ b/Tests/Validation/Magnetics/test_FEMM_LamMagNS.py
@@ -44,8 +44,8 @@ def test_FEMM_LamSlotMagNS():
BNS.rotor.magnet_south = B.rotor.magnet.copy()
# Change magnet dimensions on south pole
BNS.rotor.slot_south = B.rotor.slot.copy()
- BNS.rotor.slot_south.Hmag /= 2
- BNS.rotor.slot_south.Wmag /= 2
+ BNS.rotor.slot_south.H1 /= 2
+ BNS.rotor.slot_south.W1 /= 2
# South magnet have different material
BNS.rotor.magnet_south.mat_type.name += "_2"
BNS.rotor.magnet_south.mat_type.mag.mur_lin = 2
diff --git a/Tests/Validation/Magnetics/test_FEMM_NotchKey.py b/Tests/Validation/Magnetics/test_FEMM_NotchKey.py
index cfaa78f08..f4f7f6018 100644
--- a/Tests/Validation/Magnetics/test_FEMM_NotchKey.py
+++ b/Tests/Validation/Magnetics/test_FEMM_NotchKey.py
@@ -41,7 +41,7 @@ def test_FEMM_NotchKey_Airgap():
Steel2.mag.mur_lin /= 2
B.name = "Benchmark_NotchKey_Airgap_FEMM"
# Reduce magnet width
- B.rotor.slot.Wmag /= 2
+ B.rotor.slot.W1 /= 2
B.rotor.slot.W0 /= 2
# Add notches with keys
B.rotor.notch = [
@@ -49,9 +49,9 @@ def test_FEMM_NotchKey_Airgap():
alpha=0,
key_mat=Steel,
notch_shape=SlotM11(
- Hmag=B.rotor.slot.Hmag * 1.2,
+ H1=B.rotor.slot.H1 * 1.2,
H0=0,
- Wmag=B.rotor.slot.Wmag,
+ W1=B.rotor.slot.W1,
W0=B.rotor.slot.W0,
Zs=B.rotor.slot.Zs,
is_bore=True,
@@ -63,9 +63,9 @@ def test_FEMM_NotchKey_Airgap():
alpha=0,
key_mat=Steel2,
notch_shape=SlotM10(
- Hmag=4e-3,
+ H1=4e-3,
H0=3e-3,
- Wmag=5e-3,
+ W1=5e-3,
W0=5e-3,
Zs=B.stator.slot.Zs,
is_bore=True,
@@ -169,7 +169,7 @@ def test_FEMM_NotchKey_inner():
Steel = load(join(DATA_DIR, "Material", "Steel1.json"))
B.name = "Benchmark_NotchKey_inner_FEMM"
# Reduce magnet width
- B.rotor.slot.Wmag /= 2
+ B.rotor.slot.W1 /= 2
B.rotor.slot.W0 /= 2
# Add notches with keys
B.rotor.notch = [
@@ -177,9 +177,9 @@ def test_FEMM_NotchKey_inner():
alpha=0,
key_mat=Steel,
notch_shape=SlotM11(
- Hmag=B.rotor.slot.Hmag * 0.8,
- H0=B.rotor.slot.Hmag,
- Wmag=B.rotor.slot.Wmag,
+ H1=B.rotor.slot.H1 * 0.8,
+ H0=B.rotor.slot.H1,
+ W1=B.rotor.slot.W1,
W0=B.rotor.slot.W0,
Zs=B.rotor.slot.Zs,
is_bore=True,
@@ -191,9 +191,9 @@ def test_FEMM_NotchKey_inner():
alpha=0,
key_mat=Steel,
notch_shape=SlotM10(
- Hmag=2e-3,
+ H1=2e-3,
H0=3e-3,
- Wmag=5e-3,
+ W1=5e-3,
W0=5e-3,
Zs=B.stator.slot.Zs,
is_bore=True,
@@ -298,7 +298,7 @@ def test_FEMM_NotchKey_2():
M270 = load(join(DATA_DIR, "Material", "M270-35A.json"))
B.name = "Benchmark_NotchKey_FEMM_2"
# Reduce magnet width
- B.rotor.slot.Wmag /= 2
+ B.rotor.slot.W1 /= 2
B.rotor.slot.W0 /= 2
# Add notches with keys
B.rotor.notch = [
@@ -306,9 +306,9 @@ def test_FEMM_NotchKey_2():
alpha=0,
key_mat=M270,
notch_shape=SlotM11(
- Hmag=B.rotor.slot.Hmag * 0.8,
+ H1=B.rotor.slot.H1 * 0.8,
H0=0,
- Wmag=B.rotor.slot.Wmag,
+ W1=B.rotor.slot.W1,
W0=B.rotor.slot.W0,
Zs=B.rotor.slot.Zs // 2,
is_bore=True,
@@ -318,9 +318,9 @@ def test_FEMM_NotchKey_2():
alpha=2 * pi / B.rotor.slot.Zs,
key_mat=M400,
notch_shape=SlotM11(
- Hmag=B.rotor.slot.Hmag * 1.2,
+ H1=B.rotor.slot.H1 * 1.2,
H0=0,
- Wmag=B.rotor.slot.Wmag,
+ W1=B.rotor.slot.W1,
W0=B.rotor.slot.W0,
Zs=B.rotor.slot.Zs // 2,
is_bore=True,
@@ -387,7 +387,7 @@ def test_FEMM_NotchKey_NoCut():
M270 = load(join(DATA_DIR, "Material", "M270-35A.json"))
B.name = "Benchmark_NotchKey_FEMM_NoCut"
# Reduce magnet width
- B.rotor.slot.Wmag /= 2
+ B.rotor.slot.W1 /= 2
B.rotor.slot.W0 /= 2
# Add notches with keys
B.rotor.notch = [
@@ -395,9 +395,9 @@ def test_FEMM_NotchKey_NoCut():
alpha=0,
key_mat=None, # No key on Ox, but a notch
notch_shape=SlotM11(
- Hmag=0,
- H0=B.rotor.slot.Hmag * 0.5,
- Wmag=0,
+ H1=0,
+ H0=B.rotor.slot.H1 * 0.5,
+ W1=0,
W0=B.rotor.slot.W0,
Zs=2,
is_bore=True,
@@ -407,9 +407,9 @@ def test_FEMM_NotchKey_NoCut():
alpha=2 * pi / B.rotor.slot.Zs,
key_mat=M400,
notch_shape=SlotM11(
- Hmag=B.rotor.slot.Hmag * 1.2,
+ H1=B.rotor.slot.H1 * 1.2,
H0=0,
- Wmag=B.rotor.slot.Wmag,
+ W1=B.rotor.slot.W1,
W0=B.rotor.slot.W0,
Zs=2,
is_bore=True,
@@ -422,9 +422,9 @@ def test_FEMM_NotchKey_NoCut():
alpha=2 * pi / B.stator.slot.Zs,
key_mat=M400,
notch_shape=SlotM10(
- Hmag=4e-3,
+ H1=4e-3,
H0=3e-3,
- Wmag=5e-3,
+ W1=5e-3,
W0=5e-3,
Zs=B.stator.slot.Zs // 2,
is_bore=True,
diff --git a/Tests/Validation/Magnetics/test_FEMM_periodicity.py b/Tests/Validation/Magnetics/test_FEMM_periodicity.py
index 9e5ae9557..e61cd58aa 100644
--- a/Tests/Validation/Magnetics/test_FEMM_periodicity.py
+++ b/Tests/Validation/Magnetics/test_FEMM_periodicity.py
@@ -29,6 +29,7 @@
from pyleecan.definitions import DATA_DIR
+
# python -m pytest ./Tests/Validation/Magnetics/test_FEMM_periodicity.py
@pytest.mark.long_5s
@pytest.mark.long_1m
@@ -784,10 +785,10 @@ def test_Ring_Magnet():
def test_Ring_Magnet_2():
"""Check that a machine with 2 Ring magnet can be simulated with sym"""
machine = load(join(DATA_DIR, "Machine", "SPMSM_001.json"))
- Hmag = machine.rotor.slot.Hmag
+ H0 = machine.rotor.slot.H0
machine.rotor.slot = SlotM18_2(init_dict=machine.rotor.slot.as_dict())
- machine.rotor.slot.Hmag_bore = machine.rotor.Rext - machine.rotor.Rint - Hmag
- machine.rotor.slot.Hmag_gap = Hmag
+ machine.rotor.slot.H0_bore = machine.rotor.Rext - machine.rotor.Rint - H0
+ machine.rotor.slot.H0_gap = H0
machine.rotor.Rext = machine.rotor.Rint
mur_lin = machine.rotor.magnet.mat_type.mag.mur_lin
diff --git a/Tutorials/Converter.ipynb b/Tutorials/Converter.ipynb
new file mode 100644
index 000000000..adb4490bc
--- /dev/null
+++ b/Tutorials/Converter.ipynb
@@ -0,0 +1,388 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "1c52274e-e36a-4642-8dca-a4b8b81a8333",
+ "metadata": {},
+ "source": [
+ "# Converter"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "84161717-2a78-4e85-bf32-54d500e1a304",
+ "metadata": {},
+ "source": [
+ "## How to use a converter ?"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1656bb14-16c4-4a2f-934a-526a84bf02a1",
+ "metadata": {},
+ "source": [
+ "This tutorial shows the way to call converter, and in a second part we explain this architecture.
\n",
+ "So, with this converter you can convert **motor IPMSM and SPMSM** for the moment with all slot, hole, notch, duct present in pyleecan. Just the **geometrical conversion** is present.
\n",
+ "This converter is between Motor-CAD and Pyleecan but the architecture is create to be reuse if you want an other converter.
\n",
+ "below is the code to call the converter :"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fb0b20c5",
+ "metadata": {},
+ "source": [
+ "```python\n",
+ "from pyleecan.Classes.ConvertMC import ConvertMC\n",
+ "path = \"path/to/mot.mot\"\n",
+ "conv = ConvertMC()\n",
+ "machine = conv.convert_to_P(path)\n",
+ "other_dict = conv.convert_to_other(machine)\n",
+ "```\n",
+ "This code block is equivalente to:\n",
+ "- select your file.mot\n",
+ "- select class of converter\n",
+ "- select the direction of conversion\n",
+ "- to convert a file .mot in object machine \n",
+ "- to convert a object machine in dict with setting use in Motor_cad "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c95a4937-f37b-44a1-add0-9a50819417d7",
+ "metadata": {},
+ "source": [
+ "This converter could propose a reversibility, but attention the reversibility is not perfect. In fact, we don't know the fonctionnement of Motor-CAD, that is why, we return a dictionnary with all equivalent parameter between Motor-CAD and Pyleecan present in a file.mot "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d93df52f-92dd-4cbb-90c4-8d4aff140d76",
+ "metadata": {},
+ "source": [
+ "If you want to find equivalent, approximation or error you have a file Pyleecan.log. In this file you have big step to example equivalent between parallel_slot and slotW21. Or if you have an error or approximation in conversion.
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "59cd9a7a",
+ "metadata": {},
+ "source": [
+ "Ex log :
\n",
+ "2023-12-13 10:42:50- INFO: Pyleecan version : 1.5.2 [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Path file use to convert : /Users\\LAP17\\Documents/machine_MC_P/file_mot/WRSM_salient_pole.mot [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion file .mot into dict [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion dict into obj machine [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion SYNC into MachineWRSM [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion Parallel_Tooth into SlotW11 [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion AWG_Table into CondType12 [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion Sync_Salient_Pole into SlotW62 [Pyleecan]
\n",
+ "2023-12-13 10:42:50- DEBUG: No duct to convert at Rotor [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: Conversion AWG_Table into CondType12 [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: skew, not implemented [Pyleecan]
\n",
+ "2023-12-13 10:42:50- INFO: End of conversion, obj machine is create [Pyleecan]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "41fd6487-6618-4243-b67b-16f272c5769a",
+ "metadata": {},
+ "source": [
+ "## Converter architecture"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0d437d4a-5430-4d28-92b8-dc0f92a51fad",
+ "metadata": {},
+ "source": [
+ "### Class presentation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "66b00a78-9725-4aee-bf0b-e2142a5d3128",
+ "metadata": {},
+ "source": [
+ "#### Class Converter"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "88547c17-c4b6-4bf3-93e1-7d53e6423cf7",
+ "metadata": {},
+ "source": [
+ "In this abstract class, we have variable use to convert, and different general methods. In fact, if you want to create an other converter you can reuse this methods."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "72b70dff-1b0b-4851-91a2-380930c46d55",
+ "metadata": {},
+ "source": [
+ "#### ConverterMC"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "4e6fa29c-2b31-48c9-bd12-8ee04b901f83",
+ "metadata": {},
+ "source": [
+ "Contrary to convert, this class has all methods specific at Motor-CAD. We have all rules, and methods convert, and particularity. And ConvertMC inherits from Convert."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c39106d4",
+ "metadata": {},
+ "source": [
+ "![](Images/UML_convert.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "80a03b3d-b26e-4248-9a41-92aa5e54f1db",
+ "metadata": {},
+ "source": [
+ "#### Rule"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "82d856f0-35fa-4aef-9b40-903c2009a784",
+ "metadata": {},
+ "source": [
+ "In this abstract class, you can find methods to select or set value in dict or in obj machine."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "53a9eef4-5cc0-418d-9712-be5e2ca9e577",
+ "metadata": {},
+ "source": [
+ "#### RuleComplex"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "62eb613d-ac3f-4a9e-941a-ede651bb5793",
+ "metadata": {},
+ "source": [
+ "RuleComplex inherits from Rule, this class works with functions who handles special cases "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "eb9833c6-9d15-4265-87f1-4f74a2da4764",
+ "metadata": {},
+ "source": [
+ "#### RuleSimple"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7230e2c5-a5b0-4e01-979b-07df69b93948",
+ "metadata": {},
+ "source": [
+ "RuleSimple inherits from Rule, this class is use to equivalent parameter with just a multiplicator between param motor-cad and Pyleecan. "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "638354a5-d278-4d6a-bd6d-8d3640a9c4a5",
+ "metadata": {},
+ "source": [
+ "#### RuleEquation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "668e2bd8-11e2-4778-9146-3ebd485704cc",
+ "metadata": {},
+ "source": [
+ "RuleEquation inherits from Rule, this class is use if equivalent between parameter motor-cad and Pyleecan is more difficult but can be solve with an equation. And if equation is complex, we can choose a RuleComplex."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6f97b6a8",
+ "metadata": {},
+ "source": [
+ "![](Images/UML_rules.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e22f129f-ba9d-46c9-a260-eeeccbd8ada9",
+ "metadata": {},
+ "source": [
+ "### Architecture presentation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "77fd37a3",
+ "metadata": {},
+ "source": [
+ "L'architecture du convertisseur va suivre l'interface Pyleecan. En effet, l'interface de pyleecan est composée de différente étape qui permet de définir la machine.\n",
+ "\n",
+ "![](Images/Selection_machine.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "76588684",
+ "metadata": {},
+ "source": [
+ "Par exemple pour définir la Toyota_Prius, on définit :
\n",
+ " - Machine type
\n",
+ " - Machine Dimensions
\n",
+ " - Stator Slot
\n",
+ " - ...
\n",
+ "\n",
+ "Dans chacune de ces étapes, nous définisons les paramètres. Dans l'exemple ci-dessous, pour la Machine Dimensions, on va définir la longueur du stator, du rotor... \n",
+ "\n",
+ "![](Images/Machine_dimension.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "19a11d63",
+ "metadata": {},
+ "source": [
+ "Le convertisseur va donc reproduire ces étapes de définitions pour définir la machine. \n",
+ "L'objectif étant de pouvoir garder l'architecture si l'on souhaite refaire un convertisseur avec un autre logiciel.\n",
+ "\n",
+ "C'est pourquoi le convertisseur est composé de 2 classes:\n",
+ "- la classe convert va contenir l'ensemble des méthodes qui peuvent être réutilisable par n'importe quelle convertisseur.\n",
+ "- la classe convertMC est spécifique à la conversion vers Pyleecan <-> motor-cad, elle devra être réécrite pour chaque convertisseur.\n",
+ "\n",
+ "\n",
+ "Fonctionnement du convertisseur :\n",
+ "\n",
+ "On va commencer par sélectionner le type de machine.\n",
+ "Puis en fonction du type de machine nous allons appeler d'autre sélection, suivant l'ordre de linterface pyleecan. Le schéma suivant illustre l'enchainement des séléctions.\n",
+ "L'ensemble des méthode effectuant la sélection commence par \"select\". Elles sont toutes dans la class Convert.\n",
+ "L'objectif de ces méthodes est d'appeler les bonnes règles en fonction des besoins et d'orienter vers les autres fichiers de selection.\n",
+ "\n",
+ "Les séléctions dans ces méthodes sont effectué à partir de l'objet machine de Pyleecan, pour garder la possibilité de réutiliser ces méthodes. Cependant, pour avoir toujours cette séléctions possible, des méthodes spécifiques au convertisseur (présent dans la classes convertMC) sont nécessaire. \n",
+ "\n",
+ "Ces méthodes commencent par \"convert\" vont permettre de définir la machine en lui ajoutant ces grandes étapes (ces différentes classes), on a par exemple le type de machine, le type de slot, le type de notch...\n",
+ "\n",
+ "![](Images/schematics_architecture_converter.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7d6e6ad0",
+ "metadata": {},
+ "source": [
+ "Nous avons donc en fonction de la selection d'autre selection (d'autre step) comme ci-dessus:\n",
+ "L'objectif étant d'arriver au moment où l'on puisse ajouter des règles. Pour cela, il faut soit être très précis comme savoir le type de slot, soit si la règle peut être généralisé par exemple les dimensions pour toutes les SCIM.\n",
+ "\n",
+ "\n",
+ "Nous arrivons donc aux règles, durant ce parcour les règles sont ajouté dans un ordre précis dans une liste nommmée rules_list.\n",
+ "\n",
+ "A la fin de la sélection initier par la fonction selection_machine_rules nous nous retrouvons avec une liste de règle.\n",
+ "Nous allons donc convertir l'ensemble des règles et les ajouter dans l'objet machine. Cette conversion utilise le polymorphisme car en effet, il existe 3 types de règle :\n",
+ "- règle Simple qui permet de passer d'un paramètre à un autre avec seulement un multiplicateur (ex radius<->diameter)\n",
+ "- règle Equation qui permet de passer d'un paramètre à un autre mais en impliquant d'autre paramètre ou des conversion complex\n",
+ "(ex: y = a+2b -3x) \n",
+ "- règle Complexe qui traite les autres situations, ces situations sont traité dans des fonctions spécifique.\n",
+ "\n",
+ "On a donc finalement l'ensemble des règles qui sont traité, et implémenté dans l'objet machine. Ainsi la conversion sera terminée, avec l'objet complètement définie."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1a1cdab0",
+ "metadata": {},
+ "source": [
+ "Pour simplifier le convertisseur, un dictionnaire est créé à partir du fichier .mot.\n",
+ "\n",
+ "Le fichier .mot est composé de différente partie commençant par un titre entre crochet ex [Dimensions] et après une liste de valeur.
\n",
+ "ex : \n",
+ "```yaml\n",
+ "[Dimensions]\n",
+ "Stator_Lam_Dia=130\n",
+ "Stator_Bore=80\n",
+ "Airgap=1\n",
+ "\n",
+ "[Design_Options]\n",
+ "BPM_Rotor=Surface_Radial\n",
+ "Top_Bar=Round\n",
+ "Bottom_Bar=Rectangular\n",
+ "```\n",
+ "\n",
+ "On va donc reproduire cette architecture dans un dictionnaire, comprenant des dictionnaires comme vous pouvez le voir ci-dessous.
\n",
+ "\n",
+ "On a reproduit la même organisation que le fichier .mot, pour simplifier l'accès aux paramètres.\n",
+ "\n",
+ "```python\n",
+ "other_dict = {\n",
+ " \"[Dimensions]\" : { \n",
+ " \"Stator_Lam_Dia\" : 130,\n",
+ " \"Stator_Bore\" : 80,\n",
+ " \"Airgap\" : 1,\n",
+ " },\n",
+ " \"[Design_Options]\" : {\n",
+ " \"BPM_Rotor\" : \"Surface_Radial\",\n",
+ " \"Top_Bar\" : \"Round\",\n",
+ " \"Bottom_Bar\" : \"Rectangular\",\n",
+ " },\n",
+ "}\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "293680ca",
+ "metadata": {},
+ "source": [
+ "On a reproduit la même organisation que le fichier .mot, pour simplifier l'accès aux paramètres.\n",
+ "\n",
+ "![](Images/convert_mot_to_dict.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9cf1dcc7",
+ "metadata": {},
+ "source": [
+ "Comme on a un objet machine, on peut le sauvegarder en .json, ou load le .json en machine.\n",
+ "Car le convertisseur peut effectuer les 2 sens de conversion. Et le fonctionnement du convertisseur ne change pas en fonction du sens.\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "79389fd6",
+ "metadata": {},
+ "source": [
+ "Voici ci-dessous l'oragnisation des fichiers du convertisseur dans les différentes classes :\n",
+ "![](Images/structure_converter.png)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.10"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/Tutorials/Images/Architecture_1.png b/Tutorials/Images/Architecture_1.png
new file mode 100644
index 000000000..07f2e55df
Binary files /dev/null and b/Tutorials/Images/Architecture_1.png differ
diff --git a/Tutorials/Images/Architecture_2.png b/Tutorials/Images/Architecture_2.png
new file mode 100644
index 000000000..9b065ad9e
Binary files /dev/null and b/Tutorials/Images/Architecture_2.png differ
diff --git a/Tutorials/Images/Machine_dimension.png b/Tutorials/Images/Machine_dimension.png
new file mode 100644
index 000000000..4671a9e26
Binary files /dev/null and b/Tutorials/Images/Machine_dimension.png differ
diff --git a/Tutorials/Images/Selection_machine.png b/Tutorials/Images/Selection_machine.png
new file mode 100644
index 000000000..280395825
Binary files /dev/null and b/Tutorials/Images/Selection_machine.png differ
diff --git a/Tutorials/Images/UML_convert.png b/Tutorials/Images/UML_convert.png
new file mode 100644
index 000000000..dadf8dfee
Binary files /dev/null and b/Tutorials/Images/UML_convert.png differ
diff --git a/Tutorials/Images/UML_rules.png b/Tutorials/Images/UML_rules.png
new file mode 100644
index 000000000..50042c923
Binary files /dev/null and b/Tutorials/Images/UML_rules.png differ
diff --git a/Tutorials/Images/convert_mot_to_dict.png b/Tutorials/Images/convert_mot_to_dict.png
new file mode 100644
index 000000000..cfa2c87c5
Binary files /dev/null and b/Tutorials/Images/convert_mot_to_dict.png differ
diff --git a/Tutorials/Images/schematics_architecture_converter.png b/Tutorials/Images/schematics_architecture_converter.png
new file mode 100644
index 000000000..995cb716a
Binary files /dev/null and b/Tutorials/Images/schematics_architecture_converter.png differ
diff --git a/Tutorials/Images/structure_converter.png b/Tutorials/Images/structure_converter.png
new file mode 100644
index 000000000..55c3fb52d
Binary files /dev/null and b/Tutorials/Images/structure_converter.png differ
diff --git a/pyleecan/Classes/Class_Dict.json b/pyleecan/Classes/Class_Dict.json
index 7def94d79..c3f30ff5d 100644
--- a/pyleecan/Classes/Class_Dict.json
+++ b/pyleecan/Classes/Class_Dict.json
@@ -1059,6 +1059,154 @@
}
]
},
+ "Convert": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [
+ "ConvertMC"
+ ],
+ "desc": "initialisation of conversion abstract",
+ "is_internal": false,
+ "methods": [
+ "convert_to_other",
+ "convert_to_P",
+ "select_LamSlotWind_rules",
+ "select_machine_rules",
+ "Step.select_slot_rotor_rules",
+ "Step.select_slot_rules",
+ "Step.select_lamination_rules",
+ "Step.select_winding_rules",
+ "Step.select_conductor_rules",
+ "Step.select_hole_rules",
+ "Step.select_pole_rules",
+ "Step.select_magnet_rules",
+ "Step.select_skew_rules",
+ "Step.select_bar_rules",
+ "Step.select_duct_rules",
+ "Step.select_notch_rules",
+ "machine_type.select_SIPMSM_rules",
+ "machine_type.select_IPMSM_rules",
+ "machine_type.select_SCIM_rules",
+ "machine_type.select_WRSM_rules"
+ ],
+ "mother": "",
+ "name": "Convert",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/Convert.csv",
+ "properties": [
+ {
+ "as_dict": "",
+ "desc": "convertion unit file .mot into unit_dict",
+ "max": "",
+ "min": "",
+ "name": "other_unit_dict",
+ "type": "dict",
+ "unit": "-",
+ "value": {}
+ },
+ {
+ "as_dict": "",
+ "desc": "convertion file .mot in dict",
+ "max": "",
+ "min": "",
+ "name": "other_dict",
+ "type": "dict",
+ "unit": "-",
+ "value": {}
+ },
+ {
+ "as_dict": "",
+ "desc": "machine pyleecan",
+ "max": "",
+ "min": "",
+ "name": "machine",
+ "type": "Machine",
+ "unit": "-",
+ "value": null
+ },
+ {
+ "as_dict": "",
+ "desc": "list differents rules",
+ "max": "",
+ "min": "",
+ "name": "rules_list",
+ "type": "list",
+ "unit": "-",
+ "value": []
+ },
+ {
+ "as_dict": "",
+ "desc": "booleen to select the direction of conversion",
+ "max": "",
+ "min": "",
+ "name": "is_P_to_other",
+ "type": "bool",
+ "unit": "-",
+ "value": false
+ }
+ ]
+ },
+ "ConvertMC": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [],
+ "desc": "convertorMC abstract",
+ "is_internal": false,
+ "methods": [
+ "convert_to_P.convert_other_to_dict",
+ "convert_to_P.convert_slot_to_P",
+ "convert_to_P.convert_machine_to_P",
+ "convert_to_P.convert_magnet_to_P",
+ "convert_to_P.convert_hole_to_P",
+ "convert_to_P.convert_duct_to_P",
+ "convert_to_P.convert_notch_to_P",
+ "convert_to_other.init_other_unit",
+ "convert_to_other.convert_slot_to_other",
+ "convert_to_other.convert_machine_to_other",
+ "convert_to_other.convert_magnet_to_other",
+ "convert_to_other.convert_hole_to_other",
+ "convert_to_other.convert_duct_to_other",
+ "convert_to_other.convert_notch_to_other",
+ "Rules.add_rule_machine_dimension",
+ "Rules.add_rule_machine_dimension_surface_magnet",
+ "Rules.add_rule_machine_type",
+ "Rules.Slot.add_rule_slotW11",
+ "Rules.Slot.add_rule_slotW29",
+ "Rules.Slot.add_rule_slotW21",
+ "Rules.Slot.add_rule_slotW14",
+ "Rules.Slot.add_rule_slotW23",
+ "Rules.Lamination.add_rule_ventilationCirc",
+ "Rules.Lamination.add_rule_ventilationPolar",
+ "Rules.Lamination.add_rule_ventilationTrap",
+ "Rules.Lamination.add_rule_notch_slotM19",
+ "Rules.Rotor_Magnet.add_rule_slotM14",
+ "Rules.Rotor_Magnet.add_rule_slotM13",
+ "Rules.Rotor_Magnet.add_rule_slotM16",
+ "Rules.Rotor_Magnet.add_rule_slotM11",
+ "Rules.Rotor_Magnet.add_rule_slotM15",
+ "Rules.Rotor_Magnet.add_rule_slotM12",
+ "select_SIPMSM_machine_dimension",
+ "Rules.Hole.add_rule_holeM61",
+ "Rules.Hole.add_rule_holeM57",
+ "Rules.Hole.add_rule_holeM60",
+ "Rules.Hole.add_rule_holeM63",
+ "Rules.Hole.add_rule_holeM52",
+ "Rules.Hole.add_rule_holeM62"
+ ],
+ "mother": "Convert",
+ "name": "ConvertMC",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/ConvertMC.csv",
+ "properties": []
+ },
"DXFImport": {
"constants": [
{
@@ -5935,7 +6083,7 @@
"mother": "LamSlotM",
"name": "LamSlotMag",
"package": "Machine",
- "path": "pyleecan/Generator/ClassesRef/Machine/.csv",
+ "path": "pyleecan/Generator/ClassesRef/Machine/LamSlotMag.csv",
"properties": [
{
"as_dict": "",
@@ -12152,6 +12300,209 @@
"path": "pyleecan/Generator/ClassesRef/Mesh/Interpolation/RefTriangle6.csv",
"properties": []
},
+ "Rule": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [
+ "RuleComplex",
+ "RuleEquation",
+ "RuleSimple"
+ ],
+ "desc": "abstract class for rules",
+ "is_internal": false,
+ "methods": [
+ "set_P",
+ "get_P",
+ "set_other",
+ "get_other",
+ "get_name"
+ ],
+ "mother": "",
+ "name": "Rule",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/Rule.csv",
+ "properties": [
+ {
+ "as_dict": "",
+ "desc": "unit",
+ "max": "",
+ "min": "",
+ "name": "unit_type",
+ "type": "str",
+ "unit": "-",
+ "value": "m"
+ }
+ ]
+ },
+ "RuleComplex": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [],
+ "desc": "complex rules",
+ "is_internal": false,
+ "methods": [
+ "convert_to_P",
+ "convert_to_other",
+ "_set_fct_name"
+ ],
+ "mother": "Rule",
+ "name": "RuleComplex",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/RuleComplex.csv",
+ "properties": [
+ {
+ "as_dict": "",
+ "desc": "fonction name to convert",
+ "max": "",
+ "min": "",
+ "name": "fct_name",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ },
+ {
+ "as_dict": "",
+ "desc": "name source",
+ "max": "",
+ "min": "",
+ "name": "folder",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ },
+ {
+ "as_dict": "",
+ "desc": "dict to pass param ",
+ "max": "",
+ "min": "",
+ "name": "param_dict",
+ "type": "dict",
+ "unit": "-",
+ "value": {}
+ }
+ ]
+ },
+ "RuleEquation": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [],
+ "desc": "simple rules",
+ "is_internal": false,
+ "methods": [
+ "convert_to_P",
+ "convert_to_other",
+ "solve_equation"
+ ],
+ "mother": "Rule",
+ "name": "RuleEquation",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/RuleEquation.csv",
+ "properties": [
+ {
+ "as_dict": "",
+ "desc": "dict all parameters",
+ "max": "",
+ "min": "",
+ "name": "param",
+ "type": "list",
+ "unit": "-",
+ "value": null
+ },
+ {
+ "as_dict": "",
+ "desc": "conversion paramter to pyleecan (Y are always on other side",
+ "max": "",
+ "min": "",
+ "name": "equation",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ },
+ {
+ "as_dict": "",
+ "desc": "use just to debug, give name of file",
+ "max": "",
+ "min": "",
+ "name": "file_name",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ }
+ ]
+ },
+ "RuleSimple": {
+ "constants": [
+ {
+ "name": "VERSION",
+ "value": "1"
+ }
+ ],
+ "daughters": [],
+ "desc": "simple rules",
+ "is_internal": false,
+ "methods": [
+ "convert_to_P",
+ "convert_to_other"
+ ],
+ "mother": "Rule",
+ "name": "RuleSimple",
+ "package": "Converter",
+ "path": "pyleecan/Generator/ClassesRef/Converter/RuleSimple.csv",
+ "properties": [
+ {
+ "as_dict": "",
+ "desc": "parameter ",
+ "max": "",
+ "min": "",
+ "name": "other_key_list",
+ "type": "list",
+ "unit": "-",
+ "value": null
+ },
+ {
+ "as_dict": "",
+ "desc": "path pyleecan parameter in object machine ",
+ "max": "",
+ "min": "",
+ "name": "P_obj_path",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ },
+ {
+ "as_dict": "",
+ "desc": "conversion paramter to pyleecan",
+ "max": "",
+ "min": "",
+ "name": "scaling_to_P",
+ "type": "float",
+ "unit": "-",
+ "value": 1
+ },
+ {
+ "as_dict": "",
+ "desc": "use just to debug, give name of file",
+ "max": "",
+ "min": "",
+ "name": "file_name",
+ "type": "str",
+ "unit": "-",
+ "value": "None"
+ }
+ ]
+ },
"ScalarProduct": {
"constants": [
{
@@ -13193,7 +13544,7 @@
"name": "W0",
"type": "float",
"unit": "m",
- "value": 0.0122
+ "value": 0
},
{
"as_dict": "",
@@ -13203,27 +13554,27 @@
"name": "H0",
"type": "float",
"unit": "m",
- "value": 0.001
+ "value": 0
},
{
"as_dict": "",
"desc": "Magnet width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "m",
- "value": 0.0122
+ "value": 0
},
{
"as_dict": "",
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
- "value": 0.001
+ "value": 0
}
]
},
@@ -13268,7 +13619,7 @@
"name": "W0",
"type": "float",
"unit": "rad",
- "value": 0.0122
+ "value": 0
},
{
"as_dict": "",
@@ -13278,27 +13629,27 @@
"name": "H0",
"type": "float",
"unit": "m",
- "value": 0.001
+ "value": 0
},
{
"as_dict": "",
"desc": "Magnet angular width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "rad",
- "value": 0.0122
+ "value": 0
},
{
"as_dict": "",
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
- "value": 0.001
+ "value": 0
}
]
},
@@ -13359,7 +13710,7 @@
"desc": "Magnet width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "m",
"value": 0.0122
@@ -13369,7 +13720,7 @@
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13433,7 +13784,7 @@
"desc": "Magnet width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "m",
"value": 0.0122
@@ -13443,7 +13794,7 @@
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13518,7 +13869,7 @@
"desc": "Magnet angular width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "rad",
"value": 0.0122
@@ -13528,7 +13879,7 @@
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13602,7 +13953,7 @@
"desc": "Magnet width",
"max": "",
"min": "0",
- "name": "Wmag",
+ "name": "W1",
"type": "float",
"unit": "m",
"value": 0.0122
@@ -13612,7 +13963,7 @@
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H1",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13773,7 +14124,7 @@
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H0",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13819,7 +14170,7 @@
"desc": "Height of the magnet near the bore",
"max": "",
"min": "0",
- "name": "Hmag_bore",
+ "name": "H0_bore",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13829,7 +14180,7 @@
"desc": "Height of the magnet near the airgap",
"max": "",
"min": "0",
- "name": "Hmag_gap",
+ "name": "H0_gap",
"type": "float",
"unit": "m",
"value": 0.001
@@ -13875,7 +14226,7 @@
"name": "W0",
"type": "float",
"unit": "m",
- "value": 0.03
+ "value": 0
},
{
"as_dict": "",
@@ -13885,17 +14236,17 @@
"name": "W1",
"type": "float",
"unit": "m",
- "value": 0.02
+ "value": 0
},
{
"as_dict": "",
"desc": "Magnet Height",
"max": "",
"min": "0",
- "name": "Hmag",
+ "name": "H0",
"type": "float",
"unit": "m",
- "value": 0.00175
+ "value": 0
}
]
},
@@ -14508,7 +14859,8 @@
"get_surface_active",
"get_surface_wedge",
"get_surface_opening",
- "plot_schematics"
+ "plot_schematics",
+ "get_H1"
],
"mother": "Slot",
"name": "SlotW14",
@@ -14537,13 +14889,13 @@
},
{
"as_dict": "",
- "desc": "Slot intermediate height.",
+ "desc": "height or angle (See Schematics)",
"max": "",
"min": "0",
"name": "H1",
"type": "float",
- "unit": "m",
- "value": 0.0015
+ "unit": "m/rad",
+ "value": 0
},
{
"as_dict": "",
@@ -14574,6 +14926,16 @@
"type": "float",
"unit": "m",
"value": 0.0122
+ },
+ {
+ "as_dict": "",
+ "desc": "H1 unit, 0 for m, 1 for rad",
+ "max": "",
+ "min": "",
+ "name": "H1_is_rad",
+ "type": "bool",
+ "unit": "",
+ "value": false
}
]
},
diff --git a/pyleecan/Classes/Convert.py b/pyleecan/Classes/Convert.py
new file mode 100644
index 000000000..a3d5f4ed7
--- /dev/null
+++ b/pyleecan/Classes/Convert.py
@@ -0,0 +1,758 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/Convert.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/Convert
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from ._frozen import FrozenClass
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.Convert.convert_to_other import convert_to_other
+except ImportError as error:
+ convert_to_other = error
+
+try:
+ from ..Methods.Converter.Convert.convert_to_P import convert_to_P
+except ImportError as error:
+ convert_to_P = error
+
+try:
+ from ..Methods.Converter.Convert.select_LamSlotWind_rules import (
+ select_LamSlotWind_rules,
+ )
+except ImportError as error:
+ select_LamSlotWind_rules = error
+
+try:
+ from ..Methods.Converter.Convert.select_machine_rules import select_machine_rules
+except ImportError as error:
+ select_machine_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_slot_rotor_rules import (
+ select_slot_rotor_rules,
+ )
+except ImportError as error:
+ select_slot_rotor_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_slot_rules import select_slot_rules
+except ImportError as error:
+ select_slot_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_lamination_rules import (
+ select_lamination_rules,
+ )
+except ImportError as error:
+ select_lamination_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_winding_rules import (
+ select_winding_rules,
+ )
+except ImportError as error:
+ select_winding_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_conductor_rules import (
+ select_conductor_rules,
+ )
+except ImportError as error:
+ select_conductor_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_hole_rules import select_hole_rules
+except ImportError as error:
+ select_hole_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_pole_rules import select_pole_rules
+except ImportError as error:
+ select_pole_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_magnet_rules import select_magnet_rules
+except ImportError as error:
+ select_magnet_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_skew_rules import select_skew_rules
+except ImportError as error:
+ select_skew_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_bar_rules import select_bar_rules
+except ImportError as error:
+ select_bar_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_duct_rules import select_duct_rules
+except ImportError as error:
+ select_duct_rules = error
+
+try:
+ from ..Methods.Converter.Convert.Step.select_notch_rules import select_notch_rules
+except ImportError as error:
+ select_notch_rules = error
+
+try:
+ from ..Methods.Converter.Convert.machine_type.select_SIPMSM_rules import (
+ select_SIPMSM_rules,
+ )
+except ImportError as error:
+ select_SIPMSM_rules = error
+
+try:
+ from ..Methods.Converter.Convert.machine_type.select_IPMSM_rules import (
+ select_IPMSM_rules,
+ )
+except ImportError as error:
+ select_IPMSM_rules = error
+
+try:
+ from ..Methods.Converter.Convert.machine_type.select_SCIM_rules import (
+ select_SCIM_rules,
+ )
+except ImportError as error:
+ select_SCIM_rules = error
+
+try:
+ from ..Methods.Converter.Convert.machine_type.select_WRSM_rules import (
+ select_WRSM_rules,
+ )
+except ImportError as error:
+ select_WRSM_rules = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class Convert(FrozenClass):
+ """initialisation of conversion abstract"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.Convert.convert_to_other
+ if isinstance(convert_to_other, ImportError):
+ convert_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method convert_to_other: "
+ + str(convert_to_other)
+ )
+ )
+ )
+ else:
+ convert_to_other = convert_to_other
+ # cf Methods.Converter.Convert.convert_to_P
+ if isinstance(convert_to_P, ImportError):
+ convert_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method convert_to_P: " + str(convert_to_P)
+ )
+ )
+ )
+ else:
+ convert_to_P = convert_to_P
+ # cf Methods.Converter.Convert.select_LamSlotWind_rules
+ if isinstance(select_LamSlotWind_rules, ImportError):
+ select_LamSlotWind_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_LamSlotWind_rules: "
+ + str(select_LamSlotWind_rules)
+ )
+ )
+ )
+ else:
+ select_LamSlotWind_rules = select_LamSlotWind_rules
+ # cf Methods.Converter.Convert.select_machine_rules
+ if isinstance(select_machine_rules, ImportError):
+ select_machine_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_machine_rules: "
+ + str(select_machine_rules)
+ )
+ )
+ )
+ else:
+ select_machine_rules = select_machine_rules
+ # cf Methods.Converter.Convert.Step.select_slot_rotor_rules
+ if isinstance(select_slot_rotor_rules, ImportError):
+ select_slot_rotor_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_slot_rotor_rules: "
+ + str(select_slot_rotor_rules)
+ )
+ )
+ )
+ else:
+ select_slot_rotor_rules = select_slot_rotor_rules
+ # cf Methods.Converter.Convert.Step.select_slot_rules
+ if isinstance(select_slot_rules, ImportError):
+ select_slot_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_slot_rules: "
+ + str(select_slot_rules)
+ )
+ )
+ )
+ else:
+ select_slot_rules = select_slot_rules
+ # cf Methods.Converter.Convert.Step.select_lamination_rules
+ if isinstance(select_lamination_rules, ImportError):
+ select_lamination_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_lamination_rules: "
+ + str(select_lamination_rules)
+ )
+ )
+ )
+ else:
+ select_lamination_rules = select_lamination_rules
+ # cf Methods.Converter.Convert.Step.select_winding_rules
+ if isinstance(select_winding_rules, ImportError):
+ select_winding_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_winding_rules: "
+ + str(select_winding_rules)
+ )
+ )
+ )
+ else:
+ select_winding_rules = select_winding_rules
+ # cf Methods.Converter.Convert.Step.select_conductor_rules
+ if isinstance(select_conductor_rules, ImportError):
+ select_conductor_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_conductor_rules: "
+ + str(select_conductor_rules)
+ )
+ )
+ )
+ else:
+ select_conductor_rules = select_conductor_rules
+ # cf Methods.Converter.Convert.Step.select_hole_rules
+ if isinstance(select_hole_rules, ImportError):
+ select_hole_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_hole_rules: "
+ + str(select_hole_rules)
+ )
+ )
+ )
+ else:
+ select_hole_rules = select_hole_rules
+ # cf Methods.Converter.Convert.Step.select_pole_rules
+ if isinstance(select_pole_rules, ImportError):
+ select_pole_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_pole_rules: "
+ + str(select_pole_rules)
+ )
+ )
+ )
+ else:
+ select_pole_rules = select_pole_rules
+ # cf Methods.Converter.Convert.Step.select_magnet_rules
+ if isinstance(select_magnet_rules, ImportError):
+ select_magnet_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_magnet_rules: "
+ + str(select_magnet_rules)
+ )
+ )
+ )
+ else:
+ select_magnet_rules = select_magnet_rules
+ # cf Methods.Converter.Convert.Step.select_skew_rules
+ if isinstance(select_skew_rules, ImportError):
+ select_skew_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_skew_rules: "
+ + str(select_skew_rules)
+ )
+ )
+ )
+ else:
+ select_skew_rules = select_skew_rules
+ # cf Methods.Converter.Convert.Step.select_bar_rules
+ if isinstance(select_bar_rules, ImportError):
+ select_bar_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_bar_rules: "
+ + str(select_bar_rules)
+ )
+ )
+ )
+ else:
+ select_bar_rules = select_bar_rules
+ # cf Methods.Converter.Convert.Step.select_duct_rules
+ if isinstance(select_duct_rules, ImportError):
+ select_duct_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_duct_rules: "
+ + str(select_duct_rules)
+ )
+ )
+ )
+ else:
+ select_duct_rules = select_duct_rules
+ # cf Methods.Converter.Convert.Step.select_notch_rules
+ if isinstance(select_notch_rules, ImportError):
+ select_notch_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_notch_rules: "
+ + str(select_notch_rules)
+ )
+ )
+ )
+ else:
+ select_notch_rules = select_notch_rules
+ # cf Methods.Converter.Convert.machine_type.select_SIPMSM_rules
+ if isinstance(select_SIPMSM_rules, ImportError):
+ select_SIPMSM_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_SIPMSM_rules: "
+ + str(select_SIPMSM_rules)
+ )
+ )
+ )
+ else:
+ select_SIPMSM_rules = select_SIPMSM_rules
+ # cf Methods.Converter.Convert.machine_type.select_IPMSM_rules
+ if isinstance(select_IPMSM_rules, ImportError):
+ select_IPMSM_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_IPMSM_rules: "
+ + str(select_IPMSM_rules)
+ )
+ )
+ )
+ else:
+ select_IPMSM_rules = select_IPMSM_rules
+ # cf Methods.Converter.Convert.machine_type.select_SCIM_rules
+ if isinstance(select_SCIM_rules, ImportError):
+ select_SCIM_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_SCIM_rules: "
+ + str(select_SCIM_rules)
+ )
+ )
+ )
+ else:
+ select_SCIM_rules = select_SCIM_rules
+ # cf Methods.Converter.Convert.machine_type.select_WRSM_rules
+ if isinstance(select_WRSM_rules, ImportError):
+ select_WRSM_rules = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use Convert method select_WRSM_rules: "
+ + str(select_WRSM_rules)
+ )
+ )
+ )
+ else:
+ select_WRSM_rules = select_WRSM_rules
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(
+ self,
+ other_unit_dict=-1,
+ other_dict=-1,
+ machine=None,
+ rules_list=-1,
+ is_P_to_other=False,
+ init_dict=None,
+ init_str=None,
+ ):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "other_unit_dict" in list(init_dict.keys()):
+ other_unit_dict = init_dict["other_unit_dict"]
+ if "other_dict" in list(init_dict.keys()):
+ other_dict = init_dict["other_dict"]
+ if "machine" in list(init_dict.keys()):
+ machine = init_dict["machine"]
+ if "rules_list" in list(init_dict.keys()):
+ rules_list = init_dict["rules_list"]
+ if "is_P_to_other" in list(init_dict.keys()):
+ is_P_to_other = init_dict["is_P_to_other"]
+ # Set the properties (value check and convertion are done in setter)
+ self.parent = None
+ self.other_unit_dict = other_unit_dict
+ self.other_dict = other_dict
+ self.machine = machine
+ self.rules_list = rules_list
+ self.is_P_to_other = is_P_to_other
+
+ # The class is frozen, for now it's impossible to add new properties
+ self._freeze()
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ Convert_str = ""
+ if self.parent is None:
+ Convert_str += "parent = None " + linesep
+ else:
+ Convert_str += "parent = " + str(type(self.parent)) + " object" + linesep
+ Convert_str += "other_unit_dict = " + str(self.other_unit_dict) + linesep
+ Convert_str += "other_dict = " + str(self.other_dict) + linesep
+ if self.machine is not None:
+ tmp = self.machine.__str__().replace(linesep, linesep + "\t").rstrip("\t")
+ Convert_str += "machine = " + tmp
+ else:
+ Convert_str += "machine = None" + linesep + linesep
+ Convert_str += (
+ "rules_list = "
+ + linesep
+ + str(self.rules_list).replace(linesep, linesep + "\t")
+ + linesep
+ )
+ Convert_str += "is_P_to_other = " + str(self.is_P_to_other) + linesep
+ return Convert_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+ if other.other_unit_dict != self.other_unit_dict:
+ return False
+ if other.other_dict != self.other_dict:
+ return False
+ if other.machine != self.machine:
+ return False
+ if other.rules_list != self.rules_list:
+ return False
+ if other.is_P_to_other != self.is_P_to_other:
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+ if other._other_unit_dict != self._other_unit_dict:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._other_unit_dict)
+ + ", other="
+ + str(other._other_unit_dict)
+ + ")"
+ )
+ diff_list.append(name + ".other_unit_dict" + val_str)
+ else:
+ diff_list.append(name + ".other_unit_dict")
+ if other._other_dict != self._other_dict:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._other_dict)
+ + ", other="
+ + str(other._other_dict)
+ + ")"
+ )
+ diff_list.append(name + ".other_dict" + val_str)
+ else:
+ diff_list.append(name + ".other_dict")
+ if (other.machine is None and self.machine is not None) or (
+ other.machine is not None and self.machine is None
+ ):
+ diff_list.append(name + ".machine None mismatch")
+ elif self.machine is not None:
+ diff_list.extend(
+ self.machine.compare(
+ other.machine,
+ name=name + ".machine",
+ ignore_list=ignore_list,
+ is_add_value=is_add_value,
+ )
+ )
+ if other._rules_list != self._rules_list:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._rules_list)
+ + ", other="
+ + str(other._rules_list)
+ + ")"
+ )
+ diff_list.append(name + ".rules_list" + val_str)
+ else:
+ diff_list.append(name + ".rules_list")
+ if other._is_P_to_other != self._is_P_to_other:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._is_P_to_other)
+ + ", other="
+ + str(other._is_P_to_other)
+ + ")"
+ )
+ diff_list.append(name + ".is_P_to_other" + val_str)
+ else:
+ diff_list.append(name + ".is_P_to_other")
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+ if self.other_unit_dict is not None:
+ for key, value in self.other_unit_dict.items():
+ S += getsizeof(value) + getsizeof(key)
+ if self.other_dict is not None:
+ for key, value in self.other_dict.items():
+ S += getsizeof(value) + getsizeof(key)
+ S += getsizeof(self.machine)
+ if self.rules_list is not None:
+ for value in self.rules_list:
+ S += getsizeof(value)
+ S += getsizeof(self.is_P_to_other)
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ Convert_dict = dict()
+ Convert_dict["other_unit_dict"] = (
+ self.other_unit_dict.copy() if self.other_unit_dict is not None else None
+ )
+ Convert_dict["other_dict"] = (
+ self.other_dict.copy() if self.other_dict is not None else None
+ )
+ if self.machine is None:
+ Convert_dict["machine"] = None
+ else:
+ Convert_dict["machine"] = self.machine.as_dict(
+ type_handle_ndarray=type_handle_ndarray,
+ keep_function=keep_function,
+ **kwargs
+ )
+ Convert_dict["rules_list"] = (
+ self.rules_list.copy() if self.rules_list is not None else None
+ )
+ Convert_dict["is_P_to_other"] = self.is_P_to_other
+ # The class name is added to the dict for deserialisation purpose
+ Convert_dict["__class__"] = "Convert"
+ return Convert_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ if self.other_unit_dict is None:
+ other_unit_dict_val = None
+ else:
+ other_unit_dict_val = self.other_unit_dict.copy()
+ if self.other_dict is None:
+ other_dict_val = None
+ else:
+ other_dict_val = self.other_dict.copy()
+ if self.machine is None:
+ machine_val = None
+ else:
+ machine_val = self.machine.copy()
+ if self.rules_list is None:
+ rules_list_val = None
+ else:
+ rules_list_val = self.rules_list.copy()
+ is_P_to_other_val = self.is_P_to_other
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(
+ other_unit_dict=other_unit_dict_val,
+ other_dict=other_dict_val,
+ machine=machine_val,
+ rules_list=rules_list_val,
+ is_P_to_other=is_P_to_other_val,
+ )
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ self.other_unit_dict = None
+ self.other_dict = None
+ if self.machine is not None:
+ self.machine._set_None()
+ self.rules_list = None
+ self.is_P_to_other = None
+
+ def _get_other_unit_dict(self):
+ """getter of other_unit_dict"""
+ return self._other_unit_dict
+
+ def _set_other_unit_dict(self, value):
+ """setter of other_unit_dict"""
+ if type(value) is int and value == -1:
+ value = dict()
+ check_var("other_unit_dict", value, "dict")
+ self._other_unit_dict = value
+
+ other_unit_dict = property(
+ fget=_get_other_unit_dict,
+ fset=_set_other_unit_dict,
+ doc=u"""convertion unit file .mot into unit_dict
+
+ :Type: dict
+ """,
+ )
+
+ def _get_other_dict(self):
+ """getter of other_dict"""
+ return self._other_dict
+
+ def _set_other_dict(self, value):
+ """setter of other_dict"""
+ if type(value) is int and value == -1:
+ value = dict()
+ check_var("other_dict", value, "dict")
+ self._other_dict = value
+
+ other_dict = property(
+ fget=_get_other_dict,
+ fset=_set_other_dict,
+ doc=u"""convertion file .mot in dict
+
+ :Type: dict
+ """,
+ )
+
+ def _get_machine(self):
+ """getter of machine"""
+ return self._machine
+
+ def _set_machine(self, value):
+ """setter of machine"""
+ if isinstance(value, str): # Load from file
+ try:
+ value = load_init_dict(value)[1]
+ except Exception as e:
+ self.get_logger().error(
+ "Error while loading " + value + ", setting None instead"
+ )
+ value = None
+ if isinstance(value, dict) and "__class__" in value:
+ class_obj = import_class(
+ "pyleecan.Classes", value.get("__class__"), "machine"
+ )
+ value = class_obj(init_dict=value)
+ elif type(value) is int and value == -1: # Default constructor
+ Machine = import_class("pyleecan.Classes", "Machine", "machine")
+ value = Machine()
+ check_var("machine", value, "Machine")
+ self._machine = value
+
+ if self._machine is not None:
+ self._machine.parent = self
+
+ machine = property(
+ fget=_get_machine,
+ fset=_set_machine,
+ doc=u"""machine pyleecan
+
+ :Type: Machine
+ """,
+ )
+
+ def _get_rules_list(self):
+ """getter of rules_list"""
+ return self._rules_list
+
+ def _set_rules_list(self, value):
+ """setter of rules_list"""
+ if type(value) is int and value == -1:
+ value = list()
+ check_var("rules_list", value, "list")
+ self._rules_list = value
+
+ rules_list = property(
+ fget=_get_rules_list,
+ fset=_set_rules_list,
+ doc=u"""list differents rules
+
+ :Type: list
+ """,
+ )
+
+ def _get_is_P_to_other(self):
+ """getter of is_P_to_other"""
+ return self._is_P_to_other
+
+ def _set_is_P_to_other(self, value):
+ """setter of is_P_to_other"""
+ check_var("is_P_to_other", value, "bool")
+ self._is_P_to_other = value
+
+ is_P_to_other = property(
+ fget=_get_is_P_to_other,
+ fset=_set_is_P_to_other,
+ doc=u"""booleen to select the direction of conversion
+
+ :Type: bool
+ """,
+ )
diff --git a/pyleecan/Classes/ConvertMC.py b/pyleecan/Classes/ConvertMC.py
new file mode 100644
index 000000000..10a39ac66
--- /dev/null
+++ b/pyleecan/Classes/ConvertMC.py
@@ -0,0 +1,930 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/ConvertMC.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/ConvertMC
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from .Convert import Convert
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_other_to_dict import (
+ convert_other_to_dict,
+ )
+except ImportError as error:
+ convert_other_to_dict = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_slot_to_P import (
+ convert_slot_to_P,
+ )
+except ImportError as error:
+ convert_slot_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_machine_to_P import (
+ convert_machine_to_P,
+ )
+except ImportError as error:
+ convert_machine_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_magnet_to_P import (
+ convert_magnet_to_P,
+ )
+except ImportError as error:
+ convert_magnet_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_hole_to_P import (
+ convert_hole_to_P,
+ )
+except ImportError as error:
+ convert_hole_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_duct_to_P import (
+ convert_duct_to_P,
+ )
+except ImportError as error:
+ convert_duct_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_P.convert_notch_to_P import (
+ convert_notch_to_P,
+ )
+except ImportError as error:
+ convert_notch_to_P = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.init_other_unit import (
+ init_other_unit,
+ )
+except ImportError as error:
+ init_other_unit = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_slot_to_other import (
+ convert_slot_to_other,
+ )
+except ImportError as error:
+ convert_slot_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_machine_to_other import (
+ convert_machine_to_other,
+ )
+except ImportError as error:
+ convert_machine_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_magnet_to_other import (
+ convert_magnet_to_other,
+ )
+except ImportError as error:
+ convert_magnet_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_hole_to_other import (
+ convert_hole_to_other,
+ )
+except ImportError as error:
+ convert_hole_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_duct_to_other import (
+ convert_duct_to_other,
+ )
+except ImportError as error:
+ convert_duct_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.convert_to_other.convert_notch_to_other import (
+ convert_notch_to_other,
+ )
+except ImportError as error:
+ convert_notch_to_other = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.add_rule_machine_dimension import (
+ add_rule_machine_dimension,
+ )
+except ImportError as error:
+ add_rule_machine_dimension = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.add_rule_machine_dimension_surface_magnet import (
+ add_rule_machine_dimension_surface_magnet,
+ )
+except ImportError as error:
+ add_rule_machine_dimension_surface_magnet = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.add_rule_machine_type import (
+ add_rule_machine_type,
+ )
+except ImportError as error:
+ add_rule_machine_type = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW11 import (
+ add_rule_slotW11,
+ )
+except ImportError as error:
+ add_rule_slotW11 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW29 import (
+ add_rule_slotW29,
+ )
+except ImportError as error:
+ add_rule_slotW29 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW21 import (
+ add_rule_slotW21,
+ )
+except ImportError as error:
+ add_rule_slotW21 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW14 import (
+ add_rule_slotW14,
+ )
+except ImportError as error:
+ add_rule_slotW14 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW23 import (
+ add_rule_slotW23,
+ )
+except ImportError as error:
+ add_rule_slotW23 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationCirc import (
+ add_rule_ventilationCirc,
+ )
+except ImportError as error:
+ add_rule_ventilationCirc = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationPolar import (
+ add_rule_ventilationPolar,
+ )
+except ImportError as error:
+ add_rule_ventilationPolar = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationTrap import (
+ add_rule_ventilationTrap,
+ )
+except ImportError as error:
+ add_rule_ventilationTrap = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Lamination.add_rule_notch_slotM19 import (
+ add_rule_notch_slotM19,
+ )
+except ImportError as error:
+ add_rule_notch_slotM19 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM14 import (
+ add_rule_slotM14,
+ )
+except ImportError as error:
+ add_rule_slotM14 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM13 import (
+ add_rule_slotM13,
+ )
+except ImportError as error:
+ add_rule_slotM13 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM16 import (
+ add_rule_slotM16,
+ )
+except ImportError as error:
+ add_rule_slotM16 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM11 import (
+ add_rule_slotM11,
+ )
+except ImportError as error:
+ add_rule_slotM11 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM15 import (
+ add_rule_slotM15,
+ )
+except ImportError as error:
+ add_rule_slotM15 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM12 import (
+ add_rule_slotM12,
+ )
+except ImportError as error:
+ add_rule_slotM12 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.select_SIPMSM_machine_dimension import (
+ select_SIPMSM_machine_dimension,
+ )
+except ImportError as error:
+ select_SIPMSM_machine_dimension = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM61 import (
+ add_rule_holeM61,
+ )
+except ImportError as error:
+ add_rule_holeM61 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM57 import (
+ add_rule_holeM57,
+ )
+except ImportError as error:
+ add_rule_holeM57 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM60 import (
+ add_rule_holeM60,
+ )
+except ImportError as error:
+ add_rule_holeM60 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM63 import (
+ add_rule_holeM63,
+ )
+except ImportError as error:
+ add_rule_holeM63 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM52 import (
+ add_rule_holeM52,
+ )
+except ImportError as error:
+ add_rule_holeM52 = error
+
+try:
+ from ..Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM62 import (
+ add_rule_holeM62,
+ )
+except ImportError as error:
+ add_rule_holeM62 = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class ConvertMC(Convert):
+ """convertorMC abstract"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_other_to_dict
+ if isinstance(convert_other_to_dict, ImportError):
+ convert_other_to_dict = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_other_to_dict: "
+ + str(convert_other_to_dict)
+ )
+ )
+ )
+ else:
+ convert_other_to_dict = convert_other_to_dict
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_slot_to_P
+ if isinstance(convert_slot_to_P, ImportError):
+ convert_slot_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_slot_to_P: "
+ + str(convert_slot_to_P)
+ )
+ )
+ )
+ else:
+ convert_slot_to_P = convert_slot_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_machine_to_P
+ if isinstance(convert_machine_to_P, ImportError):
+ convert_machine_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_machine_to_P: "
+ + str(convert_machine_to_P)
+ )
+ )
+ )
+ else:
+ convert_machine_to_P = convert_machine_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_magnet_to_P
+ if isinstance(convert_magnet_to_P, ImportError):
+ convert_magnet_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_magnet_to_P: "
+ + str(convert_magnet_to_P)
+ )
+ )
+ )
+ else:
+ convert_magnet_to_P = convert_magnet_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_hole_to_P
+ if isinstance(convert_hole_to_P, ImportError):
+ convert_hole_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_hole_to_P: "
+ + str(convert_hole_to_P)
+ )
+ )
+ )
+ else:
+ convert_hole_to_P = convert_hole_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_duct_to_P
+ if isinstance(convert_duct_to_P, ImportError):
+ convert_duct_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_duct_to_P: "
+ + str(convert_duct_to_P)
+ )
+ )
+ )
+ else:
+ convert_duct_to_P = convert_duct_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_P.convert_notch_to_P
+ if isinstance(convert_notch_to_P, ImportError):
+ convert_notch_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_notch_to_P: "
+ + str(convert_notch_to_P)
+ )
+ )
+ )
+ else:
+ convert_notch_to_P = convert_notch_to_P
+ # cf Methods.Converter.ConvertMC.convert_to_other.init_other_unit
+ if isinstance(init_other_unit, ImportError):
+ init_other_unit = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method init_other_unit: "
+ + str(init_other_unit)
+ )
+ )
+ )
+ else:
+ init_other_unit = init_other_unit
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_slot_to_other
+ if isinstance(convert_slot_to_other, ImportError):
+ convert_slot_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_slot_to_other: "
+ + str(convert_slot_to_other)
+ )
+ )
+ )
+ else:
+ convert_slot_to_other = convert_slot_to_other
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_machine_to_other
+ if isinstance(convert_machine_to_other, ImportError):
+ convert_machine_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_machine_to_other: "
+ + str(convert_machine_to_other)
+ )
+ )
+ )
+ else:
+ convert_machine_to_other = convert_machine_to_other
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_magnet_to_other
+ if isinstance(convert_magnet_to_other, ImportError):
+ convert_magnet_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_magnet_to_other: "
+ + str(convert_magnet_to_other)
+ )
+ )
+ )
+ else:
+ convert_magnet_to_other = convert_magnet_to_other
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_hole_to_other
+ if isinstance(convert_hole_to_other, ImportError):
+ convert_hole_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_hole_to_other: "
+ + str(convert_hole_to_other)
+ )
+ )
+ )
+ else:
+ convert_hole_to_other = convert_hole_to_other
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_duct_to_other
+ if isinstance(convert_duct_to_other, ImportError):
+ convert_duct_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_duct_to_other: "
+ + str(convert_duct_to_other)
+ )
+ )
+ )
+ else:
+ convert_duct_to_other = convert_duct_to_other
+ # cf Methods.Converter.ConvertMC.convert_to_other.convert_notch_to_other
+ if isinstance(convert_notch_to_other, ImportError):
+ convert_notch_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method convert_notch_to_other: "
+ + str(convert_notch_to_other)
+ )
+ )
+ )
+ else:
+ convert_notch_to_other = convert_notch_to_other
+ # cf Methods.Converter.ConvertMC.Rules.add_rule_machine_dimension
+ if isinstance(add_rule_machine_dimension, ImportError):
+ add_rule_machine_dimension = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_machine_dimension: "
+ + str(add_rule_machine_dimension)
+ )
+ )
+ )
+ else:
+ add_rule_machine_dimension = add_rule_machine_dimension
+ # cf Methods.Converter.ConvertMC.Rules.add_rule_machine_dimension_surface_magnet
+ if isinstance(add_rule_machine_dimension_surface_magnet, ImportError):
+ add_rule_machine_dimension_surface_magnet = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_machine_dimension_surface_magnet: "
+ + str(add_rule_machine_dimension_surface_magnet)
+ )
+ )
+ )
+ else:
+ add_rule_machine_dimension_surface_magnet = (
+ add_rule_machine_dimension_surface_magnet
+ )
+ # cf Methods.Converter.ConvertMC.Rules.add_rule_machine_type
+ if isinstance(add_rule_machine_type, ImportError):
+ add_rule_machine_type = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_machine_type: "
+ + str(add_rule_machine_type)
+ )
+ )
+ )
+ else:
+ add_rule_machine_type = add_rule_machine_type
+ # cf Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW11
+ if isinstance(add_rule_slotW11, ImportError):
+ add_rule_slotW11 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotW11: "
+ + str(add_rule_slotW11)
+ )
+ )
+ )
+ else:
+ add_rule_slotW11 = add_rule_slotW11
+ # cf Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW29
+ if isinstance(add_rule_slotW29, ImportError):
+ add_rule_slotW29 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotW29: "
+ + str(add_rule_slotW29)
+ )
+ )
+ )
+ else:
+ add_rule_slotW29 = add_rule_slotW29
+ # cf Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW21
+ if isinstance(add_rule_slotW21, ImportError):
+ add_rule_slotW21 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotW21: "
+ + str(add_rule_slotW21)
+ )
+ )
+ )
+ else:
+ add_rule_slotW21 = add_rule_slotW21
+ # cf Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW14
+ if isinstance(add_rule_slotW14, ImportError):
+ add_rule_slotW14 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotW14: "
+ + str(add_rule_slotW14)
+ )
+ )
+ )
+ else:
+ add_rule_slotW14 = add_rule_slotW14
+ # cf Methods.Converter.ConvertMC.Rules.Slot.add_rule_slotW23
+ if isinstance(add_rule_slotW23, ImportError):
+ add_rule_slotW23 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotW23: "
+ + str(add_rule_slotW23)
+ )
+ )
+ )
+ else:
+ add_rule_slotW23 = add_rule_slotW23
+ # cf Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationCirc
+ if isinstance(add_rule_ventilationCirc, ImportError):
+ add_rule_ventilationCirc = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_ventilationCirc: "
+ + str(add_rule_ventilationCirc)
+ )
+ )
+ )
+ else:
+ add_rule_ventilationCirc = add_rule_ventilationCirc
+ # cf Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationPolar
+ if isinstance(add_rule_ventilationPolar, ImportError):
+ add_rule_ventilationPolar = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_ventilationPolar: "
+ + str(add_rule_ventilationPolar)
+ )
+ )
+ )
+ else:
+ add_rule_ventilationPolar = add_rule_ventilationPolar
+ # cf Methods.Converter.ConvertMC.Rules.Lamination.add_rule_ventilationTrap
+ if isinstance(add_rule_ventilationTrap, ImportError):
+ add_rule_ventilationTrap = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_ventilationTrap: "
+ + str(add_rule_ventilationTrap)
+ )
+ )
+ )
+ else:
+ add_rule_ventilationTrap = add_rule_ventilationTrap
+ # cf Methods.Converter.ConvertMC.Rules.Lamination.add_rule_notch_slotM19
+ if isinstance(add_rule_notch_slotM19, ImportError):
+ add_rule_notch_slotM19 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_notch_slotM19: "
+ + str(add_rule_notch_slotM19)
+ )
+ )
+ )
+ else:
+ add_rule_notch_slotM19 = add_rule_notch_slotM19
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM14
+ if isinstance(add_rule_slotM14, ImportError):
+ add_rule_slotM14 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM14: "
+ + str(add_rule_slotM14)
+ )
+ )
+ )
+ else:
+ add_rule_slotM14 = add_rule_slotM14
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM13
+ if isinstance(add_rule_slotM13, ImportError):
+ add_rule_slotM13 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM13: "
+ + str(add_rule_slotM13)
+ )
+ )
+ )
+ else:
+ add_rule_slotM13 = add_rule_slotM13
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM16
+ if isinstance(add_rule_slotM16, ImportError):
+ add_rule_slotM16 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM16: "
+ + str(add_rule_slotM16)
+ )
+ )
+ )
+ else:
+ add_rule_slotM16 = add_rule_slotM16
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM11
+ if isinstance(add_rule_slotM11, ImportError):
+ add_rule_slotM11 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM11: "
+ + str(add_rule_slotM11)
+ )
+ )
+ )
+ else:
+ add_rule_slotM11 = add_rule_slotM11
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM15
+ if isinstance(add_rule_slotM15, ImportError):
+ add_rule_slotM15 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM15: "
+ + str(add_rule_slotM15)
+ )
+ )
+ )
+ else:
+ add_rule_slotM15 = add_rule_slotM15
+ # cf Methods.Converter.ConvertMC.Rules.Rotor_Magnet.add_rule_slotM12
+ if isinstance(add_rule_slotM12, ImportError):
+ add_rule_slotM12 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_slotM12: "
+ + str(add_rule_slotM12)
+ )
+ )
+ )
+ else:
+ add_rule_slotM12 = add_rule_slotM12
+ # cf Methods.Converter.ConvertMC.select_SIPMSM_machine_dimension
+ if isinstance(select_SIPMSM_machine_dimension, ImportError):
+ select_SIPMSM_machine_dimension = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method select_SIPMSM_machine_dimension: "
+ + str(select_SIPMSM_machine_dimension)
+ )
+ )
+ )
+ else:
+ select_SIPMSM_machine_dimension = select_SIPMSM_machine_dimension
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM61
+ if isinstance(add_rule_holeM61, ImportError):
+ add_rule_holeM61 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM61: "
+ + str(add_rule_holeM61)
+ )
+ )
+ )
+ else:
+ add_rule_holeM61 = add_rule_holeM61
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM57
+ if isinstance(add_rule_holeM57, ImportError):
+ add_rule_holeM57 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM57: "
+ + str(add_rule_holeM57)
+ )
+ )
+ )
+ else:
+ add_rule_holeM57 = add_rule_holeM57
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM60
+ if isinstance(add_rule_holeM60, ImportError):
+ add_rule_holeM60 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM60: "
+ + str(add_rule_holeM60)
+ )
+ )
+ )
+ else:
+ add_rule_holeM60 = add_rule_holeM60
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM63
+ if isinstance(add_rule_holeM63, ImportError):
+ add_rule_holeM63 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM63: "
+ + str(add_rule_holeM63)
+ )
+ )
+ )
+ else:
+ add_rule_holeM63 = add_rule_holeM63
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM52
+ if isinstance(add_rule_holeM52, ImportError):
+ add_rule_holeM52 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM52: "
+ + str(add_rule_holeM52)
+ )
+ )
+ )
+ else:
+ add_rule_holeM52 = add_rule_holeM52
+ # cf Methods.Converter.ConvertMC.Rules.Hole.add_rule_holeM62
+ if isinstance(add_rule_holeM62, ImportError):
+ add_rule_holeM62 = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use ConvertMC method add_rule_holeM62: "
+ + str(add_rule_holeM62)
+ )
+ )
+ )
+ else:
+ add_rule_holeM62 = add_rule_holeM62
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(
+ self,
+ other_unit_dict=-1,
+ other_dict=-1,
+ machine=None,
+ rules_list=-1,
+ is_P_to_other=False,
+ init_dict=None,
+ init_str=None,
+ ):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "other_unit_dict" in list(init_dict.keys()):
+ other_unit_dict = init_dict["other_unit_dict"]
+ if "other_dict" in list(init_dict.keys()):
+ other_dict = init_dict["other_dict"]
+ if "machine" in list(init_dict.keys()):
+ machine = init_dict["machine"]
+ if "rules_list" in list(init_dict.keys()):
+ rules_list = init_dict["rules_list"]
+ if "is_P_to_other" in list(init_dict.keys()):
+ is_P_to_other = init_dict["is_P_to_other"]
+ # Set the properties (value check and convertion are done in setter)
+ # Call Convert init
+ super(ConvertMC, self).__init__(
+ other_unit_dict=other_unit_dict,
+ other_dict=other_dict,
+ machine=machine,
+ rules_list=rules_list,
+ is_P_to_other=is_P_to_other,
+ )
+ # The class is frozen (in Convert init), for now it's impossible to
+ # add new properties
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ ConvertMC_str = ""
+ # Get the properties inherited from Convert
+ ConvertMC_str += super(ConvertMC, self).__str__()
+ return ConvertMC_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+
+ # Check the properties inherited from Convert
+ if not super(ConvertMC, self).__eq__(other):
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+
+ # Check the properties inherited from Convert
+ diff_list.extend(
+ super(ConvertMC, self).compare(
+ other, name=name, ignore_list=ignore_list, is_add_value=is_add_value
+ )
+ )
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+
+ # Get size of the properties inherited from Convert
+ S += super(ConvertMC, self).__sizeof__()
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ # Get the properties inherited from Convert
+ ConvertMC_dict = super(ConvertMC, self).as_dict(
+ type_handle_ndarray=type_handle_ndarray,
+ keep_function=keep_function,
+ **kwargs
+ )
+ # The class name is added to the dict for deserialisation purpose
+ # Overwrite the mother class name
+ ConvertMC_dict["__class__"] = "ConvertMC"
+ return ConvertMC_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ if self.other_unit_dict is None:
+ other_unit_dict_val = None
+ else:
+ other_unit_dict_val = self.other_unit_dict.copy()
+ if self.other_dict is None:
+ other_dict_val = None
+ else:
+ other_dict_val = self.other_dict.copy()
+ if self.machine is None:
+ machine_val = None
+ else:
+ machine_val = self.machine.copy()
+ if self.rules_list is None:
+ rules_list_val = None
+ else:
+ rules_list_val = self.rules_list.copy()
+ is_P_to_other_val = self.is_P_to_other
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(
+ other_unit_dict=other_unit_dict_val,
+ other_dict=other_dict_val,
+ machine=machine_val,
+ rules_list=rules_list_val,
+ is_P_to_other=is_P_to_other_val,
+ )
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ # Set to None the properties inherited from Convert
+ super(ConvertMC, self)._set_None()
diff --git a/pyleecan/Classes/Rule.py b/pyleecan/Classes/Rule.py
new file mode 100644
index 000000000..8ed2da9ca
--- /dev/null
+++ b/pyleecan/Classes/Rule.py
@@ -0,0 +1,229 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/Rule.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/Rule
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from ._frozen import FrozenClass
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.Rule.set_P import set_P
+except ImportError as error:
+ set_P = error
+
+try:
+ from ..Methods.Converter.Rule.get_P import get_P
+except ImportError as error:
+ get_P = error
+
+try:
+ from ..Methods.Converter.Rule.set_other import set_other
+except ImportError as error:
+ set_other = error
+
+try:
+ from ..Methods.Converter.Rule.get_other import get_other
+except ImportError as error:
+ get_other = error
+
+try:
+ from ..Methods.Converter.Rule.get_name import get_name
+except ImportError as error:
+ get_name = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class Rule(FrozenClass):
+ """abstract class for rules"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.Rule.set_P
+ if isinstance(set_P, ImportError):
+ set_P = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use Rule method set_P: " + str(set_P))
+ )
+ )
+ else:
+ set_P = set_P
+ # cf Methods.Converter.Rule.get_P
+ if isinstance(get_P, ImportError):
+ get_P = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use Rule method get_P: " + str(get_P))
+ )
+ )
+ else:
+ get_P = get_P
+ # cf Methods.Converter.Rule.set_other
+ if isinstance(set_other, ImportError):
+ set_other = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use Rule method set_other: " + str(set_other))
+ )
+ )
+ else:
+ set_other = set_other
+ # cf Methods.Converter.Rule.get_other
+ if isinstance(get_other, ImportError):
+ get_other = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use Rule method get_other: " + str(get_other))
+ )
+ )
+ else:
+ get_other = get_other
+ # cf Methods.Converter.Rule.get_name
+ if isinstance(get_name, ImportError):
+ get_name = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use Rule method get_name: " + str(get_name))
+ )
+ )
+ else:
+ get_name = get_name
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(self, unit_type="m", init_dict=None, init_str=None):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "unit_type" in list(init_dict.keys()):
+ unit_type = init_dict["unit_type"]
+ # Set the properties (value check and convertion are done in setter)
+ self.parent = None
+ self.unit_type = unit_type
+
+ # The class is frozen, for now it's impossible to add new properties
+ self._freeze()
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ Rule_str = ""
+ if self.parent is None:
+ Rule_str += "parent = None " + linesep
+ else:
+ Rule_str += "parent = " + str(type(self.parent)) + " object" + linesep
+ Rule_str += 'unit_type = "' + str(self.unit_type) + '"' + linesep
+ return Rule_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+ if other.unit_type != self.unit_type:
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+ if other._unit_type != self._unit_type:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._unit_type)
+ + ", other="
+ + str(other._unit_type)
+ + ")"
+ )
+ diff_list.append(name + ".unit_type" + val_str)
+ else:
+ diff_list.append(name + ".unit_type")
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+ S += getsizeof(self.unit_type)
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ Rule_dict = dict()
+ Rule_dict["unit_type"] = self.unit_type
+ # The class name is added to the dict for deserialisation purpose
+ Rule_dict["__class__"] = "Rule"
+ return Rule_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ unit_type_val = self.unit_type
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(unit_type=unit_type_val)
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ self.unit_type = None
+
+ def _get_unit_type(self):
+ """getter of unit_type"""
+ return self._unit_type
+
+ def _set_unit_type(self, value):
+ """setter of unit_type"""
+ check_var("unit_type", value, "str")
+ self._unit_type = value
+
+ unit_type = property(
+ fget=_get_unit_type,
+ fset=_set_unit_type,
+ doc=u"""unit
+
+ :Type: str
+ """,
+ )
diff --git a/pyleecan/Classes/RuleComplex.py b/pyleecan/Classes/RuleComplex.py
new file mode 100644
index 000000000..d8292d744
--- /dev/null
+++ b/pyleecan/Classes/RuleComplex.py
@@ -0,0 +1,328 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/RuleComplex.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/RuleComplex
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from .Rule import Rule
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.RuleComplex.convert_to_P import convert_to_P
+except ImportError as error:
+ convert_to_P = error
+
+try:
+ from ..Methods.Converter.RuleComplex.convert_to_other import convert_to_other
+except ImportError as error:
+ convert_to_other = error
+
+try:
+ from ..Methods.Converter.RuleComplex._set_fct_name import _set_fct_name
+except ImportError as error:
+ _set_fct_name = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class RuleComplex(Rule):
+ """complex rules"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.RuleComplex.convert_to_P
+ if isinstance(convert_to_P, ImportError):
+ convert_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleComplex method convert_to_P: " + str(convert_to_P)
+ )
+ )
+ )
+ else:
+ convert_to_P = convert_to_P
+ # cf Methods.Converter.RuleComplex.convert_to_other
+ if isinstance(convert_to_other, ImportError):
+ convert_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleComplex method convert_to_other: "
+ + str(convert_to_other)
+ )
+ )
+ )
+ else:
+ convert_to_other = convert_to_other
+ # cf Methods.Converter.RuleComplex._set_fct_name
+ if isinstance(_set_fct_name, ImportError):
+ _set_fct_name = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleComplex method _set_fct_name: " + str(_set_fct_name)
+ )
+ )
+ )
+ else:
+ _set_fct_name = _set_fct_name
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(
+ self,
+ fct_name=None,
+ folder=None,
+ param_dict=-1,
+ unit_type="m",
+ init_dict=None,
+ init_str=None,
+ ):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "fct_name" in list(init_dict.keys()):
+ fct_name = init_dict["fct_name"]
+ if "folder" in list(init_dict.keys()):
+ folder = init_dict["folder"]
+ if "param_dict" in list(init_dict.keys()):
+ param_dict = init_dict["param_dict"]
+ if "unit_type" in list(init_dict.keys()):
+ unit_type = init_dict["unit_type"]
+ # Set the properties (value check and convertion are done in setter)
+ self.fct_name = fct_name
+ self.folder = folder
+ self.param_dict = param_dict
+ # Call Rule init
+ super(RuleComplex, self).__init__(unit_type=unit_type)
+ # The class is frozen (in Rule init), for now it's impossible to
+ # add new properties
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ RuleComplex_str = ""
+ # Get the properties inherited from Rule
+ RuleComplex_str += super(RuleComplex, self).__str__()
+ RuleComplex_str += 'fct_name = "' + str(self.fct_name) + '"' + linesep
+ RuleComplex_str += 'folder = "' + str(self.folder) + '"' + linesep
+ RuleComplex_str += "param_dict = " + str(self.param_dict) + linesep
+ return RuleComplex_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+
+ # Check the properties inherited from Rule
+ if not super(RuleComplex, self).__eq__(other):
+ return False
+ if other.fct_name != self.fct_name:
+ return False
+ if other.folder != self.folder:
+ return False
+ if other.param_dict != self.param_dict:
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+
+ # Check the properties inherited from Rule
+ diff_list.extend(
+ super(RuleComplex, self).compare(
+ other, name=name, ignore_list=ignore_list, is_add_value=is_add_value
+ )
+ )
+ if other._fct_name != self._fct_name:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._fct_name)
+ + ", other="
+ + str(other._fct_name)
+ + ")"
+ )
+ diff_list.append(name + ".fct_name" + val_str)
+ else:
+ diff_list.append(name + ".fct_name")
+ if other._folder != self._folder:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._folder)
+ + ", other="
+ + str(other._folder)
+ + ")"
+ )
+ diff_list.append(name + ".folder" + val_str)
+ else:
+ diff_list.append(name + ".folder")
+ if other._param_dict != self._param_dict:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._param_dict)
+ + ", other="
+ + str(other._param_dict)
+ + ")"
+ )
+ diff_list.append(name + ".param_dict" + val_str)
+ else:
+ diff_list.append(name + ".param_dict")
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+
+ # Get size of the properties inherited from Rule
+ S += super(RuleComplex, self).__sizeof__()
+ S += getsizeof(self.fct_name)
+ S += getsizeof(self.folder)
+ if self.param_dict is not None:
+ for key, value in self.param_dict.items():
+ S += getsizeof(value) + getsizeof(key)
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ # Get the properties inherited from Rule
+ RuleComplex_dict = super(RuleComplex, self).as_dict(
+ type_handle_ndarray=type_handle_ndarray,
+ keep_function=keep_function,
+ **kwargs
+ )
+ RuleComplex_dict["fct_name"] = self.fct_name
+ RuleComplex_dict["folder"] = self.folder
+ RuleComplex_dict["param_dict"] = (
+ self.param_dict.copy() if self.param_dict is not None else None
+ )
+ # The class name is added to the dict for deserialisation purpose
+ # Overwrite the mother class name
+ RuleComplex_dict["__class__"] = "RuleComplex"
+ return RuleComplex_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ fct_name_val = self.fct_name
+ folder_val = self.folder
+ if self.param_dict is None:
+ param_dict_val = None
+ else:
+ param_dict_val = self.param_dict.copy()
+ unit_type_val = self.unit_type
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(
+ fct_name=fct_name_val,
+ folder=folder_val,
+ param_dict=param_dict_val,
+ unit_type=unit_type_val,
+ )
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ self.fct_name = None
+ self.folder = None
+ self.param_dict = None
+ # Set to None the properties inherited from Rule
+ super(RuleComplex, self)._set_None()
+
+ def _get_fct_name(self):
+ """getter of fct_name"""
+ return self._fct_name
+
+ fct_name = property(
+ fget=_get_fct_name,
+ fset=_set_fct_name,
+ doc=u"""fonction name to convert
+
+ :Type: str
+ """,
+ )
+
+ def _get_folder(self):
+ """getter of folder"""
+ return self._folder
+
+ def _set_folder(self, value):
+ """setter of folder"""
+ check_var("folder", value, "str")
+ self._folder = value
+
+ folder = property(
+ fget=_get_folder,
+ fset=_set_folder,
+ doc=u"""name source
+
+ :Type: str
+ """,
+ )
+
+ def _get_param_dict(self):
+ """getter of param_dict"""
+ return self._param_dict
+
+ def _set_param_dict(self, value):
+ """setter of param_dict"""
+ if type(value) is int and value == -1:
+ value = dict()
+ check_var("param_dict", value, "dict")
+ self._param_dict = value
+
+ param_dict = property(
+ fget=_get_param_dict,
+ fset=_set_param_dict,
+ doc=u"""dict to pass param
+
+ :Type: dict
+ """,
+ )
diff --git a/pyleecan/Classes/RuleEquation.py b/pyleecan/Classes/RuleEquation.py
new file mode 100644
index 000000000..ca7e9a430
--- /dev/null
+++ b/pyleecan/Classes/RuleEquation.py
@@ -0,0 +1,335 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/RuleEquation.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/RuleEquation
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from .Rule import Rule
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.RuleEquation.convert_to_P import convert_to_P
+except ImportError as error:
+ convert_to_P = error
+
+try:
+ from ..Methods.Converter.RuleEquation.convert_to_other import convert_to_other
+except ImportError as error:
+ convert_to_other = error
+
+try:
+ from ..Methods.Converter.RuleEquation.solve_equation import solve_equation
+except ImportError as error:
+ solve_equation = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class RuleEquation(Rule):
+ """simple rules"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.RuleEquation.convert_to_P
+ if isinstance(convert_to_P, ImportError):
+ convert_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleEquation method convert_to_P: " + str(convert_to_P)
+ )
+ )
+ )
+ else:
+ convert_to_P = convert_to_P
+ # cf Methods.Converter.RuleEquation.convert_to_other
+ if isinstance(convert_to_other, ImportError):
+ convert_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleEquation method convert_to_other: "
+ + str(convert_to_other)
+ )
+ )
+ )
+ else:
+ convert_to_other = convert_to_other
+ # cf Methods.Converter.RuleEquation.solve_equation
+ if isinstance(solve_equation, ImportError):
+ solve_equation = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleEquation method solve_equation: "
+ + str(solve_equation)
+ )
+ )
+ )
+ else:
+ solve_equation = solve_equation
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(
+ self,
+ param=None,
+ equation=None,
+ file_name=None,
+ unit_type="m",
+ init_dict=None,
+ init_str=None,
+ ):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "param" in list(init_dict.keys()):
+ param = init_dict["param"]
+ if "equation" in list(init_dict.keys()):
+ equation = init_dict["equation"]
+ if "file_name" in list(init_dict.keys()):
+ file_name = init_dict["file_name"]
+ if "unit_type" in list(init_dict.keys()):
+ unit_type = init_dict["unit_type"]
+ # Set the properties (value check and convertion are done in setter)
+ self.param = param
+ self.equation = equation
+ self.file_name = file_name
+ # Call Rule init
+ super(RuleEquation, self).__init__(unit_type=unit_type)
+ # The class is frozen (in Rule init), for now it's impossible to
+ # add new properties
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ RuleEquation_str = ""
+ # Get the properties inherited from Rule
+ RuleEquation_str += super(RuleEquation, self).__str__()
+ RuleEquation_str += (
+ "param = "
+ + linesep
+ + str(self.param).replace(linesep, linesep + "\t")
+ + linesep
+ )
+ RuleEquation_str += 'equation = "' + str(self.equation) + '"' + linesep
+ RuleEquation_str += 'file_name = "' + str(self.file_name) + '"' + linesep
+ return RuleEquation_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+
+ # Check the properties inherited from Rule
+ if not super(RuleEquation, self).__eq__(other):
+ return False
+ if other.param != self.param:
+ return False
+ if other.equation != self.equation:
+ return False
+ if other.file_name != self.file_name:
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+
+ # Check the properties inherited from Rule
+ diff_list.extend(
+ super(RuleEquation, self).compare(
+ other, name=name, ignore_list=ignore_list, is_add_value=is_add_value
+ )
+ )
+ if other._param != self._param:
+ if is_add_value:
+ val_str = (
+ " (self=" + str(self._param) + ", other=" + str(other._param) + ")"
+ )
+ diff_list.append(name + ".param" + val_str)
+ else:
+ diff_list.append(name + ".param")
+ if other._equation != self._equation:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._equation)
+ + ", other="
+ + str(other._equation)
+ + ")"
+ )
+ diff_list.append(name + ".equation" + val_str)
+ else:
+ diff_list.append(name + ".equation")
+ if other._file_name != self._file_name:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._file_name)
+ + ", other="
+ + str(other._file_name)
+ + ")"
+ )
+ diff_list.append(name + ".file_name" + val_str)
+ else:
+ diff_list.append(name + ".file_name")
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+
+ # Get size of the properties inherited from Rule
+ S += super(RuleEquation, self).__sizeof__()
+ if self.param is not None:
+ for value in self.param:
+ S += getsizeof(value)
+ S += getsizeof(self.equation)
+ S += getsizeof(self.file_name)
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ # Get the properties inherited from Rule
+ RuleEquation_dict = super(RuleEquation, self).as_dict(
+ type_handle_ndarray=type_handle_ndarray,
+ keep_function=keep_function,
+ **kwargs
+ )
+ RuleEquation_dict["param"] = (
+ self.param.copy() if self.param is not None else None
+ )
+ RuleEquation_dict["equation"] = self.equation
+ RuleEquation_dict["file_name"] = self.file_name
+ # The class name is added to the dict for deserialisation purpose
+ # Overwrite the mother class name
+ RuleEquation_dict["__class__"] = "RuleEquation"
+ return RuleEquation_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ if self.param is None:
+ param_val = None
+ else:
+ param_val = self.param.copy()
+ equation_val = self.equation
+ file_name_val = self.file_name
+ unit_type_val = self.unit_type
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(
+ param=param_val,
+ equation=equation_val,
+ file_name=file_name_val,
+ unit_type=unit_type_val,
+ )
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ self.param = None
+ self.equation = None
+ self.file_name = None
+ # Set to None the properties inherited from Rule
+ super(RuleEquation, self)._set_None()
+
+ def _get_param(self):
+ """getter of param"""
+ return self._param
+
+ def _set_param(self, value):
+ """setter of param"""
+ if type(value) is int and value == -1:
+ value = list()
+ check_var("param", value, "list")
+ self._param = value
+
+ param = property(
+ fget=_get_param,
+ fset=_set_param,
+ doc=u"""dict all parameters
+
+ :Type: list
+ """,
+ )
+
+ def _get_equation(self):
+ """getter of equation"""
+ return self._equation
+
+ def _set_equation(self, value):
+ """setter of equation"""
+ check_var("equation", value, "str")
+ self._equation = value
+
+ equation = property(
+ fget=_get_equation,
+ fset=_set_equation,
+ doc=u"""conversion paramter to pyleecan (Y are always on other side
+
+ :Type: str
+ """,
+ )
+
+ def _get_file_name(self):
+ """getter of file_name"""
+ return self._file_name
+
+ def _set_file_name(self, value):
+ """setter of file_name"""
+ check_var("file_name", value, "str")
+ self._file_name = value
+
+ file_name = property(
+ fget=_get_file_name,
+ fset=_set_file_name,
+ doc=u"""use just to debug, give name of file
+
+ :Type: str
+ """,
+ )
diff --git a/pyleecan/Classes/RuleSimple.py b/pyleecan/Classes/RuleSimple.py
new file mode 100644
index 000000000..58d73a6c9
--- /dev/null
+++ b/pyleecan/Classes/RuleSimple.py
@@ -0,0 +1,371 @@
+# -*- coding: utf-8 -*-
+# File generated according to Generator/ClassesRef/Converter/RuleSimple.csv
+# WARNING! All changes made in this file will be lost!
+"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Converter/RuleSimple
+"""
+
+from os import linesep
+from sys import getsizeof
+from logging import getLogger
+from ._check import check_var, raise_
+from ..Functions.get_logger import get_logger
+from ..Functions.save import save
+from ..Functions.load import load_init_dict
+from ..Functions.Load.import_class import import_class
+from copy import deepcopy
+from .Rule import Rule
+
+# Import all class method
+# Try/catch to remove unnecessary dependencies in unused method
+try:
+ from ..Methods.Converter.RuleSimple.convert_to_P import convert_to_P
+except ImportError as error:
+ convert_to_P = error
+
+try:
+ from ..Methods.Converter.RuleSimple.convert_to_other import convert_to_other
+except ImportError as error:
+ convert_to_other = error
+
+
+from numpy import isnan
+from ._check import InitUnKnowClassError
+
+
+class RuleSimple(Rule):
+ """simple rules"""
+
+ VERSION = 1
+
+ # Check ImportError to remove unnecessary dependencies in unused method
+ # cf Methods.Converter.RuleSimple.convert_to_P
+ if isinstance(convert_to_P, ImportError):
+ convert_to_P = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleSimple method convert_to_P: " + str(convert_to_P)
+ )
+ )
+ )
+ else:
+ convert_to_P = convert_to_P
+ # cf Methods.Converter.RuleSimple.convert_to_other
+ if isinstance(convert_to_other, ImportError):
+ convert_to_other = property(
+ fget=lambda x: raise_(
+ ImportError(
+ "Can't use RuleSimple method convert_to_other: "
+ + str(convert_to_other)
+ )
+ )
+ )
+ else:
+ convert_to_other = convert_to_other
+ # generic save method is available in all object
+ save = save
+ # get_logger method is available in all object
+ get_logger = get_logger
+
+ def __init__(
+ self,
+ other_key_list=None,
+ P_obj_path=None,
+ scaling_to_P=1,
+ file_name=None,
+ unit_type="m",
+ init_dict=None,
+ init_str=None,
+ ):
+ """Constructor of the class. Can be use in three ways :
+ - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values
+ for pyleecan type, -1 will call the default constructor
+ - __init__ (init_dict = d) d must be a dictionary with property names as keys
+ - __init__ (init_str = s) s must be a string
+ s is the file path to load
+
+ ndarray or list can be given for Vector and Matrix
+ object or dict can be given for pyleecan Object"""
+
+ if init_str is not None: # Load from a file
+ init_dict = load_init_dict(init_str)[1]
+ if init_dict is not None: # Initialisation by dict
+ assert type(init_dict) is dict
+ # Overwrite default value with init_dict content
+ if "other_key_list" in list(init_dict.keys()):
+ other_key_list = init_dict["other_key_list"]
+ if "P_obj_path" in list(init_dict.keys()):
+ P_obj_path = init_dict["P_obj_path"]
+ if "scaling_to_P" in list(init_dict.keys()):
+ scaling_to_P = init_dict["scaling_to_P"]
+ if "file_name" in list(init_dict.keys()):
+ file_name = init_dict["file_name"]
+ if "unit_type" in list(init_dict.keys()):
+ unit_type = init_dict["unit_type"]
+ # Set the properties (value check and convertion are done in setter)
+ self.other_key_list = other_key_list
+ self.P_obj_path = P_obj_path
+ self.scaling_to_P = scaling_to_P
+ self.file_name = file_name
+ # Call Rule init
+ super(RuleSimple, self).__init__(unit_type=unit_type)
+ # The class is frozen (in Rule init), for now it's impossible to
+ # add new properties
+
+ def __str__(self):
+ """Convert this object in a readeable string (for print)"""
+
+ RuleSimple_str = ""
+ # Get the properties inherited from Rule
+ RuleSimple_str += super(RuleSimple, self).__str__()
+ RuleSimple_str += (
+ "other_key_list = "
+ + linesep
+ + str(self.other_key_list).replace(linesep, linesep + "\t")
+ + linesep
+ )
+ RuleSimple_str += 'P_obj_path = "' + str(self.P_obj_path) + '"' + linesep
+ RuleSimple_str += "scaling_to_P = " + str(self.scaling_to_P) + linesep
+ RuleSimple_str += 'file_name = "' + str(self.file_name) + '"' + linesep
+ return RuleSimple_str
+
+ def __eq__(self, other):
+ """Compare two objects (skip parent)"""
+
+ if type(other) != type(self):
+ return False
+
+ # Check the properties inherited from Rule
+ if not super(RuleSimple, self).__eq__(other):
+ return False
+ if other.other_key_list != self.other_key_list:
+ return False
+ if other.P_obj_path != self.P_obj_path:
+ return False
+ if other.scaling_to_P != self.scaling_to_P:
+ return False
+ if other.file_name != self.file_name:
+ return False
+ return True
+
+ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
+ """Compare two objects and return list of differences"""
+
+ if ignore_list is None:
+ ignore_list = list()
+ if type(other) != type(self):
+ return ["type(" + name + ")"]
+ diff_list = list()
+
+ # Check the properties inherited from Rule
+ diff_list.extend(
+ super(RuleSimple, self).compare(
+ other, name=name, ignore_list=ignore_list, is_add_value=is_add_value
+ )
+ )
+ if other._other_key_list != self._other_key_list:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._other_key_list)
+ + ", other="
+ + str(other._other_key_list)
+ + ")"
+ )
+ diff_list.append(name + ".other_key_list" + val_str)
+ else:
+ diff_list.append(name + ".other_key_list")
+ if other._P_obj_path != self._P_obj_path:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._P_obj_path)
+ + ", other="
+ + str(other._P_obj_path)
+ + ")"
+ )
+ diff_list.append(name + ".P_obj_path" + val_str)
+ else:
+ diff_list.append(name + ".P_obj_path")
+ if (
+ other._scaling_to_P is not None
+ and self._scaling_to_P is not None
+ and isnan(other._scaling_to_P)
+ and isnan(self._scaling_to_P)
+ ):
+ pass
+ elif other._scaling_to_P != self._scaling_to_P:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._scaling_to_P)
+ + ", other="
+ + str(other._scaling_to_P)
+ + ")"
+ )
+ diff_list.append(name + ".scaling_to_P" + val_str)
+ else:
+ diff_list.append(name + ".scaling_to_P")
+ if other._file_name != self._file_name:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._file_name)
+ + ", other="
+ + str(other._file_name)
+ + ")"
+ )
+ diff_list.append(name + ".file_name" + val_str)
+ else:
+ diff_list.append(name + ".file_name")
+ # Filter ignore differences
+ diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
+ return diff_list
+
+ def __sizeof__(self):
+ """Return the size in memory of the object (including all subobject)"""
+
+ S = 0 # Full size of the object
+
+ # Get size of the properties inherited from Rule
+ S += super(RuleSimple, self).__sizeof__()
+ if self.other_key_list is not None:
+ for value in self.other_key_list:
+ S += getsizeof(value)
+ S += getsizeof(self.P_obj_path)
+ S += getsizeof(self.scaling_to_P)
+ S += getsizeof(self.file_name)
+ return S
+
+ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
+ """
+ Convert this object in a json serializable dict (can be use in __init__).
+ type_handle_ndarray: int
+ How to handle ndarray (0: tolist, 1: copy, 2: nothing)
+ keep_function : bool
+ True to keep the function object, else return str
+ Optional keyword input parameter is for internal use only
+ and may prevent json serializability.
+ """
+
+ # Get the properties inherited from Rule
+ RuleSimple_dict = super(RuleSimple, self).as_dict(
+ type_handle_ndarray=type_handle_ndarray,
+ keep_function=keep_function,
+ **kwargs
+ )
+ RuleSimple_dict["other_key_list"] = (
+ self.other_key_list.copy() if self.other_key_list is not None else None
+ )
+ RuleSimple_dict["P_obj_path"] = self.P_obj_path
+ RuleSimple_dict["scaling_to_P"] = self.scaling_to_P
+ RuleSimple_dict["file_name"] = self.file_name
+ # The class name is added to the dict for deserialisation purpose
+ # Overwrite the mother class name
+ RuleSimple_dict["__class__"] = "RuleSimple"
+ return RuleSimple_dict
+
+ def copy(self):
+ """Creates a deepcopy of the object"""
+
+ # Handle deepcopy of all the properties
+ if self.other_key_list is None:
+ other_key_list_val = None
+ else:
+ other_key_list_val = self.other_key_list.copy()
+ P_obj_path_val = self.P_obj_path
+ scaling_to_P_val = self.scaling_to_P
+ file_name_val = self.file_name
+ unit_type_val = self.unit_type
+ # Creates new object of the same type with the copied properties
+ obj_copy = type(self)(
+ other_key_list=other_key_list_val,
+ P_obj_path=P_obj_path_val,
+ scaling_to_P=scaling_to_P_val,
+ file_name=file_name_val,
+ unit_type=unit_type_val,
+ )
+ return obj_copy
+
+ def _set_None(self):
+ """Set all the properties to None (except pyleecan object)"""
+
+ self.other_key_list = None
+ self.P_obj_path = None
+ self.scaling_to_P = None
+ self.file_name = None
+ # Set to None the properties inherited from Rule
+ super(RuleSimple, self)._set_None()
+
+ def _get_other_key_list(self):
+ """getter of other_key_list"""
+ return self._other_key_list
+
+ def _set_other_key_list(self, value):
+ """setter of other_key_list"""
+ if type(value) is int and value == -1:
+ value = list()
+ check_var("other_key_list", value, "list")
+ self._other_key_list = value
+
+ other_key_list = property(
+ fget=_get_other_key_list,
+ fset=_set_other_key_list,
+ doc=u"""parameter
+
+ :Type: list
+ """,
+ )
+
+ def _get_P_obj_path(self):
+ """getter of P_obj_path"""
+ return self._P_obj_path
+
+ def _set_P_obj_path(self, value):
+ """setter of P_obj_path"""
+ check_var("P_obj_path", value, "str")
+ self._P_obj_path = value
+
+ P_obj_path = property(
+ fget=_get_P_obj_path,
+ fset=_set_P_obj_path,
+ doc=u"""path pyleecan parameter in object machine
+
+ :Type: str
+ """,
+ )
+
+ def _get_scaling_to_P(self):
+ """getter of scaling_to_P"""
+ return self._scaling_to_P
+
+ def _set_scaling_to_P(self, value):
+ """setter of scaling_to_P"""
+ check_var("scaling_to_P", value, "float")
+ self._scaling_to_P = value
+
+ scaling_to_P = property(
+ fget=_get_scaling_to_P,
+ fset=_set_scaling_to_P,
+ doc=u"""conversion paramter to pyleecan
+
+ :Type: float
+ """,
+ )
+
+ def _get_file_name(self):
+ """getter of file_name"""
+ return self._file_name
+
+ def _set_file_name(self, value):
+ """setter of file_name"""
+ check_var("file_name", value, "str")
+ self._file_name = value
+
+ file_name = property(
+ fget=_get_file_name,
+ fset=_set_file_name,
+ doc=u"""use just to debug, give name of file
+
+ :Type: str
+ """,
+ )
diff --git a/pyleecan/Classes/SlotM10.py b/pyleecan/Classes/SlotM10.py
index 3bed22222..ef39eddac 100644
--- a/pyleecan/Classes/SlotM10.py
+++ b/pyleecan/Classes/SlotM10.py
@@ -214,10 +214,10 @@ class SlotM10(Slot):
def __init__(
self,
- W0=0.0122,
- H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W0=0,
+ H0=0,
+ W1=0,
+ H1=0,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -243,10 +243,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -256,8 +256,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
# Call Slot init
super(SlotM10, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -271,8 +271,8 @@ def __str__(self):
SlotM10_str += super(SlotM10, self).__str__()
SlotM10_str += "W0 = " + str(self.W0) + linesep
SlotM10_str += "H0 = " + str(self.H0) + linesep
- SlotM10_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM10_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM10_str += "W1 = " + str(self.W1) + linesep
+ SlotM10_str += "H1 = " + str(self.H1) + linesep
return SlotM10_str
def __eq__(self, other):
@@ -288,9 +288,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
return True
@@ -336,35 +336,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -378,8 +374,8 @@ def __sizeof__(self):
S += super(SlotM10, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -401,8 +397,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM10_dict["W0"] = self.W0
SlotM10_dict["H0"] = self.H0
- SlotM10_dict["Wmag"] = self.Wmag
- SlotM10_dict["Hmag"] = self.Hmag
+ SlotM10_dict["W1"] = self.W1
+ SlotM10_dict["H1"] = self.H1
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM10_dict["__class__"] = "SlotM10"
@@ -414,8 +410,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -426,8 +422,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -439,8 +435,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
# Set to None the properties inherited from Slot
super(SlotM10, self)._set_None()
@@ -482,18 +478,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet width
:Type: float
@@ -501,18 +497,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM11.py b/pyleecan/Classes/SlotM11.py
index bcc5bbeff..764938579 100644
--- a/pyleecan/Classes/SlotM11.py
+++ b/pyleecan/Classes/SlotM11.py
@@ -231,10 +231,10 @@ class SlotM11(Slot):
def __init__(
self,
- W0=0.0122,
- H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W0=0,
+ H0=0,
+ W1=0,
+ H1=0,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -260,10 +260,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -273,8 +273,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
# Call Slot init
super(SlotM11, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -288,8 +288,8 @@ def __str__(self):
SlotM11_str += super(SlotM11, self).__str__()
SlotM11_str += "W0 = " + str(self.W0) + linesep
SlotM11_str += "H0 = " + str(self.H0) + linesep
- SlotM11_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM11_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM11_str += "W1 = " + str(self.W1) + linesep
+ SlotM11_str += "H1 = " + str(self.H1) + linesep
return SlotM11_str
def __eq__(self, other):
@@ -305,9 +305,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
return True
@@ -353,35 +353,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -395,8 +391,8 @@ def __sizeof__(self):
S += super(SlotM11, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -418,8 +414,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM11_dict["W0"] = self.W0
SlotM11_dict["H0"] = self.H0
- SlotM11_dict["Wmag"] = self.Wmag
- SlotM11_dict["Hmag"] = self.Hmag
+ SlotM11_dict["W1"] = self.W1
+ SlotM11_dict["H1"] = self.H1
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM11_dict["__class__"] = "SlotM11"
@@ -431,8 +427,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -443,8 +439,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -456,8 +452,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
# Set to None the properties inherited from Slot
super(SlotM11, self)._set_None()
@@ -499,18 +495,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet angular width
:Type: float
@@ -518,18 +514,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM12.py b/pyleecan/Classes/SlotM12.py
index 3eeb86397..5d196f4a1 100644
--- a/pyleecan/Classes/SlotM12.py
+++ b/pyleecan/Classes/SlotM12.py
@@ -216,8 +216,8 @@ def __init__(
self,
W0=0.0122,
H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W1=0.0122,
+ H1=0.001,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -243,10 +243,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -256,8 +256,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
# Call Slot init
super(SlotM12, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -271,8 +271,8 @@ def __str__(self):
SlotM12_str += super(SlotM12, self).__str__()
SlotM12_str += "W0 = " + str(self.W0) + linesep
SlotM12_str += "H0 = " + str(self.H0) + linesep
- SlotM12_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM12_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM12_str += "W1 = " + str(self.W1) + linesep
+ SlotM12_str += "H1 = " + str(self.H1) + linesep
return SlotM12_str
def __eq__(self, other):
@@ -288,9 +288,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
return True
@@ -336,35 +336,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -378,8 +374,8 @@ def __sizeof__(self):
S += super(SlotM12, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -401,8 +397,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM12_dict["W0"] = self.W0
SlotM12_dict["H0"] = self.H0
- SlotM12_dict["Wmag"] = self.Wmag
- SlotM12_dict["Hmag"] = self.Hmag
+ SlotM12_dict["W1"] = self.W1
+ SlotM12_dict["H1"] = self.H1
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM12_dict["__class__"] = "SlotM12"
@@ -414,8 +410,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -426,8 +422,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -439,8 +435,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
# Set to None the properties inherited from Slot
super(SlotM12, self)._set_None()
@@ -482,18 +478,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet width
:Type: float
@@ -501,18 +497,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM13.py b/pyleecan/Classes/SlotM13.py
index e2e008957..40fed26c7 100644
--- a/pyleecan/Classes/SlotM13.py
+++ b/pyleecan/Classes/SlotM13.py
@@ -216,8 +216,8 @@ def __init__(
self,
W0=0.0122,
H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W1=0.0122,
+ H1=0.001,
Rtopm=0.001,
Zs=36,
wedge_mat=None,
@@ -244,10 +244,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Rtopm" in list(init_dict.keys()):
Rtopm = init_dict["Rtopm"]
if "Zs" in list(init_dict.keys()):
@@ -259,8 +259,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
self.Rtopm = Rtopm
# Call Slot init
super(SlotM13, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
@@ -275,8 +275,8 @@ def __str__(self):
SlotM13_str += super(SlotM13, self).__str__()
SlotM13_str += "W0 = " + str(self.W0) + linesep
SlotM13_str += "H0 = " + str(self.H0) + linesep
- SlotM13_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM13_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM13_str += "W1 = " + str(self.W1) + linesep
+ SlotM13_str += "H1 = " + str(self.H1) + linesep
SlotM13_str += "Rtopm = " + str(self.Rtopm) + linesep
return SlotM13_str
@@ -293,9 +293,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
if other.Rtopm != self.Rtopm:
return False
@@ -343,35 +343,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
if (
other._Rtopm is not None
and self._Rtopm is not None
@@ -400,8 +396,8 @@ def __sizeof__(self):
S += super(SlotM13, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
S += getsizeof(self.Rtopm)
return S
@@ -424,8 +420,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM13_dict["W0"] = self.W0
SlotM13_dict["H0"] = self.H0
- SlotM13_dict["Wmag"] = self.Wmag
- SlotM13_dict["Hmag"] = self.Hmag
+ SlotM13_dict["W1"] = self.W1
+ SlotM13_dict["H1"] = self.H1
SlotM13_dict["Rtopm"] = self.Rtopm
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
@@ -438,8 +434,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Rtopm_val = self.Rtopm
Zs_val = self.Zs
if self.wedge_mat is None:
@@ -451,8 +447,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Rtopm=Rtopm_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
@@ -465,8 +461,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
self.Rtopm = None
# Set to None the properties inherited from Slot
super(SlotM13, self)._set_None()
@@ -509,18 +505,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet width
:Type: float
@@ -528,18 +524,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM14.py b/pyleecan/Classes/SlotM14.py
index 4fcc31368..4aef3a7e1 100644
--- a/pyleecan/Classes/SlotM14.py
+++ b/pyleecan/Classes/SlotM14.py
@@ -233,8 +233,8 @@ def __init__(
self,
W0=0.0122,
H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W1=0.0122,
+ H1=0.001,
Rtopm=0.001,
Zs=36,
wedge_mat=None,
@@ -261,10 +261,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Rtopm" in list(init_dict.keys()):
Rtopm = init_dict["Rtopm"]
if "Zs" in list(init_dict.keys()):
@@ -276,8 +276,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
self.Rtopm = Rtopm
# Call Slot init
super(SlotM14, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
@@ -292,8 +292,8 @@ def __str__(self):
SlotM14_str += super(SlotM14, self).__str__()
SlotM14_str += "W0 = " + str(self.W0) + linesep
SlotM14_str += "H0 = " + str(self.H0) + linesep
- SlotM14_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM14_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM14_str += "W1 = " + str(self.W1) + linesep
+ SlotM14_str += "H1 = " + str(self.H1) + linesep
SlotM14_str += "Rtopm = " + str(self.Rtopm) + linesep
return SlotM14_str
@@ -310,9 +310,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
if other.Rtopm != self.Rtopm:
return False
@@ -360,35 +360,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
if (
other._Rtopm is not None
and self._Rtopm is not None
@@ -417,8 +413,8 @@ def __sizeof__(self):
S += super(SlotM14, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
S += getsizeof(self.Rtopm)
return S
@@ -441,8 +437,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM14_dict["W0"] = self.W0
SlotM14_dict["H0"] = self.H0
- SlotM14_dict["Wmag"] = self.Wmag
- SlotM14_dict["Hmag"] = self.Hmag
+ SlotM14_dict["W1"] = self.W1
+ SlotM14_dict["H1"] = self.H1
SlotM14_dict["Rtopm"] = self.Rtopm
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
@@ -455,8 +451,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Rtopm_val = self.Rtopm
Zs_val = self.Zs
if self.wedge_mat is None:
@@ -468,8 +464,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Rtopm=Rtopm_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
@@ -482,8 +478,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
self.Rtopm = None
# Set to None the properties inherited from Slot
super(SlotM14, self)._set_None()
@@ -526,18 +522,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet angular width
:Type: float
@@ -545,18 +541,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM15.py b/pyleecan/Classes/SlotM15.py
index bc6ba3331..8d3346c27 100644
--- a/pyleecan/Classes/SlotM15.py
+++ b/pyleecan/Classes/SlotM15.py
@@ -216,8 +216,8 @@ def __init__(
self,
W0=0.0122,
H0=0.001,
- Wmag=0.0122,
- Hmag=0.001,
+ W1=0.0122,
+ H1=0.001,
Rtopm=0.001,
Zs=36,
wedge_mat=None,
@@ -244,10 +244,10 @@ def __init__(
W0 = init_dict["W0"]
if "H0" in list(init_dict.keys()):
H0 = init_dict["H0"]
- if "Wmag" in list(init_dict.keys()):
- Wmag = init_dict["Wmag"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "W1" in list(init_dict.keys()):
+ W1 = init_dict["W1"]
+ if "H1" in list(init_dict.keys()):
+ H1 = init_dict["H1"]
if "Rtopm" in list(init_dict.keys()):
Rtopm = init_dict["Rtopm"]
if "Zs" in list(init_dict.keys()):
@@ -259,8 +259,8 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.H0 = H0
- self.Wmag = Wmag
- self.Hmag = Hmag
+ self.W1 = W1
+ self.H1 = H1
self.Rtopm = Rtopm
# Call Slot init
super(SlotM15, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
@@ -275,8 +275,8 @@ def __str__(self):
SlotM15_str += super(SlotM15, self).__str__()
SlotM15_str += "W0 = " + str(self.W0) + linesep
SlotM15_str += "H0 = " + str(self.H0) + linesep
- SlotM15_str += "Wmag = " + str(self.Wmag) + linesep
- SlotM15_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM15_str += "W1 = " + str(self.W1) + linesep
+ SlotM15_str += "H1 = " + str(self.H1) + linesep
SlotM15_str += "Rtopm = " + str(self.Rtopm) + linesep
return SlotM15_str
@@ -293,9 +293,9 @@ def __eq__(self, other):
return False
if other.H0 != self.H0:
return False
- if other.Wmag != self.Wmag:
+ if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H1 != self.H1:
return False
if other.Rtopm != self.Rtopm:
return False
@@ -343,35 +343,31 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".H0")
if (
- other._Wmag is not None
- and self._Wmag is not None
- and isnan(other._Wmag)
- and isnan(self._Wmag)
+ other._W1 is not None
+ and self._W1 is not None
+ and isnan(other._W1)
+ and isnan(self._W1)
):
pass
- elif other._Wmag != self._Wmag:
+ elif other._W1 != self._W1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Wmag) + ", other=" + str(other._Wmag) + ")"
- )
- diff_list.append(name + ".Wmag" + val_str)
+ val_str = " (self=" + str(self._W1) + ", other=" + str(other._W1) + ")"
+ diff_list.append(name + ".W1" + val_str)
else:
- diff_list.append(name + ".Wmag")
+ diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H1 is not None
+ and self._H1 is not None
+ and isnan(other._H1)
+ and isnan(self._H1)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H1 != self._H1:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H1) + ", other=" + str(other._H1) + ")"
+ diff_list.append(name + ".H1" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H1")
if (
other._Rtopm is not None
and self._Rtopm is not None
@@ -400,8 +396,8 @@ def __sizeof__(self):
S += super(SlotM15, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.H0)
- S += getsizeof(self.Wmag)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.W1)
+ S += getsizeof(self.H1)
S += getsizeof(self.Rtopm)
return S
@@ -424,8 +420,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM15_dict["W0"] = self.W0
SlotM15_dict["H0"] = self.H0
- SlotM15_dict["Wmag"] = self.Wmag
- SlotM15_dict["Hmag"] = self.Hmag
+ SlotM15_dict["W1"] = self.W1
+ SlotM15_dict["H1"] = self.H1
SlotM15_dict["Rtopm"] = self.Rtopm
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
@@ -438,8 +434,8 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
H0_val = self.H0
- Wmag_val = self.Wmag
- Hmag_val = self.Hmag
+ W1_val = self.W1
+ H1_val = self.H1
Rtopm_val = self.Rtopm
Zs_val = self.Zs
if self.wedge_mat is None:
@@ -451,8 +447,8 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
H0=H0_val,
- Wmag=Wmag_val,
- Hmag=Hmag_val,
+ W1=W1_val,
+ H1=H1_val,
Rtopm=Rtopm_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
@@ -465,8 +461,8 @@ def _set_None(self):
self.W0 = None
self.H0 = None
- self.Wmag = None
- self.Hmag = None
+ self.W1 = None
+ self.H1 = None
self.Rtopm = None
# Set to None the properties inherited from Slot
super(SlotM15, self)._set_None()
@@ -509,18 +505,18 @@ def _set_H0(self, value):
""",
)
- def _get_Wmag(self):
- """getter of Wmag"""
- return self._Wmag
+ def _get_W1(self):
+ """getter of W1"""
+ return self._W1
- def _set_Wmag(self, value):
- """setter of Wmag"""
- check_var("Wmag", value, "float", Vmin=0)
- self._Wmag = value
+ def _set_W1(self, value):
+ """setter of W1"""
+ check_var("W1", value, "float", Vmin=0)
+ self._W1 = value
- Wmag = property(
- fget=_get_Wmag,
- fset=_set_Wmag,
+ W1 = property(
+ fget=_get_W1,
+ fset=_set_W1,
doc=u"""Magnet width
:Type: float
@@ -528,18 +524,18 @@ def _set_Wmag(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H1(self):
+ """getter of H1"""
+ return self._H1
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H1(self, value):
+ """setter of H1"""
+ check_var("H1", value, "float", Vmin=0)
+ self._H1 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H1 = property(
+ fget=_get_H1,
+ fset=_set_H1,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM18.py b/pyleecan/Classes/SlotM18.py
index 4ec89ac2d..66b2017bf 100644
--- a/pyleecan/Classes/SlotM18.py
+++ b/pyleecan/Classes/SlotM18.py
@@ -231,7 +231,7 @@ class SlotM18(Slot):
def __init__(
self,
- Hmag=0.001,
+ H0=0.001,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -253,8 +253,8 @@ def __init__(
if init_dict is not None: # Initialisation by dict
assert type(init_dict) is dict
# Overwrite default value with init_dict content
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "H0" in list(init_dict.keys()):
+ H0 = init_dict["H0"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -262,7 +262,7 @@ def __init__(
if "is_bore" in list(init_dict.keys()):
is_bore = init_dict["is_bore"]
# Set the properties (value check and convertion are done in setter)
- self.Hmag = Hmag
+ self.H0 = H0
# Call Slot init
super(SlotM18, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -274,7 +274,7 @@ def __str__(self):
SlotM18_str = ""
# Get the properties inherited from Slot
SlotM18_str += super(SlotM18, self).__str__()
- SlotM18_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM18_str += "H0 = " + str(self.H0) + linesep
return SlotM18_str
def __eq__(self, other):
@@ -286,7 +286,7 @@ def __eq__(self, other):
# Check the properties inherited from Slot
if not super(SlotM18, self).__eq__(other):
return False
- if other.Hmag != self.Hmag:
+ if other.H0 != self.H0:
return False
return True
@@ -306,20 +306,18 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
)
)
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H0 is not None
+ and self._H0 is not None
+ and isnan(other._H0)
+ and isnan(self._H0)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H0 != self._H0:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H0) + ", other=" + str(other._H0) + ")"
+ diff_list.append(name + ".H0" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H0")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -331,7 +329,7 @@ def __sizeof__(self):
# Get size of the properties inherited from Slot
S += super(SlotM18, self).__sizeof__()
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.H0)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -351,7 +349,7 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
keep_function=keep_function,
**kwargs
)
- SlotM18_dict["Hmag"] = self.Hmag
+ SlotM18_dict["H0"] = self.H0
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM18_dict["__class__"] = "SlotM18"
@@ -361,7 +359,7 @@ def copy(self):
"""Creates a deepcopy of the object"""
# Handle deepcopy of all the properties
- Hmag_val = self.Hmag
+ H0_val = self.H0
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -370,29 +368,29 @@ def copy(self):
is_bore_val = self.is_bore
# Creates new object of the same type with the copied properties
obj_copy = type(self)(
- Hmag=Hmag_val, Zs=Zs_val, wedge_mat=wedge_mat_val, is_bore=is_bore_val
+ H0=H0_val, Zs=Zs_val, wedge_mat=wedge_mat_val, is_bore=is_bore_val
)
return obj_copy
def _set_None(self):
"""Set all the properties to None (except pyleecan object)"""
- self.Hmag = None
+ self.H0 = None
# Set to None the properties inherited from Slot
super(SlotM18, self)._set_None()
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H0(self):
+ """getter of H0"""
+ return self._H0
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H0(self, value):
+ """setter of H0"""
+ check_var("H0", value, "float", Vmin=0)
+ self._H0 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H0 = property(
+ fget=_get_H0,
+ fset=_set_H0,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotM18_2.py b/pyleecan/Classes/SlotM18_2.py
index f6f6bd549..4e25b291d 100644
--- a/pyleecan/Classes/SlotM18_2.py
+++ b/pyleecan/Classes/SlotM18_2.py
@@ -251,8 +251,8 @@ class SlotM18_2(Slot):
def __init__(
self,
- Hmag_bore=0.001,
- Hmag_gap=0.001,
+ H0_bore=0.001,
+ H0_gap=0.001,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -274,10 +274,10 @@ def __init__(
if init_dict is not None: # Initialisation by dict
assert type(init_dict) is dict
# Overwrite default value with init_dict content
- if "Hmag_bore" in list(init_dict.keys()):
- Hmag_bore = init_dict["Hmag_bore"]
- if "Hmag_gap" in list(init_dict.keys()):
- Hmag_gap = init_dict["Hmag_gap"]
+ if "H0_bore" in list(init_dict.keys()):
+ H0_bore = init_dict["H0_bore"]
+ if "H0_gap" in list(init_dict.keys()):
+ H0_gap = init_dict["H0_gap"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -285,8 +285,8 @@ def __init__(
if "is_bore" in list(init_dict.keys()):
is_bore = init_dict["is_bore"]
# Set the properties (value check and convertion are done in setter)
- self.Hmag_bore = Hmag_bore
- self.Hmag_gap = Hmag_gap
+ self.H0_bore = H0_bore
+ self.H0_gap = H0_gap
# Call Slot init
super(SlotM18_2, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -298,8 +298,8 @@ def __str__(self):
SlotM18_2_str = ""
# Get the properties inherited from Slot
SlotM18_2_str += super(SlotM18_2, self).__str__()
- SlotM18_2_str += "Hmag_bore = " + str(self.Hmag_bore) + linesep
- SlotM18_2_str += "Hmag_gap = " + str(self.Hmag_gap) + linesep
+ SlotM18_2_str += "H0_bore = " + str(self.H0_bore) + linesep
+ SlotM18_2_str += "H0_gap = " + str(self.H0_gap) + linesep
return SlotM18_2_str
def __eq__(self, other):
@@ -311,9 +311,9 @@ def __eq__(self, other):
# Check the properties inherited from Slot
if not super(SlotM18_2, self).__eq__(other):
return False
- if other.Hmag_bore != self.Hmag_bore:
+ if other.H0_bore != self.H0_bore:
return False
- if other.Hmag_gap != self.Hmag_gap:
+ if other.H0_gap != self.H0_gap:
return False
return True
@@ -333,43 +333,43 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
)
)
if (
- other._Hmag_bore is not None
- and self._Hmag_bore is not None
- and isnan(other._Hmag_bore)
- and isnan(self._Hmag_bore)
+ other._H0_bore is not None
+ and self._H0_bore is not None
+ and isnan(other._H0_bore)
+ and isnan(self._H0_bore)
):
pass
- elif other._Hmag_bore != self._Hmag_bore:
+ elif other._H0_bore != self._H0_bore:
if is_add_value:
val_str = (
" (self="
- + str(self._Hmag_bore)
+ + str(self._H0_bore)
+ ", other="
- + str(other._Hmag_bore)
+ + str(other._H0_bore)
+ ")"
)
- diff_list.append(name + ".Hmag_bore" + val_str)
+ diff_list.append(name + ".H0_bore" + val_str)
else:
- diff_list.append(name + ".Hmag_bore")
+ diff_list.append(name + ".H0_bore")
if (
- other._Hmag_gap is not None
- and self._Hmag_gap is not None
- and isnan(other._Hmag_gap)
- and isnan(self._Hmag_gap)
+ other._H0_gap is not None
+ and self._H0_gap is not None
+ and isnan(other._H0_gap)
+ and isnan(self._H0_gap)
):
pass
- elif other._Hmag_gap != self._Hmag_gap:
+ elif other._H0_gap != self._H0_gap:
if is_add_value:
val_str = (
" (self="
- + str(self._Hmag_gap)
+ + str(self._H0_gap)
+ ", other="
- + str(other._Hmag_gap)
+ + str(other._H0_gap)
+ ")"
)
- diff_list.append(name + ".Hmag_gap" + val_str)
+ diff_list.append(name + ".H0_gap" + val_str)
else:
- diff_list.append(name + ".Hmag_gap")
+ diff_list.append(name + ".H0_gap")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -381,8 +381,8 @@ def __sizeof__(self):
# Get size of the properties inherited from Slot
S += super(SlotM18_2, self).__sizeof__()
- S += getsizeof(self.Hmag_bore)
- S += getsizeof(self.Hmag_gap)
+ S += getsizeof(self.H0_bore)
+ S += getsizeof(self.H0_gap)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -402,8 +402,8 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
keep_function=keep_function,
**kwargs
)
- SlotM18_2_dict["Hmag_bore"] = self.Hmag_bore
- SlotM18_2_dict["Hmag_gap"] = self.Hmag_gap
+ SlotM18_2_dict["H0_bore"] = self.H0_bore
+ SlotM18_2_dict["H0_gap"] = self.H0_gap
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM18_2_dict["__class__"] = "SlotM18_2"
@@ -413,8 +413,8 @@ def copy(self):
"""Creates a deepcopy of the object"""
# Handle deepcopy of all the properties
- Hmag_bore_val = self.Hmag_bore
- Hmag_gap_val = self.Hmag_gap
+ H0_bore_val = self.H0_bore
+ H0_gap_val = self.H0_gap
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -423,8 +423,8 @@ def copy(self):
is_bore_val = self.is_bore
# Creates new object of the same type with the copied properties
obj_copy = type(self)(
- Hmag_bore=Hmag_bore_val,
- Hmag_gap=Hmag_gap_val,
+ H0_bore=H0_bore_val,
+ H0_gap=H0_gap_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -434,23 +434,23 @@ def copy(self):
def _set_None(self):
"""Set all the properties to None (except pyleecan object)"""
- self.Hmag_bore = None
- self.Hmag_gap = None
+ self.H0_bore = None
+ self.H0_gap = None
# Set to None the properties inherited from Slot
super(SlotM18_2, self)._set_None()
- def _get_Hmag_bore(self):
- """getter of Hmag_bore"""
- return self._Hmag_bore
+ def _get_H0_bore(self):
+ """getter of H0_bore"""
+ return self._H0_bore
- def _set_Hmag_bore(self, value):
- """setter of Hmag_bore"""
- check_var("Hmag_bore", value, "float", Vmin=0)
- self._Hmag_bore = value
+ def _set_H0_bore(self, value):
+ """setter of H0_bore"""
+ check_var("H0_bore", value, "float", Vmin=0)
+ self._H0_bore = value
- Hmag_bore = property(
- fget=_get_Hmag_bore,
- fset=_set_Hmag_bore,
+ H0_bore = property(
+ fget=_get_H0_bore,
+ fset=_set_H0_bore,
doc=u"""Height of the magnet near the bore
:Type: float
@@ -458,18 +458,18 @@ def _set_Hmag_bore(self, value):
""",
)
- def _get_Hmag_gap(self):
- """getter of Hmag_gap"""
- return self._Hmag_gap
+ def _get_H0_gap(self):
+ """getter of H0_gap"""
+ return self._H0_gap
- def _set_Hmag_gap(self, value):
- """setter of Hmag_gap"""
- check_var("Hmag_gap", value, "float", Vmin=0)
- self._Hmag_gap = value
+ def _set_H0_gap(self, value):
+ """setter of H0_gap"""
+ check_var("H0_gap", value, "float", Vmin=0)
+ self._H0_gap = value
- Hmag_gap = property(
- fget=_get_Hmag_gap,
- fset=_set_Hmag_gap,
+ H0_gap = property(
+ fget=_get_H0_gap,
+ fset=_set_H0_gap,
doc=u"""Height of the magnet near the airgap
:Type: float
diff --git a/pyleecan/Classes/SlotM19.py b/pyleecan/Classes/SlotM19.py
index 417f35ef8..0a2619da2 100644
--- a/pyleecan/Classes/SlotM19.py
+++ b/pyleecan/Classes/SlotM19.py
@@ -197,9 +197,9 @@ class SlotM19(Slot):
def __init__(
self,
- W0=0.03,
- W1=0.02,
- Hmag=0.00175,
+ W0=0,
+ W1=0,
+ H0=0,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -225,8 +225,8 @@ def __init__(
W0 = init_dict["W0"]
if "W1" in list(init_dict.keys()):
W1 = init_dict["W1"]
- if "Hmag" in list(init_dict.keys()):
- Hmag = init_dict["Hmag"]
+ if "H0" in list(init_dict.keys()):
+ H0 = init_dict["H0"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -236,7 +236,7 @@ def __init__(
# Set the properties (value check and convertion are done in setter)
self.W0 = W0
self.W1 = W1
- self.Hmag = Hmag
+ self.H0 = H0
# Call Slot init
super(SlotM19, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -250,7 +250,7 @@ def __str__(self):
SlotM19_str += super(SlotM19, self).__str__()
SlotM19_str += "W0 = " + str(self.W0) + linesep
SlotM19_str += "W1 = " + str(self.W1) + linesep
- SlotM19_str += "Hmag = " + str(self.Hmag) + linesep
+ SlotM19_str += "H0 = " + str(self.H0) + linesep
return SlotM19_str
def __eq__(self, other):
@@ -266,7 +266,7 @@ def __eq__(self, other):
return False
if other.W1 != self.W1:
return False
- if other.Hmag != self.Hmag:
+ if other.H0 != self.H0:
return False
return True
@@ -312,20 +312,18 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
else:
diff_list.append(name + ".W1")
if (
- other._Hmag is not None
- and self._Hmag is not None
- and isnan(other._Hmag)
- and isnan(self._Hmag)
+ other._H0 is not None
+ and self._H0 is not None
+ and isnan(other._H0)
+ and isnan(self._H0)
):
pass
- elif other._Hmag != self._Hmag:
+ elif other._H0 != self._H0:
if is_add_value:
- val_str = (
- " (self=" + str(self._Hmag) + ", other=" + str(other._Hmag) + ")"
- )
- diff_list.append(name + ".Hmag" + val_str)
+ val_str = " (self=" + str(self._H0) + ", other=" + str(other._H0) + ")"
+ diff_list.append(name + ".H0" + val_str)
else:
- diff_list.append(name + ".Hmag")
+ diff_list.append(name + ".H0")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -339,7 +337,7 @@ def __sizeof__(self):
S += super(SlotM19, self).__sizeof__()
S += getsizeof(self.W0)
S += getsizeof(self.W1)
- S += getsizeof(self.Hmag)
+ S += getsizeof(self.H0)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -361,7 +359,7 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
)
SlotM19_dict["W0"] = self.W0
SlotM19_dict["W1"] = self.W1
- SlotM19_dict["Hmag"] = self.Hmag
+ SlotM19_dict["H0"] = self.H0
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotM19_dict["__class__"] = "SlotM19"
@@ -373,7 +371,7 @@ def copy(self):
# Handle deepcopy of all the properties
W0_val = self.W0
W1_val = self.W1
- Hmag_val = self.Hmag
+ H0_val = self.H0
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -384,7 +382,7 @@ def copy(self):
obj_copy = type(self)(
W0=W0_val,
W1=W1_val,
- Hmag=Hmag_val,
+ H0=H0_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -396,7 +394,7 @@ def _set_None(self):
self.W0 = None
self.W1 = None
- self.Hmag = None
+ self.H0 = None
# Set to None the properties inherited from Slot
super(SlotM19, self)._set_None()
@@ -438,18 +436,18 @@ def _set_W1(self, value):
""",
)
- def _get_Hmag(self):
- """getter of Hmag"""
- return self._Hmag
+ def _get_H0(self):
+ """getter of H0"""
+ return self._H0
- def _set_Hmag(self, value):
- """setter of Hmag"""
- check_var("Hmag", value, "float", Vmin=0)
- self._Hmag = value
+ def _set_H0(self, value):
+ """setter of H0"""
+ check_var("H0", value, "float", Vmin=0)
+ self._H0 = value
- Hmag = property(
- fget=_get_Hmag,
- fset=_set_Hmag,
+ H0 = property(
+ fget=_get_H0,
+ fset=_set_H0,
doc=u"""Magnet Height
:Type: float
diff --git a/pyleecan/Classes/SlotW14.py b/pyleecan/Classes/SlotW14.py
index 5e134272c..989a4e0d3 100644
--- a/pyleecan/Classes/SlotW14.py
+++ b/pyleecan/Classes/SlotW14.py
@@ -92,6 +92,11 @@
except ImportError as error:
plot_schematics = error
+try:
+ from ..Methods.Slot.SlotW14.get_H1 import get_H1
+except ImportError as error:
+ get_H1 = error
+
from numpy import isnan
from ._check import InitUnKnowClassError
@@ -273,6 +278,15 @@ class SlotW14(Slot):
)
else:
plot_schematics = plot_schematics
+ # cf Methods.Slot.SlotW14.get_H1
+ if isinstance(get_H1, ImportError):
+ get_H1 = property(
+ fget=lambda x: raise_(
+ ImportError("Can't use SlotW14 method get_H1: " + str(get_H1))
+ )
+ )
+ else:
+ get_H1 = get_H1
# generic save method is available in all object
save = save
# get_logger method is available in all object
@@ -282,10 +296,11 @@ def __init__(
self,
W0=0.0122,
H0=0.001,
- H1=0.0015,
+ H1=0,
H3=0.0122,
wedge_type=0,
W3=0.0122,
+ H1_is_rad=False,
Zs=36,
wedge_mat=None,
is_bore=True,
@@ -319,6 +334,8 @@ def __init__(
wedge_type = init_dict["wedge_type"]
if "W3" in list(init_dict.keys()):
W3 = init_dict["W3"]
+ if "H1_is_rad" in list(init_dict.keys()):
+ H1_is_rad = init_dict["H1_is_rad"]
if "Zs" in list(init_dict.keys()):
Zs = init_dict["Zs"]
if "wedge_mat" in list(init_dict.keys()):
@@ -332,6 +349,7 @@ def __init__(
self.H3 = H3
self.wedge_type = wedge_type
self.W3 = W3
+ self.H1_is_rad = H1_is_rad
# Call Slot init
super(SlotW14, self).__init__(Zs=Zs, wedge_mat=wedge_mat, is_bore=is_bore)
# The class is frozen (in Slot init), for now it's impossible to
@@ -349,6 +367,7 @@ def __str__(self):
SlotW14_str += "H3 = " + str(self.H3) + linesep
SlotW14_str += "wedge_type = " + str(self.wedge_type) + linesep
SlotW14_str += "W3 = " + str(self.W3) + linesep
+ SlotW14_str += "H1_is_rad = " + str(self.H1_is_rad) + linesep
return SlotW14_str
def __eq__(self, other):
@@ -372,6 +391,8 @@ def __eq__(self, other):
return False
if other.W3 != self.W3:
return False
+ if other.H1_is_rad != self.H1_is_rad:
+ return False
return True
def compare(self, other, name="self", ignore_list=None, is_add_value=False):
@@ -466,6 +487,18 @@ def compare(self, other, name="self", ignore_list=None, is_add_value=False):
diff_list.append(name + ".W3" + val_str)
else:
diff_list.append(name + ".W3")
+ if other._H1_is_rad != self._H1_is_rad:
+ if is_add_value:
+ val_str = (
+ " (self="
+ + str(self._H1_is_rad)
+ + ", other="
+ + str(other._H1_is_rad)
+ + ")"
+ )
+ diff_list.append(name + ".H1_is_rad" + val_str)
+ else:
+ diff_list.append(name + ".H1_is_rad")
# Filter ignore differences
diff_list = list(filter(lambda x: x not in ignore_list, diff_list))
return diff_list
@@ -483,6 +516,7 @@ def __sizeof__(self):
S += getsizeof(self.H3)
S += getsizeof(self.wedge_type)
S += getsizeof(self.W3)
+ S += getsizeof(self.H1_is_rad)
return S
def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
@@ -508,6 +542,7 @@ def as_dict(self, type_handle_ndarray=0, keep_function=False, **kwargs):
SlotW14_dict["H3"] = self.H3
SlotW14_dict["wedge_type"] = self.wedge_type
SlotW14_dict["W3"] = self.W3
+ SlotW14_dict["H1_is_rad"] = self.H1_is_rad
# The class name is added to the dict for deserialisation purpose
# Overwrite the mother class name
SlotW14_dict["__class__"] = "SlotW14"
@@ -523,6 +558,7 @@ def copy(self):
H3_val = self.H3
wedge_type_val = self.wedge_type
W3_val = self.W3
+ H1_is_rad_val = self.H1_is_rad
Zs_val = self.Zs
if self.wedge_mat is None:
wedge_mat_val = None
@@ -537,6 +573,7 @@ def copy(self):
H3=H3_val,
wedge_type=wedge_type_val,
W3=W3_val,
+ H1_is_rad=H1_is_rad_val,
Zs=Zs_val,
wedge_mat=wedge_mat_val,
is_bore=is_bore_val,
@@ -552,6 +589,7 @@ def _set_None(self):
self.H3 = None
self.wedge_type = None
self.W3 = None
+ self.H1_is_rad = None
# Set to None the properties inherited from Slot
super(SlotW14, self)._set_None()
@@ -605,7 +643,7 @@ def _set_H1(self, value):
H1 = property(
fget=_get_H1,
fset=_set_H1,
- doc=u"""Slot intermediate height.
+ doc=u"""height or angle (See Schematics)
:Type: float
:min: 0
@@ -668,3 +706,21 @@ def _set_W3(self, value):
:min: 0
""",
)
+
+ def _get_H1_is_rad(self):
+ """getter of H1_is_rad"""
+ return self._H1_is_rad
+
+ def _set_H1_is_rad(self, value):
+ """setter of H1_is_rad"""
+ check_var("H1_is_rad", value, "bool")
+ self._H1_is_rad = value
+
+ H1_is_rad = property(
+ fget=_get_H1_is_rad,
+ fset=_set_H1_is_rad,
+ doc=u"""H1 unit, 0 for m, 1 for rad
+
+ :Type: bool
+ """,
+ )
diff --git a/pyleecan/Classes/import_all.py b/pyleecan/Classes/import_all.py
index 4d470ca10..3350686cd 100644
--- a/pyleecan/Classes/import_all.py
+++ b/pyleecan/Classes/import_all.py
@@ -21,6 +21,8 @@
from ..Classes.CondType21 import CondType21
from ..Classes.CondType22 import CondType22
from ..Classes.Conductor import Conductor
+from ..Classes.Convert import Convert
+from ..Classes.ConvertMC import ConvertMC
from ..Classes.DXFImport import DXFImport
from ..Classes.DataKeeper import DataKeeper
from ..Classes.Drive import Drive
@@ -189,6 +191,10 @@
from ..Classes.RefSegmentP1 import RefSegmentP1
from ..Classes.RefTriangle3 import RefTriangle3
from ..Classes.RefTriangle6 import RefTriangle6
+from ..Classes.Rule import Rule
+from ..Classes.RuleComplex import RuleComplex
+from ..Classes.RuleEquation import RuleEquation
+from ..Classes.RuleSimple import RuleSimple
from ..Classes.ScalarProduct import ScalarProduct
from ..Classes.ScalarProductL2 import ScalarProductL2
from ..Classes.Section import Section
diff --git a/pyleecan/Data/Machine/Benchmark.json b/pyleecan/Data/Machine/Benchmark.json
index 44b56c7ae..bda775e35 100644
--- a/pyleecan/Data/Machine/Benchmark.json
+++ b/pyleecan/Data/Machine/Benchmark.json
@@ -612,9 +612,9 @@
"skew": null,
"slot": {
"H0": 0.0,
- "Hmag": 0.005,
+ "H1": 0.005,
"W0": 0.6048,
- "Wmag": 0.6048,
+ "W1": 0.6048,
"Zs": 10,
"__class__": "SlotM11",
"is_bore": true,
diff --git a/pyleecan/Data/Machine/Protean_InWheel.json b/pyleecan/Data/Machine/Protean_InWheel.json
index a426fa283..3b6a0a3ee 100644
--- a/pyleecan/Data/Machine/Protean_InWheel.json
+++ b/pyleecan/Data/Machine/Protean_InWheel.json
@@ -329,9 +329,9 @@
"skew": null,
"slot": {
"H0": 0.002,
- "Hmag": 0.005,
+ "H1": 0.005,
"W0": 0.014,
- "Wmag": 0.014,
+ "W1": 0.014,
"Zs": 64,
"__class__": "SlotM10"
},
diff --git a/pyleecan/Data/Machine/SIPMSM_001.json b/pyleecan/Data/Machine/SIPMSM_001.json
index f7a436567..d2b619fc1 100644
--- a/pyleecan/Data/Machine/SIPMSM_001.json
+++ b/pyleecan/Data/Machine/SIPMSM_001.json
@@ -327,9 +327,9 @@
"notch": [],
"slot": {
"H0": 0.007,
- "Hmag": 0.007,
+ "H1": 0.007,
"W0": 1.3351769,
- "Wmag": 1.3351769,
+ "W1": 1.3351769,
"Zs": 4,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/SPMSM_001.json b/pyleecan/Data/Machine/SPMSM_001.json
index 96e9c93e6..5707e462f 100644
--- a/pyleecan/Data/Machine/SPMSM_001.json
+++ b/pyleecan/Data/Machine/SPMSM_001.json
@@ -326,7 +326,7 @@
},
"notch": [],
"slot": {
- "Hmag": 0.003,
+ "H0": 0.003,
"Zs": 8,
"__class__": "SlotM18"
},
diff --git a/pyleecan/Data/Machine/SPMSM_002.json b/pyleecan/Data/Machine/SPMSM_002.json
index 0b136eab9..579932da1 100644
--- a/pyleecan/Data/Machine/SPMSM_002.json
+++ b/pyleecan/Data/Machine/SPMSM_002.json
@@ -327,9 +327,9 @@
"notch": [],
"slot": {
"H0": 0.0,
- "Hmag": 0.007,
+ "H1": 0.007,
"W0": 1.3351769,
- "Wmag": 1.3351769,
+ "W1": 1.3351769,
"Zs": 4,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/SPMSM_003.json b/pyleecan/Data/Machine/SPMSM_003.json
index 686566914..f47bf7f21 100644
--- a/pyleecan/Data/Machine/SPMSM_003.json
+++ b/pyleecan/Data/Machine/SPMSM_003.json
@@ -327,9 +327,9 @@
"notch": [],
"slot": {
"H0": 0,
- "Hmag": 0.012,
+ "H1": 0.012,
"W0": 2.82743338823,
- "Wmag": 2.82743338823,
+ "W1": 2.82743338823,
"Zs": 2,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/SPMSM_015.json b/pyleecan/Data/Machine/SPMSM_015.json
index e9a0beea3..c135c39da 100644
--- a/pyleecan/Data/Machine/SPMSM_015.json
+++ b/pyleecan/Data/Machine/SPMSM_015.json
@@ -327,9 +327,9 @@
"notch": [],
"slot": {
"H0": 0,
- "Hmag": 0.002,
+ "H1": 0.002,
"W0": 0.23529412,
- "Wmag": 0.23529412,
+ "W1": 0.23529412,
"Zs": 18,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/SPMSM_020.json b/pyleecan/Data/Machine/SPMSM_020.json
index bf4a328f2..30153ced5 100644
--- a/pyleecan/Data/Machine/SPMSM_020.json
+++ b/pyleecan/Data/Machine/SPMSM_020.json
@@ -391,9 +391,9 @@
"notch": null,
"slot": {
"H0": 0.0,
- "Hmag": 0.001905,
+ "H1": 0.001905,
"W0": 0.0074168,
- "Wmag": 0.0074168,
+ "W1": 0.0074168,
"Zs": 16,
"__class__": "SlotM12"
}
diff --git a/pyleecan/Data/Machine/SPMSM_18s16p_loss.json b/pyleecan/Data/Machine/SPMSM_18s16p_loss.json
index 081c2e875..9ac8802b9 100644
--- a/pyleecan/Data/Machine/SPMSM_18s16p_loss.json
+++ b/pyleecan/Data/Machine/SPMSM_18s16p_loss.json
@@ -771,9 +771,9 @@
"skew": null,
"slot": {
"H0": 0.0,
- "Hmag": 0.001905,
+ "H1": 0.001905,
"W0": 0.007417,
- "Wmag": 0.007417,
+ "W1": 0.007417,
"Zs": 16,
"__class__": "SlotM12",
"wedge_mat": null
diff --git a/pyleecan/Data/Machine/SPMSM_LamSlotMultiWind.json b/pyleecan/Data/Machine/SPMSM_LamSlotMultiWind.json
index 74f28e340..884cfe30d 100644
--- a/pyleecan/Data/Machine/SPMSM_LamSlotMultiWind.json
+++ b/pyleecan/Data/Machine/SPMSM_LamSlotMultiWind.json
@@ -328,9 +328,9 @@
"notch": [],
"slot": {
"H0": 0,
- "Hmag": 0.003,
+ "H1": 0.003,
"W0": 0.78539816,
- "Wmag": 0.78539816,
+ "W1": 0.78539816,
"Zs": 8,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/SPMSM_skew.json b/pyleecan/Data/Machine/SPMSM_skew.json
index 147dd1c0d..0dc849bd7 100644
--- a/pyleecan/Data/Machine/SPMSM_skew.json
+++ b/pyleecan/Data/Machine/SPMSM_skew.json
@@ -329,9 +329,9 @@
"skew": null,
"slot": {
"H0": 0.0,
- "Hmag": 0.003,
+ "H1": 0.003,
"W0": 0.013099999999999999,
- "Wmag": 0.013099999999999999,
+ "W1": 0.013099999999999999,
"Zs": 4,
"__class__": "SlotM12"
},
diff --git a/pyleecan/Data/Machine/Slotless_CEFC.json b/pyleecan/Data/Machine/Slotless_CEFC.json
index e88cf2005..4c5d0d712 100644
--- a/pyleecan/Data/Machine/Slotless_CEFC.json
+++ b/pyleecan/Data/Machine/Slotless_CEFC.json
@@ -752,9 +752,9 @@
"notch": [],
"slot": {
"H0": 0,
- "Hmag": 0,
+ "H1": 0,
"W0": 0.2617993877991494,
- "Wmag": 0.0122,
+ "W1": 0.0122,
"Zs": 12,
"__class__": "SlotM11"
},
diff --git a/pyleecan/Data/Machine/slotless_M18.json b/pyleecan/Data/Machine/slotless_M18.json
index 12180e94e..e9259c7f1 100644
--- a/pyleecan/Data/Machine/slotless_M18.json
+++ b/pyleecan/Data/Machine/slotless_M18.json
@@ -618,10 +618,10 @@
"skew": null,
"slot": {
"H0": 0.0,
- "Hmag": 0.0036,
+ "H1": 0.0036,
"Rtopm": 0.0089,
"W0": 0.0095,
- "Wmag": 0.0095,
+ "W1": 0.0095,
"Zs": 4,
"__class__": "SlotM13",
"is_bore": true,
@@ -1089,7 +1089,7 @@
"notch": [],
"skew": null,
"slot": {
- "Hmag": 0.002,
+ "H0": 0.002,
"Zs": 12,
"__class__": "SlotM18",
"is_bore": true,
diff --git a/pyleecan/Functions/Converter/MotorCAD/add_notch_slotM19.py b/pyleecan/Functions/Converter/MotorCAD/add_notch_slotM19.py
new file mode 100644
index 000000000..3ba104672
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/add_notch_slotM19.py
@@ -0,0 +1,63 @@
+from numpy import cos, sqrt
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts motor-cad notch into pyleecan notch slotM19
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "PoleNotchDepth"]
+ H0 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ Rbo = machine.rotor.get_Rbo()
+
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "PoleNotchArc_Outer"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "PoleNotchArc_Inner"]
+ W0 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ machine.rotor.notch[0].notch_shape.W1 = sqrt(2 * Rbo ** 2 * (1 - cos(W1)))
+ machine.rotor.notch[0].notch_shape.W0 = sqrt(2 * (Rbo - H0) ** 2 * (1 - cos(W0)))
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/arc_duct_polar.py b/pyleecan/Functions/Converter/MotorCAD/arc_duct_polar.py
new file mode 100644
index 000000000..58b199ca7
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/arc_duct_polar.py
@@ -0,0 +1,82 @@
+from numpy import arccos, pi
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Conversion of the slot arc duct (motor-cad) into polar duct (pyleecan)
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+
+ if isinstance(self.param_dict["duct_id"], int):
+ duct_id = self.param_dict["duct_id"]
+ else:
+ ValueError("duct_id isn't int")
+
+ lam_name_MC = self.param_dict["lam_name_MC"]
+ lam_name_py = self.param_dict["lam_name_py"]
+
+ other_path_list = [
+ "[Through_Vent]",
+ f"{lam_name_MC}CircularDuctLayer_Channels[{duct_id}]",
+ ]
+ self.unit_type = ""
+ Zh = self.get_other(other_dict, other_path_list, other_unit_dict)
+ gamma = 2 * pi / Zh
+
+ self.unit_type = "m"
+ other_path_list = [
+ "[Through_Vent]",
+ f"{lam_name_MC}ArcDuctLayer_InnerDiameter[{duct_id}]",
+ ]
+ H0 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ H0 = H0 * 0.5
+
+ self.unit_type = "m"
+ other_path_list = [
+ "[Through_Vent]",
+ f"{lam_name_MC}ArcDuctLayer_WebWidth[{duct_id}]",
+ ]
+ A = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ other_value = gamma - (pi / 180) * arccos((2 * H0 * H0 - A * A) / (2 * H0))
+
+ path = f"machine.{lam_name_py}.axial_vent[{duct_id}].W1"
+ self.set_P(machine, other_value, path)
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/embedded_breadloaf_holeM63.py b/pyleecan/Functions/Converter/MotorCAD/embedded_breadloaf_holeM63.py
new file mode 100644
index 000000000..8ce2a72e6
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/embedded_breadloaf_holeM63.py
@@ -0,0 +1,67 @@
+from numpy import sin, cos, pi, sqrt, tan
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Conversion of the slot inset_breadloaf (motor-cad) into the slotM12 (pyleecan)
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ if isinstance(self.param_dict["hole_id"], int):
+ hole_id = self.param_dict["hole_id"]
+ else:
+ ValueError("hole_id isn't int")
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Embed_Depth"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ Rbo = machine.rotor.get_Rbo()
+
+ H = Rbo - H1
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W0 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ W0 = H * tan(W0 / 2)
+
+ machine.rotor.hole[hole_id].W0 = W0 * 2
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/embedded_parallel_holeM62.py b/pyleecan/Functions/Converter/MotorCAD/embedded_parallel_holeM62.py
new file mode 100644
index 000000000..8ce2a72e6
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/embedded_parallel_holeM62.py
@@ -0,0 +1,67 @@
+from numpy import sin, cos, pi, sqrt, tan
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Conversion of the slot inset_breadloaf (motor-cad) into the slotM12 (pyleecan)
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ if isinstance(self.param_dict["hole_id"], int):
+ hole_id = self.param_dict["hole_id"]
+ else:
+ ValueError("hole_id isn't int")
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Embed_Depth"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ Rbo = machine.rotor.get_Rbo()
+
+ H = Rbo - H1
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W0 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ W0 = H * tan(W0 / 2)
+
+ machine.rotor.hole[hole_id].W0 = W0 * 2
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/inset_breadloaf_slotM12.py b/pyleecan/Functions/Converter/MotorCAD/inset_breadloaf_slotM12.py
new file mode 100644
index 000000000..92f9e4dde
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/inset_breadloaf_slotM12.py
@@ -0,0 +1,68 @@
+from numpy import sin
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts motor-cad inset_breadloaf slot into pyleecanc slotM12
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Thickness"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ # We set H0, to be able to call the comp_point_coordiante and obtain the true value of H0
+ slot_width = (Rbo - H1) * sin(W1 / 2)
+ machine.rotor.slot.W1 = 2 * slot_width
+ machine.rotor.slot.W0 = 2 * slot_width
+ machine.rotor.slot.H0 = H1
+
+ point_dict = machine.rotor.slot._comp_point_coordinate()
+ Z1 = point_dict["ZM1"]
+ Z2 = point_dict["ZM2"]
+
+ machine.rotor.slot.H0 = abs(Z2 - Z1)
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/inset_parallel_slotM15.py b/pyleecan/Functions/Converter/MotorCAD/inset_parallel_slotM15.py
new file mode 100644
index 000000000..60529eebe
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/inset_parallel_slotM15.py
@@ -0,0 +1,58 @@
+from numpy import sin
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts motor-cad inset_parallel slot into pyleecan slotM15
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ Rbo = machine.rotor.get_Rbo()
+
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ # Set W1
+ slot_width = (Rbo) * sin(W1 / 2)
+ machine.rotor.slot.W1 = 2 * slot_width
+
+ # Set Rtopm
+ machine.rotor.slot.Rtopm = Rbo
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine into dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/interior_U_shape_holeM61.py b/pyleecan/Functions/Converter/MotorCAD/interior_U_shape_holeM61.py
new file mode 100644
index 000000000..e557d5b5f
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/interior_U_shape_holeM61.py
@@ -0,0 +1,69 @@
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts interior_U_shape motor-cad slot into pyleecan holeM61
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+
+ if isinstance(self.param_dict["hole_id"], int):
+ hole_id = self.param_dict["hole_id"]
+ else:
+ ValueError("hole_id isn't int")
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", f"UShape_InnerDiameter_Array[{hole_id}]"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ # Set H0
+ machine.rotor.hole[hole_id].H0 = Rbo - H1 / 2
+
+ # Set W2
+ other_path_list = ["[Dimensions]", f"UMagnet_Length_Outer_Array[{hole_id}]"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ if H1 == 0:
+ machine.rotor.hole[hole_id].W2 = None
+
+ # Set W1
+ other_path_list = ["[Dimensions]", f"UMagnet_Length_Inner_Array[{hole_id}]"]
+ H2 = self.get_other(other_dict, other_path_list, other_unit_dict)
+ if H2 == 0:
+ machine.rotor.hole[hole_id].W1 = None
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11.py b/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11.py
new file mode 100644
index 000000000..889bc67ff
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11.py
@@ -0,0 +1,25 @@
+from pyleecan.Classes.LamSlotMag import LamSlotMag
+from pyleecan.Classes.SlotW11 import SlotW11
+
+from pyleecan.Methods.Slot.SlotW11.get_H1 import get_H1
+from pyleecan.Methods.Slot.SlotW11._comp_W import _comp_W
+
+# !!!!! not use for the moment
+
+
+def other_to_P(self, machine, other_dict):
+ dict_machine = machine.rotor.as_dict()
+
+ machine.rotor = LamSlotMag(init_dict=dict_machine)
+
+ machine.rotor.slot = SlotW11()
+
+ machine.rotor.slot.is_cstt_tooth = True
+ machine.rotor.slot.H1_is_rad = True
+
+ machine.rotor.is_internal = True
+ return machine
+
+
+def P_to_other(self, machine, other_dict):
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11_H1.py b/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11_H1.py
new file mode 100644
index 000000000..a1b4efcec
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/rotor_slotW11_H1.py
@@ -0,0 +1,14 @@
+# !!!!! not use for the moment
+
+
+def other_to_P(self, machine, other_dict):
+ H1 = machine.rotor.slot.get_H1()
+
+ machine.rotor.slot.H1 = H1
+ machine.rotor.slot.H1_is_rad = False
+ # machine.rotor.slot = _comp_W(machine.rotor.slot)
+ return machine
+
+
+def P_to_other(self, machine, other_dict):
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/set_pole_pair_number.py b/pyleecan/Functions/Converter/MotorCAD/set_pole_pair_number.py
new file mode 100644
index 000000000..5903fce19
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/set_pole_pair_number.py
@@ -0,0 +1,53 @@
+def other_to_P(self, machine, other_dict, other_unit_dict=None):
+ """Converts the pole pair number
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ other_value = other_dict["[Dimensions]"]["Pole_Number"]
+ machine.set_pole_pair_number(other_value // 2)
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ pole_pair_number = machine.get_pole_pair_number() * 2
+
+ if not "[Dimensions]" in other_dict:
+ other_dict["[Dimensions]"] = {}
+
+ other_dict["[Dimensions]"]["Pole_Number"] = pole_pair_number
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/slotW11_H1.py b/pyleecan/Functions/Converter/MotorCAD/slotW11_H1.py
new file mode 100644
index 000000000..04c63bb88
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/slotW11_H1.py
@@ -0,0 +1,46 @@
+def other_to_P(self, machine, other_dict, other_unit_dict=None):
+ """Conversion H1 in m to slotW11
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A obj machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Return
+ ---------
+ machine : Machine
+ A obj machine
+ """
+ H1 = machine.stator.slot.get_H1()
+ machine.stator.slot.H1_is_rad = False
+ machine.stator.slot.H1 = H1
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/slotW14_H1.py b/pyleecan/Functions/Converter/MotorCAD/slotW14_H1.py
new file mode 100644
index 000000000..e271fe9e5
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/slotW14_H1.py
@@ -0,0 +1,46 @@
+def other_to_P(self, machine, other_dict, other_unit_dict=None):
+ """Conversion H1 in m to slotW14
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A obj machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Return
+ ---------
+ machine : Machine
+ A obj machine
+ """
+ H1 = machine.stator.slot.get_H1()
+
+ machine.stator.slot.H1 = H1
+ machine.stator.slot.H1_is_rad = False
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/slotW21_H1.py b/pyleecan/Functions/Converter/MotorCAD/slotW21_H1.py
new file mode 100644
index 000000000..c86570c39
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/slotW21_H1.py
@@ -0,0 +1,46 @@
+def other_to_P(self, machine, other_dict, other_unit_dict=None):
+ """Conversion H1 in m to slotW11
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A obj machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Return
+ ---------
+ machine : Machine
+ A obj machine
+ """
+ H1 = machine.stator.slot.get_H1()
+
+ machine.stator.slot.H1 = H1
+ machine.stator.slot.H1_is_rad = False
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/slotW23_H1.py b/pyleecan/Functions/Converter/MotorCAD/slotW23_H1.py
new file mode 100644
index 000000000..c86570c39
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/slotW23_H1.py
@@ -0,0 +1,46 @@
+def other_to_P(self, machine, other_dict, other_unit_dict=None):
+ """Conversion H1 in m to slotW11
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A obj machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Return
+ ---------
+ machine : Machine
+ A obj machine
+ """
+ H1 = machine.stator.slot.get_H1()
+
+ machine.stator.slot.H1 = H1
+ machine.stator.slot.H1_is_rad = False
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/surface_breadloaf_slotM13.py b/pyleecan/Functions/Converter/MotorCAD/surface_breadloaf_slotM13.py
new file mode 100644
index 000000000..676718fe3
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/surface_breadloaf_slotM13.py
@@ -0,0 +1,107 @@
+from numpy import sqrt, cos, arcsin, exp
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts the surface_breadloaf motor-cad slot into pyleecan slotM13
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Thickness"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ # Magnet arc is equivalent at W1 in ED
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "MagnetReduction"]
+ Red = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ slot_W1 = sqrt(2 * (Rbo + H1) ** 2 * (1 - cos(W1)))
+ machine.rotor.slot.W1 = slot_W1
+
+ # set W0
+ machine.rotor.slot.W0 = slot_W1
+
+ # define rtopm at max
+
+ # alpha is the angle to rotate Z0 so ||Z1,Z10|| = W0
+ alpha = float(arcsin(slot_W1 / (2 * Rbo)))
+
+ Z1 = Rbo * exp(-1j * alpha)
+
+ machine.rotor.slot.Rtopm = abs(Z1)
+
+ point_dict = machine.rotor.slot._comp_point_coordinate()
+
+ ZM0 = point_dict["ZM0"]
+ ZM2 = point_dict["ZM2"]
+ ZM3 = point_dict["ZM3"]
+ ZM2 = ZM2 - Red
+ ZM3 = ZM3 - Red
+
+ x2 = ZM0
+ y2 = 0
+ x1 = ZM2.real
+ y1 = ZM2.imag
+
+ x3 = ZM3.real
+ y3 = ZM3.imag
+
+ # equation cercle with 3 points
+ # coordonné du centre x
+ x = -(
+ (x3 ** 2 - x2 ** 2 + y3 ** 2 - y2 ** 2) / (2 * (y3 - y2))
+ - (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ ) / (((x2 - x1) / (y2 - y1)) - ((x3 - x2) / (y3 - y2)))
+
+ y = -((x2 - x1) * x / (y2 - y1)) + (
+ (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ )
+
+ Rtopm = sqrt((x1 - x) ** 2 + (y1 - y) ** 2)
+
+ machine.rotor.slot.Rtopm = Rtopm
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/surface_parallel_slotM15.py b/pyleecan/Functions/Converter/MotorCAD/surface_parallel_slotM15.py
new file mode 100644
index 000000000..fcda31b5e
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/surface_parallel_slotM15.py
@@ -0,0 +1,100 @@
+from numpy import sqrt, cos, arctan
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Conversion of the slot surface_parallel (motor-cad) into the slotM15 (pyleecan)
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Thickness"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ # Magnet arc is equivalent at W1 in ED
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "Magnet_Reduction"]
+ Red = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ slot_W1 = sqrt(2 * (Rbo + H1) ** 2 * (1 - cos(W1)))
+ machine.rotor.slot.W1 = slot_W1
+
+ # set W0
+ machine.rotor.slot.W0 = 2 * arctan((slot_W1 / 2) / Rbo)
+
+ machine.rotor.slot.Rtopm = Rbo + H1
+
+ point_dict = machine.rotor.slot._comp_point_coordinate()
+
+ ZM0 = point_dict["ZM0"]
+ ZM2 = point_dict["ZM2"]
+ ZM3 = point_dict["ZM3"]
+ ZM2 = ZM2 - Red
+ ZM3 = ZM3 - Red
+
+ x2 = ZM0
+ y2 = 0
+ x1 = ZM2.real
+ y1 = ZM2.imag
+
+ x3 = ZM3.real
+ y3 = ZM3.imag
+
+ # equation cercle with 3 points
+ # coordonné du centre x
+ x = -(
+ (x3 ** 2 - x2 ** 2 + y3 ** 2 - y2 ** 2) / (2 * (y3 - y2))
+ - (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ ) / (((x2 - x1) / (y2 - y1)) - ((x3 - x2) / (y3 - y2)))
+
+ y = -((x2 - x1) * x / (y2 - y1)) + (
+ (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ )
+
+ Rtopm = sqrt((x1 - x) ** 2 + (y1 - y) ** 2)
+
+ machine.rotor.slot.Rtopm = Rtopm
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/MotorCAD/surface_radial_slotM14.py b/pyleecan/Functions/Converter/MotorCAD/surface_radial_slotM14.py
new file mode 100644
index 000000000..8d946ed99
--- /dev/null
+++ b/pyleecan/Functions/Converter/MotorCAD/surface_radial_slotM14.py
@@ -0,0 +1,104 @@
+from numpy import sqrt, exp, cos, arctan
+
+
+def other_to_P(self, machine, other_dict, other_unit_dict):
+ """Converts surface_radial motor-cad slot into pyleecan slotM14
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ machine : Machine
+ A pyleecan machine
+ """
+ other_path_list = ["[Dimensions]", "Magnet_Thickness"]
+ H1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ # Magnet arc is equivalent at W1 in ED
+ self.unit_type = "ED"
+ other_path_list = ["[Dimensions]", "Magnet_Arc_[ED]"]
+ W1 = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ self.unit_type = "m"
+ other_path_list = ["[Dimensions]", "MagnetReduction"]
+ Red = self.get_other(other_dict, other_path_list, other_unit_dict)
+
+ Rbo = machine.rotor.get_Rbo()
+
+ slot_W1 = sqrt(2 * (Rbo + H1) ** 2 * (1 - cos(W1)))
+ machine.rotor.slot.W1 = 2 * arctan((slot_W1 / 2) / Rbo)
+
+ # set W0
+ machine.rotor.slot.W0 = 2 * arctan((slot_W1 / 2) / Rbo)
+
+ machine.rotor.slot.Rtopm = Rbo + H1
+
+ point_dict = machine.rotor.slot._comp_point_coordinate()
+
+ ZM0 = point_dict["ZM0"]
+ ZM2 = point_dict["ZM2"]
+ ZM3 = point_dict["ZM3"]
+ ZM2 = ZM2 * exp(-1j * machine.rotor.slot.W0 / 2)
+ ZM2 = ZM2 - Red
+ ZM2 = ZM2 * exp(+1j * machine.rotor.slot.W0 / 2)
+
+ ZM3 = ZM3 * exp(1j * machine.rotor.slot.W0 / 2)
+ ZM3 = ZM3 - Red
+ ZM3 = ZM3 * exp(-1j * machine.rotor.slot.W0 / 2)
+
+ x2 = ZM0
+ y2 = 0
+ x1 = ZM2.real
+ y1 = ZM2.imag
+
+ x3 = ZM3.real
+ y3 = ZM3.imag
+
+ # equation cercle with 3 points
+ # coordonné du centre x
+ x = -(
+ (x3 ** 2 - x2 ** 2 + y3 ** 2 - y2 ** 2) / (2 * (y3 - y2))
+ - (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ ) / (((x2 - x1) / (y2 - y1)) - ((x3 - x2) / (y3 - y2)))
+
+ y = -((x2 - x1) * x / (y2 - y1)) + (
+ (x2 ** 2 - x1 ** 2 + y2 ** 2 - y1 ** 2) / (2 * (y2 - y1))
+ )
+
+ Rtopm = sqrt((x1 - x) ** 2 + (y1 - y) ** 2)
+
+ machine.rotor.slot.Rtopm = Rtopm
+
+ return machine
+
+
+def P_to_other(self, machine, other_dict, other_unit_dict=None):
+ """conversion obj machine in dict
+
+ Parameters
+ ----------
+ self : ConvertMC
+ A ConvertMC object
+ machine : Machine
+ A pyleecan machine
+ other_dict : dict
+ A dict with the conversion obj machine
+ other_unit_dict : dict
+ dict with unit to make conversion (key: unit family, value: factor)
+
+ Returns
+ ---------
+ other_dict : dict
+ A dict with the conversion obj machine
+ """
+
+ return other_dict
diff --git a/pyleecan/Functions/Converter/Utils/ConvertionError.py b/pyleecan/Functions/Converter/Utils/ConvertionError.py
new file mode 100644
index 000000000..bc4e5aef8
--- /dev/null
+++ b/pyleecan/Functions/Converter/Utils/ConvertionError.py
@@ -0,0 +1,2 @@
+class ConvertionError(Exception):
+ ...
diff --git a/pyleecan/Functions/Converter/Utils/EquivalentError.py b/pyleecan/Functions/Converter/Utils/EquivalentError.py
new file mode 100644
index 000000000..59ac93581
--- /dev/null
+++ b/pyleecan/Functions/Converter/Utils/EquivalentError.py
@@ -0,0 +1,3 @@
+# Unused for now
+class EquivalentError(Exception):
+ ...
diff --git a/pyleecan/Functions/FEMM/create_FEMM_materials.py b/pyleecan/Functions/FEMM/create_FEMM_materials.py
index 54669eaa0..a20b709cf 100644
--- a/pyleecan/Functions/FEMM/create_FEMM_materials.py
+++ b/pyleecan/Functions/FEMM/create_FEMM_materials.py
@@ -265,6 +265,7 @@ def create_FEMM_materials(
FEMM_dict["circuits"] = circuits
return prop_dict, FEMM_dict
+
def add_BH_curve(femm, BH, mat_name):
"""Add the BH curve of a lamination on femm
@@ -279,4 +280,4 @@ def add_BH_curve(femm, BH, mat_name):
"""
if BH is not None and BH.shape[0] > 1:
for B, H in BH:
- femm.mi_addbhpoint(mat_name, H, B)
\ No newline at end of file
+ femm.mi_addbhpoint(mat_name, H, B)
diff --git a/pyleecan/Functions/Load/retrocompatibility.py b/pyleecan/Functions/Load/retrocompatibility.py
index a562663b9..f2534c46c 100644
--- a/pyleecan/Functions/Load/retrocompatibility.py
+++ b/pyleecan/Functions/Load/retrocompatibility.py
@@ -65,6 +65,8 @@ def _search_and_update(obj_dict, parent=None, parent_index=None, update_dict=Non
parent[parent_index] = convert_opticonstraint(obj_dict)
elif update_dict["OptiDesignVar"] and is_OptiDesignVar_dict(obj_dict):
parent[parent_index] = convert_optidesignvar(obj_dict)
+ elif update_dict["WmagHmag"] and is_Wmag_Hmag(obj_dict):
+ parent[parent_index] = convert_Wmag_Hmag(obj_dict)
else:
# walk through the dict
for key, value in obj_dict.items():
@@ -430,6 +432,43 @@ def convert_optidesignvar(optidesignvar_dict):
return OptiDesignVarInterval(init_dict=optidesignvar_dict_new)
+######################
+# v 1.5.1 => 1.5.2
+# Wmag/Hmag renamed as W1/H1
+######################
+WmagRenaming_VERSION = "1.5.2"
+
+
+def is_Wmag_Hmag(obj_dict):
+ """Check if the object need to be updated for Hmag/Wmag"""
+ return "__class__" in obj_dict.keys() and (
+ "Hmag" in obj_dict.keys() or "Wmag" in obj_dict.keys()
+ )
+
+
+def convert_Wmag_Hmag(Wmag_Hmag_dict):
+ """Update the old Wmag_Hmag_dict to the new W1_H1_dict"""
+ getLogger(GUI_LOG_NAME).info("Old machine version detected, Updating Wmag_Hmag")
+ # Copy dict to keep original version
+ Wmag_Hmag_dict_news = Wmag_Hmag_dict.copy()
+
+ if (
+ Wmag_Hmag_dict_news["__class__"] == "SlotM18"
+ or Wmag_Hmag_dict_news["__class__"] == "SlotM19"
+ ):
+ if "Hmag" in Wmag_Hmag_dict_news.keys():
+ Wmag_Hmag_dict_news["H0"] = Wmag_Hmag_dict_news.pop("Hmag")
+
+ else:
+ if "Hmag" in Wmag_Hmag_dict_news.keys():
+ Wmag_Hmag_dict_news["H1"] = Wmag_Hmag_dict_news.pop("Hmag")
+
+ if "Wmag" in Wmag_Hmag_dict.keys():
+ Wmag_Hmag_dict_news["W1"] = Wmag_Hmag_dict_news.pop("Wmag")
+
+ return Wmag_Hmag_dict_news
+
+
def is_before_version(ref_version, check_version):
"""Check if a version str is before another version str
@@ -487,6 +526,8 @@ def create_update_dict(file_version):
update_dict["VarParam"] = True
update_dict["OptiConstraint"] = True
update_dict["OptiDesignVar"] = True
+ update_dict["WmagHmag"] = True
+
else:
update_dict["Winding"] = is_before_version(WIND_VERSION, file_version)
update_dict["HoleUD"] = is_before_version(HoleUD_VERSION, file_version)
@@ -500,4 +541,5 @@ def create_update_dict(file_version):
update_dict["OptiDesignVar"] = is_before_version(
OptiDesignVar_VERSION, file_version
)
+ update_dict["WmagHmag"] = is_before_version(WmagRenaming_VERSION, file_version)
return update_dict
diff --git a/pyleecan/Functions/Plot/get_patch_color_from_label.py b/pyleecan/Functions/Plot/get_color_legend_from_surface.py
similarity index 51%
rename from pyleecan/Functions/Plot/get_patch_color_from_label.py
rename to pyleecan/Functions/Plot/get_color_legend_from_surface.py
index 638b316c0..3a4ac2c50 100644
--- a/pyleecan/Functions/Plot/get_patch_color_from_label.py
+++ b/pyleecan/Functions/Plot/get_color_legend_from_surface.py
@@ -9,9 +9,11 @@
LAM_LAB,
VENT_LAB,
WEDGE_LAB,
+ BAR_LAB,
)
from ...definitions import config_dict
+
if "WEDGE_COLOR" not in config_dict["PLOT"]["COLOR_DICT"]:
config_dict["PLOT"]["COLOR_DICT"]["WEDGE_COLOR"] = "y"
WEDGE_COLOR = config_dict["PLOT"]["COLOR_DICT"]["WEDGE_COLOR"]
@@ -24,38 +26,60 @@
ROTOR_COLOR = config_dict["PLOT"]["COLOR_DICT"]["ROTOR_COLOR"]
STATOR_COLOR = config_dict["PLOT"]["COLOR_DICT"]["STATOR_COLOR"]
MAGNET_COLOR = config_dict["PLOT"]["COLOR_DICT"]["MAGNET_COLOR"]
+PHASE_COLORS = config_dict["PLOT"]["COLOR_DICT"]["PHASE_COLORS"]
+BAR_COLOR = config_dict["PLOT"]["COLOR_DICT"]["BAR_COLOR"]
+
+PLUS_HATCH = "++"
+MINUS_HATCH = ".."
-def get_path_color_from_label(label, label_dict=None):
- """Return the color to use for a patch in plot machine
+def get_color_legend_from_surface(surf, is_lam_only=False):
+ """Return the color and legend to use for plot the surface
Parameters
----------
- label : str
- Label of the surface to color
- label_dict : dict
- To avoid decoding label twice
+ surf : Surface
+ Surfaces on which we want the color and legend
+ is_lam_only : bool
+ True to plot only the lamination (remove the Winding)
Returns
-------
color : str
Color to use on the patch
+ legend : str
+ Legend to display for the surface
"""
-
- if label_dict is None:
- label_dict = decode_label(label)
+ label_dict = decode_label(surf.label)
if LAM_LAB in label_dict["surf_type"] and STATOR_LAB in label_dict["lam_type"]:
- return STATOR_COLOR
+ return STATOR_COLOR, "Stator"
+
elif LAM_LAB in label_dict["surf_type"] and ROTOR_LAB in label_dict["lam_type"]:
- return ROTOR_COLOR
+ return ROTOR_COLOR, "Rotor"
+
+ elif VENT_LAB in label_dict["surf_type"]:
+ return VENT_COLOR, None
+
+ # Before will always be ploted
+ elif is_lam_only:
+ return None, None
+
+ # After will be ploted only if we do not want the lamination only.
+ elif HOLEV_LAB in label_dict["surf_type"]:
+ return VENT_COLOR, None
+
elif HOLEM_LAB in label_dict["surf_type"] or MAG_LAB in label_dict["surf_type"]:
- return MAGNET_COLOR
- elif VENT_LAB in label_dict["surf_type"] or HOLEV_LAB in label_dict["surf_type"]:
- return VENT_COLOR
+ return MAGNET_COLOR, "Magnet"
+
elif WEDGE_LAB in label_dict["surf_type"]:
- return WEDGE_COLOR
+ return WEDGE_COLOR, "Wedge"
+
elif KEY_LAB in label_dict["surf_type"]:
- return KEY_COLOR
+ return KEY_COLOR, "Key"
+
+ elif BAR_LAB in label_dict["surf_type"]:
+ return BAR_COLOR, f"{label_dict['lam_type']} Bar"
+
else:
- raise Exception("Unknown label for plot " + label)
+ raise Exception(f"Unknown label for plot {surf.label}")
diff --git a/pyleecan/Functions/init_fig.py b/pyleecan/Functions/init_fig.py
index 7ff903d04..11a403b92 100644
--- a/pyleecan/Functions/init_fig.py
+++ b/pyleecan/Functions/init_fig.py
@@ -2,7 +2,6 @@
from matplotlib.pyplot import subplots
import mpl_toolkits.mplot3d
-from numpy import array
def init_fig(fig=None, ax=None, shape="default", is_3d=False):
diff --git a/pyleecan/Functions/load_switch.py b/pyleecan/Functions/load_switch.py
index e0f5ab3ab..00dfe281f 100644
--- a/pyleecan/Functions/load_switch.py
+++ b/pyleecan/Functions/load_switch.py
@@ -23,6 +23,8 @@
"CondType21": CondType21,
"CondType22": CondType22,
"Conductor": Conductor,
+ "Convert": Convert,
+ "ConvertMC": ConvertMC,
"DXFImport": DXFImport,
"DataKeeper": DataKeeper,
"Drive": Drive,
@@ -191,6 +193,10 @@
"RefSegmentP1": RefSegmentP1,
"RefTriangle3": RefTriangle3,
"RefTriangle6": RefTriangle6,
+ "Rule": Rule,
+ "RuleComplex": RuleComplex,
+ "RuleEquation": RuleEquation,
+ "RuleSimple": RuleSimple,
"ScalarProduct": ScalarProduct,
"ScalarProductL2": ScalarProductL2,
"Section": Section,
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/PVentCirc.ui b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/PVentCirc.ui
index 60feaf6ba..22269a641 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/PVentCirc.ui
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/PVentCirc.ui
@@ -50,7 +50,7 @@
- :/images/images/MachineSetup/LamParam/VentilationCirc.png
+ :/images/images/MachineSetup/LamParam/VentilationCirc_empty_int_rotor.png
false
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/Ui_PVentCirc.py b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/Ui_PVentCirc.py
index 7741909dd..3fefaefdb 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/Ui_PVentCirc.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentCirc/Ui_PVentCirc.py
@@ -35,7 +35,9 @@ def setupUi(self, PVentCirc):
self.img_vent.setMinimumSize(QSize(410, 300))
self.img_vent.setMaximumSize(QSize(16777215, 16777215))
self.img_vent.setPixmap(
- QPixmap(u":/images/images/MachineSetup/LamParam/VentilationCirc.png")
+ QPixmap(
+ u":/images/images/MachineSetup/LamParam/VentilationCirc_empty_int_rotor.png"
+ )
)
self.img_vent.setScaledContents(False)
self.img_vent.setAlignment(Qt.AlignCenter)
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/PVentPolar.ui b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/PVentPolar.ui
index 397eeafbd..89e0ecc66 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/PVentPolar.ui
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/PVentPolar.ui
@@ -50,7 +50,7 @@
- :/images/images/MachineSetup/LamParam/VentilationPolar.png
+ :/images/images/MachineSetup/LamParam/VentilationPolar_empty_int_rotor.png
false
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/Ui_PVentPolar.py b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/Ui_PVentPolar.py
index 603096be5..4a7cfbabb 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/Ui_PVentPolar.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentPolar/Ui_PVentPolar.py
@@ -35,7 +35,9 @@ def setupUi(self, PVentPolar):
self.img_vent.setMinimumSize(QSize(410, 410))
self.img_vent.setMaximumSize(QSize(16777215, 16777215))
self.img_vent.setPixmap(
- QPixmap(u":/images/images/MachineSetup/LamParam/VentilationPolar.png")
+ QPixmap(
+ u":/images/images/MachineSetup/LamParam/VentilationPolar_empty_int_rotor.png"
+ )
)
self.img_vent.setScaledContents(False)
self.img_vent.setAlignment(Qt.AlignCenter)
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/PVentTrap.ui b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/PVentTrap.ui
index 94972d5a7..27980ae5c 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/PVentTrap.ui
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/PVentTrap.ui
@@ -50,7 +50,7 @@
- :/images/images/MachineSetup/LamParam/VentilationTrap.png
+ :/images/images/MachineSetup/LamParam/VentilationTrap_empty_int_rotor.png
false
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/Ui_PVentTrap.py b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/Ui_PVentTrap.py
index 5f572773a..61ebbc6d5 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/Ui_PVentTrap.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DAVDuct/PVentTrap/Ui_PVentTrap.py
@@ -35,7 +35,9 @@ def setupUi(self, PVentTrap):
self.img_vent.setMinimumSize(QSize(410, 300))
self.img_vent.setMaximumSize(QSize(16777215, 16777215))
self.img_vent.setPixmap(
- QPixmap(u":/images/images/MachineSetup/LamParam/VentilationTrap.png")
+ QPixmap(
+ u":/images/images/MachineSetup/LamParam/VentilationTrap_empty_int_rotor.png"
+ )
)
self.img_vent.setScaledContents(False)
self.img_vent.setAlignment(Qt.AlignCenter)
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/WNotch/WNotch.py b/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/WNotch/WNotch.py
index 51f07ac5e..e39c66fc1 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/WNotch/WNotch.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/DNotchTab/WNotch/WNotch.py
@@ -228,25 +228,4 @@ def check(self):
Error message (return None if no error)
"""
- if not isinstance(self.w_notch, PWSlotUD):
- # Check that the user did not define a notch a dimension equal to 0
- if self.w_notch.lf_W0.value() is None:
- return "You must set W0 !"
- elif self.w_notch.lf_W0.value() <= 0:
- return "W0 must be higher than 0"
- # In the Slot19, the lenght H0 doesn't exist (Hmag instead)
- if not isinstance(self.w_notch, PMSlot19):
- if self.w_notch.lf_H0.value() is None:
- return "You must set H0 !"
- if (
- self.w_notch.lf_H0.value() <= 0
- and not self.w_notch.notch_obj.has_key()
- ):
- return "H0 must be higher than 0 or a key must be added"
- if isinstance(self.w_notch, PMSlot19):
- if self.w_notch.lf_Hmag.value() is None:
- return "You must set H0 !"
- if self.w_notch.lf_Hmag.value() <= 0:
- return "H0 must be higher than 0"
-
return self.w_notch.check(self.lam_notch)
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Gen_PMSlot10.py b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Gen_PMSlot10.py
index 5d855e254..17fb758a4 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Gen_PMSlot10.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Gen_PMSlot10.py
@@ -20,16 +20,16 @@ def setupUi(self, PMSlot10):
self.lf_W0.setWhatsThis(txt)
self.lf_W0.setToolTip(txt)
- # Setup of in_Wmag
+ # Setup of in_W1
txt = self.tr(u"""Magnet width""")
- self.in_Wmag.setWhatsThis(txt)
- self.in_Wmag.setToolTip(txt)
+ self.in_W1.setWhatsThis(txt)
+ self.in_W1.setToolTip(txt)
- # Setup of lf_Wmag
- self.lf_Wmag.validator().setBottom(0)
+ # Setup of lf_W1
+ self.lf_W1.validator().setBottom(0)
txt = self.tr(u"""Magnet width""")
- self.lf_Wmag.setWhatsThis(txt)
- self.lf_Wmag.setToolTip(txt)
+ self.lf_W1.setWhatsThis(txt)
+ self.lf_W1.setToolTip(txt)
# Setup of in_H0
txt = self.tr(u"""Slot isthmus height.""")
@@ -42,13 +42,13 @@ def setupUi(self, PMSlot10):
self.lf_H0.setWhatsThis(txt)
self.lf_H0.setToolTip(txt)
- # Setup of in_Hmag
+ # Setup of in_H1
txt = self.tr(u"""Magnet Height""")
- self.in_Hmag.setWhatsThis(txt)
- self.in_Hmag.setToolTip(txt)
+ self.in_H1.setWhatsThis(txt)
+ self.in_H1.setToolTip(txt)
- # Setup of lf_Hmag
- self.lf_Hmag.validator().setBottom(0)
+ # Setup of lf_H1
+ self.lf_H1.validator().setBottom(0)
txt = self.tr(u"""Magnet Height""")
- self.lf_Hmag.setWhatsThis(txt)
- self.lf_Hmag.setToolTip(txt)
+ self.lf_H1.setWhatsThis(txt)
+ self.lf_H1.setToolTip(txt)
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.py b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.py
index f4dff3c5e..3ff4806a2 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.py
@@ -53,98 +53,48 @@ def __init__(self, lamination=None, notch_obj=None, material_dict=None):
# Set FloatEdit unit
self.lf_W0.unit = "m"
self.lf_H0.unit = "m"
+ self.lf_W1.unit = "m"
+ self.lf_H1.unit = "m"
# Set unit name (m ou mm)
wid_list = [
self.unit_W0,
self.unit_H0,
+ self.unit_W1,
+ self.unit_H1,
]
for wid in wid_list:
wid.setText("[" + gui_option.unit.get_m_name() + "]")
- self.g_key.hide()
+ # Fill the fields with the machine values (if they're filled)
+ self.lf_W0.setValue(self.slot.W0)
+ self.lf_H0.setValue(self.slot.H0)
+ self.lf_W1.setValue(self.slot.W1)
+ self.lf_H1.setValue(self.slot.H1)
# Notch setup
if self.is_notch:
- # Hide magnet related widget
- wid_list = [self.in_Wmag, self.lf_Wmag, self.unit_Wmag]
- wid_list += [self.in_Hmag, self.lf_Hmag, self.unit_Hmag]
- wid_list += [self.txt_constraint] # Constraint Wmag < W0
- for wid in wid_list:
- wid.hide()
-
- # Set values for check
- self.slot.Hmag = 0
- self.slot.Wmag = 0
-
- # Selecting the right image
- if not self.lamination.is_internal:
- # Use schematics on the external without magnet
- self.img_slot.setPixmap(
- QPixmap(pixmap_dict["SlotM10_empty_ext_stator"])
- )
-
- # H/Wkey is define for notch in GUI but change the value of H/Wmag
- self.lf_Wkey.unit = "m"
- self.lf_Hkey.unit = "m"
-
- # Set unit name (m ou mm)
- wid_list = [
- self.unit_Wkey,
- self.unit_Hkey,
- ]
- for wid in wid_list:
- wid.setText("[" + gui_option.unit.get_m_name() + "]")
-
- # Fill the fields with the machine values (if they're filled)
- self.lf_Wkey.setValue(self.slot.Wmag)
- self.lf_Hkey.setValue(self.slot.Hmag)
-
- # Connect the signal
- self.lf_Wkey.editingFinished.connect(self.set_Wkey)
- self.lf_Hkey.editingFinished.connect(self.set_Hkey)
-
- self.g_key.toggled.connect(self.set_key)
-
- # Key setup
- self.g_key.show()
+ self.w_mag.hide() # Hide magnet widgets
+ self.g_key.show() # Setup key widgets
self.g_key.setChecked(self.notch_obj.key_mat is not None)
+ if self.notch_obj.key_mat is None:
+ self.slot.W1 = 0 # Clear for check
+ self.slot.H1 = 0 # Clear for check
+ self.lf_W1.setValue(None)
+ self.lf_H1.setValue(None)
+
# Material setup
self.w_key_mat.setText("Key Material")
- if self.notch_obj.key_mat is None:
- self.notch_obj.key_mat = None
- else:
- self.w_key_mat.def_mat = "Steel1"
+ self.w_key_mat.def_mat = "Steel1"
self.set_key()
- # Hide magnet widgets
- self.w_mag.hide()
else: # magnet case
# Setup the widgets according to current values
self.w_mag.update(lamination, self.material_dict)
- self.lf_Wmag.unit = "m"
- self.lf_Hmag.unit = "m"
- # Set unit name (m ou mm)
- wid_list = [
- self.unit_Wmag,
- self.unit_Hmag,
- ]
- for wid in wid_list:
- wid.setText("[" + gui_option.unit.get_m_name() + "]")
+
# Use schematics on the inner without magnet
self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_mag_int_rotor"]))
-
- # Fill the fields with the machine values (if they're filled)
- self.lf_Wmag.setValue(self.slot.Wmag)
- self.lf_Hmag.setValue(self.slot.Hmag)
-
- # Connect the signal
- self.lf_Wmag.editingFinished.connect(self.set_Wmag)
- self.lf_Hmag.editingFinished.connect(self.set_Hmag)
-
- # Fill the fields with the machine values (if they're filled)
- self.lf_W0.setValue(self.slot.W0)
- self.lf_H0.setValue(self.slot.H0)
+ self.g_key.hide()
# Display the main output of the slot (surface, height...)
self.w_out.comp_output()
@@ -152,22 +102,32 @@ def __init__(self, lamination=None, notch_obj=None, material_dict=None):
# Connect the signal
self.lf_W0.editingFinished.connect(self.set_W0)
self.lf_H0.editingFinished.connect(self.set_H0)
+ self.lf_W1.editingFinished.connect(self.set_W1)
+ self.lf_H1.editingFinished.connect(self.set_H1)
+ self.g_key.toggled.connect(self.set_key)
self.w_mag.saveNeeded.connect(self.emit_save)
def set_key(self):
"""Setup the slot key according to the GUI"""
- widget_list = [self.lf_Wkey, self.unit_Wkey, self.in_Wkey]
- widget_list += [self.lf_Hkey, self.unit_Hkey, self.in_Hkey]
+ widget_list = [self.lf_W1, self.unit_W1, self.in_W1]
+ widget_list += [self.lf_H1, self.unit_H1, self.in_H1]
widget_list += [self.w_key_mat]
if self.g_key.isChecked():
self.w_key_mat.update(self.notch_obj, "key_mat", self.material_dict)
- self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_key_ext_stator"]))
+ if self.lamination.is_internal:
+ self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_key_int_rotor"]))
+ else:
+ self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_key_ext_stator"]))
is_enabled = True
-
else:
self.notch_obj.key_mat = None
- self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_empty_ext_stator"]))
+ if self.lamination.is_internal:
+ self.img_slot.setPixmap(QPixmap(pixmap_dict["SlotM10_empty_int_rotor"]))
+ else:
+ self.img_slot.setPixmap(
+ QPixmap(pixmap_dict["SlotM10_empty_ext_stator"])
+ )
is_enabled = False
for widget in widget_list:
@@ -189,15 +149,15 @@ def set_W0(self):
# Notify the machine GUI that the machine has changed
self.saveNeeded.emit()
- def set_Wmag(self):
- """Signal to update the value of Wmag according to the line edit
+ def set_W1(self):
+ """Signal to update the value of W1 according to the line edit
Parameters
----------
self : PMSlot10
A PMSlot10 object
"""
- self.slot.Wmag = self.lf_Wmag.value()
+ self.slot.W1 = self.lf_W1.value()
self.w_out.comp_output()
# Notify the machine GUI that the machine has changed
self.saveNeeded.emit()
@@ -215,15 +175,15 @@ def set_H0(self):
# Notify the machine GUI that the machine has changed
self.saveNeeded.emit()
- def set_Hmag(self):
- """Signal to update the value of Hmag according to the line edit
+ def set_H1(self):
+ """Signal to update the value of H1 according to the line edit
Parameters
----------
self : PMSlot10
A PMSlot10 object
"""
- self.slot.Hmag = self.lf_Hmag.value()
+ self.slot.H1 = self.lf_H1.value()
self.w_out.comp_output()
# Notify the machine GUI that the machine has changed
self.saveNeeded.emit()
@@ -232,32 +192,6 @@ def emit_save(self):
"""Send a saveNeeded signal to the DMachineSetup"""
self.saveNeeded.emit()
- def set_Wkey(self):
- """Signal to update the value of Wkey according to the line edit
-
- Parameters
- ----------
- self : PMSlot10
- A PMSlot10 object
- """
- self.slot.Wmag = self.lf_Wkey.value()
- self.w_out.comp_output()
- # Notify the machine GUI that the machine has changed
- self.saveNeeded.emit()
-
- def set_Hkey(self):
- """Signal to update the value of Hkey according to the line edit
-
- Parameters
- ----------
- self : PMSlot10
- A PMSlot10 object
- """
- self.slot.Hmag = self.lf_Hkey.value()
- self.w_out.comp_output()
- # Notify the machine GUI that the machine has changed
- self.saveNeeded.emit()
-
@staticmethod
def check(lam):
"""Check that the current machine have all the needed field set
@@ -276,12 +210,12 @@ def check(lam):
# Check that everything is set
if lam.slot.W0 is None:
return "You must set W0 !"
- elif lam.slot.Wmag is None:
- return "You must set Wmag !"
elif lam.slot.H0 is None:
return "You must set H0 !"
- elif lam.slot.Hmag is None:
- return "You must set Hmag !"
+ elif lam.slot.W1 is None:
+ return "You must set W1 !"
+ elif lam.slot.H1 is None:
+ return "You must set H1 !"
# Constraints
try:
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.ui b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.ui
index 41e696a7d..0ab606ca7 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.ui
+++ b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/PMSlot10.ui
@@ -77,9 +77,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;">
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.15094pt; font-weight:400; font-style:normal;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; text-decoration: underline;">Constraints :</span></p>
-<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Wmag <= W0</span></p></body></html>
+<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">W1 <= W0</span></p></body></html>
Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
@@ -111,24 +111,55 @@ p, li { white-space: pre-wrap; }
0
0
268
- 446
+ 450
-
+ -
+
+
+ Key
+
+
+ true
+
+
+ false
+
+
+
-
+
+
+
+
+
-
-
-
-
+
-
+
- Wmag
+ H1
- -
-
+
-
+
+
+ W1
+
+
+
+ -
+
+
+ -
+
+
+ -
+
[m]
@@ -149,103 +180,34 @@ p, li { white-space: pre-wrap; }
-
-
+
[m]
- -
+
-
+
+
+ -
H0
- -
-
-
- [m]
-
-
-
- -
-
+
-
+
- -
-
+
-
+
- Hmag
+ [m]
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- Key
-
-
- true
-
-
- false
-
-
-
-
-
-
- -
-
-
-
-
-
- Hkey
-
-
-
- -
-
-
- -
-
-
- [m]
-
-
-
- -
-
-
- Wkey
-
-
-
- -
-
-
- [m]
-
-
-
- -
-
-
-
-
-
-
-
-
@@ -293,11 +255,13 @@ p, li { white-space: pre-wrap; }
+ g_key
lf_W0
- lf_Wmag
lf_H0
- lf_Hmag
+ lf_W1
+ lf_H1
txt_constraint
+ scrollArea
diff --git a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Ui_PMSlot10.py b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Ui_PMSlot10.py
index d9ba1c0e5..999d0698b 100644
--- a/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Ui_PMSlot10.py
+++ b/pyleecan/GUI/Dialog/DMachineSetup/SMSlot/PMSlot10/Ui_PMSlot10.py
@@ -70,7 +70,7 @@ def setupUi(self, PMSlot10):
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
- self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 268, 446))
+ self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 268, 450))
self.verticalLayout_3 = QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_3.setObjectName(u"verticalLayout_3")
self.w_mag = WWSlotMag(self.scrollAreaWidgetContents)
@@ -78,116 +78,82 @@ def setupUi(self, PMSlot10):
self.verticalLayout_3.addWidget(self.w_mag)
- self.gridLayout = QGridLayout()
- self.gridLayout.setObjectName(u"gridLayout")
- self.in_Wmag = QLabel(self.scrollAreaWidgetContents)
- self.in_Wmag.setObjectName(u"in_Wmag")
-
- self.gridLayout.addWidget(self.in_Wmag, 1, 0, 1, 1)
-
- self.unit_Wmag = QLabel(self.scrollAreaWidgetContents)
- self.unit_Wmag.setObjectName(u"unit_Wmag")
-
- self.gridLayout.addWidget(self.unit_Wmag, 1, 2, 1, 1)
-
- self.in_W0 = QLabel(self.scrollAreaWidgetContents)
- self.in_W0.setObjectName(u"in_W0")
-
- self.gridLayout.addWidget(self.in_W0, 0, 0, 1, 1)
-
- self.unit_W0 = QLabel(self.scrollAreaWidgetContents)
- self.unit_W0.setObjectName(u"unit_W0")
-
- self.gridLayout.addWidget(self.unit_W0, 0, 2, 1, 1)
+ self.g_key = QGroupBox(self.scrollAreaWidgetContents)
+ self.g_key.setObjectName(u"g_key")
+ self.g_key.setCheckable(True)
+ self.g_key.setChecked(False)
+ self.gridLayout_2 = QGridLayout(self.g_key)
+ self.gridLayout_2.setObjectName(u"gridLayout_2")
+ self.w_key_mat = WMatSelectV(self.g_key)
+ self.w_key_mat.setObjectName(u"w_key_mat")
- self.unit_H0 = QLabel(self.scrollAreaWidgetContents)
- self.unit_H0.setObjectName(u"unit_H0")
+ self.gridLayout_2.addWidget(self.w_key_mat, 9, 0, 1, 2)
- self.gridLayout.addWidget(self.unit_H0, 2, 2, 1, 1)
+ self.verticalLayout_3.addWidget(self.g_key)
- self.in_H0 = QLabel(self.scrollAreaWidgetContents)
- self.in_H0.setObjectName(u"in_H0")
+ self.gridLayout = QGridLayout()
+ self.gridLayout.setObjectName(u"gridLayout")
+ self.in_H1 = QLabel(self.scrollAreaWidgetContents)
+ self.in_H1.setObjectName(u"in_H1")
- self.gridLayout.addWidget(self.in_H0, 2, 0, 1, 1)
+ self.gridLayout.addWidget(self.in_H1, 4, 0, 1, 1)
- self.unit_Hmag = QLabel(self.scrollAreaWidgetContents)
- self.unit_Hmag.setObjectName(u"unit_Hmag")
+ self.in_W1 = QLabel(self.scrollAreaWidgetContents)
+ self.in_W1.setObjectName(u"in_W1")
- self.gridLayout.addWidget(self.unit_Hmag, 3, 2, 1, 1)
+ self.gridLayout.addWidget(self.in_W1, 2, 0, 1, 1)
self.lf_W0 = FloatEdit(self.scrollAreaWidgetContents)
self.lf_W0.setObjectName(u"lf_W0")
self.gridLayout.addWidget(self.lf_W0, 0, 1, 1, 1)
- self.in_Hmag = QLabel(self.scrollAreaWidgetContents)
- self.in_Hmag.setObjectName(u"in_Hmag")
-
- self.gridLayout.addWidget(self.in_Hmag, 3, 0, 1, 1)
+ self.lf_W1 = FloatEdit(self.scrollAreaWidgetContents)
+ self.lf_W1.setObjectName(u"lf_W1")
- self.lf_H0 = FloatEdit(self.scrollAreaWidgetContents)
- self.lf_H0.setObjectName(u"lf_H0")
+ self.gridLayout.addWidget(self.lf_W1, 2, 1, 1, 1)
- self.gridLayout.addWidget(self.lf_H0, 2, 1, 1, 1)
+ self.unit_H1 = QLabel(self.scrollAreaWidgetContents)
+ self.unit_H1.setObjectName(u"unit_H1")
- self.lf_Hmag = FloatEdit(self.scrollAreaWidgetContents)
- self.lf_Hmag.setObjectName(u"lf_Hmag")
+ self.gridLayout.addWidget(self.unit_H1, 4, 2, 1, 1)
- self.gridLayout.addWidget(self.lf_Hmag, 3, 1, 1, 1)
-
- self.lf_Wmag = FloatEdit(self.scrollAreaWidgetContents)
- self.lf_Wmag.setObjectName(u"lf_Wmag")
-
- self.gridLayout.addWidget(self.lf_Wmag, 1, 1, 1, 1)
-
- self.verticalLayout_3.addLayout(self.gridLayout)
-
- self.g_key = QGroupBox(self.scrollAreaWidgetContents)
- self.g_key.setObjectName(u"g_key")
- self.g_key.setCheckable(True)
- self.g_key.setChecked(False)
- self.gridLayout_2 = QGridLayout(self.g_key)
- self.gridLayout_2.setObjectName(u"gridLayout_2")
- self.w_key_mat = WMatSelectV(self.g_key)
- self.w_key_mat.setObjectName(u"w_key_mat")
-
- self.gridLayout_2.addWidget(self.w_key_mat, 10, 0, 1, 2)
+ self.in_W0 = QLabel(self.scrollAreaWidgetContents)
+ self.in_W0.setObjectName(u"in_W0")
- self.gridLayout_3 = QGridLayout()
- self.gridLayout_3.setObjectName(u"gridLayout_3")
- self.in_Hkey = QLabel(self.g_key)
- self.in_Hkey.setObjectName(u"in_Hkey")
+ self.gridLayout.addWidget(self.in_W0, 0, 0, 1, 1)
- self.gridLayout_3.addWidget(self.in_Hkey, 1, 0, 1, 1)
+ self.unit_W0 = QLabel(self.scrollAreaWidgetContents)
+ self.unit_W0.setObjectName(u"unit_W0")
- self.lf_Hkey = FloatEdit(self.g_key)
- self.lf_Hkey.setObjectName(u"lf_Hkey")
+ self.gridLayout.addWidget(self.unit_W0, 0, 2, 1, 1)
- self.gridLayout_3.addWidget(self.lf_Hkey, 1, 2, 1, 1)
+ self.unit_W1 = QLabel(self.scrollAreaWidgetContents)
+ self.unit_W1.setObjectName(u"unit_W1")
- self.unit_Hkey = QLabel(self.g_key)
- self.unit_Hkey.setObjectName(u"unit_Hkey")
+ self.gridLayout.addWidget(self.unit_W1, 2, 2, 1, 1)
- self.gridLayout_3.addWidget(self.unit_Hkey, 1, 3, 1, 1)
+ self.lf_H1 = FloatEdit(self.scrollAreaWidgetContents)
+ self.lf_H1.setObjectName(u"lf_H1")
- self.in_Wkey = QLabel(self.g_key)
- self.in_Wkey.setObjectName(u"in_Wkey")
+ self.gridLayout.addWidget(self.lf_H1, 4, 1, 1, 1)
- self.gridLayout_3.addWidget(self.in_Wkey, 0, 0, 1, 1)
+ self.in_H0 = QLabel(self.scrollAreaWidgetContents)
+ self.in_H0.setObjectName(u"in_H0")
- self.unit_Wkey = QLabel(self.g_key)
- self.unit_Wkey.setObjectName(u"unit_Wkey")
+ self.gridLayout.addWidget(self.in_H0, 1, 0, 1, 1)
- self.gridLayout_3.addWidget(self.unit_Wkey, 0, 3, 1, 1)
+ self.lf_H0 = FloatEdit(self.scrollAreaWidgetContents)
+ self.lf_H0.setObjectName(u"lf_H0")
- self.lf_Wkey = FloatEdit(self.g_key)
- self.lf_Wkey.setObjectName(u"lf_Wkey")
+ self.gridLayout.addWidget(self.lf_H0, 1, 1, 1, 1)
- self.gridLayout_3.addWidget(self.lf_Wkey, 0, 2, 1, 1)
+ self.unit_H0 = QLabel(self.scrollAreaWidgetContents)
+ self.unit_H0.setObjectName(u"unit_H0")
- self.gridLayout_2.addLayout(self.gridLayout_3, 0, 0, 1, 1)
+ self.gridLayout.addWidget(self.unit_H0, 1, 2, 1, 1)
- self.verticalLayout_3.addWidget(self.g_key)
+ self.verticalLayout_3.addLayout(self.gridLayout)
self.verticalSpacer = QSpacerItem(
20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding
@@ -204,10 +170,12 @@ def setupUi(self, PMSlot10):
self.horizontalLayout.addWidget(self.scrollArea)
- QWidget.setTabOrder(self.lf_W0, self.lf_Wmag)
- QWidget.setTabOrder(self.lf_Wmag, self.lf_H0)
- QWidget.setTabOrder(self.lf_H0, self.lf_Hmag)
- QWidget.setTabOrder(self.lf_Hmag, self.txt_constraint)
+ QWidget.setTabOrder(self.g_key, self.lf_W0)
+ QWidget.setTabOrder(self.lf_W0, self.lf_H0)
+ QWidget.setTabOrder(self.lf_H0, self.lf_W1)
+ QWidget.setTabOrder(self.lf_W1, self.lf_H1)
+ QWidget.setTabOrder(self.lf_H1, self.txt_constraint)
+ QWidget.setTabOrder(self.txt_constraint, self.scrollArea)
self.retranslateUi(PMSlot10)
@@ -224,24 +192,20 @@ def retranslateUi(self, PMSlot10):
u'\n'
'\n"
+ "\n"
'
Constraints :
\n'
- 'Wmag <= W0
',
+ 'W1 <= W0