Below is the example of using the GetMs operation to stop 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" : "S42!M!S!C1" }, "tArg" : { "pattern" : { "obInst" : "true", "item" :
{ "key" : "2803", "problem" : { "calculation" : { "calculationState" : "" } } }
}, "execParams" : { "problemCalculationKey" : "0", "execStop" : "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" : "20", "pointPassed" : "0", "saveData" : "1", "copyFact" : "0", "treatNullsAsZeros" : "0", "isRunning" : "0", "calculationState" : { "scenarioKey" : "4294967295", "currentPoint" : "1899-12-30",
"message" : "Task calculation completed. Caculation time 00:00:04" }, "isSuspend" : "1" } } } } } } } }
The GetMsCalcStop function stops 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 GetMsCalcStop(MsId ms, ulong modelKey, ulong? prCalcKey) { var getMsOp = new GetMs(); // Set operation execution parameters getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Set general data getting 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() { execStop = 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: