8.7.22. Env¶
- class Env¶
Represents the runtime environment of a model, including License and Configuration. When creating a model, an Env associated with the model must be provided. Python automatically creates a default Env for each process. If you no longer need it, you can call disposeDefaultEnv() to release it.
Methods
Construct an Environment,
Release the resources associated with the Environment
Reset all parameters to default values
Set the value of a parameter
start an Environment
Write parameter settings to a file
- __init__(logfilename='', empty=False)¶
Construct an Environment,
- Parameters
logfilename='' – Set the log file name of the Environment.
empty=False – Indicate whether to construct an empty Environment.
example:
Env("env1.log") env = Env("env1.log", True) env.start()
- dispose()¶
Release the resources associated with the Environment.
example:
env.dispose()
- resetParam()¶
Reset all parameters to default values.
example:
env.resetParam()
- setParam(paramname, paramvalue)¶
Set the value of a parameter.
- Parameters
paramname – The name of the parameter to be set.
paramvalue – Parameter value.
example:
env.setParam("MaxTime", 10) env.setParam("MaxTi*", 10) env.setParam("MaxTi*", "default")
Note
Parameter names can contain ‘*’ and ‘?’ wildcards. If more than one parameter name is matched, the parameter values are not modified.
When the parameter value is ‘default’, you can reset the parameter to its default value.
- start()¶
start an Environment. When the Environment is empty, you must call start before you can use it. Environment starting, the parameter loading and license checking will be performed.
example:
env = Env("env1.log", True) env.start()
- writeParams(filename)¶
Write parameter settings to a file.
- Parameters
filename – The name of the file.
example:
env.writeParams("settings.prm")