Execute;
Execute();
The Execute method calculates controlling variables.
Use the ICallbackCycle.GetTermValue and ICallbackCycle.SetControlVariableValue methods to get and edit variables values.
To execute the example, add a link to the Cp system assembly.
Class MyCallbackCycle: Object, ICallbackCycle
Public
U_Vars, P_Vars: INonLoVariables;
U, P: array[10] Of double;
Vrbl: INonLoVariable;
Public Function GetTermValue(EquationNumber: Integer; TimeMoment: Integer): Variant;
Begin
Return P[EquationNumber];
End Function GetTermValue;
Public Sub SetControlVariableValue(VariableNumber: Integer; TimeMoment: Integer; Value: Double);
Begin
U[VariableNumber] := Value * TimeMoment / 100;
End Sub SetControlVariableValue;
Public Sub Execute;
Begin
P := U;
End Sub Execute;
End Class MyCallbackCycle;
The use of this class to calculate non-linear optimization is given in description of ICpNonLinearOptimization.CallbackCycle.
Imports Prognoz.Platform.Interop.Cp;
…
Public Class MyCallbackCycle: Object, ICallbackCycle
Shared
U_Vars: INonLoVariables;
P_Vars: INonLoVariables;
U: array[10] Of double;
P: array[10] Of double;
Vrbl: INonLoVariable;
Public Function GetTermValue(EquationNumber: Integer; TimeMoment: Integer): object;
Begin
Return P[EquationNumber];
End Function GetTermValue;
Public Sub SetControlVariableValue(VariableNumber: Integer; TimeMoment: Integer; Value: Double);
Begin
U[VariableNumber] := Value * TimeMoment / 100;
End Sub SetControlVariableValue;
Public Sub Execute();
Begin
P := U;
End Sub Execute;
End Class MyCallbackCycle;
The use of this class to calculate non-linear optimization is given in description of ICpNonLinearOptimization.CallbackCycle.
See also: