CST DESIGN STUDIO TM, CST PARTICLE STUDIO TM - 1 - Linking MATLAB and CST STUDIO USER NOTE This user note is centered on the use of CST MICROWAVE STUDIO (CST MWS) with MATLAB. MATLAB is a scientific computing program based on linear algebra and matrix mathematics. Component Object Models (COM) and ActiveX were used to interface with MATLAB via CST MWS s VBA macro language. The motivation for CST MWS <->MATLAB integration is to take advantage of the extensive data manipulation, signal processing, and graphics capability in MATLAB. COM and ActiveX interfaces allow behind the scenes data transfer and tight integration between the two programs. The described approach can be applied on other members of the CST STUDIO product line as well. Linking CST STUDIO with any third parties Windows based tools, e.g. MATHCAD, MATHEMATICA, MAPLE can be achieved using the technique described, too. Keywords: COM, ActiveX, MATLAB, MATHCAD, MAPLE, MATHEMATICA
CST DESIGN STUDIO TM, CST PARTICLE STUDIO TM - 2 - Table of contents Background...2 Macro Overview...3 Handling...3 Conclusion...4 Background This user note assumes some familiarity with scripting in CST MWS s VBA compatible macro language. User s unfamiliar with the macro language can refer to CST Microwave Studio s Advanced Topics manual. This manual can be found in PDF form under C:\Program Files\CST Microwave Studio 5.1\Documentation. There is also extensive help and examples in the HTML based help pages. The HTML help pages are easily accessed via the drop down menu under Help->VBA Macro Language. CST MWS can be configured to either control or be controlled by MATLAB. When CST MWS controls MATLAB, CST MWS is the client, and MATLAB is the server. When CST MWS is controlled by MATLAB, it is acting as the server and MATLAB is the client. This user note centers on using CST MWS as the client and MATLAB as a server. There is extensive information on using and programming in MATLAB at www.mathworks.com. Attached to this user note is an excerpt from a Mathworks PDF file focusing on COM and DDE Support for use with MATLAB, entitled COM&DDE.pdf. One can also view available COM object methods by typing the following at a MATLAB command prompt: h=actxserver('matlab.application'); invoke(h) The following will be displayed in the command window: Execute = String Execute (String) GetCharArray = String GetCharArray (String, String) GetFullMatrix = Void GetFullMatrix (String, String, Variant(Pointer), Variant(Pointer)) MaximizeCommandWindow = Void MaximizeCommandWindow () MinimizeCommandWindow = Void MinimizeCommandWindow () PutCharArray = Void PutCharArray (String, String, String) PutFullMatrix = Void PutFullMatrix (String, String, SafeArray, SafeArray) Quit = Void Quit () This is a summary of the available methods allowing a user to send, retrieve, and manipulate data in MATLAB. The Execute method can be used to implement any MATLAB command, allowing a user to program as if he/she was in the MATLAB command window.
CST DESIGN STUDIO TM, CST PARTICLE STUDIO TM - 3 - Macro Overview Macro 1 - Data Exchange The first macro entitled MATLAB / Data Exchange focuses on exchanging data between CST MWS and MATLAB. Data Exchange passes S11 linear to MATLAB, computes S11dB, and returns this value to CST MWS to be plotted in the 1DResults tree. Macro 2 - Signal Processing The second macro entitled MATLAB / Time Window relies on data exchange methods, a FFT routine, and an interactive plotting window. Time Window allows a user to change the simulation end time and recalculates S11 based on this new stop time. The new stop time is chosen graphically from the energy plot. A CST MWS simulation is completed when the total system energy reaches the db level set in Accuracy under Solver Settings. This setting is found in the transient solver dialogue box. Time Window then allows a user to investigate the effect of the Accuracy setting on the resulting S-Parameters. Handling These macros are meant to demonstrate the correct implementation of the COM object methods, as such they are limited to one port/one mode structures. They can be easily expanded to include any number of ports and modes. You must have MATLAB installed on the PC where you are using CST MWS. These macro s were successfully tested using MATLAB Release 12.1. Each macro has been incorporated into the CST MWS model file antenna patch.mod. To execute either macro open antenna patch.mod in CST MWS, and run the transient solver. After the simulation has completed select the Macro drop down menu. The last 2 macro s listed should read MATLAB / Data Exchange and MATLAB / Time Window. The execution of MATLAB / Time Window requires the storage of four accompanying.m files as specified in the below details. Macro 1 - Data Exchange Select the Data Exchange macro. CST MWS will initiate MATLAB, and a MATLAB window will appear displaying S11 in db. Also note the MATLAB command window has remained open. Now click in the MATLAB command window and type whos at the command prompt to display the internal MATLAB variables. You can now perform various signal processing and data analysis on these internal variables. Also note that these variables have been stored as a MATLAB data file as cst_data.mat. This file has been stored under C:\Program Files\CST Microwave Studio 5.1\Macros, which can be verified by typing cd at the MATLAB command prompt. Returning to the CST MWS command window the MATLAB computed S11dB can be found under 1DResults- >Matlab->S11dB. Now click Macros from the drop down menu in CST MWS, and select edit / Move / Delete VBA Macro. Highlight MATLAB / Data Exchange from the resulting list and choose edit. The VBA script for the MATLAB / Data Exchange macro will now appear in the VBA editor. You can now scroll down through the script to view the implementation details. Note that the first section of script is labeled user defined settings. Matlab_visible can be set to True or False, allowing the MATLAB command window to stay open or close after the calculation is completed.
CST DESIGN STUDIO TM, CST PARTICLE STUDIO TM - 4 - User_path contains the complete path where all files are stored and the directory MATLAB is set to. Save_file_name specifies the name of the.mat file where the MATLAB data is stored to. Note that independent MATLAB scripts (.m files) can be run via the COM object method execute. This is will demonstrated in the Time Window macro. Macro 2 - Time Window The Time Window Macro requires the use of several independent.m files. These files are matlab_fft.m, nearest.m, calc_sparm.m, and energy_plot.m. These files must be saved in the directory specified by user_path. Click on the Macro drop down menu, and select MATLAB / Time Window. CST MWS will initiate MATLAB, and a MATLAB window will appear displaying the 1DResults energy plot. A red vertical line will appear at the end of the energy plot, indicating the current simulation stop time. Bring the cursor over the MATLAB plot window, where a set of cross hairs should appear. Click anywhere on the graph to indicate the new simulation stop time. The vertical red line will be reset to the new simulation stop time, and S11 will be recomputed. The new S11 is then passed back to CST MWS and displayed in the 1DResults- >Matlab->S11dB. As in the Data Exchange macro one can then inspect the VBA script and conduct further analysis of the time signals in the MATLAB command window. Conclusion This user note discussed the use of CST MICROWAVE STUDIO (CST MWS) with MATLAB, the scientific computing program by MathWorks. Component Object Models (COM) and ActiveX were used to interact with MATLAB through CST MWS s VBA macro language. The use of CST MWS with MATLAB allows for greater flexibility in signal processing and data manipulation. A Data Exchange macro was presented using COM object methods to transfer data between CST MWS and MATLAB. A Time Windowing macro was also presented expanding on the transfer of data to include a computation of S parameters based on a new user defined simulation stop time.
易迪拓培训 专注于微波 射频 天线设计人才的培养网址 :http://www.edatop.com 射频和天线设计培训课程推荐 易迪拓培训 (www.edatop.com) 由数名来自于研发第一线的资深工程师发起成立, 致力并专注于微波 射频 天线设计研发人才的培养 ; 我们于 2006 年整合合并微波 EDA 网 (www.mweda.com), 现已发展成为国内最大的微波射频和天线设计人才培养基地, 成功推出多套微波射频以及天线设计经典培训课程和 ADS HFSS 等专业软件使用培训课程, 广受客户好评 ; 并先后与人民邮电出版社 电子工业出版社合作出版了多本专业图书, 帮助数万名工程师提升了专业技术能力 客户遍布中兴通讯 研通高频 埃威航电 国人通信等多家国内知名公司, 以及台湾工业技术研究院 永业科技 全一电子等多家台湾地区企业 易迪拓培训课程列表 :http://www.edatop.com/peixun/rfe/129.html 射频工程师养成培训课程套装该套装精选了射频专业基础培训课程 射频仿真设计培训课程和射频电路测量培训课程三个类别共 30 门视频培训课程和 3 本图书教材 ; 旨在引领学员全面学习一个射频工程师需要熟悉 理解和掌握的专业知识和研发设计能力 通过套装的学习, 能够让学员完全达到和胜任一个合格的射频工程师的要求 课程网址 :http://www.edatop.com/peixun/rfe/110.html ADS 学习培训课程套装该套装是迄今国内最全面 最权威的 ADS 培训教程, 共包含 10 门 ADS 学习培训课程 课程是由具有多年 ADS 使用经验的微波射频与通信系统设计领域资深专家讲解, 并多结合设计实例, 由浅入深 详细而又全面地讲解了 ADS 在微波射频电路设计 通信系统设计和电磁仿真设计方面的内容 能让您在最短的时间内学会使用 ADS, 迅速提升个人技术能力, 把 ADS 真正应用到实际研发工作中去, 成为 ADS 设计专家... 课程网址 : http://www.edatop.com/peixun/ads/13.html HFSS 学习培训课程套装该套课程套装包含了本站全部 HFSS 培训课程, 是迄今国内最全面 最专业的 HFSS 培训教程套装, 可以帮助您从零开始, 全面深入学习 HFSS 的各项功能和在多个方面的工程应用 购买套装, 更可超值赠送 3 个月免费学习答疑, 随时解答您学习过程中遇到的棘手问题, 让您的 HFSS 学习更加轻松顺畅 课程网址 :http://www.edatop.com/peixun/hfss/11.html `
易迪拓培训 专注于微波 射频 天线设计人才的培养网址 :http://www.edatop.com CST 学习培训课程套装该培训套装由易迪拓培训联合微波 EDA 网共同推出, 是最全面 系统 专业的 CST 微波工作室培训课程套装, 所有课程都由经验丰富的专家授课, 视频教学, 可以帮助您从零开始, 全面系统地学习 CST 微波工作的各项功能及其在微波射频 天线设计等领域的设计应用 且购买该套装, 还可超值赠送 3 个月免费学习答疑 课程网址 :http://www.edatop.com/peixun/cst/24.html HFSS 天线设计培训课程套装套装包含 6 门视频课程和 1 本图书, 课程从基础讲起, 内容由浅入深, 理论介绍和实际操作讲解相结合, 全面系统的讲解了 HFSS 天线设计的全过程 是国内最全面 最专业的 HFSS 天线设计课程, 可以帮助您快速学习掌握如何使用 HFSS 设计天线, 让天线设计不再难 课程网址 :http://www.edatop.com/peixun/hfss/122.html 13.56MHz NFC/RFID 线圈天线设计培训课程套装套装包含 4 门视频培训课程, 培训将 13.56MHz 线圈天线设计原理和仿真设计实践相结合, 全面系统地讲解了 13.56MHz 线圈天线的工作原理 设计方法 设计考量以及使用 HFSS 和 CST 仿真分析线圈天线的具体操作, 同时还介绍了 13.56MHz 线圈天线匹配电路的设计和调试 通过该套课程的学习, 可以帮助您快速学习掌握 13.56MHz 线圈天线及其匹配电路的原理 设计和调试 详情浏览 :http://www.edatop.com/peixun/antenna/116.html 我们的课程优势 : 成立于 2004 年,10 多年丰富的行业经验, 一直致力并专注于微波射频和天线设计工程师的培养, 更了解该行业对人才的要求 经验丰富的一线资深工程师讲授, 结合实际工程案例, 直观 实用 易学 联系我们 : 易迪拓培训官网 :http://www.edatop.com 微波 EDA 网 :http://www.mweda.com 官方淘宝店 :http://shop36920890.taobao.com 专注于微波 射频 天线设计人才的培养易迪拓培训官方网址 :http://www.edatop.com 淘宝网店 :http://shop36920890.taobao.com