Issue with Exporting Lab Model elecdata as MATLAB-Compatible .mat File in Motor-CAD #455
Open
2 tasks done
Labels
bug
Something isn't working
🔍 Before submitting the issue
🐞 Description of the bug
Hi there,
I am trying to export the Lab model elecdata results from Motor-CAD using the Python API, specifically to generate a MATLAB-compatible .mat file similar to the MotorLAB_elecdata.mat file provided in the Motor-CAD GUI exports.
Here’s what I have tried:
Script Execution:
I configured the Lab settings (e.g., SpeedMax, SpeedInc, SpeedMin) and successfully ran the calculate_magnetic_lab() method.
I used export_results("Lab", <output_path>) to export the results. However, the generated .mat file is not MATLAB-compatible and does not contain the structured elecdata results.
I attempted to parse the text data manually and recreate the .mat structure, but it does not replicate the expected elecdata structure from the GUI-exported MotorLAB_elecdata.mat.
Export Attempt Using export_lab_model:
I tried using the export_lab_model(<output_path>) method, but it either produces errors (e.g., method not found) or does not output the expected data.
Issue:
I need to extract and export the Lab model elecdata results into a .mat file that is identical in structure and content to the MotorLAB_elecdata.mat file generated via the Motor-CAD GUI.
Could you confirm the correct method to export the Lab model elecdata results using the Python API?
Regards,
AhmedSimulation_script_Modified.zip
📝 Steps to reproduce
Load the Motor-CAD Project:
Open Motor-CAD or use the Python API to load the .mot file:
javascript
Copy code
C:/------------------/PMMotor5V8_090C.mot
Configure Lab Settings:
Set the following Lab configuration parameters via the Python API:
python
Copy code
mcApp.set_variable('EmagneticCalcType_Lab', 0) # Magnetic calculation type
mcApp.set_variable('SpeedMax_MotorLAB', 15000) # Maximum speed
mcApp.set_variable('Speedinc_MotorLAB', 250) # Speed increment
mcApp.set_variable('SpeedMin_MotorLAB', 250) # Minimum speed
Run the Magnetic Lab Calculation:
Use the Python API to calculate the magnetic Lab results:
python
Copy code
mcApp.calculate_magnetic_lab()
Attempt to Export Lab Model Results:
Export the Lab model results using the following methods:
Method 1:
python
mcApp.export_results("Lab", "C:/path_to_results/Lab_Results.mat")
The exported file is generated but is not a valid MATLAB .mat file and does not contain the required elecdata structure.
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
2024.2.3.1
🐍 Which Python version are you using?
3.13
📦 Installed packages
The text was updated successfully, but these errors were encountered: