Interaction with environment
This package contains functions to interact with the environment.
Extends from Modelica.Icons.Package (Icon for standard packages).
| Name | Description |
|---|---|
| Get full path name of work directory | |
| Set work directory | |
| Get content of environment variable | |
| Set content of local environment variable | |
| Retrieve the local time (in the local time zone) | |
| Retrieve the current process id | |
| Execute command in default shell | |
| Terminate execution of Modelica environment |
Modelica.Utilities.System.getWorkDirectoryGet full path name of work directory
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| directory | Full path name of work directory |
Modelica.Utilities.System.setWorkDirectorySet work directory
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| directory | New work directory |
Modelica.Utilities.System.getEnvironmentVariableGet content of environment variable
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| name | Name of environment variable |
| convertToSlash | True, if native directory separators in 'result' shall be changed to '/' |
| Name | Description |
|---|---|
| content | Content of environment variable (empty, if not existent) |
| exist | = true, if environment variable exists; = false, if it does not exist |
Modelica.Utilities.System.setEnvironmentVariableSet content of local environment variable
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| name | Name of environment variable |
| content | Value of the environment variable |
| convertFromSlash | True, if '/' in content shall be changed to the native directory separator |
Retrieve the local time (in the local time zone)
(ms, sec, min, hour, day, mon, year) = System.getTime();
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
(ms, sec, min, hour, mon, year) = getTime() // = (281, 30, 13, 10, 15, 2, 2015)
// Feb. 15, 2015 at 10:13 after 30.281 s
This function is impure!
| Name | Description |
|---|---|
| ms | Millisecond |
| sec | Second |
| min | Minute |
| hour | Hour |
| day | Day |
| mon | Month |
| year | Year |
Retrieve the current process id
pid = System.getPid();
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.
getPid() // = 3044
This function is impure!
| Name | Description |
|---|---|
| pid | Process ID |
Modelica.Utilities.System.commandExecute command in default shell
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| string | String to be passed to shell |
| Name | Description |
|---|---|
| result | Return value from command (depends on environment) |
Modelica.Utilities.System.exitTerminate execution of Modelica environment
Extends from Modelica.Icons.Function (Icon for functions).
| Name | Description |
|---|---|
| status | Result to be returned by environment (0 means success) |