Below is the example of using the GetMs operation to start model calculation. The request contains an instance of opened modeling container, pattern and parameters of model calculation. The response contains information about calculation.
{ "Envelope" : { "Body" : { "GetMs" : {
"tMs" : { "id" : "S43!M!S!C1" }, "tArg" : { "pattern" : { "obInst" : "true", "item" :
{ "key" : "2803", "problem" : { "calculation" : { "calculationState" : "" } } }
}, "execParams" : { "problemCalculationKey" : "0", "execRun" : "true" } } } } } }
{ "Envelope" : { "Body" : { "GetMsResult" : { "id" :
{ "id" : "S43!M!S!C1" }, "meta" : { "obInst" : { "obDesc" : { "@isShortcut" : "0",
"i" : "MODELSPACE", "n" : "Modeling container", "k" : "1581", "c" : "5121", "p" : "1580", "h" : "0" } }, "dirty" : "0", "item" :
{ "k" : "2803", "id" : "TEMP_MODEL", "n" : "TEMP_MODEL", "vis" : "1", "type" : "Problem", "problemMd" : { "calculation" : {
"pointCount" : "72", "pointPassed" : "36", "saveData" : "1", "copyFact" : "0", "treatNullsAsZeros" : "0", "isRunning" : "0", "calculationState" : { "scenarioKey" : "4294967295", "currentPoint" : "1990-01-01",
"message" : "identification of model "MyInputVavable[t] = A1*MyOutputVavable[t]"" }, "isSuspend" : "1" } } } } } } } }
The GetMsCalcRun function starts calculation of the specified model. Input parameters:
ms. Opened modeling container instance.
modelKey. Key of the calculated model.
prCalcKey. Key of the object that executes calculation.
After executing the function returns the calculated model.
public static MsItem GetMsCalcRun(MsId ms, ulong modelKey, ulong? prCalcKey) { var getMsOp = new GetMs(); // Set operation execution parameters getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Set general data extraction pattern pattern = new MsMdPattern() { item = new MsItemPattern() { // Set calculated model key key = modelKey, // Set data calculation pattern problem = new MsProblemPattern() { calculation = new MsProblemCalculationPattern() { calculationState = new MsCalculationStatePattern(){} } } } },// Set calculation parameters execParams = new MsMdExecParams() { execRun = true, problemCalculationKey = prCalcKey } }; // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute calculation GetMsResult getMsResult = somClient.GetMs(getMsOp); return getMsResult.meta.item; }
See also: