Creating a Voltage Source
Create a voltage source by searching and navigating the documentation.
-
Search for voltagesource in the integrated help.
The results returned in response to the voltagesource query includes VoltageSource (object).
- Double-click VoltageSource (object).
-
View the VoltageSource (object).
Note: Since there can be multiple voltage sources in the model, the voltage source object is part of a collection.
-
Click SourceCollection hyperlink to navigate to the
SourceCollection description.
Note: A voltage source is configuration specific. It can be added to either a standard configuration or a characteristic modes configuration.
We want to add the voltage source to the default configuration (standard configuration).
-
Search for StandardConfiguration in the integrated help.
Double-click StandardConfiguration (object).
-
View the standard configuration object.
Note: Since there can be multiple standard configurations in a model, the standard configuration object is part of a collection.
-
Click the SolutionConfigurationCollection hyperlink to
navigate to the SolutionConfigurationCollection
description.
Note: The application project contains the StandardConfiguration.The prepending syntax is as follows.
Project.SolutionConfigurations
-
Go back to SolutionConfigurationCollection in the integrated
help.
Note: The Index list indicates you can reference the specific StandardConfiguration through indexing with the use of a number or a string.
-
Create a separate handle for the configuration.
this_config = my_project.SolutionConfigurations[1]
Tip: It is not necessary to create a separate handle for the StandardConfiguration, but is convenient for adding more configuration specific objects. -
Add the voltage source using the following syntax.
my_voltage_source = thisConfig.Sources:AddVoltageSource(myPort)