Aimsun Next API Scenario Management¶
Functions related to ANG Objects, Replication, Experiment, and Scenario Information¶
Get ANG Replication Identifier¶
In C++ and Python¶
Explanation¶
Get the replication Identifier.
Format¶
unsigned int ANGConnGetReplicationId ();
Parameters¶
None.
Output¶
- > 0: Replication Identifier.
- = 0: Error.
Get ANG Experiment Identifier¶
In C++ and Python¶
Explanation¶
Get the experiment Identifier.
Format¶
unsigned int ANGConnGetExperimentId ();
Parameters¶
None.
Output¶
- > 0: Experiment Identifier.
- = 0: Error.
Get ANG Scenario Identifier¶
In C++ and Python¶
Explanation¶
Get the scenario identifier.
Format¶
unsigned int ANGConnGetScenarioId ();
Parameters: None.¶
Output¶
- > 0: Scenario identifier.
- = 0: Error.
Get ANG Scenario Simulated Date and Initial Time¶
In C++ and Python¶
Explanation¶
Get the scenario Simulated Date and Initial Time.
Format¶
const char * ANGConnGetScenarioTime();
Parameters¶
None.
Output¶
- ≠ NULL: Returns a string with the scenario date and time using ISO 8601 extended format (YYYY-MM-DDTHH:MM:SS),or an empty string if no information is available. Do not delete this string.
- = NULL: Error.
Functions related to ANG Objects Connection¶
Get ANG Object ID¶
In C++ and Python¶
Explanation¶
Get the Object ID of any object by name.
Format¶
int ANGConnGetObjectId( const unsigned short * name, bool deleteUShortName ); // Deprecated
int ANGConnGetObjectIdByType( const unsigned short * name, const unsigned short * typeName, bool deleteUShortName );
Parameters¶
- name: The name of the object.
- typeName: Filters the search by the object type name. When NULL, it returns the first object that matches the name.
- deleteUShortName: true if the name is to be deleted automatically.
Output¶
- > 0: object id.
- < 0: the object doesn’t exist.
Get ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Get a pointer to an attribute of an ANG object. This pointer can be used to modify or read the value of the attribute of different objects, using functions ANGConnSetAttributeValue or ANGConnGetAttributeValue. In Aimsun Next, the internal attribute names of each object type can be displayed by selecting Window / Type from the main menu.
Format¶
void * ANGConnGetAttribute(const unsigned short * internalAttrName );
Parameters¶
- internalAttrName: The internal name of the attribute.
Output¶
- ≠ NULL: pointer to attribute.
- = NULL: Error.
Create ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Create an attribute of one ANG object. This pointer can be used to modify or read the value of the attribute of different objects, using functions ANGConnSetAttributeValue or ANGConnGetAttributeValue. The internal attribute names of each object type can be displayed by selecting Window / Type from the main menu.
Format¶
void * ANGConnCreateAttribute(const unsigned short * typeName, const unsigned short * internalAttrName, const unsigned short * externalAttrName, int attrType, int columnType);
Parameters¶
- typeName: Name of the ANG object.
- internalAttrName: Internal name of the attribute.
- externalAttrName: External name of the attribute (as displayed in the editors of the object).
- attrType: INTEGER_TYPE as integer, DOUBLE_TYPE as double or STRING_TYPE as a string.
- columnType: Defines the way to store the column as EXTERNAL_TEMPORAL, INTERNAL or EXTERNAL.
Output¶
- ≠ NULL: pointer to attribute.
- = NULL: Error.
Create ANG Object Time Series Attribute¶
In C++ and Python¶
Explanation¶
Create a time series attribute of one ANG object. This pointer can be used to modify or read the value of the attribute of different objects, using functions ANGConnSetTimeSeriesValue or ANGConnGetTimeSeriesValue. The internal attribute names of each object type can be displayed by selecting Window / Type from the main menu.
Format¶
void * ANGConnCreateTimeSerieAttribute( const unsigned short* typeName, const unsigned short* internalAttrName, const unsigned short* externalAttrName, int aggregationType );
Parameters¶
- typeName: Name of the ANG object.
- internalAttrName: Internal name of the attribute.
- externalAttrName: External name of the attribute (as displayed in the editors of the object).
- aggregationType: Defines the aggretation type of the time series. AGGREGATION_UNDEFINED, AGGREGATION_DEFAULT, AGGREGATION_MEAN, AGGREGATION_SUM, AGGREGATION_CUSTOM, AGGREGATION_MAX, AGGREGATION_MIN, AGGREGATION_STDDEV, AGGREGATION_MEDIAN, AGGREGATION_HMEAN
Output¶
- ≠ NULL: pointer to attribute.
- = NULL: Error.
Set value to ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Set the value to an attribute of an ANG object. UNICODE version.
Format¶
void ANGConnSetAttributeValueString( void * attr, unsigned int objectId, const unsigned short * value ); // Unicode version. Not available in Python.
void ANGConnSetAttributeValueStringA( void * attr, unsigned int objectId, const char * value ); // Ascii version.
void ANGConnSetAttributeValueInt ( void * attr, unsigned int objectId, int value );
void ANGConnSetAttributeValueDouble ( void * attr, unsigned int objectId, double value );
Parameters¶
- attr: Pointer to the attribute, obtained by calling either ANGConnGetAttribute or ANGConnCreateAttribute.
- objectId: Object identifier.
- value: New value to assign.
Output¶
None.
Get value from ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Get the value of an attribute of an ANG object.
Format¶
const unsigned short * ANGConnGetAttributeValueString(void * attr, unsigned int objectId); // Unicode version. Not available in Python.
const char * ANGConnGetAttributeValueStringA(void * attr, unsigned int objectId); // Ascii version.
int ANGConnGetAttributeValueInt( void * attr, unsigned int objectId );
double ANGConnGetAttributeValueDouble( void * attr, unsigned int objectId );
Parameters¶
- attr: Pointer of the attribute, obtained calling either ANGConnGetAttribute or ANGConnCreateAttribute.
- objectId: Object identifier.
Output¶
Returns the value, according to the attribute type (integer, double or string).
Get number of values in a Time Series ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Get number of values of a time series attribute of an ANG object.
Format¶
int ANGConnGetTimeSeriesSize( void * attr, unsigned int objectId );
Parameters¶
- attr: Pointer of the attribute, obtained calling either ANGConnGetAttribute or ANGConnCreateAttribute.
- objectId: Object identifier.
Output¶
Returns the number of values.
Get value in a Time Series ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Get a value of a time series attribute of an ANG object.
Format¶
double ANGConnGetTimeSeriesValue( void * attr, unsigned int objectId, unsigned int pos );
Parameters¶
- attr: Pointer of the attribute, obtained calling either ANGConnGetAttribute or ANGConnCreateTimeSerieAttribute.
- objectId: Object identifier.
- pos: Position of the value in the Time Series attribute (from 0 to (ANGConnGetTimeSeriesSize(attr, objectId )-1).
Output¶
Returns the value.
Set value in a Time Series ANG Object Attribute¶
In C++ and Python¶
Explanation¶
Set the value of an ANG object for a time series index.
Format¶
void ANGConnSetTimeSeriesValue(void* attr, unsigned int objectId, unsigned int pos, double value, double deviation, double lowerValue);
Parameters¶
- attr: Pointer of the attribute, obtained calling either ANGConnGetAttribute or ANGConnCreateTimeSerieAttribute.
- objectId: Object identifier.
- pos: Position of the value in the Time Series attribute (from 0 to (ANGConnGetTimeSeriesSize(attr, objectId )-1).
- value: Value to assign.
- deviation: Deviation or upperBound value. Can be -1 for NULL deviations.
- lowerValue: LowerBound value. Can be -1 for no bounds definition.