Skip to content

ExcelConceptEV #500

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 10 commits into
base: main
Choose a base branch
from
Open

ExcelConceptEV #500

wants to merge 10 commits into from

Conversation

ravi-ansys
Copy link
Collaborator

Added a function to export Efficient map data of LAB as excel file suitable for ConceptEV

@ravi-ansys ravi-ansys self-assigned this Apr 8, 2025
@ravi-ansys ravi-ansys requested a review from RobKellyAnsys April 8, 2025 13:50
@github-actions github-actions bot added the maintenance Package and maintenance related label Apr 8, 2025
@ravi-ansys ravi-ansys added enhancement New features or code improvements dependencies Related with project dependencies and removed maintenance Package and maintenance related labels Apr 8, 2025
@ravi-ansys ravi-ansys linked an issue Apr 8, 2025 that may be closed by this pull request
@github-actions github-actions bot added the maintenance Package and maintenance related label May 1, 2025
@ravi-ansys ravi-ansys requested a review from philipjusher May 7, 2025 10:37
@@ -32,6 +32,10 @@
k_custom_loss_power_function_external_lab = "CustomLoss_PowerFunction_External_Lab"
k_custom_loss_voltage_function_external_lab = "CustomLoss_VoltageFunction_External_Lab"

import numpy as np
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen if numpy and scipy aren't available? They aren't in the main dependencies (only in the test dependencies). I think in other cases we detect and warn if some specific dependencies aren't available. At least until now I think we have been trying to avoid adding large things like numpy/scipy to the required dependencies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi James,
May I confirm,
I have looked into the installed folder of python with Motor-CAD. It seems numpy and scipy is already available.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

@ravi-ansys, scipy (and therefore numpy) are included in the Python environment distributed with the Motor-CAD installation, as you show above. However, they are only optional (documentation) dependencies of PyMotorCAD itself (see https://github.com/ansys/pymotorcad/blob/main/pyproject.toml).

There are two options, one is to move scipy into the main dependencies (which we have avoided until now), the other is to check when you import it if it's available, and fail with a useful error message if it isn't available. For an example of this, have a look at how MATPLOTLIB_AVAILABLE is used in https://github.com/ansys/pymotorcad/blob/main/src/ansys/motorcad/core/geometry_drawing.py

@jgsdavies, any opinion on this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer the MATPLOTLIB_AVAILABLE method for now. We can also add an optional dependency list in the same way as we do docs and tests in pyproject.yml. Maybe CEV can also have this?

Copy link

@philipjusher philipjusher left a comment

Choose a reason for hiding this comment

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

Make the tests pass.

ii = 0
jj = 0
if sheet == "Speed":
for col in ws.iter_cols(min_col=0, max_col=j_len, max_row=i_len):

Choose a reason for hiding this comment

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

use "enumerate" for the index variables ii and jj

@@ -304,3 +308,166 @@ def export_lab_model(self, file_path):
method = "ExportLabModel"
params = [file_path]
return self.connection.send_and_receive(method, params)

@staticmethod

Choose a reason for hiding this comment

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

lets just make this a function rather than a staticmethod

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think if I make this function than it will show up in documentation which we may not want .This is supporting function to the main function export_concept_ev_model. @jgsdavies can confirm .

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think it's going to add functions with underscores

@james-packer
Copy link
Contributor

It's odd that the thermal tests are failing (test_get_node_to_node_resistance, test_get_node_power), I can't see how these are related to the code changes. @ravi-ansys, do you get these failures if you run the tests locally?

@ravi-ansys
Copy link
Collaborator Author

ravi-ansys commented May 21, 2025

It's odd that the thermal tests are failing (test_get_node_to_node_resistance, test_get_node_power), I can't see how these are related to the code changes. @ravi-ansys, do you get these failures if you run the tests locally?
Hi @james-packer , I have checked . These are failing locally too. I am not sure as these are not linked to my method
image

@ravi-ansys
Copy link
Collaborator Author

@philipjusher Hi Phill, I have update the branch with the reviews. It seems to pass test also this time.

Let me know if any further issues need addressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Related with project dependencies enhancement New features or code improvements maintenance Package and maintenance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export loss map motor data in ConceptEV format
4 participants