CAObject::MethodEvaluationTimeLimit

This page is a translated version of the page CAObject::MethodEvaluationTimeLimit and the translation is 100% complete.

ADE User Guide > ADE Server Class Reference > CAObject

Other languages:
English • ‎中文

new to ADE 4.1

Description

This property of CAObject specifies a maximum time limit in milliseconds on evaluations that occur from this object. It can be used to ensure that a method call will eventually return even if the model has an infinite loop, or takes much longer than otherwise expected.

This impacts primarily the methods CAObject::Evaluate, CAObject::Result and CAObject::ResultTable. In some cases it can also impact CAObject::DefTable when a table index requires computation. When a timeout occurs when calling these methods, the CAEngine::ErrorCode is set to 77 ("Method Evaluation Time Limit exceeded"). Note that a computation may also abort (if the Break event is signalled externally) and return CAEngine::ErrorCode=78 ("Computation aborted").

(in ADE 4.3) Its value is inherited from CAEngine::DefaultEvaluationTimeLimit when the CAObject is first created. Changing the value of CAEngine::DefaultEvaluationTimeLimit has no impact on CAObjects that already exist at that time.

A value of zero (the usual default) means that there is no time limit. Method calls will not return until the computation is complete or terminates (e.g., due to an evaluation error) or the Abort event is triggered. It may never return if the model contains an infinite loop.

Data type

long int

Access

read/write

Example Usage

CAObject obj = ade.GetObjectByName("Projected_profit")
obj.MethodEvaluationTimeLimit = 50000;
CATable result = obj.ResultTable;
if (ade.ErrorCode == 77) {
   /* computation timed out */
}

ErrorCodes

The ErrorCode is not changed by reading or writing a property like this, but when calling other methods when a time limit is in force, you may encounter this error code from them:

  • 77 – "Method Evaluation Time Limit exceeded"

See Also

Comments


You are not allowed to post comments.