Below is the example of using the SetMs operation to delete a variable from the equation. The request contains an instance of opened modeling container, parameters of operation execution, and index of the variable to be deleted. After execution the operation returns the the changed equation.
{ "SetMs" : { "tMs" : { "id" : "S119!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" :
{ "modelsFactors" : { "its" : { "Item" : { "modelKey" : "4996", "factorIndex" : "1" }
} }, "execSaveMetaModel" : "true", "execSaveProblem" : "true", "execRemoveFactor" : "true" } } } } } }
{ "SetMsResult" :
{ "id" : { "id" : "S119!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" : "4996",
"id" : "OBJ4996", "n" : "Varable[t] = A1*Varable[t] + A2*Time series database!d12[t]", "vis" : "1", "type" : "Model", "excluded" : "0", "model" : { "generatedName" : "Varable[t] = A1*Varable[t]" } }
} }, "visualController" : "" } } } }
public static MsItem SetMsRemoveFactor(MsId ms, ulong modelKey, ulong eqKey) { 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() { execSaveProblem = true
execSaveMetaModel = true, execRemoveFactor = true, modelsFactors = new MsModelsFactors() { its = new MsModelFactor[] { new MsModelFactor() { // Set equation key modelKey = eqKey, // Set variable index
factorIndex = 1 } } } } }; // Create a proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute operation var result = somClient.SetMs(setMsOp); return result.meta.item; }
See also: