From 1d0259c520b9c53a0ddcd020b0a99ecd562003eb Mon Sep 17 00:00:00 2001 From: EmileDvs <58598539+EmileDvs@users.noreply.github.com> Date: Fri, 3 Dec 2021 14:19:48 +0100 Subject: [PATCH] [CC] various cleaning + scidatatool version update --- pyleecan/Classes/Class_Dict.json | 10 +++++----- pyleecan/Classes/VarLoad.py | 8 ++++---- pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv | 8 ++++---- pyleecan/Methods/Output/OutMag/store.py | 11 ++--------- .../Methods/Simulation/EEC_PMSM/comp_parameters.py | 5 +++++ requirements.txt | 2 +- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/pyleecan/Classes/Class_Dict.json b/pyleecan/Classes/Class_Dict.json index da8e7496f..ae346ada7 100644 --- a/pyleecan/Classes/Class_Dict.json +++ b/pyleecan/Classes/Class_Dict.json @@ -13611,7 +13611,7 @@ "path": "pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv", "properties": [ { - "desc": "Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) ", + "desc": "Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) or (N0,U0,s,T,P)", "max": "", "min": "", "name": "OP_matrix", @@ -13620,8 +13620,8 @@ "value": null }, { - "desc": "Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P) ", - "max": "1", + "desc": "Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P), 2:(N0,U0,s,T,P)", + "max": "2", "min": "0", "name": "type_OP_matrix", "type": "int", @@ -13635,7 +13635,7 @@ "name": "is_torque", "type": "bool", "unit": "-", - "value": false + "value": 0 }, { "desc": "True if the Power is defined in OP_matrix", @@ -13644,7 +13644,7 @@ "name": "is_power", "type": "bool", "unit": "", - "value": false + "value": 0 } ] }, diff --git a/pyleecan/Classes/VarLoad.py b/pyleecan/Classes/VarLoad.py index ff3bfec4a..4d0cda05c 100644 --- a/pyleecan/Classes/VarLoad.py +++ b/pyleecan/Classes/VarLoad.py @@ -281,7 +281,7 @@ def _set_OP_matrix(self, value): OP_matrix = property( fget=_get_OP_matrix, fset=_set_OP_matrix, - doc=u"""Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) + doc=u"""Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) or (N0,U0,s,T,P) :Type: ndarray """, @@ -293,17 +293,17 @@ def _get_type_OP_matrix(self): def _set_type_OP_matrix(self, value): """setter of type_OP_matrix""" - check_var("type_OP_matrix", value, "int", Vmin=0, Vmax=1) + check_var("type_OP_matrix", value, "int", Vmin=0, Vmax=2) self._type_OP_matrix = value type_OP_matrix = property( fget=_get_type_OP_matrix, fset=_set_type_OP_matrix, - doc=u"""Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P) + doc=u"""Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P), 2:(N0,U0,s,T,P) :Type: int :min: 0 - :max: 1 + :max: 2 """, ) diff --git a/pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv b/pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv index 8c2b1bac6..ed82345e8 100644 --- a/pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv +++ b/pyleecan/Generator/ClassesRef/Simulation/VarLoad.csv @@ -1,5 +1,5 @@ Variable name,Unit,Description (EN),Size,Type,Default value,Minimum value,Maximum value,,Package,Inherit,Methods,Constant Name,Constant Value,Class description -OP_matrix,-,"Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) ","(Nsimu, 5)",ndarray,None,,,,Simulation,VarSimu,get_ref_simu_index,VERSION,1,Abstract class to generate multi-simulation by changing the operating point -type_OP_matrix,-,"Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P) ",,int,0,0,1,,,,,NAME,"""Variable Load""", -is_torque,-,True if the Torque is defined in OP_matrix,,bool,False,,,,,,,,, -is_power,,True if the Power is defined in OP_matrix,,bool,False,,,,,,,,, +OP_matrix,-,"Operating point matrix (N0,I0,Phi0,T,P) or (N0,Id,Iq,T,P) or (N0,U0,s,T,P)","(Nsimu, 5)",ndarray,None,,,,Simulation,VarSimu,get_ref_simu_index,VERSION,1,Abstract class to generate multi-simulation by changing the operating point +type_OP_matrix,-,"Select which kind of OP_matrix is used 0: (N0,I0,Phi0,T,P), 1:(N0,Id,Iq,T,P), 2:(N0,U0,s,T,P)",,int,0,0,2,,,,,NAME,"""Variable Load""", +is_torque,-,True if the Torque is defined in OP_matrix,,bool,0,,,,,,,,, +is_power,,True if the Power is defined in OP_matrix,,bool,0,,,,,,,,, diff --git a/pyleecan/Methods/Output/OutMag/store.py b/pyleecan/Methods/Output/OutMag/store.py index 4d79ac6a0..29b61fd8a 100644 --- a/pyleecan/Methods/Output/OutMag/store.py +++ b/pyleecan/Methods/Output/OutMag/store.py @@ -1,8 +1,7 @@ from numpy import max as np_max, min as np_min, mean as np_mean -from SciDataTool import DataTime, VectorField, Data1D +from SciDataTool import DataTime, VectorField -from ....Functions.Winding.gen_phase_list import gen_name from ....Functions.labels import STATOR_LAB @@ -103,14 +102,8 @@ def store(self, out_dict, axes_dict): for key, phi_wind in out_dict["Phi_wind"].items(): # Store stator winding flux lam = machine.get_lam_by_label(key) - qs = lam.winding.qs - Phase = Data1D( - name="phase", - unit="", - values=gen_name(qs), - is_components=True, - ) + Phase = self.parent.elec.axes_dict["phase_" + key] prefix = "Stator" if lam.is_stator else "Rotor" # Store winding flux linkage per phase and per slice (in Weber per meter) diff --git a/pyleecan/Methods/Simulation/EEC_PMSM/comp_parameters.py b/pyleecan/Methods/Simulation/EEC_PMSM/comp_parameters.py index 47ceb6c2b..de1e80f59 100644 --- a/pyleecan/Methods/Simulation/EEC_PMSM/comp_parameters.py +++ b/pyleecan/Methods/Simulation/EEC_PMSM/comp_parameters.py @@ -6,6 +6,7 @@ def comp_parameters( ): """Compute the parameters dict for the equivalent electrical circuit: resistance, inductance and back electromotive force + Parameters ---------- self : EEC_PMSM @@ -18,6 +19,10 @@ def comp_parameters( Average stator temperature Trot : float Average rotor temperature + Id_array : ndarray + Array of Id currents for vectorized calculation + Iq_array : ndarray + Array of Iq currents for vectorized calculation """ if self.parameters is None: diff --git a/requirements.txt b/requirements.txt index 6979f726e..fe832e070 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ pytest-qt>=3.3.0 pyuff>=1.25 pyvista>=0.25.3 quadpy -SciDataTool>=1.4.18 +SciDataTool>=1.4.23 scipy>=1.4.1 setuptools swat_em>=0.6.3