Below is the example of using the GetMs operation to add variables to a model. The request contains the following information: instance of opened modeling container, data getting pattern and data slices that correspond to the added variables. The response contains variables that are not included into any of the model equations.
{ "GetMs" : { "tMs" :
{ "id" : "S38!M!S!C1" }, "tArg" : { "pattern" : { "obInst" : "true", "item" : {
"key" : "4412", "metaModel" : { "tag" : "false", "visualControllerPattern" : { "freeVariables" : "true" } } }
}, "execParams" : { "slices" : { "its" : { "Item" : { "k" : "0",
"id" : "261", "n" : "MyInputVavable", "vis" : "true", "variableKey" : "5156", "stubKey" : "2805", "selections" : { "its" : { "Item" :
{ "id" : { "id" : "2818" }, "variant" : "261" } } }, "aggregator" : "None",
"parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" } }
}, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "None" }
} }, "execSaveMetaModel" : "true", "execSaveProblem" : "true", "execCreateVariables" : "true" } } } } } }
{
"GetMsResult" : { "id" : { "id" : "S38!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" : "4412", "id" : "MODEL_DEL_METAMODEL", "n" : "model_del", "vis" : "1", "type" : "MetaModel", "metaModelMd" :
{ "k" : "4412", "visualController" : { "freeVariables" : { "its" : { "Item" : {
"k" : "0", "id" : "261", "n" : "MyInputVavable", "vis" : "1", "variableKey" : "5179", "stubKey" : "2805", "selections" : { "its" : {
"Item" : { "id" : { "id" : "2818" }, "variant" : "261" } } },
"aggregator" : "None", "parametrizedDimensions" : { "its" : { "Item" : { "dimension" : "0", "parameter" : "0" }
} }, "unitInfo" : { "unit" : "4294967295", "measure" : "4294967295", "baseUnit" : "4294967295", "unitsDimensionKey" : "0" }, "level" : "None"
} } } } } } }
public static MsItem GetMsAddVars(MsId ms, ulong metaModelKey, MsFormulaTransformSlices slices) { var getMsOp = new GetMs(); getMsOp.tMs = ms; getMsOp.tArg = new GetMsArg() { // Set data change pattern pattern = new MsMdPattern() { item = new MsItemPattern() { key = metaModelKey, metaModel = new MsMetaModelPattern() { tag = false, visualControllerPattern = new MsMetaModelVisualControllerPattern() { freeVariables=true } } } }, execParams = new MsMdExecParams() { slices = slices, execCreateVariables = true, execSaveProblem = true, execSaveMetaModel = true } }; // Create a proxy object for operation execution var somClient = new SomPortTypeClient(); // Set operation execution parameters var result = somClient.GetMs(getMsOp); return result.meta.item; }
See also: