AmesimKnowledge

The Simulation Scripting environment in detail > Export setup

Using the Export Setup 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 an Export parameters configuration

Follow the steps below to load a model's export configuration. You can access the export configuration object of a model by typing the command below, where the parameter passed in is the path of the model file:

Copy

xpt_config = XPT.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 Export Setup API from a Python console launched from outside Simcenter Amesim (you can right-click on the model and select Explode).

Adding new Export parameters

Below, we describe the different methods for adding a new parameter to an export 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_export_apy xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add the pressure sensor gain by passing its data path pressure_param = xpt_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 Export Parameters Setup dialog box: Figure 4: Export Parameters Setup 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_export_apy xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add a local input parameter local_input = xpt_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_export_apy xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\ OptimizationRobustnessDOE\Optimization\DesignOptimization.ame") # Add state variable parameter to the Input type integrator_output = xpt_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 XPTConfig, 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 export API wants to add the parameters as selected below: Figure 5: Parameter with vectors

Here, the command would be as follows: Copyimport ame_export_apy xpt_config = ame_export_apy.XPT.get_config(r"c:\hydraulic\ 1d\simple_model.ame") # Add the first parameter in the selected list above by passing its data pressure_param = xpt_config.add_param("pn_1@hydraulic_1") #the pressure_param above refers to the first among the XPT parameters #added to the xpt configuration shown below.

Retrieving an existing Export parameter

You can retrieve a parameter by passing the export name as an argument to the following method: import ame_export_apy:

Copy

import ame_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    # Add state variable parameter to the Input type
    seat_param = xpt_config.get_param(‘seatD’)

Retrieving the list of Export parameters

or can retrieve a list of Export parameters by using the get_params_list API:

Copy

import ame_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    # Add state variable parameter to the Input type
    all_params_list = xpt_config.get_params_list()

The export 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 XPTParam 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_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    # Add state variable parameter to the Input type
    input_params_list = xpt_config.get_params_list(IOType.Input)

Removing an Export parameter

You can remove a parameter using the remove_param API as shown below. You can either pass the reference to the export param or the export name of the parameter to remove it.

Copy

import ame_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    # Add state variable parameter to the Input type
    pressure_param = xpt_config.add_param("gain@pressuresensor")
    seat_param = xpt_config.add_param("seatD")
    …
    xpt_config.remove_param(‘seat_param’)
    # return True or False

Retrieving the IO type of an Export parameter

You can use the get_iotype API to determine the iotype of Export parameter:

Copy

import ame_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    seat_param = xpt_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 Export parameter. You need to pass the Property enum corresponding to the column as the first argument: Property, which is one of the following:

  • Submodel

  • Title

  • Export_Name

  • Units

  • Default_Value

  • Type

  • Possible_Values

  • Lower_Bound

  • Upper_Bound

  • Status

  • Expression

Copy

import ame_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    seat_param = xpt_config.get_param(‘seatD’)
    seat_param.get_property(Property.Submodel)
    # return ‘GLOBAL (seatD)’
    seat_param.get_property(Property.Export_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 Export 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_export_apy
    xpt_config = ame_export_apy.XPT.get_config(r"$AME\demo\Platform\
    OptimizationRobustnessDOE\Optimization\DesignOptimization.ame")
    seat_param = xpt_config.get_param(‘seatD’)
    seat_param.get_property(Property.Export_Name)
    # return ‘seatD’
    seat_param.set_property(Property.Export_Name, ‘new_seatD’)
    # return True

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Scripting/xid1124525 · retrieved 2026-07-17