How can I extract parameter values of a solving scenario using python?

Yann_Le_Floch
Yann_Le_Floch
Altair Employee
edited November 2021 in Altair HyperWorks

In order to extract parameter values of a solving scenario, you have to use the command Scenario['ScenarioName'].getValuesParameter().

Example: Let extract the 1st value of the 1st parameter pilot of the scenario PARAMETRIC*.

# To store all the parameter values in array
A=Scenario['PARAMETRIC'].getValuesParameter()

# To display the array content
print A.values()

[array('d',[90.0, 95.0, 100.0, 105.0, 110.0]) , array('d',[90.0]) , array('d',[0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.25, 5.5, 5.75, 6.0, 6.25, 6.5, 6.75, 7.0, 7.25, 7.5, 7.75, 8.0, 8.25, 8.5, 8.75, 9.0, 9.25, 9.5, 9.75, 10.0]) ]

# To extract the values of the 1st parameter
A.values()[0]
array('d',[90.0, 95.0, 100.0, 105.0, 110.0])

# To extract the 1st value of the 1st parameter
A.values()[0][0] 90.0

Using these commands any parameter value can be extracted and stored. For instance, it could be useful when a specific step of the scenario should be selected.

*The scenario should be fully or partly processed.