Quickly Accessing Component Properties in Scripts


In large networks, time to process and transfer data may have an impact on solve time. Scripts are a commonly used for accessing component properties to dictate operating conditions or simulate controls. In this blog post, we will be exploring how to reduce operating time when accessing component properties via script. We will also walk through an example of how to access internal identifiers and component type names, as well as how to use them in a script. We will be using a quick script that accesses various component properties during each pressure iteration. For the networks in this blog, I will be using version


First, we are going to take a look at how to directly reference component properties in a script. This a relatively straightforward process of using the GUI to determine a component’s type and property names.  We will use that information to assign references to properties of components in a control system as an alternative to using data transfer links and DCS components (using a process similar to a previous post). Finally, we will take a look at some tradeoffs between explicitly referencing component properties and using a method to retrieve them.


Consider a simple network, where 3 variable speed pumps are regulated by a PID controller and a quick script. The recruitment and deactivation of pumps and pump speed rate limits are controlled using a quick script. Below is an image of the network.


The pump activation can be seen by adjusting the setpoint manually using a slide bar (right).

Accessing Properties

In a previous post, we discussed how to retrieve variable references using a function, using the GetPropertyFromFullDisplayName() method.

Alternatively, the output may be accessed using internal identifiers. This requires a bit more legwork, but we will see that it offers a significant reduction in script runtime. We will start our code with our component reference. We can paste the component identifier into the GetComponent() method. For this example, we are passing this in though a script input.


For this example PIDComponentID will return “PID” in the code below.

//Identify PID Component – Setting references for future operations
//Setting Component Reference
IPS.Core.Component PID = Project.GetComponent(PIDComponentID.ToString()); 

The next step is to determine the type of the component. We can retrieve this by right clicking on the component and selecting “Copy Type Name”.


This should return:


We can use this to create a reference to the Flownex component using the copied Type.

//Setting PID Component Reference
DCS.Components.Analog.Controllers.PID PID = PIDComponent as DCS.Components.Analog.Controllers.PID;

Now we can right click on property in the PID that we would like to reference and select Copy internal identifiers to clipboard.


This will copy the following property name to the clipboard:


Now we can make a reference to the Output property of our PID Controller component.

//Setting PID Output Reference PIDOutput = PID.Output;

Putting our code together results in the following:

//Identify PID Component – Setting references for future operations
//Setting Component Reference IPS.Core.Component PID = Project.GetComponent(PIDComponentID.ToString());
// IPS.Core.Component
//Setting PID Component Reference
DCS.Components.Analog.Controllers.PID PID = PIDComponent as DCS.Components.Analog.Controllers.PID;
//Setting PID Output Reference
PIDOutput = PID.Output;

This approach takes a few clicks and an extra line of code for each component type, but it decreases the runtime of script components and permits the same functionality as the GetPropertyFromFullDisplayName() method.

Testing Solve Speed

Now that we know how to access internal properties of Flownex components, we can compare two functionally identical network solutions solve speeds. One uses GetPropertyFromFullDisplayName() to access properties and the other uses internal identifiers to access properties.

We will be running a 10 minute simulation with 100 ms timesteps. All pumps are initially set to 1200rpm (125.7 rad/s) and the setpoint remains at 10kg/s. The resulting graphs for pump speeds, PID Output, and number of active pumps in this simulation is shown below.

The script will access properties form the component identifiers specified above.

Speed Comparison

Each network was run five times, a summary of the runtime is
shown below:


time (s)

time (s)

% Difference





















Mean 15.56



Running this network with a direct property access resulted in over 15% reduction in runtime for this network.

This difference is caused by the significant reduction in the script evaluation time. The image below shows the total simulation time when accessing properties directly.

This evaluates on the order of 1E-4s per pressure iteration.
We can compare this to retrieving properties with a method (below).

The script evaluation time is nearly an order of magnitude larger when using a script to access properties.


So, when most useful to access properties directly? Directly referencing properties is helpful when you are concerned about execution time and your scripts account for a significant fraction of time in your timestep. Hopefully this helped you shave some time off your simulation.

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

PADT’s Pulse Newsletter

Keep up to date on what is going on at PADT by subscribing to our newsletter. Every month we share news about PADT, our partners, and our customers. We also share links to useful information on simulation, product development, and 3D Printing.  Sign up, and let's stay in touch.

By submitting this form, you are consenting to receive marketing emails from: . You can revoke your consent to receive emails at any time by using the SafeUnsubscribe® link, found at the bottom of every email. Emails are serviced by Constant Contact

Share this post:

Upcoming Events


Stratafest - Denver, CO


2024 CEO Leadership Retreat


Turbine Engine Technology Symposium 2024


New Mexico Tech Summit 2024


Rocky Mountain Life Sciences Investor & Partnering Conference


Rocky Mountain Life Sciences Investor & Partnering Conference


PADT30 | Nerdtoberfest 2024