Below is the example of using the GetMs operation to create a model. The request contains an instance of opened modeling container and pattern of metadata for model creation. The response contains the created model.
{
"GetMs" :
{
"tMs" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CEDFMNBMHGPMOFOAEEOKCHDKLPKPFFKNEILBKMMPKNGGGFEEE"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"scenarios" : "Get",
"period" : "true",
"item" :
{
"problem" :
{
"metamodel" :
{
"calculationChain" : "Get",
"mmParams" : "Get",
"tag" : "true",
"calcChainPattern" :
{
"modelPattern" :
{
"transform" :
{
"inputs" : "Get",
"outputs" : "Get",
"formulaCount" : "true",
"formulas" :
{
"method" : ""
},
"displayId" : "true",
"equationsFormula" :
{
"method" : ""
},
"series" : "Get",
"kind" : "true",
"displaySettings" : "true",
"additionalAttributes" : "true",
"calculationType" : "true",
"calculationDirection" : "true",
"transformVariable" :
{
"slices" : "Get",
"transformSlice" :
{
"selection" : "Get"
}
}
},
"stochastic" : "true",
"calculationPeriod" : "true",
"useModelPeriod" : "true",
"useExistingData" : "true",
"treatNullsAsZeros" : "true",
"autoName" : "true",
"generatedName" : "true",
"period" : "true",
"isExclusive" : "true",
"useAutoPeriod" : "true"
}
},
"visualControllerPattern" :
{
"variableRubricatorKey" : "true",
"useSourceName" : "true",
"levelFormat" : "Short"
}
},
"scenarios" : "Get",
"details" : "true",
"useSavedCoefficients" : "true"
}
}
},
"execParams" :
{
"execCreateProblem" :
{
"parent" : "1581",
"id" : "",
"name" : "Model"
}
}
}
}
}
{
"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",
"period" :
{
"start" : "1968-12-08",
"end" : "2022-12-31"
},
"scenarios" :
{
"nodes" :
{
"it" :
{
"@isFolder" : "0",
"k" : "306497",
"id" : "OBJ306497",
"n" : "Basic",
"vis" : "1",
"scenDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "OBJ306497",
"n" : "Basic",
"k" : "306497",
"c" : "5124",
"p" : "306485",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
},
"internalKey" : "306497"
}
}
},
"item" :
{
"k" : "306669",
"id" : "OBJ306669",
"n" : "Model",
"vis" : "1",
"type" : "Problem",
"problemMd" :
{
"metamodel" :
{
"k" : "306670",
"calculationChain" :
{
"its" : ""
},
"mmParams" :
{
"its" : ""
},
"visualController" :
{
"userRPath" : "",
"isRExist" : "0"
},
"suppressEmptyFilter" :
{
"suppressEmpty" : "0",
"suppressEmptyArea" : "SerieBounds"
},
"readOnly" : "0",
"variableTestUseR" : "0",
"calculateIdentOnFact" : "0"
},
"scenarios" :
{
"its" : ""
},
"details" :
{
"period" :
{
"identificationStartDate" : "1968-01-01",
"identificationEndDate" : "2020-12-31",
"forecastStartDate" : "2020-12-31",
"forecastEndDate" : "2020-12-31",
"identificationStartDateParamID" : "",
"identificationEndDateParamID" : "",
"forecastStartDateParamID" : "",
"forecastEndDateParamID" : "",
"autoPeriod" : "0",
"identificationStartOffset" : "0",
"identificationEndOffset" : "0",
"forecastEndOffset" : "0",
"isIdentStartCorrect" : "1",
"isIdentEndCorrect" : "1",
"isForecastEndCorrect" : "1"
},
"currentPoint" : "2020-12-31"
},
"useSavedCoefficients" : "0",
"useScenarios" : "0",
"readOnly" : "0"
}
}
}
}
}
public static string GetMsNewModel(MsId ms, uint msKey, string id, string modelName)
{
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Operation execution parameters
var getMsOp = new GetMs()
{
tArg = new GetMsArg()
{
// Metadata extraction pattern
pattern = new MsMdPattern()
{
scenarios = ListOperation.Get,
period = true,
item = new MsItemPattern()
{ // Model metadata pattern
problem = new MsProblemPattern()
{
details = true,
scenarios = ListOperation.Get,
useSavedCoefficients = true,
// Metamodel metadata pattern
metamodel = new MsMetaModelPattern()
{
calculationChain = ListOperation.Get,
mmParams = ListOperation.Get,
tag = true,
// Metadata pattern for calculation chain
calcChainPattern = new MsCalculationChainPattern()
{
modelPattern = new MsModelPattern()
{
transform = new MsFormulaTransformPattern()
{
inputs = ListOperation.Get,
outputs = ListOperation.Get,
kind = true,
formulaCount = true,
formulas = new TsFormulaPattern()
{
method = new TsMethodPattern()
},
displayId = true,
equationsFormula = new TsFormulaPattern()
{
method = new TsMethodPattern()
},
series = ListOperation.Get,
displaySettings = true,
additionalAttributes = true,
calculationType = true,
calculationDirection = true,
transformVariable = new MsFormulaTransformVariablePattern()
{
slices = ListOperation.Get,
transformSlice = new MsFormulaTransformSlicePattern()
{
selection = ListOperation.Get
}
}
},
stochastic = true,
calculationPeriod = true,
useModelPeriod = true,
useExistingData = true,
treatNullsAsZeros = true,
autoName = true,
period = true,
isExclusive = true,
useAutoPeriod = true,
generatedName = true
}
},
visualControllerPattern = new MsMetaModelVisualControllerPattern()
{
variableRubricatorKey = true,
levelFormat = MsLevelFormat.Short,
useSourceName = true
}
}
}
}
},
execParams = new MsMdExecParams()
{
execCreateProblem = new MsMdExecCreateProblem()
{
id = id,
name = modelName,
key = null,
parent = msKey
}
}
},
tMs = ms
};
// Create a model
var result = somClient.GetMs(getMsOp);
return result.meta.item.id;
}
See also: