Below is the example of using the GetMs operation to suspend model calculation. The request contains and instance of opened modeling container, pattern and parameters of model calculation. The response contains information about calculation.
{ "Envelope" : { "Body" : { "GetMs" : {
"tMs" : { "id" : "S42!M!S!C1" }, "tArg" : { "pattern" : { "obInst" : "true", "item" :
{ "key" : "2803", "problem" : { "calculation" : { "calculationState" : "" } } }
}, "execParams" : { "problemCalculationKey" : "0", "execSuspend" : "true" } } } } } }
{ "Envelope" : { "Body" : { "GetMsResult" : { "id" :
{ "id" : "S42!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" : "26", "saveData" : "1", "copyFact" : "0", "treatNullsAsZeros" : "0", "isRunning" : "0", "calculationState" : { "scenarioKey" : "4294967295", "currentPoint" : "1899-12-30",
"message" : "Loading time series database "Variables"" }, "isSuspend" : "1" } } } } } } } }
The GetMsCalcSuspend function suspends 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 GetMsCalcSuspend(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() { execSuspend = 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: