Suspending Model Calculation

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetMs xmlns="http://www.fsight.ru/PP.SOM.Som">
<tMs xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE</id>
  </tMs>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
<item>
  <key>306496</key>
<problem>
<problemCalculation>
  <calcAction>Suspend</calcAction>
  <calculationState />
  </problemCalculation>
  <problemCalculationKey>0</problemCalculationKey>
  </problem>
  </item>
  </pattern>
  </tArg>
  </GetMs>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetMsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="key 306480" isShortcut="0" isLink="0" ver="6" hf="0">
  <i>MODELSPACE</i>
  <n>Modeling container</n>
  <k>306480</k>
  <c>5121</c>
  <p>1580</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<item>
  <k>306496</k>
  <id>OBJ306496</id>
  <n>Modeling problem</n>
  <vis>1</vis>
  <type>Problem</type>
<problemMd>
<calculation>
  <pointCount>0</pointCount>
  <pointPassed>0</pointPassed>
  <saveData>1</saveData>
  <copyFact>0</copyFact>
  <treatNullsAsZeros>0</treatNullsAsZeros>
  <isRunning>0</isRunning>
<calculationState>
  <message>Task calculation is finished. Calculation time is 00:00:00</message>
  </calculationState>
  <isSuspend>1</isSuspend>
  <saveZeros>1</saveZeros>
  <overwriteSameValues>0</overwriteSameValues>
  </calculation>
  <problemCalculationKey>2</problemCalculationKey>
  <useScenarios>1</useScenarios>
  <readOnly>0</readOnly>
  </problemMd>
  </item>
  </meta>
  </GetMsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetMs" :
{
"tMs" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"item" :
{
"key" : "306496",
"problem" :
{
"problemCalculation" :
{
"calcAction" : "Suspend",
"calculationState" : ""
},
"problemCalculationKey" : "0"
}
}
}
}
}
}

JSON response:

{
"GetMsResult" :
{
"id" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "key 306480",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "6",
"@hf" : "0",
"i" : "MODELSPACE",
"n" : "Modeling container",
"k" : "306480",
"c" : "5121",
"p" : "1580",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"item" :
{
"k" : "306496",
"id" : "OBJ306496",
"n" : "Modeling problem",
"vis" : "1",
"type" : "Problem",
"problemMd" :
{
"calculation" :
{
"pointCount" : "0",
"pointPassed" : "0",
"saveData" : "1",
"copyFact" : "0",
"treatNullsAsZeros" : "0",
"isRunning" : "0",
"calculationState" :
{
"message" : "Problem calculation is finished. Calculation time is 00:00:00"
},
"isSuspend" : "1",
"saveZeros" : "1",
"overwriteSameValues" : "0"
},
"problemCalculationKey" : "2",
"useScenarios" : "1",
"readOnly" : "0"
}
}
}
}
}
public static MsItem GetMsCalcSuspend(MsId ms, uint modelKey, uint? prCalcKey)
{
var getMsOp = new GetMs()
{
// Set operation execution parameters
tMs = ms,
tArg = new GetMsArg()
{ // Set general data extraction pattern
pattern = new MsMdPattern()
{
item = new MsItemPattern()
{ // Set key of calculated model
key = modelKey,
// Set data calculation pattern
problem = new MsProblemPattern()
{
problemCalculation = new MsProblemCalculationPattern()
{
calcAction = CalcAction.Suspend,
calculationState = new MsCalculationStatePattern()
},
problemCalculationKey = prCalcKey
}
}
}
}
};
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Stop calculation
var result = somClient.GetMs(getMsOp);
return result.meta.item;
}

See also:

GetMs: Operation