Modelica.Utilities.System

Interaction with environment

Information


This package contains functions to interact with the environment.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
Modelica.Utilities.System.getWorkDirectory getWorkDirectory Get full path name of work directory
Modelica.Utilities.System.setWorkDirectory setWorkDirectory Set work directory
Modelica.Utilities.System.getEnvironmentVariable getEnvironmentVariable Get content of environment variable
Modelica.Utilities.System.setEnvironmentVariable setEnvironmentVariable Set content of local environment variable
Modelica.Utilities.System.command command Execute command in default shell
Modelica.Utilities.System.exit exit Terminate execution of Modelica environment


Modelica.Utilities.System.getWorkDirectory 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

Modelica definition

function getWorkDirectory "Get full path name of work directory"
  extends Modelica.Icons.Function;
  output String directory "Full path name of work directory";
// POSIX function "getcwd"
  external "C" directory = ModelicaInternal_getcwd(0);
end getWorkDirectory;

Modelica.Utilities.System.setWorkDirectory Modelica.Utilities.System.setWorkDirectory

Set work directory

Information



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

Inputs

TypeNameDefaultDescription
Stringdirectory New work directory

Modelica definition

function setWorkDirectory "Set work directory"
  extends Modelica.Icons.Function;
  input String directory "New work directory";
// POSIX function "chdir"
external "C" ModelicaInternal_chdir(directory);
end setWorkDirectory;

Modelica.Utilities.System.getEnvironmentVariable Modelica.Utilities.System.getEnvironmentVariable

Get content of environment variable

Information



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

Inputs

TypeNameDefaultDescription
Stringname Name of environment variable
BooleanconvertToSlashfalseTrue, if native directory separators in 'result' 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

Modelica definition

function getEnvironmentVariable "Get content of environment variable"
  extends Modelica.Icons.Function;
  input String name "Name of environment variable";
  input Boolean convertToSlash =  false 
    "True, if native directory separators in 'result' shall be changed to '/'";
  output String content 
    "Content of environment variable (empty, if not existent)";
  output Boolean exist 
    "= true, if environment variable exists; = false, if it does not exist";
  external "C" ModelicaInternal_getenv(name, convertToSlash, content, exist);
end getEnvironmentVariable;

Modelica.Utilities.System.setEnvironmentVariable Modelica.Utilities.System.setEnvironmentVariable

Set content of local environment variable

Information



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

Inputs

TypeNameDefaultDescription
Stringname Name of environment variable
Stringcontent Value of the environment variable
BooleanconvertFromSlashfalseTrue, if '/' in content shall be changed to the native directory separator

Modelica definition

function setEnvironmentVariable 
  "Set content of local environment variable"
  extends Modelica.Icons.Function;
  input String name "Name of environment variable";
  input String content "Value of the environment variable";
  input Boolean convertFromSlash =  false 
    "True, if '/' in content shall be changed to the native directory separator";
external "C" ModelicaInternal_setenv(name, content, convertFromSlash);
end setEnvironmentVariable;

Modelica.Utilities.System.command Modelica.Utilities.System.command

Execute command in default shell

Information



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

Inputs

TypeNameDefaultDescription
Stringstring String to be passed to shell

Outputs

TypeNameDescription
IntegerresultReturn value from command (depends on environment)

Modelica definition

function command "Execute command in default shell"
  extends Modelica.Icons.Function;
  input String string "String to be passed to shell";
  output Integer result "Return value from command (depends on environment)";
  external "C" result = system(string);
end command;

Modelica.Utilities.System.exit Modelica.Utilities.System.exit

Terminate execution of Modelica environment

Information

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

Inputs

TypeNameDefaultDescription
Integerstatus0Result to be returned by environment (0 means success)

Modelica definition

function exit "Terminate execution of Modelica environment"
  extends Modelica.Icons.Function;
  input Integer status=0 
    "Result to be returned by environment (0 means success)";
  external "C" ModelicaInternal_exit(status);

end exit;

Automatically generated Fri Nov 12 16:31:49 2010.