兰亭星落 发表于 2016-10-18 15:30

matlab与ansoft maxwell怎么联合仿真

本帖最后由 兰亭星落 于 2016-10-18 19:06 编辑

使用matlab控制ansoft maxwell,可以在matlab中用M语言编写函数,将自己的电机设计思想用程序实现,还可以利用matlab中自带的优化工具,比如遗传算法,控制Rmxprt和maxwell2d,实现电机智能设计
以下是matlab控制Rmxprt的一个例子,大部分参考H60880316的帖子https://bbs.simol.cn/thread-28895-1-1.html,实际中使用maxwell自带的记录脚本功能,记录成VB或Python脚本,再更改为matlab中的m语言即可,具体要使用invoke函数,并将Array()改为大括号{},将双引号改为单引号

iMaxwell=actxserver('AnsoftMaxwell.MaxwellScriptInterface');
Desktop = iMaxwell.GetAppDesktop()
Desktop.RestoreWindow

Project = Desktop.NewProject

invoke(Project,'InsertDesign','RMxprt','RMxprtDesign1','Adjust-Speed Synchronous Machine','')

Design = Project.SetActiveDesign('RMxprtDesign1')
Module = Design.GetModule('AnalysisSetup')

invoke(Module,'InsertSetup', 'ASSM', {'NAME:Setup1', 'Enabled:=', true, 'RatedOutputPower:=', ...
'3000W', 'RatedVoltage:=', '380V', 'RatedSpeed:=', '400rpm', 'OperatingTemperature:=', ...
'75cel', 'OperationType:=', 'Motor', 'LoadType:=', 'ConstPower', 'RatedPowerFactor:=', ...
0.75, 'Domain:=', false})

Editor = Design.SetActiveEditor('Machine')

invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Machine', {'NAME:PropServers', ...
'Machine'}, {'NAME:ChangedProps', {'NAME:Number of Poles', 'MustBeInt:=', true, 'Value:=', ...
'6'}, {'NAME:Rotor Position', 'Value:=', 'Outer Rotor'}, {'NAME:Control Type', 'Value:=', ...
'AC'}, {'NAME:Windage Loss', 'Value:=', '100W'}, {'NAME:Reference Speed', 'MustBeInt:=',...
false, 'Value:=', '400rpm'}, {'NAME:Frictional Loss', 'Value:=', '100W'}}}})

invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Stator', {'NAME:PropServers',...
'Stator'}, {'NAME:ChangedProps', {'NAME:Outer Diameter', 'Value:=', '190mm'}, {'NAME:Inner Diameter', 'Value:=',...
'50mm'}, {'NAME:Length', 'Value:=', '100mm'}, {'NAME:Steel Type', 'Material:=',...
'DW310_35'}, {'NAME:Number of Slots', 'MustBeInt:=', true, 'Value:=', '36'}, {'NAME:Slot Type', 'SlotType:=',...
'2'}}}})


invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Slot', {'NAME:PropServers',...
'Stator:Slot'}, {'NAME:ChangedProps', {'NAME:Auto Design', 'Value:=', false}, {'NAME:Hs0', 'Value:=',...
'0.1mm'}, {'NAME:Hs0', 'Value:=', '0.5mm'}, {'NAME:Hs1', 'Value:=', '0.5mm'}, {'NAME:Bs0', 'Value:=',...
'1mm'}}}})
invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Slot', {'NAME:PropServers',...
'Stator:Slot'}, {'NAME:ChangedProps', {'NAME:Parallel Tooth', 'Value:=', true}, {'NAME:Hs2', 'Value:=',...
'5mm'}, {'NAME:Bs1', 'Value:=', '2mm'}, {'NAME:Bs2', 'Value:=', '3mm'}}}})
invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Slot', {'NAME:PropServers',...
'Stator:Slot'}, {'NAME:ChangedProps', {'NAME:Tooth Width', 'Value:=', '5mm'}}}})

invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Slot', {'NAME:PropServers',...
'Stator:Slot'}, {'NAME:ChangedProps', {'NAME:Bs0', 'Value:=', '2.5mm'}, {'NAME:Hs2', 'Value:=',...
'17mm'}, {'NAME:Hs1', 'Value:=', '1mm'}, {'NAME:Hs0', 'Value:=', '0.5mm'}, {'NAME:Tooth Width', 'Value:=',...
'6.8mm'}}}})

invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Winding', {'NAME:PropServers',...
'Stator:Winding'}, {'NAME:ChangedProps', {'NAME:Number of Strands', 'Value:=',...
'1'}, {'NAME:Wire Size', 'WireSizeWireDiameter:=', '0.7mm', 'WireSizeGauge:=',...
'0', 'WireSizeWireWidth:=', '0mm', 'WireSizeWireThickness:=', '0mm', 'WireSizeMixedWireRectType:=',...
true, {'NAME:WireSizeMixedDiameter'}, {'NAME:WireSizeMixedWidth'}, {'NAME:WireSizeMixedThickness'}, {'NAME:WireSizeMixedThicknessMixedFillet'}, {'NAME:WireSizeMixedThicknessMixedNumber'}}, {'NAME:Wire Wrap', 'MustBeInt:=',...
false, 'Value:=', '0.05mm'}, {'NAME:Conductors per Slot', 'Value:=', '32'}, {'NAME:Coil Pitch', 'MustBeInt:=',...
true, 'Value:=', '6'}, {'NAME:Parallel Branches', 'MustBeInt:=', true, 'Value:=',...
'1'}}}, {'NAME:End/Insulation', {'NAME:PropServers', 'Stator:Winding'}, {'NAME:ChangedProps', {'NAME:Slot Liner', 'MustBeInt:=',...
false, 'Value:=', '0.6mm'}}}})



invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Rotor', {'NAME:PropServers',...
'Rotor'}, {'NAME:ChangedProps', {'NAME:Outer Diameter', 'Value:=', '280mm'}, {'NAME:Inner Diameter', 'Value:=', ...
'192.4mm'}, {'NAME:Length', 'Value:=', '100mm'}, {'NAME:Steel Type', 'Material:=', ...
'DW310_35'}, {'NAME:Pole Type', 'PoleType:=', '1'}}}})


invoke(Editor,'ChangeProperty', {'NAME:AllTabs', {'NAME:Pole', {'NAME:PropServers',...
'Rotor:Pole'}, {'NAME:ChangedProps', {'NAME:Magnet Thickness', 'Value:=', '4mm'}, {'NAME:Magnet Type', 'Material:=',...
'NdFe30'}}}})

Project.Save

Design.AnalyzeAll

delete(iMaxwell)

空城泪 发表于 2016-10-18 17:00

请问结果呢?可以实现联合仿真吗

520蝴蝶花 发表于 2016-10-18 17:02

没得用,很早前都看到过这个东东了

right985211 发表于 2016-10-18 17:20

有成品么,发上来看看额

兰亭星落 发表于 2016-10-18 18:53

空城泪 发表于 2016-10-18 17:00
请问结果呢?可以实现联合仿真吗

可以啊,复制上面的代码到.m格式的文件运行就行

兰亭星落 发表于 2016-10-18 18:55

right985211 发表于 2016-10-18 17:20
有成品么,发上来看看额

接下来会更新的{:1_551:}

兰亭星落 发表于 2016-10-18 18:56

520蝴蝶花 发表于 2016-10-18 17:02
没得用,很早前都看到过这个东东了

站在前人的基础上{:1_561:}

Dream丶逐梦 发表于 2016-10-18 20:33

高大上,没搞过。

right985211 发表于 2016-10-19 08:27

兰亭星落 发表于 2016-10-18 18:55
接下来会更新的

好的,期待中{:1_551:}

raozhimeng 发表于 2016-11-8 20:37

期待高大上的东西赶紧出来 让我们开开眼

兰比比 发表于 2018-5-9 15:28

楼主,您好,运行这个matlab的程序,就可以调动ansoft的建模并仿真吗

兰比比 发表于 2018-5-12 14:20

520蝴蝶花 发表于 2016-10-18 17:02
没得用,很早前都看到过这个东东了

ansoft和matlab的联合仿真是不是不能实现呢?可以和您交流一下吗

CXBcxb 发表于 2018-7-20 23:23

楼主,我能请教您一个问题吗?我的QQ号是295714029

cuixiupeng2521 发表于 2018-10-29 21:22

楼主 在matlab中如何启动一个已有的maxwell文件呢? 你这个文件的第一句是启动一个新的maxwell

一只会飞的猪 发表于 2019-1-13 17:05

我想问问各位,这个软件版本是多少呢?我用的EM18.2和matlab2014b,第一步运行就出错
出错 Untitled5 (line 1)
iMaxwell = actxserver('AnsoftMaxwell.MaxwellScriptInterface')

doulitangduo 发表于 2019-2-21 14:23

楼主的程序实现了创建并运行Rmxprt,请问一下您知不知道如何通过脚本编程实现将Rmxprt的运算结果输出并返回matlab?因为本想想在matlab中对结果进行处理,希望楼主能够提供解答,或给点思路。

BY_CH1 发表于 2019-8-16 14:28

请问怎么启动以保存的工程?         

sam643 发表于 2019-8-16 14:39

試試看XD感謝分享

sam643 发表于 2019-8-21 23:09

感謝分享~~感謝分享~~

取啥名字呢? 发表于 2020-7-31 13:35

感謝分享~~感謝分享~~
页: [1] 2
查看完整版本: matlab与ansoft maxwell怎么联合仿真