フィルターのクリア

Motor-Cad wont export results as .csv file (or any other file type)

11 ビュー (過去 30 日間)
Dom
Dom 2022 年 1 月 20 日
移動済み: Sabin 2023 年 9 月 29 日
Hi guys,
I am trying to run an automated motor-cad script, but when I try to export the results to a .csv file I get the following error:
"Error using COM.MotorCAD_AppAutomation/ExportResults
Invoke Error, Dispatch Exception:
Source: MotorCAD.AppAutomation
Description: Range check error"
The computation runs succesfully, and I get reults with the "GetVariable" method.
My Code is pretty much the default example:
%% Script initialisation
% Launch Motor-CAD
mcad = actxserver('MotorCAD.AppAutomation');
% Disable all popup messages
invoke(mcad,'SetVariable','MessageDisplayState',2);
% Choose model type
invoke(mcad,'ShowMagneticContext');
%% Geometry
% Display the scripting tab
invoke(mcad,'DisplayScreen','Scripting');
invoke(mcad,'LoadFromFile','C:\NotrealPath')
% Set the slot number, tooth width and magnetic thickness
% invoke(mcad,'SetVariable','Slot_Number',24);
% invoke(mcad,'SetVariable','Tooth_Width',6);
% invoke(mcad,'SetVariable','Magnet_Thickness',4.5);
%% Custom Winding Example
%{
% Set the number of phases, parallel paths and winding layers:
invoke(mcad,'SetVariable','MagPhases',3);
invoke(mcad,'SetVariable','ParallelPaths',1);
invoke(mcad,'SetVariable','WindingLayers',2);
% Set the winding type to custom
invoke(mcad,'SetVariable','MagWindingType',1);
% Set the Path type to Upper and Lower
invoke(mcad,'SetVariable','MagPathType',1);
% Define a coil's parameters:
% Phase, Path, Coil, Goslot, GoPosition, ReturnSlot, ReturnPoisition, Turns
% Position parameters can be "a", "b", "c" etc. for Upper/Lower paths and "L" or "R" for Left/Right paths
invoke(mcad,'SetWindingCoil',2, 1, 3, 4, 'b', 18, 'a', 60);
%}
%% Materials
% Change the stator/rotor lamination materials
% invoke(mcad,'SetComponentMaterial','Stator Lam (Back Iron)','M250-35A');
% invoke(mcad,'SetComponentMaterial','Rotor Lam (Back Iron)','M250-35A');
%% Calculation Options
% Run a transient torque calculation with 30 points in 1 electrical cycle
PointsPerCycle = 3;
NumberCycles = 1;
invoke(mcad,'SetVariable','TorquePointsPerCycle',PointsPerCycle);
invoke(mcad,'SetVariable','TorqueNumberCycles',NumberCycles);
% Disable all performance tests except for the torque calculation in order
% to minimise simulation time
invoke(mcad, 'SetVariable', 'BackEMFCalculation', false);
invoke(mcad, 'SetVariable', 'CoggingTorqueCalculation', false);
invoke(mcad, 'SetVariable', 'ElectromagneticForcesCalc_OC', false);
invoke(mcad, 'SetVariable', 'TorqueSpeedCalculation', false);
invoke(mcad, 'SetVariable', 'DemagnetizationCalc', false);
invoke(mcad, 'SetVariable', 'ElectromagneticForcesCalc_Load', false);
invoke(mcad, 'SetVariable', 'InductanceCalc', false);
invoke(mcad, 'SetVariable', 'BPMShortCircuitCalc', false);
invoke(mcad, 'SetVariable', 'TorqueCalculation', true);
%% Operating Point
% Set the operating point of the machine - speed, current and phase
% advantage
invoke(mcad, 'SetVariable', 'Shaft_Speed_[RPM]', 1000);
invoke(mcad, 'SetVariable', 'CurrentDefinition', 0);
invoke(mcad, 'SetVariable', 'PeakCurrent', 3);
invoke(mcad, 'SetVariable', 'DCBusVoltage', 350);
invoke(mcad, 'SetVariable', 'PhaseAdvance', 45);
%% Saving File
% invoke(mcad,'SaveToFile','C:\Workspace\ActiveX_Scripting_EMagnetic.mot');
%% Simulation
success = invoke(mcad,'DoMagneticCalculation');
if success == 0
disp('Magnetic calculation successfully completed');
else
disp('Magnetic calculation failed');
end
%% Results
% Export data to csv file
success = invoke(mcad,'ExportResults','EMagnetic','D:\ANSYS_Motor-CAD\14_1_4\Emag\Export EMag Results.csv');
if success == 0
disp('Results successfully exported');
else
disp('Results failed to export');
end
% Output Data Sheets
[success,ShaftTorque] = invoke(mcad,'GetVariable','ShaftTorque');
[success,LineVoltage] = invoke(mcad,'GetVariable','PeakLineLineVoltage');
  1 件のコメント
Xuezhou
Xuezhou 2022 年 4 月 8 日
I have met the same problem like you. How did you solve it finally?

サインインしてコメントする。

回答 (1 件)

Dom
Dom 2022 年 4 月 8 日
移動済み: Sabin 2023 年 9 月 29 日
Copied file, renamed it, chose a different lokal path.
  1 件のコメント
Xuezhou
Xuezhou 2022 年 4 月 8 日
移動済み: Sabin 2023 年 9 月 29 日
Thanks, Dom. I will give it a try.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by