Skip to content

Electric Machines #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open

Electric Machines #84

wants to merge 37 commits into from

Conversation

askprash
Copy link
Member

@askprash askprash commented Sep 30, 2024

This PR adds models for electric machines, including motors, generators, inverters and cables. In general, sizing and off-design operation functions are created for each of these components.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 95.02262% with 11 lines in your changes missing coverage. Please review.

Project coverage is 80.66%. Comparing base (9908fe2) to head (876e8ff).

Files with missing lines Patch % Lines
src/propsys/PMSM.jl 95.62% 7 Missing ⚠️
src/data_structs/materials.jl 84.61% 2 Missing ⚠️
src/propsys/cable.jl 92.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            main      #84       +/-   ##
==========================================
+ Coverage   5.41%   80.66%   +75.25%     
==========================================
  Files         87       94        +7     
  Lines      14014    14266      +252     
==========================================
+ Hits         759    11508    +10749     
+ Misses     13255     2758    -10497     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

shaft.Ri = (shaft.Ro^4 - torque / shaft.material.τmax * 2 * shaft.Ro / π)^0.25
else
# shaft can be solid as well
shaft.Ri = 0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this case should return an error. The case when Ri = 0 is covered by the previous case as well.

@ngomezve ngomezve marked this pull request as ready for review April 15, 2025 21:44
Copy link
Member Author

@askprash askprash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good overall! Thanks for completing this.

Main thing to clean up is the motor/generator implementation as instances of base. The current approach introduces a bunch of code that will make maintenance harder in the future. I have some ideas of how to clean this up using a parametric type in PMS M and then the downstream functions should be straight forward. I'll try to add that in as suggestions in a while.


## Permanent-magnet synchronous machines

Permanent-magnet synchronous machines (PMSMs), particularly motors and generators, can be modeled tp estimate their performance and weight. The function [`size_PMSM!()`](@ref propsys.ElectricMachine.size_PMSM!) can be used to find the thickness and lengths of the PMSM components, their masses, as well as to calculate the phase electrical resistance. Once a PMSM has been sized, its off-design performance can be computed using [`operate_PMSM!()`](@ref propsys.ElectricMachine.operate_PMSM!), which calculates power losses tp compute the input power (motor) or output power (generator).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Permanent-magnet synchronous machines (PMSMs), particularly motors and generators, can be modeled tp estimate their performance and weight. The function [`size_PMSM!()`](@ref propsys.ElectricMachine.size_PMSM!) can be used to find the thickness and lengths of the PMSM components, their masses, as well as to calculate the phase electrical resistance. Once a PMSM has been sized, its off-design performance can be computed using [`operate_PMSM!()`](@ref propsys.ElectricMachine.operate_PMSM!), which calculates power losses tp compute the input power (motor) or output power (generator).
Permanent-magnet synchronous machines (PMSMs), particularly motors and generators, can be modeled to estimate their performance and weight. The function [`size_PMSM!()`](@ref propsys.ElectricMachine.size_PMSM!) can be used to find the thickness and lengths of the PMSM components, their masses, as well as to calculate the phase electrical resistance. Once a PMSM has been sized, its off-design performance can be computed using [`operate_PMSM!()`](@ref propsys.ElectricMachine.operate_PMSM!), which calculates power losses and computes the input electrical power required (motor) or output shaft power (generator).

base::PMSMBase = PMSMBase()

"""Number of multi-phase inverters [-]"""
N_inverters::Int = 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there setups that need more than 1 inverter for a single machine? This motor structure seems unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that by using multiple inverters, you can reduce the required voltage as the power is divided among them. For example, the GTL group at MIT used thirty single-phase inverters.

end # function Base.getproperty

#List of computed fields that are not stored in the structure but are derived from other fields
const BASE_COMPUTED_FIELDS = [:f, :torque, :N_slots, :N_slots_per_phase, :N_energized_slots, :λ, :B_gap]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring something as "BASE" to refer to some very specific variables just for convenience is going to be very confusing down the line! I see what you are trying to do here but I'm not sure this setup of having a "base" implementation is really needed just to define the Motor and Generator as two types of PMSM. This introduces a bunch of convenience functions that I think are just going to make it harder to read later.

The motor and generator could be implemented simply via a parametric type added to the PMSM sturct and then the sizing functions will know exactly what to do - what are inputs and what are outputs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at the parametric type implementation in commit 25d7411. I agree it is a lot neater!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants