Version 0.1.95+
This topic present solution of inter-CLC communication.
bsize=125uProblem:/u/size/b
We have had many problems associated with data transmission between CLCs in last couple of weeks. Most widely used solution based on direct modification of variable values of Extern CLCs is not safe.
There is no control of the completeness and validity of inputs (and results) of Extern CLCs.
uIdea:/u
Use "Structure" objects for data exchange (hereinafter called "biInput Structure/i/b" / "biOutput Structure/i/b") => Communication between Master and Extern CLC will be mediated purely by these biExchange Structures/i/b.
biExchange Structures/i/b provides clear interface and safe communication between Master and Extern CLC. No direct mapping of variables is used, no direct access. Until the interface is held, anybody can do any changes in Master and/or Extern CLC.
Using this technique guarantee complete and valid input for ExternCLC and valid output from ExternCLC.
uSchema:/u
attachment=0
- ExternCLC.png (27.92 KiB) Viewed 4444 times
size=125buRequirements on Extern CLC:/u/b/size
CLC which is intended to be used (called) as ExternCLC must define two system functions:
ub1) bool ValidateInput(object Input)/b/u
This function is used to uread/u and uvalidate/u Input structure.
SDF automatically calls this function just before execution of ExternCLC (see schema).
If all required input values are defined (no exception is thrown) AND function returns 'True', script execution continues with ExternCLC.
Example of 'ValidateInput' function:
code
bool ValidateInput(object Input) {
A = Input.Get("A"); // width [m]
B = Input.Get("B"); // height [m]
C = Input.Get("C"); // depth [m]
Ï = Input.Get("Ï", 2600); // density [kg/m↑3â†] - optional
bool Result = true;
IF(A < 0) { EWN.TraceEWN("E_Examples_01"); Result = false; }
IF(B < 0) { EWN.TraceEWN("E_Examples_02"); Result = false; }
IF(C < 0) { EWN.TraceEWN("E_Examples_03"); Result = false; }
return Result;
}
/code






ub2) object GetOutput()/b/u
This function is used to define output (result) of ExternCLC. Result of this function is assigned to the 2. parameter of Calculate/Draw command.
SDF automatically calls this function just after the end of execution of ExternCLC script (see schema).
Example of 'GetOutput ' function:
code
object GetOutput() {
return new Structure("V", V, "m", m);
}
/code



See attached example for more details.