Simcenter Amesim API in Python
Introduction
The Circuit API in Python gives you access to all Simcenter Amesim functions using functions in the Python language. These functions are described in the following
section.
In this guide, you will find prototypes of each function. We give a list of available functions and their prototypes.
Each function is described as follows:
a short description
the details of each parameter
the value returned
Please also consult the Circuit API documentation.
Function Documentation
◆◆
AMEAddBusCreator()
def AMEAddBusCreator
(
args,
kwargs
)
Adds a bus creator to the sketch at specified position in the current active circuit. Its submodel is automatically generated.
AMEAddBusCreator(string, (string, ...), (int, int))
First string argument is the alias of the component to add. Note the alias must be unique in the current circuit level. Second argument is the list of the bus input
names. Third argument is optional. It is couple of integers which give the component top left coordinate in pixels. If it is not set, then the component is added at
point P(0, 0).
ame_apy.AMEAddBusCreator('bus_creator', ('Input1', 'Input2', 'Input3'), (317, 115))
AMEAddBusJunction()
◆◆
def AMEAddBusJunction
(
args,
kwargs
)
Adds a bus junction to the sketch at specified position in the current active circuit. Its submodel is automatically generated.
AMEAddBusJunction(string, (int, int))
First string argument is the alias of the component to add. Note the alias must be unique in the current circuit level. Second argument is optional. It is couple of
integers which give the component top left coordinate in pixels. If it is not set, then the component is added at point P(0, 0).
ame_apy.AMEAddBusJunction('bus_junction', (317, 115))
◆◆
AMEAddBusSelector()
def AMEAddBusSelector
(
args,
kwargs
)
Adds a bus selector to the sketch at specified position in the current active circuit. Its submodel is automatically generated.
AMEAddBusSelector(string, (string, ...), (int, int))
First string argument is the alias of the component to add. Note the alias must be unique in the current circuit level. Second argument is the list of the bus outputs
names. Third argument is optional. It is couple of integers which give the component top left coordinate in pixels. If it is not set, then the component is added at
point P(0, 0).
ame_apy.AMEAddBusSelector('bus_selector', ('Input1', 'Input2', 'Input3'), (317, 115))
AMEAddComponent()
◆◆
def AMEAddComponent
(
args,
kwargs
)
Adds a component to the sketch at specified position in the current active circuit. If there is only one possible submodel for the added component, this submodel is
set.
AMEAddComponent(string, string[, (int, int)])
First string argument is the component icon name. Second string argument is the alias path of the component to add. Note the alias must be unique in the current
circuit level. Third argument is optional. It is couple of integers which give the component top left coordinate in pixels. If it is not set, then the component is added
at point P(0, 0).
ame_apy.AMEAddComponent('step', 'Step_Generator', (50, 50))
◆◆
AMEAddDynamicComponent()
def AMEAddDynamicComponent
(
args,
kwargs
)
Adds a Dynamic component to the sketch at specified position in the current active circuit. The only one possible submodel is set for the dynamic component.
AMEAddDynamicComponent(string, string, string[, (int, int)])
First string argument is the component icon name. Second string argument is the alias of the component to add. Note the alias must be unique in the current
circuit level. Third string argument represents the values of the structural parameters, separated by commas. For example, if there are two structural parameters,
the values of which should be 4 and 7, then the expected string is '4,7'. Fourth argument is optional. It is couple of integers which give the component top left
coordinate in pixels. If it is not set, then the component is added at point P(0, 0).
ame_apy.AMEAddDynamicComponent('dynamic_mux2', 'dynamic_mux2', "4,1,1,2", (317, 115))
AMEAddEnumGlobalParameter()
◆◆
def AMEAddEnumGlobalParameter
(
args,
kwargs
)
Adds a enumeration global parameter to the current active circuit.
AMEAddEnumGlobalParameter(string, string, string, string, (string, ...),AMEGPGroupPtr,integer)
First string argument is the unique name for global parameter. Second string argument is the title of the global parameter. Third string argument is the parameter
value. Fourth string argument is the parameter default value. Fifth tuple argument is the list of enumeration strings for the global parameter. Sixth AMEGPGroupPtr
argument is GP group. This is optional. If not set, then the GP will be created at root level Seventh integer location of the GP inside a group. This is optional. If not
set,Appends the GP onto the end of root or given input GP group
ame_apy.AMEAddEnumGlobalParameter('name', 'title','1', '2',['option1','option2','option3'],gp_group,1)
AMEAddGlobalParameter()
◆◆
def AMEAddGlobalParameter
(
args,
kwargs
)
Adds a global parameter to the current active circuit.
AMEAddGlobalParameter(string, string, string, string, string, string, string, string,AMEGPGroupPtr,integer)
First string argument is the unique name for global parameter. Second string argument is the title of the global parameter. Third string argument is the parameter
type. It can be 'ame_real_parameter', 'ame_integer_parameter' or 'ame_text_parameter'. Fourth string argument is the parameter value. Fifth string argument is the
parameter default value. Sixth string argument is the parameter minimal value. This must not be set in case we are adding a text parameter. Seventh string
argument is the parameter maximal value. This must not be set in case we are adding a text parameter. Eighth string argument is the parameter unit in which the
value is expressed. This must not be set in case we are adding a text or integer parameter. Ninth AMEGPGroupPtr argument is GP group. This is optional. If not
set, then the GP will be created at root level Tenth integer location of the GP in group. This is optional. If not set,Appends the GP onto the end of root
ame_apy.AMEAddGlobalParameter('p_diameter', 'Piston diameter', 'ame_real_parameter', '90', '90', '5', '200',
'mm',gp_group,1)
AMEAddInterfaceExportComponent()
◆◆
def AMEAddInterfaceExportComponent
(
args,
kwargs
)
Create an interface block.
AMEAddInterfaceExportComponent(string, string, string, string, string, int, (string, ...), int, (string, ...)[, (int, int)])
First string argument: Type of the interface block. Second string argument: Name identifier of the interface block. The alias must be unique in the current circuit
level. Third, Fourth and Fifth string argument: first, second and third line of text of the interface block's icon. Sixth integer argument: Number of inputs of the
interface block. Seventh tuple argument: Name of the inputs of the interface block. Eigth integer argument: Number of outputs of the interface block. Nineth tuple
argument: Name of the outputs of the interface block. Tenth tuple argument (optional): top left coordinates in pixels of the interface block to add. If not given, the
interface block is added in the top left corner of the sketch i.e. AME_POINT{0, 0}.
ame_apy.AMEAddInterfaceExportComponent('simulink', 'theinterfaceblock', 'Line1', 'Line2', 'Line3', ('input1', 'input2'),
('output1', 'output2', 'output3'), (50, 50))
AMEAddInterfaceExportComponentWithSetupFile()
◆◆
def AMEAddInterfaceExportComponentWithSetupFile
(
args,
kwargs
)
Create an interface block.
AMEAddInterfaceExportComponent(string, string, string, (int, int)])
First string argument: Type of the interface block. Second string argument: Name identifier of the interface block. The alias must be unique in the current circuit
level. Third string argument: Path of the load setup file. This file defines the inputs/outputs of the interface block and its comment lines. Tenth tuple argument
(optional): top left coordinates in pixels of the interface block to add. If not given, the interface block is added in the top left corner of the sketch i.e. AME_POINT{0,
0}.
ame_apy.AMEAddInterfaceExportComponentWithSetupFile('simulink', 'theinterfaceblock', 'C:/mySetupFile.txt', (50, 50))
◆◆
AMEAddPathsToPathsList()
def AMEAddPathsToPathsList
(
args,
kwargs
)
Adds a list of directories to the search paths list. By default the directory is appended. However it is possible to insert the new path at given position.
AMEAddPathToPathsList((string, ...), int)
The first argument is the list of paths to add to the search paths list The second argument is the position index at which the new path will be added. If position is
negative, the new path is appended. Default is -1.
ame_apy.AMEAddPathsToPathsList(('$AME/libhydr','$AME/libeb'), 3)
AMEAddPathToPathsList()
◆◆
def AMEAddPathToPathsList
(
args,
kwargs
)
Adds a directory to the search paths list. By default the directory is appended. However it is possible to insert the new path at given position.
AMEAddPathToPathsList(string, int)
The string argument is the path to add to the search paths list The int argument is the position index at which the new path will be added. If position is negative, the
new path is appended. Default is -1.
ame_apy.AMEAddPathToPathsList('$AME/libhydr', 2)
AMEAddSupercomponentPort()
◆◆
def AMEAddSupercomponentPort
(
args,
kwargs
)
Adds a port to a local supercomponent in the model.
AMEAddSupercomponentPort(string, string, string, (int, int))
First argument is the alias path of the supercomponent. Second argument is the port face. Third argument is the port type. Fourth argument is the port position.
AMEAddSupercomponentPort('sc_alias_path', 'ame_face_bottom', 'rshaft', (100, 100))
AMEAttachProperty()
◆◆
def AMEAttachProperty
(
args,
kwargs
)
Attach a AMEProperty object to an other object of the active circuit. This object is named 'target' object. This object type can be one of the enumeration
AMEPropertyUrlType:
ame_property_url_type_model: Attach the property object to the circuit/model. Then 'target_name' argument is unused.
ame_property_url_type_compline: Attach the property object to a component/line of the active circuit.
ame_property_url_type_experiment: Attach the property object to an experiment of the active circuit.
ame_property_url_type_group: Attach the property object to an AMEProperty object of type ame_property_type_group. This property object will become a child of
the group.
AMEAttachProperty(PyProperty, AMEPropertyUrlType[, string])
First argument is the AMEProperty object to attach. Second argument is the 'target' object type. The type is one of AMEPropertyUrlType. Third argument is the
'target' object name. Depending on the 'target' type, it could be an component alias, an experiment name, a property group name.
ame_apy.AMEAttachProperty(myProperty, ame_property_url_type_compline, 'mass_friction1port_2' )
AMEChangeSubmodel()
◆◆
def AMEChangeSubmodel
(
args,
kwargs
)
Sets a submodel to the component or the line in the current active circuit.
AMEChangeSubmodel(string, string, string) AMEChangeSubmodel(AMECompLine, string, string)
First argument is a string representing the alias path of the element (component or line) whose submodel will be set, or an AMECompLine object, as returned by
AMEGetCompLine or an AMECompLineIteration. Second string argument is the name of the submodel to set. Third argument is directory where the submodel
resides. In the case the submodel dictionary has not been built when API has not been initialized, this argument is compulsory. Otherwise it is optional. If it is not
set, submodel directory is fetched from paths list. See help(ame_apy.AMEInitAPI).
ame_apy.AMEChangeSubmodel('signal03', 'UD00', '$AME/submodels')
◆◆
AMEChangeSupercomponentIcon()
def AMEChangeSupercomponentIcon
(
args,
kwargs
)
Changes the icon of a local supercomponent in the active circuit.
AMEChangeSupercomponentIcon(string, string[, bool])
First argument is the alias path of the supercomponent. Second argument is the name of the new icon (from the library). Third argument is optional. If its value is
True, only icons that have compatible ports are allowed. Default value is True.
ame_apy.AMEChangeSupercomponentIcon('sc_alias', 'mass1port')
AMECheckCircuitSubmodels()
◆◆
def AMECheckCircuitSubmodels
(
args,
kwargs
)
This function is now obsolete. It is provided to keep old source code working.We strongly advise against using it in new code. Use AMEUpdateModel instead.
For the current active circuit, it updates submodels set for components or lines in the circuit with submodels in the libraries.
If necessary (and possible) it updates the circuit's submodels. Note that if it fails to update a submodel, you will have to remove this submodel then set a new
available one. In this case, it is strongly advised to check your submodel parameter values. When too many changes have been made in a submodel, it is possible
the parameter or state variable values will be lost. (string, ...) = AMECheckCircuitSubmodels([bool, bool,] bool)
If First bool argument is set to True, it tries to add missing libraries in the path list. Note this argument is optional. Default is True. If second bool argument is set to
True and if the circuit has been updated, then it creates a backup of the initial circuit file. This is optional. Default value is True. Third argument is deprecated and
ignored. It returns a tuple of strings. These are the paths of the parameters which may be not correctly updated. The values of the parameters in this list must be
checked.
ame_apy.AMECheckCircuitSubmodels(False, False, True)
('rp3', 'rp4', 'rp6', 'rp7', 'rp9')
AMECloseAPI()
◆◆
def AMECloseAPI
(
args,
kwargs
)
Terminates the API session. It closes without saving all opened circuits. It releases the Simcenter Amesim license token.
AMECloseAPI([bool])
bool argument is optional and it decides whether to save the pathlist file. The default value of this argument is True.
ame_apy.AMECloseAPI(False)
AMECloseCircuit()
◆◆
def AMECloseCircuit
(
args,
kwargs
)
Closes the active circuit. It collapses the circuit file in the *.ame archive file. By default, it saves the circuit before closing it. However, it is possible to close it
without saving.
AMECloseCircuit([bool])
The bool argument tells if the circuit is to be saved before closing. This is optional. Default is true.
ame_apy.AMECloseCircuit()
AMECollapseGPGroup()
◆◆
def AMECollapseGPGroup
(
args,
kwargs
)
Collapse the GP group
AMECollapseGPGroup(AMEGPGroupPtr)
First AMEGPGroupPtr argument is the GP group object This is optional. If not set,Collapse all the groups inside a global param dialog
ame_apy.AMECollapseGPGroup(gp_group)
◆◆
AMEConnectSupercomponentPort()
def AMEConnectSupercomponentPort
(
args,
kwargs
)
Connects an internal port of a supercomponent to one of its constituent.
AMEConnectSupercomponentPort(string, int, string, int)
First argument is the supercomponent alias path. Second argument is the supercomponent port number. Third argument is the constituent alias path. Fourth
argument is the constituent port number.
AMEConnectSupercomponentPort('sc_alias', 0, 'mass', 0)
◆◆
AMEConnectTwoPorts()
def AMEConnectTwoPorts
(
args,
kwargs
)
Connects two ports without line. It is equivalent to connecting two ports using an invisible DIRECT line. The ports to connect must belong to components which are
inside the current active circuit.
AMEConnectTwoPorts(string, int, string, int) AMEConnectTwoPorts(AMECompLine, int, AMECompLine, int)
In the first version, the two string arguments are the alias paths of the components to connect. In the other version, the first and third arguments must be
AMECompLine objects corresponding to the components to connect, as returned by AMEGetCompLine or an AMECompLineIteration. The second and fourth
arguments are integers corresponding to the indexes of the ports to connect.
ame_apy.AMEConnectTwoPorts('elasticendstop', 0, 'mass1port', 0)
AMEConnectTwoPortsWithLine()
◆◆
def AMEConnectTwoPortsWithLine
(
args,
kwargs
)
Connect two ports through a line. The ports to connect must belong to components which are inside the current active circuit. If the two components ports can be
connected together, then DIRECT submodel is set to the added line.
AMEConnectTwoPortsWithLine(string, int, string, int, string[, ((int, int), ...)]) AMEConnectTwoPortsWithLine(AMECompLine, int, AMECompLine, int, string[, ((int,
int), ...)])
In the first version, the first and third string arguments are the alias paths of the components to connect. In the other version, the first and third arguments must be
AMECompLine objects corresponding to the components to connect, as returned by AMEGetCompLine or an AMECompLineIteration. The second and fourth
arguments are integers corresponding to the indexes of the ports to connect. The fifth string argument is the alias of the line to be created.
The last argument is optional. It is a tuple containing couples of int values. These are points describing line topology (excluding the ports). If this argument is not
set, then a simple line is draw joining two connected ports.
ame_apy.AMEConnectTwoPortsWithLine('signal03', 0, 'thf_qvsource', 0, 'line_1', ((206, 170), (206, 181)))
AMEConnectTwoRemotePorts()
◆◆
def AMEConnectTwoRemotePorts
(
args,
kwargs
)
Connects two remote ports . The ports to connect must belong to components which are inside the current active circuit.
AMEConnectTwoRemotePorts(string, int, string, string, int, string) AMEConnectTwoRemotePorts(AMECompLine, int, string, AMECompLine, int, string)
In the first version, the first and fourth arguments are the alias paths of the components to connect. In the other version, the first and fourth arguments must be
AMECompLine objects corresponding components to connect. The second and fifth arguments are integers corresponding to the indexes of the ports to connect.
The third and sixth arguments are the tags for remote ports.
ame_apy.AMEConnectTwoRemotePorts('dynamicReceiver', 0, 'Tag1', 'dynamicTransmitter', 1, 'Tag1')
◆◆
AMECopyAliasPath()
def AMECopyAliasPath
(
args,
kwargs
)
Returns a copy of the alias path of a component or line.
string = AMECopyAliasPath(AMECompLine)
The argument is an AMECompLine object, returned by AMEGetCompLine or by an AMECompLineIteration.
AMECopyAliasPath(first_comp)
'ramp'
AMECopyDataPath()
◆◆
def AMECopyDataPath
(
args,
kwargs
)
Returns a copy of the data path of a parameter or variable.
string = AMECopyDataPath(AMEParVar)
The argument is an AMEParVar object, returned by AMEGetParVar or by an AMEParVarIteration.
AMECopyDataPath(parvar)
'out'
◆◆
AMECopyProperty()
def AMECopyProperty
(
args,
kwargs
)
Copies the given AMEProperty object into a new AMEProperty object instance. The property is entirely copied (values, parent, children)
PyProperty = AMECopyProperty(PyProperty)
First argument is the source PyProperty object to be copied. It returns a new PyProperty object duplicated from the source.
ame_apy.AMECopyProperty(myProperty)
<ame_apy.AMEProperty object at 0x01EB2180>
AMECreateCircuit()
◆◆
def AMECreateCircuit
(
args,
kwargs
)
Creates a new empty Simcenter Amesim circuit named new_circuit_name. By default the new circuit is created in the local directory, but it is possible to create it
in another target directory.
AMECreateCircuit(string[, string])
First string is the name of the new circuit. Second string is the directory where the new circuit will be saved. This is optional. If not set, the circuit is created in the
local directory.
ame_apy.AMECreateCircuit('my_new_system', '/home/test/')
◆◆
AMECreateCircuitFromStarter()
def AMECreateCircuitFromStarter
(
args,
kwargs
)
Creates a new Simcenter Amesim circuit from starter circuits. The created circuit is the concatenation of starter circuit contents. By default the new circuit is
created in the local directory, but it is possible to create it in a target directory.
AMECreateCircuitFromStarter((string, ...), string[, string])
The first tuple argument is the list of starter systems used to build the new circuit. The second string argument is the name of the new circuit. Third string argument
is the directory where the new circuit will be saved. This is optional. If not set, the circuit is created in the local directory.
ame_apy.AMECreateCircuitFromStarter(('$AME/libhydr/starters/libhydr.amt', '$AME/libhcd/starters/libhcd.amt'),
'my_new_system', '/home/test/')
◆◆
AMECreateCompLineIteration()
def AMECreateCompLineIteration
(
args,
kwargs
)
Creates an iterator on the components and lines of the active circuit.
AMECompLineIteration = AMECreateCompLineIteration(int)
Int argument is a flag combination describing which sort of components and lines to iterate on. Available values and their meanings are:
ame_compline_comp: list components
ame_compline_line: list lines
ame_compline_all: list components and lines
ame_compline_explore_supercomponents: also components or lines contained in supercomponents
ame_compline_exclude_without_submodel: list only components and lines having a submodel. Those flags can be binary-ORed.
ame_apy.AMECreateCompLineIteration(ame_compline_all|ame_compline_explore_supercomponents)
<ame_apy.AMECompLineIteration object at 0xb7d43040>
AMECreateComponentPortIteration()
◆◆
def AMECreateComponentPortIteration
(
args,
kwargs
)
Creates an iterator on the ports of a component.
AMEComponentPortIteration = AMECreateComponentPortIteration(string) AMEComponentPortIteration = AMECreateComponentPortIteration(PyCompLine)
The first argument identifies the component via its alias path or via a PyCompLine. Note: the returned value is an PyComponentPortIteration object, which can be
used in a "for" loop to produce AMEPort objects.
for port in AMECreateComponentPortIteration('sc_alias'):
... print(AMEGetPortName2(port))
AMECreateExperiment()
◆◆
def AMECreateExperiment
(
args,
kwargs
)
Creates an experiment (embedded/linked) with given type, name and description.
string = AMECreateExperiment(int, string, string, string, bool)
First argument is the type of the experiment: 1) 0 - Embedded experiment. 2) 1 - Linked experiment. Second argument (optional) is the name of the experiment. If
ignored, default name is assigned. Third argument (optional) is the description of the experiment. If ignored, default description is assigned. Default description will
be of the form - 'Experiment <EXPERIMENT_NAME>'. Fourth argument (optional) is the path to use when saving a linked experiment. Fifth argument (optional) is a
boolean indicating whether to save only parameters. It returns the name of the created experiment.
ame_apy.AMECreateExperiment(0, 'my_experiment_1', 'My sample experiment') exp_name =
ame_apy.AMECreateExperiment(0, '', 'My params only experiment', '', false) ame_apy.AMECreateExperiment(1,
'linked_exp', 'Linked experiment', 'C:/Amesim/Experiments/')
AMECreateGlobalParameterFromDataPath()
◆◆
def AMECreateGlobalParameterFromDataPath
(
args,
kwargs
)
Adds a global parameter to the current active circuit.
AMECreateGlobalParameterFromDataPath(string, string, string,AMEGPGroupPtr,integer)
First string argument is the parameter data path. Second string argument is the unique name for global parameter. This is optional. If not set, then the GP name
will be created from parameter Third string argument is the title of the global parameter. This is optional. If not set, then the GP title will be created from parameter
Fourth AMEGPGroupPtr argument is GP group. This is optional. If not set, then the GP will be created at root level Fifth integer location of the GP inside a group.
This is optional. If not set,Appends the GP onto the end of root or given input GP group
ame_apy.AMECreateGlobalParameterFromDataPath('indexf','name', 'title',gp_group, 1)
◆◆
AMECreateGPGroup()
def AMECreateGPGroup
(
args,
kwargs
)
Create a GP group inside gp dialog.
AMEGPGroupPtr = AMECreateGPGroup(string,AMEGPGroupPtr,integer)
First string argument is the GP group name Second AMEGPGroupPtr argument is GP group. This is optional. If not set, then the GP group will be created at root
level Third integer location inside a group. This is optional. If not set,Appends the GP group onto the end of root or given input GP group Returns the GP group
python object
ame_apy.AMECreateGPGroup('gourp_name',gp_group,1)
AMECreateHistoryItem()
◆◆
def AMECreateHistoryItem
(
args,
kwargs
)
Creates a new AMEHistoryItem object in the active circuit.
PyHistoryItem = AMECreateHistoryItem(string, string[, string])
First argument is the history author name. Second argument is the history comment. Third argument (optional) is the history date.
ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. It returns the history item object.
ame_apy.AMECreateHistoryItem('Myself', 'This is a comment', '2010-08-24')
<ame_apy.AMEHistoryItem object at 0x01EFD110>
AMECreateParVarIteration()
◆◆
def AMECreateParVarIteration
(
args,
kwargs
)
Creates an iterator on the parameters and variables of a component or line.
AMEParVarIteration = AMECreateParVarIteration(string, int) AMEParVarIteration = AMECreateParVarIteration(AMECompLine, int)
The first argument can be the alias path of a component or line, or an AMECompLine object. The second argument is flag combination. Available values are:
ame_parvar_all: list all types of parameters and variables
ame_parvar_ext_real_var: list external variables
ame_parvar_int_real_var: list internal variables
ame_parvar_real_param: list real parameters
ame_parvar_integer_param: list integer parameters
ame_parvar_text_param: list text parameters
ame_parvar_exclude_local_global: do not list local global parameters
ame_parvar_only_local_global: list only local global parameters
ame_parvar_only_visible: list only visible parameters or variables
ame_parvar_only_var_with_start_value: list only variables that have a start value
ame_parvar_explore_supercomp: also list parameters and variables of components and lines contained in a supercomponent
The returned value is an AMEParVarIteration object, which can be used in a "for" loop to produce AMEParVar objects.
AMECreateParVarIteration('ramp', ame_parvar_all)
<ame_apy.AMEParVarIteration object at 0xb7e3d040>
for parvar in AMECreateParVarIteration('ramp', ame_parvar_all):
... print(AMECopyDataPath(parvar)) ... out out0 slope t0
AMECreateParVarIterationOnPort()
◆◆
def AMECreateParVarIterationOnPort
(
args,
kwargs
)
Creates an iterator on the external variables on a port of a component or line.
AMEParVarIteration = AMECreateParVarIterationOnPort(string, int) AMEParVarIteration = AMECreateParVarIterationOnPort(AMECompLine, int)
The first argument can be the alias path of a component or line, or an AMECompLine object. The second argument is the index of the port whose external variables
must be listed.
See also help(ame_apy.AMECreateParVarIteration).
AMECreateParVarIterationOnPort('ramp', 0)
<ame_apy.AMEParVarIteration object at 0xb7e3d070>
◆◆
AMECreateParVarIterationOnSubmodel()
def AMECreateParVarIterationOnSubmodel
(
args,
kwargs
)
Creates an iterator on the parameters and variables of a library submodel.
AMEParVarIteration = AMECreateParVarIterationOnSubmodel(AMEAPISubmodel, long)
The first argument can be the path to a submodel. The second argument is a flag that allows to filter what kind of parameters/variables to iterate on and define
whether to explore inside supercomponents or not.
See also help(ame_apy.AMECreateParVarIterationOnSubmodel).
AMECreateParVarIterationOnSubmodel(submodel_object)
<ame_apy.AMEParVarIteration object at 0xb7e3d070>
◆◆
AMECreateProperty()
def AMECreateProperty
(
args,
kwargs
)
Creates a AMEProperty object in the active circuit for a given 'property_type'.
PyProperty = AMECreateProperty(AMEPropertyType, string[, string])
First argument is a AMEPropertyType representing the property object type. The property object type is one of AMEPropertyType enumeration.
ame_property_type_number
ame_property_type_text
ame_property_type_rich_text
ame_property_type_date ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times.
ame_property_type_file_link
ame_property_type_file_attached
ame_property_type_image
ame_property_type_enum
ame_property_type_group
Second argument is a string representing the property name. -If empty, the property name is defaulted to 'Property'.
Third argument (optional) is a string representing the property content. -If empty, the property has no default content. Returns an new PyProperty object.
ame_apy.AMECreateProperty(ame_property_type_text, 'My Property', 'My content')
<ame_apy.AMEProperty object at 0x01EFD110>
AMECreateSupercomponent()
◆◆
def AMECreateSupercomponent
(
args,
kwargs
)
Creates a local supercomponent from a list of components/lines (identified by their alias path) in the active circuit. The supercomponent's icon is the default
generated icon.
AMECreateSupercomponent((string, ...), string, string, string[, string, (int, int)])
First argument is the alias list of the components/lines from which the supercomponent will be created. If there is 0 element, an empty supercomponent will be
created. Second argument is the name of the submodel of the supercomponent being created. Third argument is the aliaspath of the supercomponent being
created. Fourth argument is the name of the supercomponent's icon in the sketch (used when file is opened from GUI). Fifth argument indicates how global
parameters should be handled. This is an optional parameter. When a supercomponent is being created from elements that reference one or several global
parameters, the API offers three options: -"duplicate": the global parameters will be duplicated inside the supercomponent being created. -"keep": references to the
original global parameter are kept; -"replace": the global parameters are replaced by their actual value; Default option is "duplicate". Sixth argument indicates the
position of the top-left corner of the supercomponent being created. This is an optional parameter. When no position is indicated, an algorithm will find a free area
on the circuit where the supercomponent can be placed.
ame_apy.AMECreateSupercomponent(('mass1port',), 'submodel_name', 'sc_alias', 'sc_icon_name', 'replace', (10, 10)))
◆◆
AMEDeleteExperiment()
def AMEDeleteExperiment
(
args,
kwargs
)
Deletes an experiment.
AMEDeleteExperiment(string)
First argument is the name of the experiment.
ame_apy.AMEDeleteExperiment('my_experiment_1')
◆◆
AMEDeleteGPGroup()
def AMEDeleteGPGroup
(
args,
kwargs
)
Deletes the GP group
AMEDeleteGPGroup(string,AMEGPGroupPtr,integer)
First string argument is the GP group name Second AMEGPGroupPtr argument is parent GP group. This is optional. If not set, then the first encountered GP group
will be deleted in a parameter model dialog Third integer location inside a group. This is optional. If not set,then the first encountered GP group will be deleted
inside a parent GP group or root
ame_apy.AMEDeleteGPGroup('gourp_name',gp_group,1)
AMEDeleteGPGroupStructure()
◆◆
def AMEDeleteGPGroupStructure
(
args,
kwargs
)
Deletes the GP group
AMEDeleteGPGroupStructure(AMEGPGroupPtr)
First AMEGPGroupPtr argument is GP group object.
ame_apy.AMEDeleteGPGroupStructure(gp_group)
AMEDeleteHistoryItem()
◆◆
def AMEDeleteHistoryItem
(
args,
kwargs
)
Deletes a AMEHistoryItem object from the active circuit.
AMEDeleteHistoryItem(PyHistoryItem)
First argument is the PyHistoryItem object to delete.
ame_apy.AMEDeleteHistoryItem(myHistoryItem)
◆◆
AMEDeleteProperty()
def AMEDeleteProperty
(
args,
kwargs
)
Deletes a AMEProperty object from the active circuit. Children of the deleted AMEProperty are not deleted. They are automatically detached and re-attached to the
active circuit.
AMEDeleteProperty(PyProperty)
First argument is the PyProperty object to delete.
ame_apy.AMEDeleteProperty(myProperty)
◆◆
AMEDetachProperty()
def AMEDetachProperty
(
args,
kwargs
)
Detaches a AMEProperty object from its current target. Once detached, the object is attached by default to the model. To be detached correctly, the property
name must be unique in the model scope.
AMEDetachProperty(PyProperty)
First argument is the PyProperty object to detach.
ame_apy.AMEDetachProperty(myProperty)
AMEDoesNeedCheckCircuitSubmodels()
◆◆
def AMEDoesNeedCheckCircuitSubmodels
(
args,
kwargs
)
Tells if the current active circuit needs an update. The model update assistant should be used when the circuit has been generated with a previous version of
Simcenter Amesim libraries.
Call AMECheckCircuitSubmodels to run the model update assistant non-interactively.
bool = AMEDoesNeedCheckCircuitSubmodels()
It returns True if the circuit has been created with an older version of Simcenter Amesim or 'AME API', False otherwise.
ame_apy.AMEDoesNeedCheckCircuitSubmodels()
False
AMEExpandGPGroup()
◆◆
def AMEExpandGPGroup
(
args,
kwargs
)
Expand the GP group
AMEExpandGPGroup(AMEGPGroupPtr)
First AMEGPGroupPtr argument is the GP group object This is optional. If not set,Expand all the groups inside a global param dialog
ame_apy.AMEExpandGPGroup(gp_group)
AMEFlipComponent()
◆◆
def AMEFlipComponent
(
args,
kwargs
)
Finds component from its alias path in the current active circuit then do a vertical flip of its icon.
AMEFlipComponent(string) AMEFlipComponent(AMECompLine)
The argument is either a string corresponding to the alias path of the component to flip, or an AMECompLine object.
ame_apy.AMEFlipComponent('Step_Generator')
◆◆
AMEGenerateCode()
def AMEGenerateCode
(
args,
kwargs
)
Generates and compiles the code for the current active circuit.
ame_apy.AMEGenerateCode()
◆◆
AMEGenerateFilesForFMI()
def AMEGenerateFilesForFMI
(
args,
kwargs
)
Generates files required for FMI export. It does first a 'write aux files'. AMEGenerateFilesForFMI((string, ...))
The required argument is a list of strings corresponding to platform types.
ame_apy.AMEGenerateFilesForFMI(['win32-gcc','win64-gcc','lnx_x64'])
AMEGenerateRealtimeFiles()
◆◆
def AMEGenerateRealtimeFiles
(
args,
kwargs
)
Generates files required for real-time export. It does first a 'write aux files'. Please note that this function requires a special license to use.
AMEGenerateRealtimeFiles(string[, (string, ...), (string, ...)])
The first (required) argument is a string corresponding to platform type. The second (optional) argument is a list of strings with parameters to access on target. The
third (optional) argument is a list of strings with variables to access on target. The second and third arguments can be useful as the API does not have access to
the watch lists for setting the observed variables. Note that if any watch lists has been set by the GUI they will be used.
ame_apy.AMEGenerateRealtimeFiles('dSpace : ds1005 : o50') ame_apy.AMEGenerateRealtimeFiles('dSpace : ds1006 :
o86') ame_apy.AMEGenerateRealtimeFiles('dSpace : ds1006 : o86',['k'],[output','p1])
AMEGetActiveCircuit()
◆◆
def AMEGetActiveCircuit
(
args,
kwargs
)
Gives the name of the current active circuit.
string = AMEGetActiveCircuit()
Returns the name of the current active circuit.
ame_apy.AMEGetActiveCircuit()
'my_new_system'
◆◆
AMEGetActiveCompiler()
def AMEGetActiveCompiler
(
args,
kwargs
)
Returns the compiler currently used in the circuit API
ame_apy.AMEGetActiveCompiler()
'ame_gcc64' is for compiling with GCC 64-bit. This is a default free compiler provided with Simcenter Amesim. 'ame_intel64' can be used if you have Intel C++
compiler 64-bit.
AMEGetAliasInfos()
◆◆
def AMEGetAliasInfos
(
args,
kwargs
)
Provides information about the component or the line having the given alias path in the current active circuit.
(string, string, string, int, string, string) = AMEGetAliasInfos(string)
String argument is the alias path of the component or line to check First returned string gives the type of element. It is 'ame_component', 'ame_line' or
'ame_alias_undefined'. Second returned string gives the icon name. Third returned string is the name of the submodel set to the component or the line. Fourth
returned int is the instance number of the submodel set to the component or the line. Fifth returned string is the directory the submodel belongs to. Sixth returned
string is the category name the component or line belongs to.
Note this string is None if the submodels dictionary has not been built when API was initialized. See help(ame_apy.AMEInitAPI)
ame_apy.AMEGetAliasInfos('step')
('ame_component', 'step', 'STEP0', -1, '$AME/submodels', 'ctrl')
AMEGetAliasTypes()
◆◆
def AMEGetAliasTypes
(
args,
kwargs
)
Gives the list of possible types for an alias.
ame_apy.AMEGetAliasTypes()
('ame_alias_undefined', 'ame_component', 'ame_line')
'ame_alias_undefined' is error case. We do not know if it is a component or a line. 'ame_component' is for component. 'ame_line' is for line.
AMEGetAPIVersion()
◆◆
def AMEGetAPIVersion
(
args,
kwargs
)
Provides API version information.
(string) = AMEGetAPIVersion()
The string is the complete release version string.
ame_apy.AMEGetAPIVersion()
('14 - 38823-34680 - 2014')
◆◆
AMEGetCategoryFiles()
def AMEGetCategoryFiles
(
args,
kwargs
)
Lists category files for category named category_name.
ame_apy.AMEGetCategoryFiles('tr')
(('$AME/libtr/Icons/tr.xbm', '$AME/libtr/Icons/tr.ico'), '$AME/libtr\AMEIcons')
AMEGetChildGPGroups()
◆◆
def AMEGetChildGPGroups
(
args,
kwargs
)
Returns the children GP group objects inside a GP group
(AMEGPGroupPtr, AMEGPGroupPtr ..) = AMEGetChildGPGroups(AMEGPGroupPtr)
First AMEGPGroupPtr argument is the GP group object This is optional. If not set,Returns all the GP groups at root level Returns the List of GP group objects
ame_apy.AMEGetChildGPGroups(gp_group)
◆◆
AMEGetChildGPs()
def AMEGetChildGPs
(
args,
kwargs
)
Returns the global parameter names inside a GP group
(string, string ..) = AMEGetChildGPs(AMEGPGroupPtr)
First AMEGPGroupPtr argument is the GP group object This is optional. If not set,Returns all the GPs at root level Returns the List of GP names
ame_apy.AMEGetChildGPs(gp_group)
◆◆
AMEGetCircuitAliasesList()
def AMEGetCircuitAliasesList
(
args,
kwargs
)
Gives the list of components and lines aliases in the current active circuit.
(string, ...) = AMEGetCircuitAliasesList()
The returned tuple contains the list of alias paths found in the active circuit
ame_apy.AMEGetCircuitAliasesList()
('zeroforcesource', 'step', 'springdamper01', 'linearxvfromxcon', 'Body', 'Wheel', 'elasticendstop', 'h2port')
AMEGetCircuitBoundingRect()
◆◆
def AMEGetCircuitBoundingRect
(
args,
kwargs
)
Calculates the minimum rectangle containing the current active circuit.
((int, int), (int, int)) = AMEGetCircuitBoundingRect()
The first couple of integers is the circuit's top_left corner coordinates given in pixels. The second couple of integers is the circuit's width and height given in pixels.
ame_apy.AMEGetCircuitBoundingRect()
((47, 12), (209, 391))
◆◆
AMEGetCircuitVersion()
def AMEGetCircuitVersion
(
args,
kwargs
)
Provides current active circuit's version information.
(int, int, int) = AMEGetCircuitVersion()
First int is major version number. Second int is medium version number. Third int is minimum version number.
ame_apy.AMEGetCircuitVersion()
(4, 3, 1)
AMEGetCommercialVersionName()
◆◆
def AMEGetCommercialVersionName
(
args,
kwargs
)
Provides API commercial version information.
(string) = AMEGetCommercialVersionName()
The string is commercial version string.
ame_apy.AMEGetCommercialVersionName()
('2019.2')
◆◆
AMEGetCompilers()
def AMEGetCompilers
(
args,
kwargs
)
Gives the list of compilers which can be used to compile systems.
ame_apy.AMEGetCompilers()
('ame_gcc64', 'ame_intel64')
'ame_gcc64' is for compiling with GCC 64-bit. This is a default free compiler provided with Simcenter Amesim. 'ame_intel64' can be used if you have Intel C++
compiler 64-bit.
AMEGetCompLine()
◆◆
def AMEGetCompLine
(
args,
kwargs
)
Returns a AMECompLine object representing a component or line of the current active circuit.
AMECompLine = AMEGetCompLine(string)
The argument is the alias path of the component or line.
ame_apy.AMEGetCompLine('signal01')
<ame_apy.AMECompLine object at 0xb7df2040>
◆◆
AMEGetComponentGeometry()
def AMEGetComponentGeometry
(
args,
kwargs
)
Finds the component from its alias path then gives its geometry.
((int, int), (int, int), ((int, int ), ...)) = AMEGetComponentGeometry(string)
((int, int), (int, int), ((int, int ), ...)) = AMEGetComponentGeometry(AMECompLine)
The argument is either a string corresponding to the alias path of the element to check, or an AMECompLine object. The returned tuple contains two couples of
integers which are the component top left coordinates and the component width and height in pixels. It also contains a tuple of int couples which are the port
coordinates of the component given in pixels. It returns an empty tuple in case there is no ports
ame_apy.AMEGetComponentGeometry('springdamper01')
((206, 116), (49, 49), ((230, 164), (230, 116)))
ame_apy.AMEGetComponentGeometry('runstats')
((432, 128), (47, 29), ())
AMEGetComponentIconTransformation()
◆◆
def AMEGetComponentIconTransformation
(
args,
kwargs
)
Returns the number of rotations and flip status of the icon of a component given the alias path.
(int, bool) = AMEGetComponentIconTransformation(string)
String argument is the alias path of the component. First returned int gives the number of rotations of the icon (in range [0, 3]). Second returned bool gives the flip
status of the icon. Note that the transformation of the icon is determined first by the number of rotations and then by the flip.
ame_apy.AMEGetComponentIconTransformation('step')
(2, True)
◆◆
AMEGetConnectionInfos()
def AMEGetConnectionInfos
(
args,
kwargs
)
This function returns both the alias and port number of the element that is connected to a given port of a given element.
(string, int) = AMEGetConnectionInfos(string, int) (string, int) = AMEGetConnectionInfos(PyCompLine, int)
The first argument identifies the component or line via its alias path or via a PyCompLine. The second argument is the port number, on the component or line, for
which information are needed. Port numbers start from zero. It returns a tuple containing the alias of the connected element and the port number of its connected
port.
AMEGetConnectionInfos('mass', 0) AMEGetConnectionInfos(ame_comp_line, 0)
('line', 0)
◆◆
AMEGetDependencies()
def AMEGetDependencies
(
args,
kwargs
)
Gets the dependencies of the queried submodel or model in a xml format. string = AMEGetDependencies(string,bool)
The first string argument is the full path of '*.ame' or '*.spe' Simcenter Amesim system file for which the dependencies have to be found. The second bool argument
sets the recursivity status. If it is set to False, then dependencies are found for only the model/submodel asked for. If it is set to True, then in case of models,
dependencies will be also found for the library submodel(s) used in the model. It will also find the dependencies of the other submodel(s) in the same category this
library submodel belong to. The API returns a string with dependencies in xml format.
xml_str = ame_apy.AMEGetDependencies('/home/injection_systems/injection_4.ame', False) xml_str_sub =
ame_apy.AMEGetDependencies('/home/mycat/submodels/SC_2.spe', True)
AMEGetEnumList()
◆◆
def AMEGetEnumList
(
args,
kwargs
)
Provides the enumeration string list for the given parameter alias path.
(string, ...) = AMEGetEnumList(string) The argument is a string corresponding to the path of the data under the form:
data_name@comp_alias_0.comp_alias_i.comp_alias_N, The returned tuple is the list of enumeration string for the given integer parameter
ame_apy.AMEGetEnumList('stiffmode')
('numerical value', 'geometrical value')
AMEGetErrorLevels()
◆◆
def AMEGetErrorLevels
(
args,
kwargs
)
Gives the list of possible values for the error level.
ame_apy.AMEGetErrorLevels()
('ame_info', 'ame_ok', 'ame_warning', 'ame_error', 'ame_fatal')
'ame_info' is for information level. The called function succeeded. Some information is provided. 'ame_ok' is for OK level. The called function succeeded.
'ame_warning' is for warning level. Something went wrong. Execution can continue anyway. 'ame_error' is for error level. The called function failed. API is still alive.
'ame_fatal' is for fatal level. The called function failed. API cannot continue.
AMEGetExperimentNamesList()
◆◆
def AMEGetExperimentNamesList
(
args,
kwargs
)
Returns a list of names of experiments in the circuit..
(string, ...) = AMEGetExperimentNamesList()
ame_apy.AMEGetExperimentNamesList()
('exp_1', 'exp_2', 'exp_3')
AMEGetFixedIntegratorMethods()
◆◆
def AMEGetFixedIntegratorMethods
(
args,
kwargs
)
Gives the list of possible fixed step integration methods .
ame_apy.AMEGetFixedIntegratorMethods()
('ame_adams_bashforth', 'ame_euler', 'ame_runge_kutta')
'ame_adams_bashforth' is for Adams-Bashforth method. 'ame_euler' is for Euler method. 'ame_runge_kutta' is for Runge-Kutta method.
AMEGetGlobalParameterNames()
◆◆
def AMEGetGlobalParameterNames
(
args,
kwargs
)
Returns names of Global Parameters in the active circuit
(string, string ..) = AMEGetGlobalParameterNames()
ame_apy.AMEGetGlobalParameterNames()
('textpar', 'realpar')
AMEGetGlobalParameterUniqueName()
◆◆
def AMEGetGlobalParameterUniqueName
(
args,
kwargs
)
Gives the unique name of a global parameter local to a supercomponent or the name of a global to system parameter.
(string ) = AMEGetGlobalParameterUniqueName(string) (string ) = AMEGetGlobalParameterUniqueName(AMEParVar)
The argument is either a string corresponding to the path of the parameter given under the form: parameter_name@comp_alias_0.comp_alias_i.comp_alias_N, or
an AMEParVar object corresponding to the parameter, as returned by AMEGetParVar or an AMEParVarIteration. It returns a string. The returned string is the
global parameter unique name.
ame_apy.AMEGetGlobalParameterUniqueName('force0')
('force0__SC_1')
AMEGetGlobalParameterValue()
◆◆
def AMEGetGlobalParameterValue
(
args,
kwargs
)
Finds then gives the value of global parameter in the current active circuit.
(string, string) = AMEGetGlobalParameterValue(string[, string])
The first string argument is the unique name of the global parameter. The second optional string argument is the extension of the global parameter file to read, for
batch runs. If "active" (the default), the value that is planned to be used for the next standard run will be returned. If the empty string (""), the value used to perform
the last standard run will be returned. If it is a non-empty string (e.g. "2") then the value of results set with the given name will be used (e.g. the value used to
perform batch run "2"). It returns a tuple containing the global parameter value and the unit in which the value is expressed. For a text or an integer global
parameter, this is None.
ame_apy.AMEGetGlobalParameterValue('p_diameter')
('92.2', 'mm')
◆◆
AMEGetGPGroupLocation()
def AMEGetGPGroupLocation
(
args,
kwargs
)
Returns the GP group location inside a global param dialog
(AMEGPGroupPtr,int) = AMEGetGPGroupLocation(string)
First string argument is the GP group name Returns the parent GP group object and position at python tuple
ame_apy.AMEGetGPGroupLocation(gp_group)
◆◆
AMEGetGPGroupName()
def AMEGetGPGroupName
(
args,
kwargs
)
Returns the GP group name
string = AMEGetGPGroupName(AMEGPGroupPtr)
First AMEGPGroupPtr argument is the GP group object Returns the group name as string
ame_apy.AMEGetGPGroupName(gp_group)
◆◆
AMEGetGPLocation()
def AMEGetGPLocation
(
args,
kwargs
)
Returns the GP location inside a global param dialog
(AMEGPGroupPtr,int) = AMEGetGPLocation(string)
First string argument is the unique name for global parameter. Returns the parent GP group object and position at python tuple
ame_apy.AMEGetGPLocation('gp_name')
◆◆
AMEGetHistoryItems()
def AMEGetHistoryItems
(
args,
kwargs
)
Returns the AMEHistoryItem objects collection of the active model.
(PyHistoryItem, ...) = AMEGetHistoryItems()
It returns the collection of PyHistoryItem objects.
ame_apy.AMEGetHistoryItems()
(<ame_apy.AMEHistoryItem object at 0x01EFD0F0>, <ame_apy.AMEHistoryItem object at 0x01EFD110>)
AMEGetHistoryItemValue()
◆◆
def AMEGetHistoryItemValue
(
args,
kwargs
)
Gets the history item value for the given 'history_item_type'. The history item type is one of AMEHistoryItemValueType enumeration:
ame_history_item_author
ame_history_item_date
ame_history_item_comment
string = AMEGetHistoryItemValue(PyHistoryItem, AMEHistoryItemValueType)
First argument is the PyHistoryItem object to get the value. The second argument is the history item type. It returns the PyHistoryItemValue value.
ame_apy.AMEGetHistoryItemValue(myHistoryItem, ame_history_item_author)
'Myself'
◆◆
AMEGetIntegratorErrorTypes()
def AMEGetIntegratorErrorTypes
(
args,
kwargs
)
Gives the list of possible error types used in standard integrator .
ame_apy.AMEGetIntegratorErrorTypes()
('ame_mixed', 'ame_relative', 'ame_absolute')
'ame_mixed' is for mixed errors. 'ame_relative' is for relative errors. 'ame_absolute' is for absolute errors.
◆◆
AMEGetIntegrators()
def AMEGetIntegrators
(
args,
kwargs
)
Gives the list of possible values for integrator type for simulation.
ame_apy.AMEGetIntegrators()
('ame_standard_integ', 'ame_fixed_step_integ')
'ame_standard_integ' is for standard Simcenter Amesim integration method. 'ame_fixed_step_integ' is for fixed step integrator.
AMEGetInterfaceInputsOutputsForModel()
◆◆
def AMEGetInterfaceInputsOutputsForModel
(
args,
kwargs
)
Returns a tuple of two lists with names of interface variables set in the active circuit. First element is the inputs to the Simcenter Amesim model, the second is the
outputs.
(inputs_to_model,outputs_from_model) = AMEGetInterfaceInputsOutputsForModel()
inputs, outputs = ame_apy.AMEGetInterfaceInputsOutputsForModel()
◆◆
AMEGetInterfaceTypeForModel()
def AMEGetInterfaceTypeForModel
(
args,
kwargs
)
Returns name of current interface set in the active circuit. If no interface blocks present - returns empty string. Typical values : 'simulink', 'simulink_cosim',
'user_cosim', 'adams', 'adams_cosim', 'virtual_lab_motion', 'virtual_lab_motion_cosim' ...
string = AMEGetInterfaceTypeForModel()
interfacetype = ame_apy.AMEGetInterfaceTypeForModel()
◆◆
AMEGetLibraryBinaryFiles()
def AMEGetLibraryBinaryFiles
(
args,
kwargs
)
Lists library binary files in the library whose node is given as an input.
ame_apy.AMEGetLibraryBinaryFiles('$AME/libhydr')
('$AME/libhydr/lib/ds1006/HYDR.lib', '$AME/libhydr/lib/lnx/libHYDR.a', '$AME/libhydr/lib/lnx_intel/libHYDR.a', '$AME/libhydr/lib/win32/HYDR.lib',
'$AME/libhydr/lib/win32-gcc/HYDR.lib', '$AME/libhydr/lib/win32_intel/HYDR.lib', '$AME/libhydr/lib/win64/HYDR.lib', '$AME/libhydr/lib/xpc/HYDR.lib')
◆◆
AMEGetLibraryCategories()
def AMEGetLibraryCategories
(
args,
kwargs
)
Lists categories in the library path lib_node_path. Contents of the returned dictionary: keys = category names, values = category descriptions.
{string: string, ...} = AMEGetLibraryCategories(string)
ame_apy.AMEGetLibraryCategories('$AME/libhydr')
{'hydr': 'Hydraulic'}
◆◆
AMEGetLibraryDocFiles()
def AMEGetLibraryDocFiles
(
args,
kwargs
)
Lists library documentation files in the library whose node is given as an input.
ame_apy.AMEGetLibraryDocFiles('$AME/libhydr')
('$AME/libhydr/doc/pdf/lib_hydraulic.pdf',)
AMEGetLibraryExtraDataFiles()
◆◆
def AMEGetLibraryExtraDataFiles
(
args,
kwargs
)
Lists library data files in the library whose node is given as an input.
ame_apy.AMEGetLibraryExtraDataFiles('$AME/libhydr')
('$AME/libhydr/data/dV_P.data', '$AME/libhydr/data/hyd_15W30_Bs.data', '$AME/libhydr/data/hyd_15W30_Bt.data', '$AME/libhydr/data/hyd_15W40_Bs.data',
'$AME/libhydr/data/hyd_15W40_Bt.data', '$AME/libhydr/data/hyd_cool_EG20_W80_Bs.data', '$AME/libhydr/data/hyd_cool_EG20_W80_B, ....)
AMEGetLibraryIconGeometry()
◆◆
def AMEGetLibraryIconGeometry
(
args,
kwargs
)
Provides the geometrical details for the given icon name.
((int,int), ((int,int), ...)) = AMEGetLibraryIconGeometry(string) The argument is a string corresponding to the name of icon.
The returned a tuple contain a couple of int and tuple of int couple. First one is the couple of integer which is width and height of icon. Second one is the tuple of int
couple which are port coordinates.
ame_apy.AMEGetLibraryIconGeometry('mass_friction_endsstops')
((49, 49), ((49, 25), (1, 25)))
ame_apy.AMEGetLibraryIconGeometry('gravityicon')
((39, 39), ())
◆◆
AMEGetLibraryMakeFiles()
def AMEGetLibraryMakeFiles
(
args,
kwargs
)
Lists files provided from library for compiling models that use this library. First of them is the AME.make file.
ame_apy.AMEGetLibraryMakeFiles('$AME/libhydr')
('$AME/libhydr/AME.make', '$AME/libhydr/lib/ds1006/HYDR.lib', '$AME/libhydr/lib/lnx/libHYDR.a', '$AME/libhydr/lib/lnx_intel/libHYDR.a',
'$AME/libhydr/lib/win32/HYDR.lib', '$AME/libhydr/lib/win32-gcc/HYDR.lib', '$AME/libhydr/lib/win32_intel/HYDR.lib', '$AME/libhydr/lib/win64/HYDR.lib',
'$AME/libhydr/lib/xpc/HYDR.lib')
◆◆
AMEGetLibrarySubmodels()
def AMEGetLibrarySubmodels
(
args,
kwargs
)
Lists the submodel names in the given library node path.
AMEGetLibrarySubmodels(string, [bool]) First argument is the library node path string; this is the path of the directory containing the submodels.index. Second
argument is a boolean controlling whether the returned output should contain the obsolete submodels or not; it is optional and defaults to True. The returned value
is a tuple of two elements: -the first element is a string list containing the submodel names in this library node -the second element is the absolute directory path
where the submodel files are located
ame_apy.AMEGetLibrarySubmodels('$AME/libsig')
(('CD000', 'CD001', 'CD002', 'CHRONO0', 'CLOC', 'CONS0', ...), 'C:/Siemens/amesim/v2020/Amesim/libsig/submodels')
ame_apy.AMEGetLibrarySubmodels('$AME/libsig', False)
(('CD001', 'CD002', 'CHRONO0', 'CLOC', 'CONS0', ...), 'C:/Siemens/amesim/v2020/Amesim/libsig/submodels')
AMEGetLineGeometry()
◆◆
def AMEGetLineGeometry
(
args,
kwargs
)
Finds the line from its alias path then gives its geometry.
((int, int), (int, int), ((int, int ), ...)) = AMEGetLineGeometry(string)
((int, int), (int, int), ((int, int ), ...)) = AMEGetLineGeometry(AMECompLine)
The argument is either a string corresponding to the alias path of the line to check, or an AMECompLine object. The returned tuple contains two couples of integers
which are the x and y co-ordinates of the line positions.
ame_apy.AMEGetLineGeometry('pneumatic_4')
((206, 116), (49, 49), ((230, 164), (230, 116)))
◆◆
AMEGetNumberOfPorts()
def AMEGetNumberOfPorts
(
args,
kwargs
)
Returns the number of ports of a component or line.
int = AMEGetNumberOfPorts(string) int = AMEGetNumberOfPorts(AMECompLine)
The argument is either a string corresponding to the alias path of the element to check, or an AMECompLine object.
AMEGetNumberOfPorts("elect01")
2
AMEGetOpenedCircuitsList()
◆◆
def AMEGetOpenedCircuitsList
(
args,
kwargs
)
Gives the list of opened circuit names.
(string, ...) = AMEGetOpenedCircuitsList()
The returned tuple is the list of opened circuits
ame_apy.AMEGetOpenedCircuitsList()
('my_new_system', 'injection_4', 'injection_3')
◆◆
AMEGetParameterDefaultValue()
def AMEGetParameterDefaultValue
(
args,
kwargs
)
Provides default value of a parameter which belongs the current active circuit.
(string) = AMEGetParameterDefaultValue(string) (string) = AMEGetParameterDefaultValue(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. It returns a tuple containing one string which represents the default value
ame_apy.AMEGetParameterDefaultValue('rp9')
('0')
◆◆
AMEGetParameterInfos()
def AMEGetParameterInfos
(
args,
kwargs
)
Provides basic information about a parameter which belongs to the current active circuit.
(string, string, string) = AMEGetParameterInfos(string) (string, string, string) = AMEGetParameterInfos(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. It returns a tuple containing three strings. First one is the parameter type. It can be 'ame_real_parameter', 'ame_integer_parameter', 'ame_text_parameter' or
'ame_parameter_undefined'. Second one is the parameter title. Third one is the parameter Unit
ame_apy.AMEGetParameterInfos('rp9')
('ame_real_parameter', 'diameter of pipe', 'null')
AMEGetParameterMaximumValue()
◆◆
def AMEGetParameterMaximumValue
(
args,
kwargs
)
Provides maximum value of a parameter which belongs the current active circuit.
(string) = AMEGetParameterMaximumValue(string) (string) = AMEGetParameterMaximumValue(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. It returns a tuple containing one string which represents the maximum value
ame_apy.AMEGetParameterMaximumValue('rp9')
('1e+06')
AMEGetParameterMinimumValue()
◆◆
def AMEGetParameterMinimumValue
(
args,
kwargs
)
Provides minimum value of a parameter which belongs the current active circuit.
(string) = AMEGetParameterMinimumValue(string) (string) = AMEGetParameterMinimumValue(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. It returns a tuple containing one string which represent the minimum value
ame_apy.AMEGetParameterMinimumValue('rp9')
('-1e+06')
AMEGetParameterTypes()
◆◆
def AMEGetParameterTypes
(
args,
kwargs
)
Gives the list of possible types for a parameter.
ame_apy.AMEGetParameterTypes()
('ame_parameter_undefined', 'ame_real_parameter', 'ame_integer_parameter', 'ame_text_parameter')
'ame_parameter_undefined' is an error case. We do not know the parameter type. 'ame_real_parameter' is for real parameter. 'ame_integer_parameter' is for integer
parameter. 'ame_text_parameter' is for text parameter.
AMEGetParameterValue()
◆◆
def AMEGetParameterValue
(
args,
kwargs
)
Finds a parameter (or state variable) in the current active circuit, then gives its value (or initial value).
(string, string ) = AMEGetParameterValue(string) (string, string ) = AMEGetParameterValue(AMEParVar)
The argument is either a string corresponding to the path of the parameter given under the form: parameter_name@comp_alias_0.comp_alias_i.comp_alias_N, or
an AMEParVar object corresponding to the parameter, as returned by AMEGetParVar or an AMEParVarIteration. It returns a tuple containing two strings. First
returned string is the parameter value. Second returned string is unit in which the value is expressed. This is None for text or integer parameter
ame_apy.AMEGetParameterValue('force0')
('1.96200000000000e+003', 'N')
AMEGetParVar()
◆◆
def AMEGetParVar
(
args,
kwargs
)
Returns a AMEParVar object representing a parameter or variable of the current active circuit.
AMEParVar = AMEGetParVar(string)
The argument is the data path of the parameter or variable.
AMEGetParVar('out')
<ame_apy.AMEParVar object at 0xb7c7d040>
◆◆
AMEGetPathsList()
def AMEGetPathsList
(
args,
kwargs
)
Gives the ordered search paths list used in the whole API.
(string, ...) = ame_apy.AMEGetPathsList()
The returned tuple contains the list of set search paths list.
ame_apy.AMEGetPathsList()
('$AME', '$AME/libhydr', '$AME/libdp', '$AME/libhcd', '$AME/libhr', '$AME/libpn', '$AME/libpcd', '$AME/libth', '$AME/libthh', '$AME/libthp', '$AME/libthcd',
'$AME/libtr', '$AME/libfi', '$AME/libcs', '$AME/libem', '$AME/libtpf', '$AME/libac', '$AME/libemd', '$AME/libdrv', '$AME/libeng', '$AME/libexh', '$AME/libplm',
'D:/AMETest/libcs', 'D:/AMETest')
◆◆
AMEGetPortInfos()
def AMEGetPortInfos
(
args,
kwargs
)
Returns both the port number and the alias path of the supercomponent that owns the port with the given name. Note: returns the first occurrence found.
[string, int] = AMEGetPortInfos(string)
The argument is the name of the port.
ame_apy.AMEGetPortInfos('port_name')
['super_component_1', 0]
AMEGetPortName()
◆◆
def AMEGetPortName
(
args,
kwargs
)
Returns the port name of a supercomponent port.
string = AMEGetPortName(string, int) string = AMEGetPortName(PyCompLine, int)
The first argument identifies the supercomponent via its alias path or via a PyCompLine. The second argument is the port number of the supercomponent port.
ame_apy.AMEGetPortName('alias_path', 0)
'port_name_1'
ame_apy.AMEGetPortName(ame_comp_line, 0)
'port_name_1'
◆◆
AMEGetPortName2()
def AMEGetPortName2
(
args,
kwargs
)
Returns the port name of a supercomponent port. Same as AMEGetPortName, except it works with a PyPort.
string = AMEGetPortName2(PyPort)
The argument is a PyPort object, returned by AMEComponentPortIteration.
AMEGetPortName2(ame_port)
'port_name'
AMEGetPortPosition()
◆◆
def AMEGetPortPosition
(
args,
kwargs
)
Returns the position of a component port, in the coordinate system of the active circuit.
[int, int] = AMEGetPortPosition(string, int) [int, int] = AMEGetPortPosition(PyCompLine, int)
The first argument identifies the component that owns the port via its alias path or via a PyCompLine. The second argument is the port number of the port.
ame_apy.AMEGetPortPosition('component_alias', 0)
[42, 88]
AMEGetPortType()
◆◆
def AMEGetPortType
(
args,
kwargs
)
Returns the type of a port from a component or line.
string = AMEGetPortType(string, int) string = AMEGetPortType(AMECompLine, int)
The first argument can be the alias path of a component or line, or an AMECompLine object. The second argument is the port index (starting from 0). The returned
string indicates the port type.
AMEGetPortType('ramp', 0)
'signal'
◆◆
AMEGetProperties()
def AMEGetProperties
(
args,
kwargs
)
Returns the AMEProperty object collection corresponding to the given source object. This source object type can be one of AMEPropertyUrlType:
ame_property_url_type_all: Return the entire property collection of the system. No other arguments are needed.
ame_property_url_type_model: Returns a collection of properties attached to the active model.
ame_property_url_type_compline: Returns a collection of properties attached to the given Component or Line. Component or Line is identified through its alias
name.
ame_property_url_type_experiment: Returns a collection of properties attached to the given Experiment. Experiment is identified through its name.
ame_property_url_type_group: Returns a collection of properties attached to the given property group. Property group is identified through its name. If different
property group with the same name exists in the active model, it returns the properties attached to the different groups.
ame_property_url_type_property: Returns a collection of properties object corresponding to the given name. This is generally one object. But if different property
with the same name exists in the active model, it returns all the property objects.
(PyProperty, ...) = AMEGetProperties([AMEPropertyUrlType[, string]])
First argument (optional) is the object type we want to collect the attached parameters from. If the type of object requires a name/alias to be given, then it should
be passed as second argument. It returns a tuple of PyProperties.
ame_apy.AMEGetProperties(ame_property_url_type_compline, 'mass_friction1port_2')
(<ame_apy.AMEProperty object at 0x0200F100>,)
AMEGetPropertyName()
◆◆
def AMEGetPropertyName
(
args,
kwargs
)
Gets the AMEProperty object name.
string = AMEGetPropertyName(PyProperty)
First argument is the PyProperty object to get the name. Returns the property name.
ame_apy.AMEGetPropertyName(myProperty)
'New Name'
AMEGetPropertyType()
◆◆
def AMEGetPropertyType
(
args,
kwargs
)
Gets the AMEProperty object type. The object type is one of AMEPropertyType enumeration.
ame_property_type_number
ame_property_type_text
ame_property_type_rich_text
ame_property_type_date
ame_property_type_file_link
ame_property_type_file_attached
ame_property_type_image
ame_property_type_enum
ame_property_type_group
AMEPropertyType = AMEGetPropertyType(PyProperty)
First argument is the PyProperty object to get the type. Returns the property type.
ame_apy.AMEGetPropertyType(myProperty)
2
AMEGetPropertyValue()
◆◆
def AMEGetPropertyValue
(
args,
kwargs
)
Gets the value associated to a AMEProperty object. For an AMEProperty object of type ame_property_type_enum, the returned value is the user selected value in
the enumeration list.
string = AMEGetPropertyValue(PyProperty)
First argument is the PyProperty object to get the value. It returns the property string value.
ame_apy.AMEGetPropertyValue(myProperty)
'My content'
AMEGetPropertyValues()
◆◆
def AMEGetPropertyValues
(
args,
kwargs
)
Gets a collection of values associated to given AMEProperty object.
The returned collection for properties of type 'ame_property_type_number', 'ame_property_type_text', 'ame_property_type_rich_text', 'ame_property_type_date',
'ame_property_type_file_link', 'ame_property_type_file_attached', 'ame_property_type_image', 'ame_property_type_group' contains a single value.
The returned collection for properties of type 'ame_property_type_enum' contains multiple values.
(string, ...) = AMEGetPropertyValues(PyProperty)
First argument is the PyProperty object to collect values. It returns a tuple of strings.
ame_apy.AMEGetPropertyValues(myProperty)
('Yes', 'No', 'Maybe')
AMEGetResultsFilesList()
◆◆
def AMEGetResultsFilesList
(
args,
kwargs
)
Gives the list of available results file for the current active circuit. For circuit named circuit_name, if circuit_name_.results, circuit_name_.results2 files are found.
Then the extension list contains ('0', '2').
(string, ...) = AMEGetResultsFilesList()
It returns a tuple containing list of file extensions of results files available for the current circuit. For example if for circuit named 'circuit_name',
'circuit_name_.results' and 'circuit_name_.results.2' are available, it returns: ('', '2').
ame_apy.AMEGetResultsFilesList()
('', '1', '2', '3', '4')
AMEGetRunParameter()
◆◆
def AMEGetRunParameter
(
args,
kwargs
)
Provides the value of one simulation parameter of the current active circuit.
string = AMEGetRunParameter(string)
The string argument identifies the parameter to get. The return value is a string encoding the value, or None if the parameter identifier is unknown. The available
simulation parameters, and the corresponding return value format are:
'start_time_s': simulation start time in seconds. Floating-point number as a string.
'stop_time_s': simulation stop time in seconds. Floating-point number as a string.
'interval_s': simulation communication interval in seconds. Floating-point number as a string.
'integ_method': integration method. "0" for standard integrator. "1" for fixed step integrator.
'fixed_step_s': fixed step time in seconds. Available with fixed step integrator only. Floating-point number as a string.
'fixed_integ_method': fixed step time integration method. "0" for Adams-Bashforth and Euler. "2" for Runge-Kutta. See 'fixed_order' for differentiating between
Adams-Bashforth and Euler.
'fixed_order': order to use for Adams-Bashforth or Runge-Kutta fixed step integration method. This is a integer value: 2 <= fixed_order <= 4, encoded as a string. If
'fixed_integ_method' is Adams-Bashforth and the order is "1", then the integration method is in fact Euler.
'max_time_step_s': maximum simulation time step in seconds. Available with standard integrator only. Floating-point number as a string.
'tolerance_s': tolerance for convergence test in seconds. Available with standard integrator only. Floating-point number as a string. Legacy parameter.
'tolerance': tolerance for convergence test. Available with standard integrator only. Floating-point number as a string.
'error_type': standard integration errortype. "0" for mixed error. "1" for relative error. "2" for absolute error.
'solver_type': standard integration accuracy level. "0" for standard solver. "1" for cautious solver.
'disable_optimized_solver': enable/disable optimized server. "1" for disabled, "0" for enabled.
'minimal_discontinuity_handling': enable/disable the minimal discontinuity handling. "0" for disabled, "1" for enabled.
'simulation_mode': simulation mode. "1" for stabilizing run. "2" for dynamic run. "3" for stabilizing run followed by dynamic run.
'discontinuity_printout': enable/disable discontinuity printout. This is a dynamic run option. "0" for disabled, "1" for enabled.
'activity_calculation': enable/disable activity index calculation for dynamic run. "0" for disabled, "1" for enabled.
'power_calculation': enable/disable power calculation for dynamic run. "0" for disabled, "1" for enabled.
'energy_calculation': enable/disable energy calculation for dynamic run. "0" for disabled, "1" for enabled.
'hold_inputs_constant': enable/disable the hold inputs constant dynamic run option. "0" for disabled, "1" for enabled.
'lock_non_propagating_state': lock/unlock non propagating states for stabilizing run. "0" for disabled, "1" for enabled.
'diagnotics': enable/disable stabilizing run diagnostics. "0" for disabled, "1" for enabled.
'run_type': run type. "0" for single run, "1" for batch.
'continuation_run': continuation run option status. "0" for disabled, "1" for enabled.
The encoding of floating-point numbers as strings is the one given by the C 'printf' function with the %25.14e format. It should be compatible with the float() Python
builtin.
ame_apy.AMEGetRunParameter('stop_time_s')
'1.80000000000000e+001'
◆◆
AMEGetSimulationModes()
def AMEGetSimulationModes
(
args,
kwargs
)
Gives the list of possible simulation modes. With dynamic standard solver it will advance the solution through time. With stabilizing, it attempts to find an
equilibrium state for the model. For both it does a stabilizing run followed by dynamic one.
ame_apy.AMEGetSimulationModes()
('ame_stabilazing', 'ame_dynamic', 'ame_stabilizing_dynamic')
'ame_stabilazing' is for stabilizing run. 'ame_dynamic' is for dynamic run. 'ame_stabilizing_dynamic' is for stabilizing run followed by dynamic one.
AMEGetSolverTypes()
◆◆
def AMEGetSolverTypes
(
args,
kwargs
)
Gives the list of possible levels of accuracy of the standard integrator.
ame_apy.AMEGetSolverTypes()
('ame_standard_solver', 'ame_cautious_solver')
'ame_standard_solver' is for standard solver accuracy. 'ame_cautious_solver' is for cautious solver.
AMEGetStartersList()
◆◆
def AMEGetStartersList
(
args,
kwargs
)
Provides the list of available starters. Starters are list of template systems. They are stores in a 'starters' directory. You can change/add the 'starters' directory from
Simcenter Amesim preferences.
(string, ...) = AMEGetStartersList()
The returned tuple contains the list of Simcenter Amesim starters systems.
ame_apy.AMEGetStartersList()
('$AME/libhydr/starters/libhydr.amt', '$AME/libhcd/starters/libhcd.amt', '$AME/libhr/starters/libhr.amt', '$AME/libpn/starters/libpn.amt',
'$AME/libpcd/starters/libpcd.amt', '$AME/libth/starters/libth.amt', '$AME/libthh/starters/libthh.amt', '$AME/libthp/starters/libthp.amt',
'$AME/libthcd/starters/libthcd.amt', '$AME/libtr/starters/libtr.amt', '$AME/libfi/starters/libfi.amt', '$AME/libcs/starters/libcs.amt', '$AME/libem/starters/libem.amt',
'$AME/libtpf/starters/libtpf.amt', '$AME/libeng/starters/libeng.amt', '$AME/libexh/starters/libexh.amt')
AMEGetSubmodelFiles()
◆◆
def AMEGetSubmodelFiles
(
args,
kwargs
)
Lists submodel files for submodel named submodel_name. First file of the list is the main submodel file: submodel_name.spe. ((string file1, ...), string index_file) =
AMEGetSubmodelFiles(string)
ame_apy.AMEGetSubmodelFiles('SC_2')
(('/home/mycat/submodels/SC_2.spe', '/home/mycat/submodels/SC_2.des.tmp', /home/mycat/submodels/SC_2.sub'), '/home/mycat/submodels.index')
AMEGetSubmodelVersion()
◆◆
def AMEGetSubmodelVersion
(
args,
kwargs
)
Provides version information for the given submodel file.
(int, int, int) = AMEGetSubmodelVersion(string)
First int is major version number. Second int is medium version number. Third int is minimum version number.
ame_apy.AMEGetSubmodelVersion('/home/mycat/submodels/SC_2.spe')
(14, 2, 1)
◆◆
AMEGetSupercomponentGlobalParameterNames()
def AMEGetSupercomponentGlobalParameterNames
(
args,
kwargs
)
Returns names of Global Parameters inside the super component in the active circuit.
(string, string ..) = AMEGetSupercomponentGlobalParameterNames(string)
ame_apy.AMEGetSupercomponentGlobalParameterNames('mySC')
('newIntPar', 'newRealPar')
◆◆
AMEGetUserLibraries()
def AMEGetUserLibraries
(
args,
kwargs
)
List user libraries. User libraries are the libraries registered in the paths list which are not in Simcenter Amesim installation directory. (string, ...) =
AMEGetUserLibraries()
The returned tuple contains the list of user libraries.
ame_apy.AMEGetUserLibraries()
('$AME\AMETest', '$AME\AMETest\123\submodels', '$AME\mycat')
AMEGetVariableFinalValue()
◆◆
def AMEGetVariableFinalValue
(
args,
kwargs
)
Reads the last variable value from the specified results file in the current active circuit.
(double, double) = AMEGetVariableFinalValue(string, string) (double, double) = AMEGetVariableFinalValue(AMEParVar, string)
First argument is either a string corresponding to the path of the variable, or an AMEParVar object, as returned by AMEGetParVar or an AMEParVarIteration.
Second string argument is the extension of the results file to read. By default it reads the 'circuit_name_.results' file, where 'circuit_name' is the name of the active
circuit. Set it to '2' if you wish to read 'circuit_name_.results.2' results file. It returns tuple containing the last time value and the last variable value.
ame_apy.AMEGetVariableFinalValue('press', '2')
(1000.0000000000001, 898.34208625924987)
AMEGetVariableInfos()
◆◆
def AMEGetVariableInfos
(
args,
kwargs
)
Provides basic information about a variable which belongs the current active circuit.
(int, string, string, string, string, string, string) = AMEGetVariableInfos(string) (int, string, string, string, string, string, string) = AMEGetVariableInfos(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. It returns a tuple containing an integer and six strings. First tuple element is the variable dimension. 1 <= dimension <= N The second element is the
variable type. It can be 'ame_basic_variable', 'ame_state_variable', or 'ame_variable_undefined'. Third one is the variable title. Fourth one is the unit of the variable.
Fifth one represents the Input/Output type for an external variable:
ame_variable_io_input: Input variable
ame_variable_io_output: Output variable
ame_variable_io_invalid: Not an External variable
Sixth one represents the Input Variable Type for a variable:
ame_variable_input_default: Input variable with default value
ame_variable_input_unused: Unused input variable
ame_variable_input_none: may be simple input var, or not a input var at all
Seventh one is the external variable bus usage:
ame_variable_used: variable is provided to the bus and consumed by at least one selector
ame_variable_unused: variable is provided to the bus and not consumed by any selector
ame_variable_missing: variable is consumed by a selector but not provided by any bus creator
ame_variable_usage_unknown: variable not found as an external variable
ame_apy.AMEGetVariableInfos('p1')
(1, 'ame_state_variable', 'pressure at port 1', 'bar', 'ame_variable_io_output', 'ame_variable_input_none', 'ame_variable_used')
ame_apy.AMEGetVariableInfos('pn_5')
(5, 'ame_state_variable', 'pressure at internal node', 'bar', 'ame_variable_io_invalid', 'ame_variable_input_none', 'ame_variable_usage_unknown')
◆◆
AMEGetVariableTypes()
def AMEGetVariableTypes
(
args,
kwargs
)
Gives the list of possible types for a variable.
ame_apy.AMEGetVariableTypes()
('ame_variable_undefined', 'ame_basic_variable', 'ame_state_variable')
'ame_variable_undefined' is an error case. We do not know the variable type. 'ame_basic_variable' is for non state variable. 'ame_state_variable' is for variable which
has an initial value.
AMEGetVariableValues()
◆◆
def AMEGetVariableValues
(
args,
kwargs
)
Reads the variable or tunable parameter values from the specified result file of the current active circuit.
((double, double), ...) = AMEGetVariableValues(string, string) ((double, double), ...) = AMEGetVariableValues(AMEParVar, string)
First argument is either a string corresponding to the path of the variable or tunable parameter, or an AMEParVar object, as returned by AMEGetParVar or an
AMEParVarIteration. Second string argument is the extension of the results file to read. By default it reads the 'circuit_name_.results' file, where 'circuit_name' is
the name of the active circuit. Set it to '2' if you wish to read 'circuit_name_.results.2' results file. It returns tuple containing couples times, values.
ame_apy.AMEGetVariableValues('press')
((0.0, 9.2350599537811156e-005), (100.00000000000023, 9.0267566515905919), (200.00000000000045, 37.182831099831255), (300.00000000000068,
84.014292131376521), (400.00000000000091, 149.32977089654025), (500.00000000000114, 232.67311255595379), (600.00000000000136, 333.48061740306184),
(700.00000000000159, 451.12132055729285), (800.00000000000182, 584.95112810520152), (900.00000000000205, 734.28997366879526), (1000.0,
898.42224851630579))
AMEInitAPI()
◆◆
def AMEInitAPI
(
args,
kwargs
)
Sets up the API. This must be called before doing anything else. It takes a Simcenter Amesim license token until AMECloseAPI has been called.
AMEInitAPI()
ame_apy.AMEInitAPI()
AMEIsCircuitOpened()
◆◆
def AMEIsCircuitOpened
(
args,
kwargs
)
Tells if the given circuit is opened.
bool = AMEIsCircuitOpened(string)
The string argument is the name of the circuit being checked. It returns True if the circuit is opened. False otherwise.
ame_apy.AMEIsCircuitOpened('my_new_system')
True
◆◆
AMEIsComponent()
def AMEIsComponent
(
args,
kwargs
)
Finds an element from this alias path in the current active circuit then tells if it is a component.
bool = AMEIsComponent(string) bool = AMEIsComponent(AMECompLine)
The argument is either a string corresponding to the alias path of the element to check, or an AMECompLine object. It returns True if the checked element is a
component, False otherwise.
ame_apy.AMEIsComponent('step')
True
AMEIsCryptedSubmodel()
◆◆
def AMEIsCryptedSubmodel
(
args,
kwargs
)
Returns True if the checked submodel is encrypted. False otherwise.
bool = AMEIsCryptedSubmodel(string[, string])
First string argument is the name of the checked submodel. Second string argument is the directory where the checked submodel resides. This is optional. By
default, directory is fetched from paths list. See help(ame_apy.AMEIniAPI). It returns bool
ame_apy.AMEIsCryptedSubmodel('CSTHF01', '$AME/libcs/submodels')
False
AMEIsCustomizedSubmodel()
◆◆
def AMEIsCustomizedSubmodel
(
args,
kwargs
)
Returns True if the checked submodel is a customized. False otherwise.
bool = AMEIsCustomizedSubmodel(string[, string])
First string argument is the name of the checked submodel. Second string argument is the directory where the checked submodel resides. This is optional. By
default, directory is fetched from paths list. See help(ame_apy.AMEIniAPI). It returns bool
ame_apy.AMEIsCustomizedSubmodel('CSTHF01', '$AME/libcs/submodels')
True
◆◆
AMEIsLibraryAccessible()
def AMEIsLibraryAccessible
(
args,
kwargs
)
Tells whether the library can be accessed considering license availability.
bool = AMEIsLibraryAccessible(string)
The string argument is the path of the library to be checked. It returns true, if the library is present in the paths list and license is available to use the library
ame_apy.AMEIsLibraryAccessible('$AME/libhydr')
True
◆◆
AMEIsLine()
def AMEIsLine
(
args,
kwargs
)
Finds an element from this alias path in the current active circuit then tells if it is a line.
bool = AMEIsLine(string) bool = AMEIsLine(AMECompLine)
The argument is either a string corresponding to the alias path of the element to check, or an AMECompLine object. It returns True if the checked element is a line,
False otherwise.
ame_apy.AMEIsLine('step')
False
AMEIsLockedVariable()
◆◆
def AMEIsLockedVariable
(
args,
kwargs
)
Finds variable in the current active circuit then gets the lock state flag.
bool = AMEIsLockedVariable(string) bool = AMEIsLockedVariable(AMEParVar)
The first argument is either a string corresponding to the path of the variable, or an AMEParVar object, as returned by AMEGetParVar or an AMEParVarIteration. It
returns bool.
ame_apy.AMEIsLockedVariable('v')
True
AMEIsModelExtracted()
◆◆
def AMEIsModelExtracted
(
args,
kwargs
)
Tells if the given .ame file is extracted.
bool = AMEIsModelExtracted(string)
The string argument is the full path of the .ame file being checked. It returns True if the .ame file is extracted. False otherwise.
ame_apy.AMEIsModelExtracted('C:/SysDM_Workspace/Collection1/my_model.ame')
True
◆◆
AMEIsParameter()
def AMEIsParameter
(
args,
kwargs
)
Finds the element data in the current active circuit, then tells if it is a parameter.
bool = AMEIsParameter(string) bool = AMEIsParameter(AMEParVar)
The argument is either a string corresponding to the path of the data under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N, or an AMEParVar
object. The function returns True if the tested is a parameter, False otherwise.
ame_apy.AMEIsParameter('rp9')
True
AMEIsSavedVariable()
◆◆
def AMEIsSavedVariable
(
args,
kwargs
)
Finds variable in the current active circuit then gets the save to results flag status.
bool = AMEIsSavedVariable(string) bool = AMEIsSavedVariable(AMEParVar)
The first argument is either a string corresponding to the path of the variable, or an AMEParVar object, as returned by AMEGetParVar or an AMEParVarIteration. It
returns bool.
ame_apy.AMEIsSavedVariable('v2')
True
AMEIsSC()
◆◆
def AMEIsSC
(
args,
kwargs
)
Returns True if the active circuit contains a supercomponent with the given identifier. This identifier can either be an alias or an AMECompLine.
bool = AMEIsSC(string) bool = AMEIsSC(PyCompLine)
ame_apy.AMEIsSC('sc_alias')
True
ame_apy.AMEIsSC(comp_line)
True
AMEIsSupercomponentSubmodel()
◆◆
def AMEIsSupercomponentSubmodel
(
args,
kwargs
)
Returns True if the checked submodel is a super-component. False otherwise.
bool = AMEIsSupercomponentSubmodel(string[, string])
First string argument is the name of the checked submodel. Second string argument is the directory where the checked submodel resides. This is optional. By
default, directory is fetched from paths list. See help(ame_apy.AMEIniAPI). It returns bool
ame_apy.AMEIsSupercomponentSubmodel('CSTHF01', '$AME/libcs/submodels')
True
◆◆
AMEIsVariable()
def AMEIsVariable
(
args,
kwargs
)
Finds the element data in the current active circuit, then tells if it is a variable.
bool = AMEIsVariable(string)
String argument is the path of the data given under the form: data_name@comp_alias_0.comp_alias_i.comp_alias_N The function returns True if the tested is a
variable, False otherwise.
ame_apy.AMEIsVariable('rp9')
False
◆◆
AMEListAvailableSubmodels()
def AMEListAvailableSubmodels
(
args,
kwargs
)
Lists the submodels found in the paths list which can be associated with the component or line found in the current active circuit. Note this function needs the
dictionary of submodels that has been built when the API was initialized, See help(ame_apy.AMEInitAPI)
{string: string, ...} = AMEListAvailableSubmodels(string) {string: string, ...} = AMEListAvailableSubmodels(AMECompLine)
First argument is the alias path of the component or line, or an AMECompLine object, as returned by AMEGetCompLine or an AMECompLineIteration. It returns a
dictionary of available submodels where key is the submodel name and value is the submodel directory.
ame_apy.AMEListAvailableSubmodels('h2port')
{'HLG020D': '$AME/libhydr/submodels', 'HL004': '$AME/libhydr/submodels', 'HL030': '$AME/libhydr/submodels', 'HL01': '$AME/libhydr/submodels', 'HL10':
'$AME/libhydr/submodels', 'HL04': '$AME/libhydr/submodels', 'HL020': '$AME/libhydr/submodels', 'HLG20': '$AME/libhydr/submodels'}
◆◆
AMELoadLibrarySubmodel()
def AMELoadLibrarySubmodel
(
args,
kwargs
)
Loads a library submodel.
AMEParVarIteration = AMELoadLibrarySubmodel(string, string)
The first argument can be the path to a submodel. The second argument is the index of the port whose external variables must be listed.
See also help(ame_apy.AMECreateParVarIteration).
AMECreateParVarIterationOnSubmodel('path/submodel_name', 0)
<ame_apy.AMEParVarIteration object at 0xb7e3d070>
◆◆
AMELoadPathsListFile()
def AMELoadPathsListFile
(
args,
kwargs
)
Loads a .AMEPath paths list file. The loaded paths list file is then set to be the current paths list.
AMELoadPathsListFile(string)
The string argument is the paths list file path
ame_apy.AMELoadPathsListFile('$HOME/my_paths.AMEPath')
◆◆
AMELockVariable()
def AMELockVariable
(
args,
kwargs
)
Finds variable in the current active circuit then sets the lock state flag.
AMELockVariable(string, bool) AMELockVariable(AMEParVar, bool)
The first argument is either a string corresponding to the path of the variable, or an AMEParVar object, as returned by AMEGetParVar or an AMEParVarIteration.
The second bool argument is the lock state variable flag. It is set to True to lock the state variable.
ame_apy.AMELockVariable('v', True)
AMEModifyBusCreator()
◆◆
def AMEModifyBusCreator
(
args,
kwargs
)
Modifies the inputs of an existing bus creator in the current active circuit.
AMEModifyBusCreator(string, (string, ...))
First string argument is the alias of the bus creator to modify. Second argument is the new list of inputs for the bus creator
ame_apy.AMEModifyBusCreator('bus_creator', ('Input1', 'Input2'))
AMEModifyBusSelector()
◆◆
def AMEModifyBusSelector
(
args,
kwargs
)
Modifies the outputs of an existing bus selector in the current active circuit.
AMEModifyBusSelector(string, (string, ...))
First string argument is the alias of the bus selector to modify. Second argument is the new list of outputs for the bus selector
ame_apy.AMEModifyBusSelector('bus_selector', ('Input1', 'Input2'))
AMEMoveComponent()
◆◆
def AMEMoveComponent
(
args,
kwargs
)
Moves a component on the current active circuit sketch. Note any component or line connected to this will not be moved.
AMEMoveComponent(string, (int, int)) AMEMoveComponent(AMECompLine, (int, int))
The first argument is either a string corresponding to the alias path of the component to move, or an AMECompLine object. Second argument is couple of integers
which give the component top left coordinate in pixels
ame_apy.AMEMoveComponent('Step_Generator', (50, 50))
◆◆
AMEOpenAmeFile()
def AMEOpenAmeFile
(
args,
kwargs
)
Loads and opens the circuit contained in a *.ame archive file. If the *.ame archive file is already expanded, you can choose to use the expanded files or you can
prefer to re-expand the *.ame archive. In that case, the files are overwritten. By default the files of an already expanded archive are used. The opened circuit
becomes the current active one.
AMEOpenAmeFile(string[, bool])
The string argument is the '*.ame' Simcenter Amesim system file to open and load The bool argument is available when the '*.ame' file is already expanded. If True
then the expanded files will be used. Otherwise, the '*.ame' file is expanded and the already expanded files are overwritten. Default is True.
ame_apy.AMEOpenAmeFile('/home/injection_systems/injection_4.ame')
AMEPremierSubmodel()
◆◆
def AMEPremierSubmodel
(
args,
kwargs
)
Selects a submodel for each component of the active circuit bool = AMEPremierSubmodel()
AMERemoveComponent()
◆◆
def AMERemoveComponent
(
args,
kwargs
)
Finds and removes a component from the current active circuit.
AMERemoveComponent(string) AMERemoveComponent(AMECompLine)
The argument is either a string corresponding to the alias path of the component to remove, or an AMECompLine object.
ame_apy.AMERemoveComponent('Step_Generator')
AMERemoveGlobalParameter()
◆◆
def AMERemoveGlobalParameter
(
args,
kwargs
)
Finds then removes a global parameter from the current active circuit.
AMERemoveGlobalParameter(string)
String argument is the unique name of the global parameter to remove.
ame_apy.AMERemoveGlobalParameter('p_diameter')
AMERemoveLine()
◆◆
def AMERemoveLine
(
args,
kwargs
)
Finds and removes a line from the current active circuit.
AMERemoveLine(string) AMERemoveLine(AMECompLine)
The argument is either a string corresponding to the alias path of the line to remove, or an AMECompLine object.
ame_apy.AMERemoveLine('Main_Pipe')
AMERemovePathFromPathsList()
◆◆
def AMERemovePathFromPathsList
(
args,
kwargs
)
Removes a directory from the search paths list.
AMERemovePathFromPathsList(string)
The string argument is the path to removed from search paths list
ame_apy.AMERemovePathFromPathsList('$AME/libhydr')
◆◆
AMERemoveSubmodel()
def AMERemoveSubmodel
(
args,
kwargs
)
Finds and removes a submodel from the current active circuit.
AMERemoveSubmodel(string) AMERemoveSubmodel(AMECompLine)
The argument is either a string corresponding to the alias path of the submodel to remove, or an AMECompLine object.
ame_apy.AMERemoveSubmodel('HL01')
◆◆
AMERotateComponent()
def AMERotateComponent
(
args,
kwargs
)
Finds component from its alias path in the current active circuit then rotate its icon of -PI/2.
AMERotateComponent(string[, int]) AMERotateComponent(AMECompLine[, int])
The first argument is either a string corresponding to the alias path of the component to rotate, or an AMECompLine object. Integer argument is the number of -PI/2
rotations to perform. It is optional
ame_apy.AMERotateComponent('Step_Generator', -1)
◆◆
AMERunSimulation()
def AMERunSimulation
(
args,
kwargs
)
Launches the current active circuit simulation run. If a structural parameter value is changed after compilation, recompilation will happen before run.
ame_apy.AMERunSimulation()
AMESAttachProperty()
◆◆
def AMESAttachProperty
(
args,
kwargs
)
Attaches a AMEProperty object to a given object of the active circuit. This can be either an AMECompLine object or an AMEProperty object.
AMESAttachProperty(PyProperty, PyCompLine) AMESAttachProperty(PyProperty, PyProperty)
First argument is the PyProperty object to attach. Second argument is the target object. This can be either an AMECompLine object or an AMEProperty object.
ame_apy.AMESAttachProperty(myProperty, myCompLine)
AMESaveCircuit()
◆◆
def AMESaveCircuit
(
args,
kwargs
)
Saves the current active circuit as Simcenter Amesim archive file (*.ame).
ame_apy.AMESaveCircuit()
AMESaveCircuitAs()
◆◆
def AMESaveCircuitAs
(
args,
kwargs
)
Saves the current active circuit under a new name and directory. By default the archive is created in the local directory, but it can be saved in a target directory.
AMESaveCircuitAs(string[, string, bool])
First string argument is the new name of the circuit. Second string argument is the directory where the circuit is to be saved. This is optional. If it is not set, then
the circuit is saved in the local directory. bool argument is the overwrite flag. If it is True, then any existing archive with the same destination name is overwritten.
This is optional. The default is False.
ame_apy.AMESaveCircuitAs('my_new_circuit_name', '/home/extra')
◆◆
AMESavePathsListFile()
def AMESavePathsListFile
(
args,
kwargs
)
Saves a .AMEPath paths list file.
AMESavePathsListFile(string, bool)
The string argument is the paths list file path Boolean argument indicates if an existing file with the same name is to be overwritten. Default is True.
ame_apy.AMESavePathsListFile('$HOME/my_paths.AMEPath', False)
AMESaveVariable()
◆◆
def AMESaveVariable
(
args,
kwargs
)
Finds variable in the current active circuit then sets the save to results flag status.
AMESaveVariable(string, bool) AMESaveVariable(AMEParVar, bool)
The first argument is either a string corresponding to the path of the variable, or an AMEParVar object, as returned by AMEGetParVar or an AMEParVarIteration.
The second bool argument is the save variable flag. It is set to True to save the variable in the results file. It is set to False if you wish the variable not to be saved in
the results file.
ame_apy.AMESaveVariable('v2', False)
AMESetActiveCircuit()
◆◆
def AMESetActiveCircuit
(
args,
kwargs
)
Sets a circuit to be the active working circuit. Note the circuit must be opened.
AMESetActiveCircuit(string)
The string argument is the name of the circuit to set active.
ame_apy.AMESetActiveCircuit('my_new_system')
◆◆
AMESetAutomaticUpdateOfPathlist()
def AMESetAutomaticUpdateOfPathlist
(
args,
kwargs
)
Sets the property abput auto update of pathlist. AMESetAutomaticUpdateOfPathlist(bool)
bool argument is to set/unset this property. If it is True, then Simcenter Amesim circuit API updates the pathlists itself. If you turn this option to false, Simcenter
Amesim circuit API does not update the pathlists, By Default it is set to True
ame_apy.AMESetAutomaticUpdateOfPathlist(True)
AMESetCompiler()
◆◆
def AMESetCompiler
(
args,
kwargs
)
Changes the compiler used to generate the executable of the system. AMESetCompiler(string)
string argument is the compiler to use. Possible compilers are:
'ame_gcc64'
'ame_intel64'
ame_apy.AMESetCompiler('ame_gcc64')
◆◆
AMESetDebugCompilation()
def AMESetDebugCompilation
(
args,
kwargs
)
Sets the debug compilation flag for the current active circuit.
AMESetDebugCompilation(bool)
Bool argument is set to True for debug compilation. It is set to False otherwise. By default circuits are compiled with release flag.
ame_apy.AMESetDebugCompilation(True)
AMESetDirectConnection()
◆◆
def AMESetDirectConnection
(
args,
kwargs
)
Go through the top level of the active circuit and try to set a DIRECT submodel to line wherever it is possible.
ame_apy.AMESetDirectConnection()
AMESetGlobalParameterValue()
◆◆
def AMESetGlobalParameterValue
(
args,
kwargs
)
Finds then sets the value of global parameter in the current active circuit.
AMESetGlobalParameterValue(string, string)
First string argument is unique name of the global parameter. Second string argument is value to set to the global parameter.
AMESetGlobalParameterValue('p_diameter', '92.2')
AMESetGPGroupLocation()
◆◆
def AMESetGPGroupLocation
(
args,
kwargs
)
Set the GP group location inside a global param dialog
AMESetGPGroupLocation(AMEGPGroupPtr,AMEGPGroupPtr,integer)
First string argument is the GP group name Second AMEGPGroupPtr argument is parent group object to which we insert this new group This is optional. If not set,
then the GP group will be moved to root level Third integer is group position in a parent group. By default appends the GP group onto the end of destination_group
This is optional. If not set,Appends the GP group onto the end of root or destination_group
ame_apy.AMESetGPGroupLocation(gp_group,destination_group,1)
◆◆
AMESetGPGroupName()
def AMESetGPGroupName
(
args,
kwargs
)
Rename the GP group name
AMESetGPGroupName(AMEGPGroupPtr,string)
First AMEGPGroupPtr argument is the GP group object Second string argument is the GP group name
ame_apy.AMESetGPGroupName(gp_group,new_group_name)
◆◆
AMESetGPLocation()
def AMESetGPLocation
(
args,
kwargs
)
Move the GP from one location to another location.Its same as drag and drop GP from one group to another group in Amesim GUI
AMESetGPLocation(string,AMEGPGroupPtr,integer)
First string argument is the unique name for global parameter. Second AMEGPGroupPtr argument is destination GP group object. This is optional. If not set, then
the GP will be moved to root level Third integer location of the GP inside a group.. By default appends the GP onto the end of destination_group This is optional. If
not set,Appends the GP onto the end of root or destination_group
ame_apy.AMESetGPLocation('gp_name',destination_group,1)
AMESetHistoryItemValue()
◆◆
def AMESetHistoryItemValue
(
args,
kwargs
)
Sets the history item value for a given 'history item type'. The history item type is one of AMEHistoryItemValueType enumeration:
ame_history_item_author
ame_history_item_date
ame_history_item_comment
AMESetHistoryItemValue(PyHistoryItem, AMEHistoryItemValueType, string)
First argument is the PyHistoryItem object to set the value. Second argument is the history item type. Third argument is the value to be set.
ame_apy.AMESetHistoryItemValue(myHistoryItem, ame_history_item_author, 'Myself')
AMESetInterfaceTypeForModel()
◆◆
def AMESetInterfaceTypeForModel
(
args,
kwargs
)
Sets the type of interface in the active circuit Typical values : 'simulink', 'simulink_cosim', 'user_cosim', 'adams', 'adams_cosim', 'virtual_lab_motion',
'virtual_lab_motion_cosim' ...
AMESetInterfaceTypeForModel(string)
ame_apy.AMESetInterfaceTypeForModel('simulink')
AMESetMessageFilter()
◆◆
def AMESetMessageFilter
(
args,
kwargs
)
Filters messages sent by AME API.
AMESetMessageFilter(string)
possible strings are: -'ame_info', -'ame_ok', -'ame_warning', -'ame_error', -'ame_fatal' Each message having a error severity superior or equal to filter level will be
displayed.
ame_apy.AMESetMessageFilter('ame_warning')
AMESetParameterValue()
◆◆
def AMESetParameterValue
(
args,
kwargs
)
Sets the value of a parameter or the initial value of a state. It must belong to the current active circuit.
AMESetParameterValue(string, string) AMESetParameterValue(AMEParVar, string)
First argument is either a string corresponding to the path of the parameter given under the form: parameter_name@comp_alias_0.comp_alias_i.comp_alias_N, or
an AMEParVar object corresponding to the parameter, as returned by AMEGetParVar or an AMEParVarIteration. Second string argument is the value to set the
parameter to.
ame_apy.AMESetParameterValue('theta', '90')
◆◆
AMESetPortName()
def AMESetPortName
(
args,
kwargs
)
Set the name of a supercomponent port. Note: the port names of a supercomponent must be unique.
AMESetPortName(string, int, string[, bool]) AMESetPortName(PyCompLine, int, string[, bool])
The first argument identifies the supercomponent via its alias path or via a PyCompLine. The second argument is the port number of the supercomponent port. The
third argument is the name to assign to the port. The fourth argument is optional. It indicates whether or not the port name will be visible in the GUI. Default value is
True.
ame_apy.AMESetPortName('sc_alias', 0, 'new_port_name', False) ame_apy.AMESetPortName(comp_line, 0,
'new_port_name', False)
AMESetPortName2()
◆◆
def AMESetPortName2
(
args,
kwargs
)
Sets the name of the port identified by a PyPort structure. Same as AMESetPortName, except it works with a PyPort. Note: the port names of a supercomponent
must be unique.
AMESetPortName(PyPort, string[, bool])
The first argument is the PyPort structure which identifies the port. The second argument is the name to assign to the port. The third argument is optional. It
indicates whether or not the port name will be visible in the GUI. Default value is True.
ame_apy.AMESetPortName2(port, 'new_port_name', False)
◆◆
AMESetPropertyName()
def AMESetPropertyName
(
args,
kwargs
)
Sets the AMEProperty object name. The name must be unique when the AMEProperty object is attached to an AMEProperty object of type
ame_property_type_group. Different AMEProperty objects can have the same name otherwise.
AMESetPropertyName(PyProperty, string)
First argument is the PyProperty object to set the name. Second argument is the new property name.
ame_apy.AMESetPropertyName(myProperty, 'New name')
AMESetPropertyType()
◆◆
def AMESetPropertyType
(
args,
kwargs
)
Sets the AMEProperty object type. The object type is one of AMEPropertyType enumeration.
ame_property_type_number
ame_property_type_text
ame_property_type_rich_text
ame_property_type_date
ame_property_type_file_link
ame_property_type_file_attached
ame_property_type_image
ame_property_type_enum
ame_property_type_group
AMESetPropertyType(PyProperty, AMEPropertyType[, string])
First argument is the PyProperty object to set the type. Second argument is the new property type. Third argument (optional) is the new default content.
ame_apy.AMESetPropertyType(myProperty, ame_property_type_text)
AMESetPropertyValue()
◆◆
def AMESetPropertyValue
(
args,
kwargs
)
Sets a value to an AMEProperty object. For an AMEProperty object of type ame_property_type_enum, this value is the user selected value in the enumeration list.
AMESetPropertyValue(PyProperty, string)
First argument is the PyPropery object to set the value. Second argument is the string value to set.
ame_apy.AMESetPropertyValue(myProperty, 'My value')
AMESetPropertyValues()
◆◆
def AMESetPropertyValues
(
args,
kwargs
)
Sets a collection of values to an AMEProperty object.
The collection for properties of type 'ame_property_type_number', 'ame_property_type_text', 'ame_property_type_rich_text', 'ame_property_type_date',
'ame_property_type_file_link', 'ame_property_type_file_attached', 'ame_property_type_image', 'ame_property_type_group' should contain a single value.
The collection for properties of type 'ame_property_type_enum' can contain multiple values.
AMESetPropertyValues(PyProperty, (string, ...))
First argument is the PyProperty object to set the values. Second argument is a tuple of strings values to set.
ame_apy.AMESetPropertyValues(myProperty, ('Yes', 'No', 'Maybe'))
AMESetRemotePortTag()
◆◆
def AMESetRemotePortTag
(
args,
kwargs
)
Sets tag to remote port. The port to assign tag must belong to component which is inside the current active circuit.
AMESetRemotePortTag(string, int, string) AMESetRemotePortTag(AMECompLine, int, string)
In the first version, the first argument is the alias path of the component, whose port should be assigned with tag. In the other version, the first argument must be
AMECompLine object corresponding to component, whose port should be assigned with tag. The second argument is integer corresponding to the index of the port
to assign the tag. The third argument is the tag for remote port.
ame_apy.AMESetRemotePortTag('dynamicReceiver', 0, 'Tag1')
◆◆
AMESetRunParameter()
def AMESetRunParameter
(
args,
kwargs
)
Sets a simulation parameter for the current active circuit.
AMESetRunParameter(string, string)
The first argument identifies the simulation parameter to set. The second argument is a string representing the value to set. The available simulation parameters,
and the expected format of values are:
'start_time_s': simulation start time in seconds. Floating-point number as a string.
'stop_time_s': simulation stop time in seconds. Floating-point number as a string.
'interval_s': simulation communication interval in seconds. Floating-point number as a string.
'integ_method': integration method. "0" for standard integrator. "1" for fixed step integrator.
'fixed_step_s': fixed step time in seconds. Available with fixed step integrator only. Floating-point number as a string.
'fixed_integ_method': fixed step time integration method. "0" for Adams-Bashforth. "1" for Euler. "2" for Runge-Kutta.
'fixed_order': order to use for Adams-Bashforth or Runge-Kutta fixed step integration method. This is a integer value: 2 <= fixed_order <= 4, encoded as a string.
'max_time_step_s': maximum simulation time step in seconds. Available with standard integrator only. Floating-point number as a string.
'tolerance': tolerance for convergence test. Available with standard integrator only. Floating-point number as a string.
(Legacy parameter) 'tolerance_s': tolerance for convergence test in seconds. Available with standard integrator only. Floating-point number as a string.
'error_type': standard integration errortype. "0" for mixed error. "1" for relative error. "2" for absolute error.
'solver_type': standard integration accuracy level. "0" for standard solver. "1" for cautious solver.
'disable_optimized_solver': enable/disable optimized server. "1" or "True" to disable, "0" or "False" to enable.
'minimal_discontinuity_handling': enable/disable the minimal discontinuity handling. "0" or "False" to disable, "1" or "True" to enable.
'simulation_mode': simulation mode. "1" for stabilizing run. "2" for dynamic run. "3" for stabilizing run followed by dynamic run.
'discontinuity_printout': enable/disable discontinuity printout. This is a dynamic run option. "0" or "False" to disable, "1" or "True" to enable.
'activity_calculation': enable/disable activity index calculation for dynamic run. "0" or "False" to disable, "1" or "True" to enable.
'power_calculation': enable/disable power calculation for dynamic run. "0" or "False" to disable, "1" or "True" to enable.
'energy_calculation': enable/disable energy calculation for dynamic run. "0" or "False" to disable, "1" or "True" to enable.
'hold_inputs_constant': enable/disable the hold inputs constant dynamic run option. "0" or "False" to disable, "1" or "True" to enable.
'lock_non_propagating_state': lock/unlock non propagating states for stabilizing run. "0" or "False" to disable, "1" or "True" to enable.
'diagnotics': enable/disable stabilizing run diagnostics. "0" or "False" to disable, "1" or "True" to enable.
'run_type': run type. "0" for single run, "1" for batch.
'continuation_run': enable/disable the continuation run option. "0" or "False" to disable, "1" or "True" to enable.
The encoding of floating-point numbers as strings must be the one expected by the C 'atof' function. It should be compatible with the result of str() builtin applied to
Python floating-point numbers.
ame_apy.AMESetRunParameter('stop_time_s', '18')
AMESGetProperties()
◆◆
def AMESGetProperties
(
args,
kwargs
)
Returns the AMEProperty object collection corresponding to the given source object. This source object object can be either an AMECompLine or an AMEProperty
object.
Using AMECompLine: Returns a collection of properties attached to the given Component or Line object. This object can be retrieved thanks to its alias name
and AMEGetCompLine method.
Using AMEProperty: Returns a collection of properties attached to the given property group object.
No parameters returns the entire property collection of the active model.
(PyProperty, ...) = AMESGetProperties(PyCompLine) (PyProperty, ...) = AMESGetProperties(PyProperty)
First argument is the AMECompLine or AMEProperty object type we want to collect the attached parameters from. It returns a tuple of PyProperties.
ame_apy.AMESGetProperties(myCompLine)
AMESTextCreateIterationInSC()
◆◆
def AMESTextCreateIterationInSC
(
args,
kwargs
)
Creates and returns a text item iterator for a supercomponent circuit.
AMETextItemIteration = AMETextCreateIteration(AMECompLine)
The argument is the AMECompLine structure of supercomponent in which text iterator is to be created.
ame_apy.AMETextCreateIteration(compline)
◆◆
AMESTextInsertItemInSC()
def AMESTextInsertItemInSC
(
args,
kwargs
)
Inserts a text item into the supercomponent circuit.
AMETextItem = AMESTextInsertItemInSC(AMECompLine, string, (int, int), string)
First argument is the AMECompLine structure of supercomponent in which the text item is to be inserted. Second argument is the string value of the text item
(Either in plain text or HTML format). Third argument is a couple of integers for setting position of the text item. Fourth argument is string for setting direction of the
text item. Possible values (string) of direction are:
'ame_text_left'
'ame_text_up'
It returns the inserted text item.
ame_apy.AMESTextInsertItemInSC(compline ,"Power sensor", AME_POINT(317, 51), ame_text_down)
AMESTextRemoveItemInSC()
◆◆
def AMESTextRemoveItemInSC
(
args,
kwargs
)
Removes a text item from the given supercomponent circuit.
AMETextRemoveItem(AMECompLine, AMETextItem)
First argument is the AMECompLine structure of supercomponent from which the text item is to be removed. Second argument is the text item to be removed.
ame_apy.AMESTextRemoveItemInSC(compline, text_item)
AMESubscribeToLogFile()
◆◆
def AMESubscribeToLogFile
(
args,
kwargs
)
Sends messages from API to a file. Log file will be created if it does not exist.
AMESubscribeToLogFile(string, bool)
string is the path of the log file where the message from API will be sent. By default it writes in local 'ame_api.log' file. bool is the append mode flag. If True, it
appends messages. Otherwise, it clears the file content coming from any previous API session. Default is False
ame_apy.AMESubscribeToLogFile('my_python_application.log', True)
AMETextCreateIteration()
◆◆
def AMETextCreateIteration
(
args,
kwargs
)
Creates and returns a text item iterator.
AMETextItemIteration = AMETextCreateIteration()
ame_apy.AMETextCreateIteration()
AMETextCreateIterationInSC()
◆◆
def AMETextCreateIterationInSC
(
args,
kwargs
)
Creates and returns a text item iterator for a supercomponent circuit.
AMETextItemIteration = AMETextCreateIteration(string)
The argument is the alias path of supercomponent in which text iterator is to be created.
ame_apy.AMETextCreateIteration('mass_friction1port_1')
AMETextGetAlignment()
◆◆
def AMETextGetAlignment
(
args,
kwargs
)
Returns the alignment of the specified text item. If the text item contains more than one alignment, then alignment of the first character of text item is returned.
int = AMETextGetAlignment(AMETextItem)
The argument is the text item. It returns string indicating the alignment of the specified text item. Returned string can be from one of the values indicated in
AMETextSetAlignment API.
ame_apy.AMETextGetAlignment(text_item)
◆◆
AMETextGetColor()
def AMETextGetColor
(
args,
kwargs
)
Returns the color of the specified text item in #RRGGBB string format. If the text item contains more than one color, then color of the first character of text item is
returned.
string = AMETextGetColor(AMETextItem)
The argument is the text item. It returns a string indicating the color of the specified text item.
ame_apy.AMETextGetColor(text_item)
◆◆
AMETextGetDirection()
def AMETextGetDirection
(
args,
kwargs
)
Returns the direction of the specified text item.
string = AMETextGetDirection(AMETextItem)
The argument is the text item. It returns a string indicating the direction of the specified text item. Returned string can be from one of the values indicated in
AMETextSetDirection API.
ame_apy.AMETextGetDirection(text_item)
AMETextGetFont()
◆◆
def AMETextGetFont
(
args,
kwargs
)
Returns the font properties of the specified text item. If the text item contains more than one font family, then font family of the first character of text item is
returned. Same applies to other font properties like weight, size, italic, etc...
(string, int, int, int, int, int) = AMETextGetFont(text_item)
The argument is the text item. It returns a tuple containing the font properties of the specified text item. The order of font properties is same as previously
mentioned in AMETextSetFont API.
ame_apy.AMETextGetFont(text_item)
◆◆
AMETextGetHTMLText()
def AMETextGetHTMLText
(
args,
kwargs
)
Returns the string value of the specified text item in HTML text format (UTF-8).
string = AMETextGetHTMLText(AMETextItem)
The argument is the text item. It returns the string value of the specified text item in HTML format.
ame_apy.AMETextGetHTMLText(text_item)
◆◆
AMETextGetPlainText()
def AMETextGetPlainText
(
args,
kwargs
)
Returns the string value of the specified text item in plain text format (UTF-8).
string = AMETextGetPlainText(AMETextItem)
The argument is the text item. It returns the string value of the specified text item in plain text format.
ame_apy.AMETextGetPlainText(text_item)
◆◆
AMETextGetPosition()
def AMETextGetPosition
(
args,
kwargs
)
Returns the position of the specified text item.
(int, int) = AMETextGetPosition(AMETextItem)
The argument is the text item. It returns a couple of integers indicating the position of the specified text item.
ame_apy.AMETextGetPosition(text_item)
AMETextInsertItem()
◆◆
def AMETextInsertItem
(
args,
kwargs
)
Inserts a text item into the circuit.
AMETextItem = AMETextInsertItem(string, (int, int), string)
First argument is the string value of the text item (Either in plain text or HTML format). Second argument is a couple of integers for setting position of the text item.
Third argument is string for setting direction of the text item. Possible values (string) of direction are:
'ame_text_left'
'ame_text_up'
It returns the inserted text item.
ame_apy.AMETextInsertItem("Power sensor", AME_POINT(317, 51), ame_text_down)
AMETextInsertItemInSC()
◆◆
def AMETextInsertItemInSC
(
args,
kwargs
)
Inserts a text item into the supercomponent circuit.
AMETextItem = AMETextInsertItemInSC(string, string, (int, int), string)
First argument is the alias path of supercomponent in which the text item is to be inserted. Second argument is the string value of the text item (Either in plain text
or HTML format). Third argument is a couple of integers for setting position of the text item. Fourth argument is string for setting direction of the text item. Possible
values (string) of direction are:
'ame_text_left'
'ame_text_up'
It returns the inserted text item.
ame_apy.AMETextInsertItemInSC('springdamper01',"Angle sensor", AME_POINT(201,193), ame_text_left)
AMETextRemoveItem()
◆◆
def AMETextRemoveItem
(
args,
kwargs
)
Removes a text item from the circuit.
AMETextRemoveItem(AMETextItem)
The argument is the text item to be removed.
ame_apy.AMETextRemoveItem(text_item)
AMETextRemoveItemInSC()
◆◆
def AMETextRemoveItemInSC
(
args,
kwargs
)
Removes a text item from the given supercomponent circuit.
AMETextRemoveItem(string, AMETextItem)
First argument is the alias path of supercomponent from which the text item is to be removed. Second argument is the text item to be removed.
ame_apy.AMETextRemoveItemInSC('fluidprops', text_item)
AMETextSetAlignment()
◆◆
def AMETextSetAlignment
(
args,
kwargs
)
Sets the alignment of the specified text item with the given alignment. This API sets the given alignment to the entire text.
AMETextSetAlignment(AMETextItem, string)
The first argument is the text item. The second argument is string for setting the alignment of the specified text item. Possible values (string) of alignment are:
'left_align'
'right_align'
'center_align'
ame_apy.AMETextSetAlignment(text_item, 'right_align')
AMETextSetColor()
◆◆
def AMETextSetColor
(
args,
kwargs
)
Sets the color of the specified text item with the given color. This API sets the given color to the entire text. Input string can be in one of these formats: 1)
#RRGGBB - String that contains Hexa-decimal value (E.g. For red color, string is #FF0000). 2) A name from the list of colors defined in SVG color keyword names.
AMETextSetColor(AMETextItem, string)
The first argument is the text item. The second argument is a string for setting the color of the specified text item.
ame_apy.AMETextSetColor(text_item,"green") ame_apy.AMETextSetColor(text_item,"#453afb")
AMETextSetDirection()
◆◆
def AMETextSetDirection
(
args,
kwargs
)
Sets the direction/orientation of the specified text item with the given direction. This operation is equivalent to rotating the text item to the specified direction.
AMETextSetDirection(AMETextItem, string)
The first argument is the text item. The second argument is a string for setting the direction of the specified text item. Possible values (string) of direction are:
'ame_text_left'
'ame_text_up'
ame_apy.AMETextSetDirection(text_item, "ame_text_left")
AMETextSetFont()
◆◆
def AMETextSetFont
(
args,
kwargs
)
Sets the font properties of the specified text item with the given font properties. This API sets the given font properties to the entire text.
AMETextSetFont(AMETextItem, string, int, int, int, int, int)
The first argument is the text item.
The second argument is a string used to set font family of the text item This is optional. If not set, then the font family is not changed.
The third argument is an integer used to set font weight of the text item This is optional. If not set, then the font weight is not changed. Possible values of font
weight can range from 1-99.
The fourth argument is an integer used to set font size of the text item This is optional. If not set, then the font size is not changed. Possible values of font size can
range from 6-72.
The fifth argument is an integer used to set italic property of the text item This is optional. If not set, then the italic property is not changed. Possible values are:
0 - Text item not to be in italic.
1 - Text item to be in italic.
Other - Input is ignored. Italic state is unchanged.
The sixth argument is an integer used to set underline property of the text item This is optional. If not set, then the underline property is not changed. Possible
values are:
0 - Text item not to be underlined.
1 - Text item to be underlined.
Other - Input is ignored. Underline state is unchanged.
The seventh argument is an integer used to set strikeout property of the text item This is optional. If not set, then the strikeout property is not changed. Possible
values are:
0 - Text item not to be striked out.
1 - Text item to be striked out.
Other - Input is ignored. Strike out state is unchanged.
For the italic, underline and strike out properties, providing any input other than 0 and 1 will be considered as invalid input, keeping that font property unchanged.
ame_apy.AMETextSetFont(text_item, "arial", 34, 22, 0, 1, 1)
If the user wants only a particular font property to be set, then other properties can beneglected or default value/invalid value can be provided. In the below example,
the user provides only the font size. Other parameters are provided with default values.
ame_apy.AMETextSetFont(text_item, "", -1, 28, -1, -1, -1)
Invalid inputs are provided for font size and strikeout, leaving them unchanged.
ame_apy.AMETextSetFont(text_item, "calibri", 32, 729, 0, 1, 12)
◆◆
AMETextSetHTMLText()
def AMETextSetHTMLText
(
args,
kwargs
)
Sets the string value of the specified text item with the given string in HTML format (UTF-8).
AMETextSetText(AMETextItem, string)
The first argument is the text item. The second argument is the string value that has to be set to the specified text item.
ame_apy.AMETextSetHTMLText(text_item, "<HTML><b>Spr</b>ing <i>dam</i>per")
◆◆
AMETextSetPlainText()
def AMETextSetPlainText
(
args,
kwargs
)
Sets the string value of the specified text item with the given string in plain text format (UTF-8).
AMETextSetText(AMETextItem, string)
The first argument is the text item. The second argument is the string value that has to be set to the specified text item.
ame_apy.AMETextSetPlainText(text_item, "Spring damper")
AMETextSetPosition()
◆◆
def AMETextSetPosition
(
args,
kwargs
)
Sets the position of the specified text item with the given position. This method is equivalent to moving the text item.
AMETextSetPosition(text_item, (int, int))
The first argument is the text item. The second argument is a couple of integers for setting the position of the text item.
ame_apy.AMETextSetPosition(text_item, 338, 297)
AMEUnSubscribeToLogFile()
◆◆
def AMEUnSubscribeToLogFile
(
args,
kwargs
)
Stops writing messages from API in the log file.
ame_apy.AMEUnSubscribeToLogFile()
AMEUpdateModel()
◆◆
def AMEUpdateModel
(
args,
kwargs
)
For the current active circuit, it updates submodels set for components or lines in the circuit with submodels in the libraries.
If necessary (and possible) it updates the circuit's submodels. Note that if it fails to update a submodel, you will have to remove this submodel then set a new
available one. In this case, it is strongly advised to check your submodel parameter values. When too many changes have been made in a submodel, it is possible
the parameter or state variable values will be lost. AMEUpdateModel(bool, bool, bool, bool)
If the first argument is set to True, it tries to add missing libraries in the path list. This argument is optional. Default is True. If the second argument is set to True
and if the circuit has been updated, then it creates a backup of the initial circuit file. This argument is optional. Default value is True. The third argument allows to
replace all supercomponents by their library versions (full update), i.e. to synchronize the supercomponents with their libraries. To only update the submodels
inside the supercomponents (minimal update), this argument must be set to False. This argument is optional. Default is False. If the fourth argument is True,
obsolete submodels are automatically replaced with recommended alternative submodels. It only applies to submodels that can safely and automatically be
replaced. To keep the obsolete submodels, this argument must be set to False. This argument is optional. Default is False. If the fifth argument is True, the binary
files existence will be checked. This argument is optional. Default is True.
ame_apy.AMEUpdateModel(False, False, False, True, False).
◆◆
AMEWriteAuxiliaryFiles()
def AMEWriteAuxiliaryFiles
(
args,
kwargs
)
Writes the files needed by the simulation executable for the current active circuit.
ame_apy.AMEWriteAuxiliaryFiles()
Unpublished w ork. © 2023 Siemens
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )