Creating a Voltage Source

Add a global voltage source to Port1 for the default configuration, StandardConfiguration1.

myVoltageSource = myProject.Contents.SolutionConfigurations.GlobalSources:AddVoltageSource(myPort)
myVoltageSource.Label = "Source1"
Figure 1. A voltage source is added to Port1.

  1. A voltage source is a object and since there may be multiple objects in the model, it is part of the SourceCollection.
  2. Search for SourceCollection in the Help1.
  3. In the Help, under SourceCollection > Method List, search for methods that are applicable to voltage sources:
    • AddVoltageSource (properties table)
    • AddVoltageSource (portterminal Port)
    To create a voltage source, we will use the method:
    AddVoltageSource(portterminal Port)
  4. Fill in the port terminal (use port, Port1):
  5. Determine the syntax to prepend to AddVoltageSource:
    1. Since AddVoltageSource is a method, it is indicated by prepending a : (colon).
    2. In the Help, under SoureCollection > Usage locations, note the following:
      SolutionConfigurations collection has collection GlobalSources2
      Since we know that Contents is the one of the top levels in the configuration tree, the result is then:
    3. Since the project is the highest level, we prepend our reference to the project:
  6. Add a reference to the newly created voltage source:
    myVoltageSource = myProject.Contents.SolutionConfigurations.GlobalSources:AddVoltageSource(myPort)
  7. Set the voltage source label to Source1:
    myPatch.Label = "Source1"
    Tip: View the VoltageSource (object) in the Help for a short example.
1 The API is available in the Feko Scripting and API Reference Guide (PDF) or Feko WebHelp.
2 The part that is prepended to the method, maps to the CADFEKO model tree structure.