Below is the example of using the GetMs operation to create an object that calculates a model. The request contains an instance of opened modeling container, pattern and parameters of model calculation. The response contains calculation parameters.
{
"GetMs" :
{
"tMs" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"item" :
{
"key" : "306496",
"problem" :
{
"problemCalculation" :
{
"calculationState" : ""
},
"calculate" :
{
"includedScenarioKeys" : "",
"factIncluded" : "true",
"paramValues" :
{
"its" :
{
"Item" :
{
"k" : "0",
"id" : "ITEM1",
"value" : "5"
}
}
},
"period" :
{
"identificationStartDate" : "1990-01-01",
"identificationEndDate" : "2005-01-01",
"forecastStartDate" : "2006-01-01",
"forecastEndDate" : "2015-01-01"
},
"dataLoadingPeriod" :
{
"useDefault" : "false",
"startDate" : "1990-01-01",
"endDate" : "2006-01-01"
},
"defaultLevel" : "Year",
"breakOnError" : "true",
"clearSeriesOnWarning" : "true",
"filterWarnings" : "true"
}
}
}
}
}
}
}
{
"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",
"isSuspend" : "0",
"saveZeros" : "1",
"overwriteSameValues" : "0"
},
"problemCalculationKey" : "0",
"useScenarios" : "1",
"readOnly" : "0"
}
}
}
}
}
public static uint? GetMsStartCalc(MsId ms, uint modelKey)
{
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,
problem = new MsProblemPattern()
{ // Set data calculation pattern
problemCalculation = new MsProblemCalculationPattern()
{
calculationState = new MsCalculationStatePattern() { }
},
calculate = new MsProblemCalculationSettings()
{
includedScenarioKeys = new long[] { },
factIncluded = true,
// Set values of metamodel parameters
paramValues = new MsModelParamValues()
{
its = new MsModelParamValue[]
{
new MsModelParamValue()
{
id = "ITEM1",
value = "5"
}
}
},
// Set calculation periods
period = new MsModelPeriod()
{
identificationStartDate = DateTime.Parse("01.01.1990"),
identificationEndDate = DateTime.Parse("01.01.2005"),
forecastStartDate = DateTime.Parse("01.01.2006"),
forecastEndDate = DateTime.Parse("01.01.2015")
},
// Set data loading periods
dataLoadingPeriod = new MsDataLoadingPeriod()
{
useDefault = false,
startDate = DateTime.Parse("01.01.1990"),
endDate = DateTime.Parse("01.01.2006")
},
// Set calendar frequency and other parameters
defaultLevel = DimCalendarLvl.Year,
breakOnError = true,
clearSeriesOnWarning = true,
filterWarnings = true
}
}
}
}
}
};
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Start calculation
GetMsResult getMsResult = somClient.GetMs(getMsOp);
uint? prCalcKey = getMsResult.meta.item.problemMd.problemCalculationKey;
return prCalcKey;
}
See also: