The Simulation Scripting environment in detail > Optimization, Design of Experiments
Using the Study API
This section describes the basic functions for working with the API. A full list of API functions is given in the HTML documentation.
Loading a Study parameters configuration
Follow the steps below to load a model's study configuration. You can access the study configuration object of a model by typing the command below, where the parameter passed in is the path of the model file:
Copy
study_config = STUDY.get_config(r'$AME\demo\Platform\OptimizationRobustnessDOE\
Optimization\DesignOptimization.ame')
Warning
You must ensure that the model is in its expanded state if you load the Study API from a Python console launched from outside Simcenter Amesim (you can right-click on the model and select Explode).
Adding new Study parameters
Below, we describe the different methods for adding a new parameter to a study configuration.
- Pass only the data_path
You can pass only the data path of any parameter or variable where the data path involved refers to a parameter or variable in Simcenter Amesim as the only argument. For example:
Copyimport ame_study_apy study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add the pressure sensor gain by passing its data path pressure_param = study_config.add_param("gain@pressuresensor")
- Pass only the IOType
This is used if you want to add a local Input parameter or local Compound parameter. This is equivalent to adding the parameter using the Add button in the Study Manager dialog box: Figure 9: Study Manager dialog box
You need to pass the IOType enum for the required type as the argument. The possible values of IOType are:
Input
Output
Compound
For example:
Copyimport ame_study_apy study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add a local input parameter local_input = study_config.add_param(IOType.Input)
- Pass data_path and IOType
The only case where both the data_path and IOType presence are relevant is when the IOType is used to specify either the Input parameters or Simple output parameters in cases of state variables. For example:
Copyimport ame_study_apy study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add state variable parameter to the Input type integrator_output = study_config.add_param(‘output@elect02’, IOType.Input)
If you are dealing with vectors, as the data path corresponds to the parameter of a vector type having a particular dimension, the returned parameter corresponds to the particular dimension, but when it is added to STUDYConfig, all the available parameters (of all the dimensions) are added. This is the same behavior as seen in Simcenter Amesim where we add all or none.
For example, consider a case where the study API wants to add the parameters as selected below:
Figure 10: Parameter with vectors
Here, the command would be as follows:
Copyimport ame_study_apy study_config = ame_study_apy.STUDY.get_config(r"c:\hydraulic\ 1d\simple_model.ame") # Add the first parameter in the selected list above by passing its data pressure_param = study_config.add_param("pn_1@hydraulic_1") #the pressure_param above refers to the first among the STUDY parameters #added to the study configuration shown below.
Retrieving an existing Study parameter
You can retrieve a parameter by passing the study name as an argument to the following method: import ame_study_apy:
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
# Add state variable parameter to the Input type
seat_param = study_config.get_param(‘seatD’)
Retrieving the list of Study parameters
Or you can retrieve a list of Study parameters by using the get_params_list API:
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
# Add state variable parameter to the Input type
all_params_list = study_config.get_params_list()
The study configuration has three different types of parameter named: input, output and compound output parameters. Using the argument of type IOType, you can retrieve the list of STUDYParam of a particular type. If you do not pass any argument, then it will retrieve all the parameters of input, output and compound types.
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
# Add state variable parameter to the Input type
input_params_list = study_config.get_params_list(IOType.Input)
Removing a Study parameter
You can remove a parameter using the remove_param API as shown below. You can either pass the reference to the study param or the study name of the parameter to remove it.
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
# Add state variable parameter to the Input type
pressure_param = study_config.add_param("gain@pressuresensor")
seat_param = study_config.add_param("seatD")
…
study_config.remove_param(‘seat_param’)
# return True or False
Retrieving the iotype of a Study parameter
You can use the get_iotype API to determine the iotype of Study parameter:
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
seat_param = study_config.get_param(‘seatD’)
seat_param.get_iotype()
# return 1
Retrieving the value of any column of an existing parameter
You can use the get_property API in order to retrieve the value of any column of the Study parameter. You need to pass the Property enum corresponding to the column as the first argument: Property, which is one of the following:
SubmodelTitleStudy_NameUnitsDefault_ValueTypePossible_ValuesLower_BoundUpper_BoundStatusExpression
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
seat_param = study_config.get_param(‘seatD’)
seat_param.get_property(Property.Submodel)
# return ‘GLOBAL (seatD)’
seat_param.get_property(Property.Study_Name)
# return ‘seatD’
Modifying the value of any column of an existing parameter
You can use the set_property API in order to set the value of any column of the Study parameter. You need to pass the Property enum corresponding to the column as the first argument and the new value as the second argument.
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
seat_param = study_config.get_param(‘seatD’)
seat_param.get_property(Property.Study_Name)
# return ‘seatD’
seat_param.set_property(Property.Study_Name, ‘new_seatD’)
# return True
Saving the study configuration
In order to save modifications made to a study configuration, you can use the API named save:
Copy
import ame_study_apy
study_config = ame_study_apy.STUDY.get_config(r"$AME\demo\Platform\
OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
seat_param = study_config.get_param(‘seatD’)
seat_param.set_property(Property.Study_Name, ‘new_seatD’)
study_config.save()
# return True or False
Warning
You can still access the Study API even if the script imports ame_export_apy.py using the two following methods:
Create the ExportConfig.settings file at the same location as the script. If this file contains the text
use_study_param_file, then the Study API is called instead of the Export API even on importingame_export_apy.py.To access the Study API [study_param file] , you can initialize
XPT = use_study_param_file(true)at the beginning of the script. Example: Copy`import sys from ame_export_apy import * try: XPT = use_study_param_file(true) xpt_config= XPT.get_config(r'D:\SourceCode_newcheckouts
Projects\BatchDOE\TestReport
New TestReport Data\ExportSettings_Scripts
Engine_DID_Turbocharged.ame')
#here are the input parameters print ("Study Input Parameters :: starts") for cur_param in xpt_config.get_params_list(IOType.Input): print ("Param name:", cur_param.get_property(Property.Export_Name))`
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Scripting/xid1465984 · retrieved 2026-07-17