Ниже приведен пример использования операции SetMs для изменения параметров уравнения. В запросе передаются: экземпляр открытого контейнера моделирования, параметры выполнения операции, настройки уравнения для Грей-метода и шаблон получения измененных данных. В результате выполнения операция возвращает модель, содержащую измененное уравнение.
{
"Envelope" :
{
"Body" :
{
"SetMs" :
{
"tMs" :
{
"id" : "S110!M!S!C1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"item" :
{
"key" : "3716",
"model" :
{
"transform" :
{
"formulas" : ""
}
}
}
},
"meta" :
{
"item" :
{
"k" : "3716",
"type" : "Model",
"modelMd" :
{
"transform" :
{
"formulas" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"kind" : "GreyForecast",
"method" :
{
"greyForecast" :
{
"missingData" :
{
"method" : "LinTrend"
},
"confidenceLevel" : "0.9" } } } ] } } } } }
},
"metaGet" :
{
"obInst" : "true",
"scenarios" : "Get",
"item" :
{
"key" : "2803",
"problem" :
{
"metamodel" :
{
"calculationChain" : "Get",
"calcChainPattern" :
{
"modelPattern" :
{
"transform" :
{
"formulaCount" : "true",
"formulas" :
{
"method" : ""
},
"equationsFormula" :
{
"method" : ""
},
"kind" : "true"
}
}
},
"visualControllerPattern" :
{
"variableRubricatorKey" : "true",
"chainWorkbookKey" : "true",
"freeVariables" : "true"
}
}
}
}
},
"execParams" :
{
"execSaveModel" : "true"
}
}
}
}
}
}
{
"Envelope" :
{
"Body" :
{
"SetMsResult" :
{
"id" :
{
"id" : "S110!M!S!C1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@isShortcut" : "0",
"i" : "MODELSPACE",
"n" : "Контейнер моделирования",
"k" : "1581",
"c" : "5121",
"p" : "1580",
"h" : "0"
}
},
"dirty" : "0",
"scenarios" :
{
"nodes" :
{
"it" :
{
"@isFolder" : "0",
"k" : "1628",
"id" : "OBJ1628",
"n" : "Базовый",
"vis" : "1",
"scenDesc" :
{
"@isShortcut" : "0",
"i" : "OBJ1628",
"n" : "Базовый",
"k" : "1628",
"c" : "5124",
"p" : "1627",
"h" : "0"
}
}
}
},
"item" :
{
"k" : "2803",
"id" : "TEMP_MODEL",
"n" : "TEMP_MODEL",
"vis" : "1",
"type" : "Problem",
"problemMd" :
{
"metamodel" :
{
"k" : "2804",
"calculationChain" :
{
"its" :
{
"Item" :
{
"k" : "3716",
"id" : "OBJ3716",
"n" : "MyOutputVavable[t] = GreyForecast(MyOutputVavable[t])",
"vis" : "1",
"type" : "Model",
"excluded" : "0",
"model" :
{
"transform" :
{
"formulaCount" : "1",
"formulas" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"kind" : "GreyForecast",
"method" :
{
"greyForecast" :
{
"missingData" :
{
"specifiedVector" : "",
"method" : "LinTrend",
"methodParameter" : "5",
"specifiedValue" : "0"
},
"confidenceLevel" : "0.900000"
},
"inversionInfo" :
{
"type" : "None",
"lag" : "PrecidingValue", "previousLag" : "-1", "seasonality" : "None", "dependence" : "Linear", "K" : "3" } }, "calendarLevel" : "Year", "outputSliceKey" : "0" }
] } }, "kind" : "Simple" } } } } }, "visualController" :
{
"variableRubricatorKey" : "2805",
"chainWorkbookKey" : "2837",
"freeVariables" :
{
"its" :
{
"Item" :
{
"k" : "0",
"id" : "261",
"n" : "MyInputVavable",
"vis" : "1",
"variableKey" : "2839",
"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"
}
} } } } } } } } } } }
Функция SetMsGrey изменяет метод расчёта уравнения. Входные параметры:
ms. Экземпляр открытого контейнера моделирования;
modelKey. Ключ модели, содержащей уравнение;
eqKey. Ключ уравнения.
В результате выполнения функция возвращает экземпляр контейнера моделирования, содержащего уравнение.
Для создания шаблона извлечения изменённых данных используется функция createMetaGetPattern, описанная в разделе «Настройка параметров метода «Подбор вида зависимости»».
public static MsItem SetMsGrey(MsId ms, ulong modelKey, ulong eqKey)
{ // Задаем параметры выполнения операции
var setMsOp = new SetMs();
setMsOp.tMs = ms;
setMsOp.tArg = new SetMsArg()
{ // Задаем шаблон изменения данных
pattern = new MsMdPattern()
{
item = new MsItemPattern()
{ // Указываем ключ уравнения
key = eqKey,
model = new MsModelPattern()
{
transform = new MsFormulaTransformPattern() { formulas = new TsFormulaPattern() { } }
}
}
}, // Задаем данные, которые необходимо изменить
meta = new MsMd()
{
item = new MsItem()
{ // Указываем ключ уравнения
k = eqKey,
type = MsItemType.Model,
modelMd = new MsModel()
{
transform = new MsFormulaTransform()
{
formulas = new TsFormulas()
{
its = new TsFormula[]
{
new TsFormula()
{
kind = TsFormulaKind.GreyForecast,
method = new TsMethod()
{ // Задаём параметры расчёта метода
greyForecast = new TsGreyForecastMethod()
{
missingData = new StatMissingData()
{method = StatMissingDataMethod.LinTrend},
confidenceLevel = 0.90
} } } } } }
} } }, // Задаём шаблон извлечения измененных данных metaGet = createMetaGetPattern(modelKey),
execParams = new MsMdExecParams() { execSaveModel = true }
}; // Создаем прокси-объект для выполнения операции
var somClient = new SomPortTypeClient();
// Задаем параметры выполнения операции
var result = somClient.SetMs(setMsOp);
return result.meta.item;
}
См. также:
SOAP