Page tree
Skip to end of metadata
Go to start of metadata

Summary

Sometimes it is useful to define a global data element and have all schematics reference the same element. One case where this is useful is when all the schematics will be using the same substrate. You can add a substrate definition to the global data definitions and then all the elements in your schematics can use that substrate. Let's look at how we'd do this in from the scripting API.

 ' Add substrate to the global data definitions
     Set elem = Project.GlobalDataElements.Add("MSUB", 0, 0)


The Global Definitions can be accessed as Project.GlobalDataElements object. This object works much like a simplified schematic so elements and equations can be added in the same way you'd add them to a schematic. We can add a substrate object in the same way we'd add one to a schematic with the Add() method specifying the MSUB name and the location to place the substrate element.

Once we have added the substrate definition to the global definitions we can create a schematic and add some elements to reference it.

     ' Create schematic with MLIN element that references global substrate
     Set schem = Project.Schematics.Add("MySchematic")
     Set elem = schem.Elements.Add("MLIN", 0, 0)
     schem.Elements.Add("PORT", elem.Nodes(1).x, elem.Nodes(1).y)
     schem.Elements.Add("PORT", elem.Nodes(2).x, elem.Nodes(2).y, 180)
 

This creates a schematic named "MySchematic" and then adds a MLIN element with input and output ports so it can be simulated. By default the MLIN element will reference a substrate named SUB1 which happens to be the default name given to the MSUB substrate. Since we added the substrate to the global definitions then all microstrip elements in all our schematics will use this substrate by default. So the entire example looks like the following:

Code Snippets

 ' Code Module
Sub Main
     Dim elem As Element
     Dim schem As Schematic

     ' Add substrate to the global data definitions
     Set elem = Project.GlobalDataElements.Add("MSUB", 0, 0)

     ' Create schematic with MLIN element that references global substrate
     Set schem = Project.Schematics.Add("MySchematic")
     Set elem = schem.Elements.Add("MLIN", 0, 0)
     schem.Elements.Add("PORT", elem.Nodes(1).x, elem.Nodes(1).y)
     schem.Elements.Add("PORT", elem.Nodes(2).x, elem.Nodes(2).y, 180)

End Sub

 

And the results of running this program looks like below:

So whenever you want to define a data element or equation to be used by all schematics place that element in the Project.GlobalDataElements and then it will be available to all elements from all schematics in the project.