Package Modelica.​Utilities.​System
Interaction with environment

Information

This package contains functions to interact with the environment.

Extends from Modelica.​Icons.​FunctionsPackage (Icon for packages containing functions).

Package Contents

NameDescription
commandExecute command in default shell
exitTerminate execution of Modelica environment
getEnvironmentVariableGet content of environment variable
getPidRetrieve the current process id
getTimeRetrieve the local time (in the local time zone)
getWorkDirectoryGet full path name of work directory
setEnvironmentVariableSet content of local environment variable
setWorkDirectorySet work directory

Function Modelica.​Utilities.​System.​getWorkDirectory
Get full path name of work directory

Information

Extends from Modelica.​Icons.​Function (Icon for functions).

Outputs

TypeNameDescription
StringdirectoryFull path name of work directory

Function Modelica.​Utilities.​System.​setWorkDirectory
Set work directory

Information

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
StringdirectoryNew work directory

Function Modelica.​Utilities.​System.​getEnvironmentVariable
Get content of environment variable

Information

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
StringnameName of environment variable
BooleanconvertToSlashTrue, if native directory separators in environment variable shall be changed to '/'

Outputs

TypeNameDescription
StringcontentContent of environment variable (empty, if not existent)
Booleanexist= true, if environment variable exists; = false, if it does not exist

Function Modelica.​Utilities.​System.​setEnvironmentVariable
Set content of local environment variable

Information

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
StringnameName of environment variable
StringcontentValue of the environment variable
BooleanconvertFromSlashTrue, if '/' in environment variable shall be changed to native directory separators

Function Modelica.​Utilities.​System.​getTime
Retrieve the local time (in the local time zone)

Information

Syntax

(ms, sec, min, hour, day, mon, year) = System.getTime();

Description

Returns the local time at the time instant this function was called. All returned values are of type Integer and have the following meaning:

Argument Range Description
ms 0 .. 999 Milli-seconds after seconds
sec 0 .. 59 Seconds after minute
min 0 .. 59 Minutes after hour
hour 0 .. 23 Hours after midnight
day 1 .. 31 Day of month
mon 1 .. 12 Current month
year ≥ 2015 Current year

Example

(ms, sec, min, hour, mon, year) = getTime()   // = (281, 30, 13, 10, 15, 2, 2015)
                                              // Feb. 15, 2015 at 10:13 after 30.281 s

Note

This function is impure!

Extends from Modelica.​Icons.​Function (Icon for functions).

Outputs

TypeNameDescription
IntegermsMillisecond
IntegersecSecond
IntegerminMinute
IntegerhourHour
IntegerdayDay
IntegermonMonth
IntegeryearYear

Function Modelica.​Utilities.​System.​getPid
Retrieve the current process id

Information

Syntax

pid = System.getPid();

Description

Returns the pid (process identification) of the process in which this function is called. This is an impure function and the returned value depends on the operating system.

Example

getPid()   // = 3044

Note

This function is impure!

Extends from Modelica.​Icons.​Function (Icon for functions).

Outputs

TypeNameDescription
IntegerpidProcess ID

Function Modelica.​Utilities.​System.​command
Execute command in default shell

Information

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
StringstringString to be passed to shell

Outputs

TypeNameDescription
IntegerresultReturn value from command (depends on environment)

Function Modelica.​Utilities.​System.​exit
Terminate execution of Modelica environment

Information

Extends from ModelicaServices.​System.​exit (Terminate execution of Modelica environment).

Inputs

TypeNameDescription
IntegerstatusResult to be returned by environment (0 means success)