INonLDVariables.FindById

Syntax

FindById(Id:String): INonLDVariable;

Parameters

Id. Searched variable identifier.

Description

The FindById method searches for the variable in the collection by its identifier.

Example

Executing the example requires the Optima variable that contains a system of non-linear equations and parameters for its calculation. The system of equations must include a variable with the "x1" identifier.

Add a link to the Cp system assembly.

Sub UserProc;
Var
    Optima: NonLinearDecomposition;
    PeriodL, i: Integer;
    Vars: INonLDVariables;
    Vrbl: INonLDVariable;
    Res: INonLoResults;
    val: Double;
Begin
    // System calculation
    PeriodL := 4;
    Res := Optima.Evaluate(PeriodL) As INonLoResults;
    Debug.WriteLine(Res.ErrorMsg);
    // Display results
    If (Res.Status = 0Then
        Vars := Optima.Variables;
        Vrbl := Vars.FindById("x1");
        Debug.WriteLine("Variable: x1");
        For i := 0 To PeriodL - 1 Do
            Val := Res.VarValues(Vrbl.Id)[i];
            Debug.WriteLine(Val);
        End For;
    End If;
End Sub UserProc;

After executing the example a system of non-linear equations is created and calculated. Data of the x1 variable is displayed in the console window.

See also:

INonLDVariables