PyANGKernel.GKSystem

class GKSystem

Class that keeps information about all data that is shared by the documents. * * The class GKSystem is a singleton class (only one instance of this class exists) that holds all the data that is shared by the documents, mainly the types, the plug-ins and the filters. Note that this means that any two documents loaded in Aimsun Next can contain different data but they will share the same type of classes, filters and plug-ins.

Details

The class hold only non GUI shared data. For the GUI equivalent see GKGUISystem class.

In order to access the unique instance of GKSystem the following code will be used:

GKSystem &system = GKSystem::getSystem();

Inheritance diagram of PyANGKernel.GKSystem

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()
accelerationGuiToModel(units, accel)
Parameters:
Return type:

float

From an acceleration in m/s2 or f/s2 it returns the acceleration in m/s2.

accelerationGuiToSystem(accel)
Parameters:

accel – float

Return type:

float

From an acceleration in m/s or f/s it returns the acceleration in m/s.

accelerationModelToGui(units, acceleration)
Parameters:
Return type:

float

From an acceleration in m/s2 to acceleration in m/s2 or f/s2 depending of the units.

accelerationName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the acceleration name, either m/s^2 or f/s^2 depending of the units.

accelerationSystemToGui(acceleration)
Parameters:

acceleration – float

Return type:

float

From an acceleration in m/s to acceleration in m/s or f/s depending of the system units defined in the preferences.

addTypeContentToFolder(folderInternalName, typeName)
Parameters:
  • folderInternalName – str

  • typeName – str

Add a type to the list of object types that a folder( by internalName) can hold.

areaGuiToModel(units, area)
Parameters:
Return type:

float

From an area in m2 or sqft returns it in m2.

areaGuiToSystem(area)
Parameters:

area – float

Return type:

float

From an area in m2 or sqft returns it in m2.

areaModelToGui(units, area)
Parameters:
Return type:

float

From an area in m2 to m2 or sqft depending of the units.

areaName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the area name, either m^2 or sqft depending of the units.

areaSystemToGui(area)
Parameters:

area – float

Return type:

float

From an area in m2 or sqft returns it in m2.

batteryConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From a fuel consumption in kWh, returns it in kWh.

batteryConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From a distance fuel consumption in kWh to kWh depending of the units.

batteryConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance fuel consumption name, either kWh or kWh depending on the units.

canExecuteAction(actionId, target, selection)
Parameters:
  • actionId – str

  • targetGKObject

  • selection – .list of GKObject

Return type:

bool

Test if an action can be executed (the selection is valid, the action exists, the resources are available…

convertVariablePath(var[, model=None])
Parameters:
Return type:

str

Expand the variables $APP_HOME, $RESOURCES_HOME, $PLUGINS_HOME, $PLUGIN_HOME or $MODEL_HOME (only if model parameter is not null) found in the parameter var to its actual values. For example: is APP_HOME = /here and var is “$APP_HOME/there” then the returned string will be: “/here/there”.

createExperiment(scenario, engineId, mode)
Parameters:
  • scenarioGKScenario

  • engineId – int

  • mode – int

Return type:

GKGenericExperiment

createFolder(root, folderInternalName[, showOnlyConts=false])
Parameters:
  • rootGKFolder

  • folderInternalName – str

  • showOnlyConts – bool

Return type:

GKFolder

Creates a folder as a child of the root folder as registered by registerFolder The used root (can be a different one than the root specified) is returned in the newRoot argument.

createInternalTask(model[, uid=""])
Parameters:
Return type:

GKTask

Adds a new task to the system. You can specify a unique ID or Aimsun Next will assign one for you.

This task cannot be monitorized by external systems. Use it for GUI and sub tasks.

createTask(model[, uid=""])
Parameters:
Return type:

GKTask

Adds a new task to the system. You can specify a unique ID or Aimsun Next will assign one for you.

This task can be monitorized by external systems. Use it for execution tasks.

static deleteSystem()

Delete the system (just before exiting the application).

densityGuiToModel(units, den)
Parameters:
Return type:

float

From a density in veh/km or veh/mi it returns the density in veh/km.

densityModelToGui(units, den)
Parameters:
Return type:

float

From a density in veh/km to density in veh/km or veh/mi depending of the units.

densityName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the density name, either veh/km or veh/mi depending of the units.

distanceBatteryConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From a distance fuel consumption in kWh/100 km, returns it in kWh/100 km.

distanceBatteryConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From a distance fuel consumption in kWh/100 km to kWh/100 mi depending of the units.

distanceBatteryConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance fuel consumption name, either kWh/100 km or kWh/100 mi depending on the units.

distanceEmissionGuiToModel(units, de)
Parameters:
Return type:

float

From a distance pollutant emission in g/km or g/mi, returns it in g/km.

distanceEmissionModelToGui(units, de)
Parameters:
Return type:

float

From a pollutant emission in g/Km to g/Km or g/mi depending of the units.

distanceEmissionsName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance emissions name, either in g/Km or g/mi, depending on the units.

distanceFuelConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From a distance fuel consumption in l/100 km or gal/100 mi, returns it in l/100 km.

distanceFuelConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From a distance fuel consumption in l/100 km to l/100 km or gal/100 mi depending of the units.

distanceFuelConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance fuel consumption name, either l/100 km or gal/100 mi depending on the units.

distanceGuiToModel(units, dist)
Parameters:
Return type:

float

From a distance in m or feet it returns the distance in m.

distanceGuiToSystem(dist)
Parameters:

dist – float

Return type:

float

Given a distance in the system units (that is, the ones set by preferences) it returns the distance in m.

distanceModelToGui(units, distance)
Parameters:
Return type:

float

From a distance in m to distance in m or feet depending of the units.

distanceName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance name, either m or feet depending of the units.

distanceSystemToGui(distance)
Parameters:

distance – float

Return type:

float

From a distance in m to distance in m or feet depending of the system units defined in the preferences.

emissionGuiToModel(units, e)
Parameters:
Return type:

float

From a pollutant emission in g, returns it in g.

emissionModelToGui(units, e)
Parameters:
Return type:

float

From a pollutant emission in g to g.

emissionPerHourGuiToModel(units, e)
Parameters:
Return type:

float

From an instant pollutant emission in g/s, returns it in g/s.

emissionPerHourModelToGui(units, e)
Parameters:
Return type:

float

From a pollutant emission in g/h to g/h.

emissionsName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the emissions name (always g).

emissionsPerHourName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the instant emissions name (always g/h).

executeAction(actionId, target, selection, taskUID)
Parameters:
  • actionId – str

  • targetGKObject

  • selection – .list of GKObject

  • taskUID – str

Return type:

bool

Executes a kernel action over a set of objects. Returns true if the action was found and the task UID if this command generates a task.

executeSystemAction(actionId, taskUID)
Parameters:
  • actionId – str

  • taskUID – str

Return type:

bool

Executes a kernel action over the GKSystem . Returns true if the action was found and the task UID if this command generates a task.

static exit(errorCode)
Parameters:

errorCode – int

fuelConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From a fuel consumption in l or gal, returns it in l.

fuelConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From a fuel consumption in l to l or gal depending of the units.

fuelConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the fuel consumption name, either l (liters) or gal (gallons) depending on the units.

getActions(type)
Parameters:

typeGKType

Return type:

.list of GKKernelActionEntry

Gets the list of all possible kernel actions for the type specified.

getActiveModel()
Return type:

GKModel

Get the active model as set by GKSystem::setActiveModel. Callable in a Python script to get its model.

getActiveSelection()
Return type:

QList

The active selection (when executing the script as a context menu over an object).

getActiveTarget()
Return type:

GKObject

The active target (when executing the script as a context menu over the target object).

getAimsunExtension(name)
Parameters:

name – str

Return type:

GKSimulatorExtensionDescription

Returns an Enhanced Extension description by its unique name.

getAppVersion()
Return type:

str

Returns the application version in the format: A.b.c (RXXXXX), i.e. 7.0.1 (R15320)

getComputerName()
Return type:

str

Get the computer name.

getHome()
Return type:

str

Get the System (application) home.

getIPAddress()
Return type:

str

Get the computer IP address.

getKernelActions(type)
Parameters:

typeGKType

Return type:

.list of GKKernelAction

Gets all the kernel actions that can be applied to type.

getLastUsedFolder([model=None])
Parameters:

modelGKModel

Return type:

str

Returns the last used folder. Used to start a file operation (save, open, import) from the last visited folder (so a new import starts from the previous imported folder).

If no last folder is found and model is not null then we will return the model folder. If nothing is found we will return the user’s home folder.

getLog()
Return type:

GKLog

System log.

getModel(uid)
Parameters:

uid – str

Return type:

GKModel

Get a loaded model by its UID.

getModel(uid)
Parameters:

uidQUuid

Return type:

GKModel

Get a loaded model by its UID.

getModels()
Return type:

.list of GKModel

Returns a list of all the loaded models.

getPlugin(moduleName)
Parameters:

moduleName – str

Return type:

GKPlugin

Returns a plug-in called “moduleName”

getPluginsHome()
Return type:

str

Get the Plugins home: - In Windows and Unix: getSystem() . getHome() + “/plugins” - In MAC OS X: qApp->applicationDirPath() + “/../PlugIns”

getPreferences()
Return type:

GKPreferencesValues

Get the preferences for this application.

getPreferencesDefinition()
Return type:

GKPreferences

Get the preferences definition for this application.

getResourcesHome()
Return type:

str

Get the Resources home: - In Windows and Unix: getSystem() . getHome() - In MAC OS X: qApp->applicationDirPath() + “/../Resources” The Resources folder contains the folders: - shared - translations - templates - shapes

static getSystem()
Return type:

GKSystem

Singleton !

getUnitSystem()
Return type:

UnitSystem

Get the system units.

getUserHome()
Return type:

str

Get the User home.

getUserName()
Return type:

str

Get the name of the user that starts the application.

getUserPreferencesPath([version=""[, applicationPreferences=""]])
Parameters:
  • version – str

  • applicationPreferences – str

Return type:

str

Get the name of the folder where preferences for the current user will be stored.

UnknownCommandversion : version path to look for. If empty, the current version number (7.0 now) will be used.

guiAvailable()
Return type:

bool

Returns true if a GUI is available for any user started operation. Aimsun can have a GUI but hidden (to create, for example, snapshots). In this case this function will return false even if getGui returns a valid GUI.

instantBatteryConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From an instant fuel consumption in Wh/s or Wh/s, returns it in ml/s.

instantBatteryConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From a distance fuel consumption in Wh to Wh depending of the units.

instantBatteryConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance fuel consumption name, either Wh or Wh depending on the units.

instantEmissionGuiToModel(units, e)
Parameters:
Return type:

float

From an instant pollutant emission in g/s, returns it in g/s.

instantEmissionModelToGui(units, e)
Parameters:
Return type:

float

From a pollutant emission in g/s to g/s.

instantEmissionsName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the instant emissions name (always g/s).

instantFuelConsumptionGuiToModel(units, c)
Parameters:
Return type:

float

From an instant fuel consumption in ml/s or fl oz/s, returns it in ml/s.

instantFuelConsumptionModelToGui(units, fc)
Parameters:
Return type:

float

From an instant fuel consumption in ml/s to ml/s or fl oz/s depending of the units.

instantFuelConsumptionName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the instant fuel consumption name, either ml/s or fl oz/s depending on the units.

static isInitialized()
Return type:

bool

Returns true is the system has been initialized (calling GKSystem::init). A system will remain initialised until a call to deleteSystem is called.

maxAllowedOpenModels()
Return type:

int

Returns the max number of GKModels that we can open in the system at the same time.

newObject(type, model[, uuid=QUuid()[, id=-1[, addItToModel=true]]])
Parameters:
Return type:

GKObject

Create a new object of type “type” in model “model” and with an ID “id”.

If id = -1 then a new unique id is automatically assigned to the new object.

If addItToModel is true the object is automatically add to the model catalog, if false then it is not (what is not recommended unless what the user wants to create is a temporary object). In any case the object can later on add to the model with the method add .

You can also use the newObject method for new objects (id = -1).

newObject(typeName, model[, uuid=QUuid()[, id=-1[, addItToModel=true]]])
Parameters:
  • typeName – str

  • modelGKModel

  • uuidQUuid

  • id – int

  • addItToModel – bool

Return type:

GKObject

Create a new object of type “typeName” in model “model” and with an ID “id”.

If id = -1 then a new unique id is automatically assigned to the new object.

If addItToModel is true the object is automatically add to the model catalog, if false then it is not (what is not recommended unless what the user wants to create is a temporary object). In any case the object can later on add to the model with the method add .

You can also use the newObject method for new objects (id = -1).

newTemporaryObject(type, model[, addItToModel=true])
Parameters:
Return type:

GKObject

Create a new temporary object of type “type” in model “model” with a new unique id that is automatically assigned to the new object from the the list of temporary IDs (see getNewId and getNewTemporalId ).

If addItToModel is true the object is automatically add to the model catalog, if false then it is not (what is not recommended unless what the user wants to create is a temporary object). In any case the object can later on add to the model with the method add .

newTemporaryObject(typeName, model[, addItToModel=true])
Parameters:
  • typeName – str

  • modelGKModel

  • addItToModel – bool

Return type:

GKObject

Create a new temporary object of type “type” in model “model” with a new unique id that is automatically assigned to the new object from the the list of temporary IDs (see getNewId and getNewTemporalId ).

If addItToModel is true the object is automatically add to the model catalog, if false then it is not (what is not recommended unless what the user wants to create is a temporary object). In any case the object can later on add to the model with the method add .

preciseSpeedGuiToModel(units, speed)
Parameters:
Return type:

float

From a speed in m/s or feet/s it returns the speed in m/s.

preciseSpeedModelToGui(units, speed)
Parameters:
Return type:

float

From a speed in m/s to speed in m/s or feet/s depending of the units.

preciseSpeedName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the speed name, either m/s or f/s depending of the units.

registerAimsunExtension(extension)
Parameters:

extensionGKSimulatorExtensionDescription

Registers an Enhanced Extension. The pointer is adopted. * Never call this method directly, use GKPlugin::registerAimsunExtension.

registerFolder(folderInternalName, folderExternalName, folderGroup)
Parameters:
  • folderInternalName – str

  • folderExternalName – str

  • folderGroup – str

Register a folder that will hold objects in the Project. It has: - an internal, unique, name - an external name that can be translated - a group folder: the internal name of a top folder where this folder will be.

registerLastUsedFile(value)
Parameters:

value – str

Notify the system of a file usage to be use at getLastUsedFolder .

registerLastUsedFolder(value)
Parameters:

value – str

Notify the system of a folder usage to be use at getLastUsedFolder .

setPreferences()
Return type:

GKPreferencesValues

Get the preferences for this application for modification.

setPreferencesDefinition()
Return type:

GKPreferences

Get the preferences definition for this application for modification.

setUnitSystem(units)
Parameters:

unitsUnitSystem

Sets the system units type that will be used to present information to the user. Note that units used internally in this application are in Metric system.

speedGuiToModel(units, speed)
Parameters:
Return type:

float

From a speed in km/h or mile/h it returns the speed in km/h.

speedGuiToSystem(speed)
Parameters:

speed – float

Return type:

float

From a speed in km/h or m/h it returns the speed in km/h.

speedModelToGui(units, speed)
Parameters:
Return type:

float

From a speed in km/h to speed in km/h or mi/h depending of the units.

speedName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the speed name, either km/h or M/h depending of the units.

speedSystemToGui(speed)
Parameters:

speed – float

Return type:

float

From a speed in km/h to speed in km/h or mi/h depending of the system units defined in the preferences.

temperatureGuiToModel(units, temperature)
Parameters:
Return type:

float

From a temperature in Celsius or Fahrenheit, transform it into Celsius.

temperatureModelToGui(units, temperature)
Parameters:
Return type:

float

From a temperature in Celsius, transform it into Celsius or Fahrenheit, depending on the units.

travelTimeDistanceGuiToModel(units, ttd)
Parameters:
Return type:

float

From a travel time/distance in sec/km or sec/mi it returns it in sec/km.

travelTimeDistanceModelToGui(units, ttd)
Parameters:
Return type:

float

From a travel time/distance in sec/km to sec/km or sec/mi depending of the units.

tryToPutVariablePath(fileName[, model=None])
Parameters:
  • fileName – str

  • modelGKModel

Return type:

str

Returns a file path changing, if possible, well know path for a variable: - $APP_HOME - $PLUGINS_HOME

If no variable can be used then fileName is returned as:

QFileInfo( fileName ).filePath()
unpreciseDistanceGuiToModel(units, dist)
Parameters:
Return type:

float

From a distance in kilometers or miles it returns the distance in kilometers.

unpreciseDistanceModelToGui(units, dist)
Parameters:
Return type:

float

From a distance in kilometers to a distance in kilometers or miles depending of the units .

unpreciseDistanceName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the distance name, either km or miles depending of the units.

weightFrontAreaGuiToModel(units, w)
Parameters:
Return type:

float

From a weight/frontal area in kg/m2 or lbs/sq.ft depending of the units to kg/m2.

weightFrontAreaModelToGui(units, w)
Parameters:
Return type:

float

From a weight/frontal area in kg/m2 to kg/m2 or lbs/sq.ft depending of the units.

weightFrontAreaName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the weight / front area name, either Kg/m^2 or lb/ft^2 depending of the units.

weightGuiToModel(units, w)
Parameters:
Return type:

float

From a weight in kg or lbs depending of the units to kg.

weightHorsePowerGuiToModel(units, w)
Parameters:
Return type:

float

From a weight/horse power in kg/hp or lbs/hp depending of the units to kg/hp.

weightHorsePowerModelToGui(units, w)
Parameters:
Return type:

float

From a weight/horse power in kg/hp to kg/hp or lbs/hp depending of the units.

weightHorsePowerName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the weight / hore power name, either Kg/hp or lb/hp depending of the units.

weightModelToGui(units, w)
Parameters:
Return type:

float

From a weight in kg to kg or lbs depending of the units.

weightName(units)
Parameters:

unitsUnitSystem

Return type:

str

Returns the weight name, either Kg or lb depending of the units.