Below is the example of using the SetMs operation to add a variable to the equation. The request contains an instance of opened modeling container, parameters of operation execution, and the added variable. After executing the operation returns the the changed equation.
{ "SetMs" : { "tMs" : { "id" : "S109!M!S!C1" }, "tArg" : { "pattern" :
{ "obInst" : "true" }, "meta" : "", "metaGet" : { "obInst" : "true", "item" : { "key" : "4411",
"problem" : { "metamodel" : { "calculationChain" : "Get", "tag" : "false", "calcChainPattern" : { "modelPattern" : {
"generatedName" : "true" } } } } } }, "execParams" : { "k" : "4936",
"slice" : { "k" : "0", "id" : "OBJ_TSDB!313", "n" : "Time series database!d12", "vis" : "true", "variableKey" : "4939", "stubKey" : "2940", "selections" : {
"its" : { "Item" : { "id" : { "id" : "208" }, "variant" : "313" }
} }, "aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0",
"parameter" : "0" } } }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0"
}, "level" : "None" }, "execSaveProblem" : "true", "execAddFactor" : "true" } } } } } }
{ "SetMsResult" :
{ "id" : { "id" : "S109!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" : "4411", "id" : "MODEL_DEL", "n" : "model_del", "vis" : "1", "type" : "Problem", "problemMd" : {
"metamodel" : { "k" : "4412", "calculationChain" : { "its" : { "Item" : { "k" : "4936",
"id" : "OBJ4936", "n" : "Varable[t] = A1*Varable[t]", "vis" : "1", "type" : "Model", "excluded" : "0", "model" : { "generatedName" : "Varable[t] = A1*Varable[t] + A2*Time series database!d12[t]" } }
} }, "visualController" : "" } } } }
public static MsItem SetMsAddFactor(MsId ms, ulong modelKey, ulong eqKey, MsFormulaTransformSlice factor) { var setMsOp = new SetMs(); setMsOp.tMs = ms; setMsOp.tArg = new SetMsArg() { // Set data change pattern pattern = new MsMdPattern() { }, meta = new MsMd() { }, // Set data getting pattern metaGet = new MsMdPattern() { item = new MsItemPattern()
{ key = modelKey, problem = new MsProblemPattern() { metamodel = new MsMetaModelPattern() { tag = false, calculationChain = ListOperation.Get, calcChainPattern = new MsCalculationChainPattern() {
modelPattern = new MsModelPattern() {generatedName = true} } } } } },// Set operation execution parameters execParams = new MsMdExecParams() { // Set equation key k = eqKey
// Set slice corresponding to series slice = factor, execAddFactor = true, execSaveProblem = true } }; // Create a proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute operation var result = somClient.SetMs(setMsOp); return result.meta.item; }
See also: