Eomys / pyleecan

Electrical engineering open-source software providing a user-friendly, unified, flexible simulation framework for the multiphysic design and optimization of electrical machines and drives
https://www.pyleecan.org
Apache License 2.0
152 stars 127 forks source link

[NF] Defining the EEC for the electrical module for squirrel cage induction motor #165

Closed MVreemann closed 3 years ago

MVreemann commented 3 years ago

I have been trying to get pyleecan to simulate a regular squirrel cage induction motor (SCIM) but i cant get it to work. I will attach my code to this post as well as the motor i defined using the GUI and a material .json file for Aluminium i made. This is just a fairly standard SCIM which i am trying to analyze for a project i am working on.

My code is basically a copy of the code found under tutorials on the main website. I know there is a key difference between both motors because there my motor doesn't have any permanent magnets in the rotor. But i reckoned i should at least get some form of output. Since there still is an input for the rotor current (albeit a total guess).

However i do not understand the error i got:

  File "......\pyleecan-master\scripttest.py", line 51, in <module>
    out = simu.run()

  File "......\pyleecan-master\pyleecan\Methods\Simulation\Simulation\run.py", line 43, in run
    self.run_single()

  File "......\pyleecan-master\pyleecan\Methods\Simulation\Simu1\run_single.py", line 19, in run_single
    output.geo = self.machine.comp_output_geo()

  File "......\pyleecan-master\pyleecan\Methods\Machine\Machine\comp_output_geo.py", line 28, in comp_output_geo
    output.rotor = self.rotor.comp_output_geo()

  File "......\pyleecan-master\pyleecan\Methods\Machine\LamSlotWind\comp_output_geo.py", line 21, in comp_output_geo
    output = Lamination.comp_output_geo(self)

  File "......\pyleecan-master\pyleecan\Methods\Machine\Lamination\comp_output_geo.py", line 22, in comp_output_geo
    output.name_phase = self.get_name_phase()

  File "......\pyleecan-master\pyleecan\Methods\Machine\LamSlotWind\get_name_phase.py", line 22, in get_name_phase
    return gen_name(self.winding.qs)

  File "......\pyleecan-master\pyleecan\Functions\Winding\gen_phase_list.py", line 75, in gen_name
    for i in range(N):

TypeError: 'NoneType' object cannot be interpreted as an integer

What i get from this is that the name of the phase can not be determined because there is no element to name? I have to admit my python skills have deteriorated over the last few years and weren't all that good to begin with. So the answer might be really simple, but i just can't seem to figure it out.

Does anyone understand the problem?

Files.zip

SebGue commented 3 years ago

Just to let you know. I'm nearly done with the first 'release' of eec_SCIM. Periodicity seems to work and the results of my example machine fit quite well. Now I only have to add some test and enable some input parameters.

BonneelP commented 3 years ago

Hello ,

I know the _comp_point_coordinate method is not mandatory, but i do feel like it makes the code slightly more readable

I totally agree, sorry if it seems otherwise ;) When I said it is not mandatory, it was to justify why I took the initiative to change the output for the slot I'm working on.

Why is making a dictionary more convenient (just asking because I honestly have no clue)?

This is a personal preference. I prefer the second line to the first one, it is more standard and I don't have to count if I just want to access Z4, i go to point_dict["Z4"] :

[Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1] = self._comp_point_coordinate()
point_dict = self._comp_point_coordinate()

For the code I send you, it is related to another slot, so it won't work for your slot. It is a test method so it is not meant to be used in check. It is a convenient way of making sure that the slot that you have define work and will always work what ever changes happened in the future of the project. We have a dedicated tutorial at https://pyleecan.org/tests_tutorials/test.contribution.Pyleecan.html

Best regards, Pierre

MVreemann commented 3 years ago

Hey Pierre,

Ooh i totally read the code wrong, but i'll make a test class for my hole somewhere next week, probably tuesday, when i have time. Should i also make a second version which is a slot? In case using a hole is not yet properly implementable

BonneelP commented 3 years ago

For now, for a SCIM machine you must have a LamSlotWind object, so yes a slot version will help you. But this constraint is arbitrary and we should be able to remove it without too much work. I will try to take some time to suggest how next week. So it depend when you want your simulation to run but at the end the Hole should be all you need.

SebGue commented 3 years ago

Hello to you,,

as you may noticed, I PRed the EEC for SCIM with #270. For now the EEC_SCIM class doesn't have a dedicated input object but some properties to set the calculation of the EEC parameter. This is mainly current 'I' that is used to magnetize the machine (model) to calculate the inductances. As mentioned before the main inductance is estimated to be the fluxlinkage that is induced in the 'other' laminations winding divided by the magnetizing current 'I'. The stray inductance is then the difference of fluxlinkage in the 2 windings fluxlinkage divided by the current. For now this excludes skew effects on the inductance but also end winding stray. Further the fluxlinkage is calculated as the mean value. As a later improvement there should at least be the option to calculate the RMS value of the fluxlinkage to also include harmonics stray (don't know if this is the right term for it in english). The other EEC parameter are for controling the underlaying MagFEMM simulation, e.g. the rotor rotation and number of steps. The actual EEC solver does utilize the electrical input. With the estimated or directly input EEC parameters the system is solved for the current so input voltage has to be set. If someone has some time to spend, one could rearrange the equations to also solve for the voltages.

There are also some general changes. With the PR there is now a 'Phi_wind' property that is a list to store the winding fluxlinkage. The list index coresponds to the lamination index of get_lam_list. This also change the way 'Phi_wind_stator' is set, i.e. 'Phi_wind_stator' is set when 'Phi_wind' is set regardless if it is in out_dict. This may not be desired and I can change this back.

Further the PR introduce the Machine method get_lam_index to get the lamination index by label.

I hope, I haven't forgot anything important here. :-) Comments are really welcome.

BR Sebastian

SebGue commented 3 years ago

Hello @MVreemann, hello @BonneelP,

with the merge of #270, I think we should close this issue for now, since EEC is working for SCIM now. Further improvements and bugs would be in their own issues then. What do you think?

Best regards, Sebastian

BonneelP commented 3 years ago

Fine for me ;)

MVreemann commented 3 years ago

Yes, that's fine ofcourse!

MVreemann commented 3 years ago

Hey @SebGue,

Could you perhaps sent me a file where you use the EEC_SCIM class? I can't figure out how it works... apparently i am not too good at reading code. But if you could supply a simple piece of code as an example i can probably alter it to do what i want it to do.

Thanks in advance.

All the best,

Menno

SebGue commented 3 years ago

Hello Menno, you can have a look at Test\Validation\Simulation\test_EEC_FEMM_SCIM.py If you need further help, let me know. BR Sebastian