This repository was archived by the owner on Oct 28, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathDoDutyCycleFromMotFileList.m
More file actions
69 lines (59 loc) · 3.18 KB
/
Copy pathDoDutyCycleFromMotFileList.m
File metadata and controls
69 lines (59 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function DoDutyCycleFromMotFileList(motFileList4Weight,numPorts)
readMotFileList=motFileList4Weight;
% numPorts=6;
clear spmdIndex
delete(gcp('nocreate')); % 사전에 실행 중인 병렬 풀 있을까봐 끄고 시작
parpool(numPorts); % 병렬 풀 생성, default가 Processes, Threads로 하면 에러
spmd
mcad(spmdIndex) = actxserver('motorcad.appautomation');
mcad(spmdIndex).SetVariable("MessageDisplayState",2)
lastPortCaseIndex=double(int32(length(readMotFileList)/numPorts));
for portCaseIndex = 1:1:lastPortCaseIndex
i = ((spmdIndex-1)*lastPortCaseIndex)+portCaseIndex;
BuildScaledMotFilePath=readMotFileList{i};
% BuildScaledMotFilePath=readMotFileList{i};
% [FileDir,MotFileName,FileExt]=fileparts(BuildScaledMotFilePath);
% LabMatFileDir=fullfile(FileDir,MotFileName,'Lab');
% SatuMapFilePath = fullfile(LabMatFileDir,[MotFileName,'SatuMapExport.mat']);
% [MotorCADGeo,SatuMapData,LabBuildingData]=devExportSatuMapFromMCADLabModel(SatuMapFilePath,mcad(spmdIndex),0);
% [SatuMapTable,SatuMapInfo]=createTableFromMCADSatuMapStr(SatuMapData);
% [ScaledMachineData,ScaledSatuMapTable] = devScaleTablebyStiepetic(Factor,SatuMapTable,MotorCADGeo);
% BuildScaledMotFilePath=fullfile(ScaledBuildDir,['ScaleBuildModel',MotFileName],['ScaleBuildModel',MotFileName,FileExt]);
if isfile(BuildScaledMotFilePath)
mcad(spmdIndex).LoadFromFile(BuildScaledMotFilePath)
end
[~,BuildCheck]=mcad(spmdIndex).GetModelBuilt_Lab();
if BuildCheck==0
mcad(spmdIndex).SetVariable("LossModel_Lab",2);
mcad(spmdIndex).SetVariable("MagnetLossCalc_Lab",0);
end
[~,BuildCheck]=mcad(spmdIndex).GetModelBuilt_Lab();
if BuildCheck==1
% mcad(spmdIndex).BuildModel_Lab();
% mcad(spmdIndex).SaveToFile(BuildScaledMotFilePath);
% end
% MachineData=tempDefMCADMachineData4Scaling(mcad(spmdIndex));
% settingLabBuildTable = defMcadLabBuildSetting()
labDriveSettingTable=defMcadLabCalcSetting(); % 이게 잘안된것도 있네
mcad(spmdIndex).SetVariable("CurrentSpec_MotorLAB",0);
[~,Armature_CoilStyle]=mcad(spmdIndex).GetVariable("Armature_CoilStyle");
if Armature_CoilStyle==0
[~,TurnsCalc_MotorLAB]=mcad(spmdIndex).GetVariable("TurnsRef_MotorLAB");
labDriveSettingTable=updateMcadTableVariable(labDriveSettingTable,"TurnsCalc_MotorLAB",TurnsCalc_MotorLAB);
end
labDriveSettingTable=updateMcadTableVariable(labDriveSettingTable,"Iinc_MotorLAB",100);
labDriveSettingTable=updateMcadTableVariable(labDriveSettingTable,"Imax_MotorLAB",900);
% updateMcadTableVariable(labDriveSettingTable,"Imax_RMS_MotorLAB",900);
setMcadTableVariable(labDriveSettingTable,mcad(spmdIndex));
% Vehicle Setting 기어비 변경
TeslaSPlaidDutyCycleTable=defMcadDutyCycleSetting;
setMcadTableVariable(TeslaSPlaidDutyCycleTable,mcad(spmdIndex));
% RefGearRatio = findMcadTableVariableFromAutomationName(TeslaSPlaidDutyCycleTable, 'N_d_MotorLAB');
mcad(spmdIndex).SetVariable('N_d_MotorLAB',3);
mcad(spmdIndex).SetVariable('SaturationModelMethod_Lab',1);
mcad(spmdIndex).CalculateDutyCycle_Lab();
mcad(spmdIndex).SaveToFile(BuildScaledMotFilePath);
end
end
end
end