Data exchange Structure

Info about design forms features
PetrS
Site Admin
Posts: 181
Joined: 11 Jul 2014, 13:55

Data exchange Structure

Postby PetrS » 18 Nov 2014, 12:45

size=150Data exchange Structure/size
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
ExternCLC.png (27.92 KiB) Viewed 4445 times
/attachment

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
:arrow: SDF automatically check completeness of the input. If any urequired/u field of the Input structure is missing, exception is thrown and ExternCLC ucall is canceled/u.
:arrow: SDF automatically track missing optional input fields (message added to the trace file).
:arrow: Use 'ValidateInput' function to validate input (dimensions are greater than zero, values are within proper range etc.)
:arrow: Use EWN system to trace Error and/or Warnings inside 'ValidateInput' function.
:arrow: Return 'False', if input values are not acceptable.
:?: Use url=http://designforms.net/forum/viewtopic.php?f=21&t=110&p=130#p130CodeSnippets/url to insert predefined 'ValidateInput' function.



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
:arrow: Return value of GetOutput must be 'Structure'.
:arrow: Use EWN system to trace Error and/or Warnings inside 'GetOutput' function.
:?: Use url=http://designforms.net/forum/viewtopic.php?f=21&t=110&p=130#p130CodeSnippets/url to insert predefined 'GetOutput' function.




See attached example for more details.
Attachments
EWN_Example.xml
Save this file to PublicDocuments\DesignForms_0.1\EWN\
(782 Bytes) Downloaded 413 times
DataExchange_Extern.cls
(40.15 KiB) Downloaded 409 times
DataExchange.cls
(84.95 KiB) Downloaded 425 times
Ing. Petr Slepicka
DesignForms Online
Engineering calculations online - EuroCode, AISC, statics
Automate your static calculations today!

Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 3 guests