Associated with each element placed in a schematic is a model. Sometimes you'd like to know information about a particular model like:
What version of the model is being used.
What dynamic library contains the model.
What is the path to the Dll from which the model was loaded.
A description of the model being used.
Each of these questions can be answered by accessing the properties of a Model object in the Models collection associated with the MWOffice application. Let's try to get some information about Microstrip Line model or MLIN model.
' Get Model Information on MLIN Sub Main Dim mdl As Model Debug.Clear Set mdl = MWOffice.Models("MLIN") Debug.Print "Name = " & mdl.Name Debug.Print "Company Name = " & mdl.Company Debug.Print "Description = " & mdl.Description Debug.Print "Version = " & mdl.Version Debug.Print "Module Name = " & mdl.Module Debug.Print "Module Filename= " & mdl.ModuleFilename End Sub
This program is pretty simple. We access the MLIN model form the Models collection associated with the MWOffice application by using string indexing to get it directly. Then we print a number of properties for the Model each with a string label so in the output we get a nice report on this Model like the following:
Name = MLIN Company Name = AWR Description = Microstrip Line (Closed Form) Version = 4 Module Name = ele_defs.dll Module Filename= H:\MWO_Dev\Debug\models\ele_defs.dll
Of particular interest to model developers are the last three items. The version number describes which version of this model will be used in the simulation of a schematic with a MLIN element. This version of the model was loaded from the ele_defs.dll and the particular version of that Dll is located at the file path H:\MWO_Dev\Debug\models\ele_defs.dll. The file path can be of particular importance if you have multiple versions of the AWR design environment installed on your system. The models should be loaded from the models sub-directory below the directory containing the executable but using the model object's ModuleFilename you can be sure exactly where the model came from. Sometimes PDK's may add additional directories.
For PowerShell users, we can get the same results with following three lines:
PS > $MWOffice = new-object -comobject MWOApp.MWOffice PS > $Model = $MWOffice.Models.Item("MLIN") PS > $Model | Select Name,Company,Description,Version,Module,ModuleFilename
Name : MLIN Company : AWR Description : Microstrip Line (Closed Form) Version : 4 Module : ele_defs.dll ModuleFilename : H:\MWO_Dev\Debug\models\ele_defs.dll
So using the Models collection it is possible to get summary information about the exact models being used to simulate a schematic design.