STEM help

8.8.2 Receiving results

A successful call to the RunModel method will return a success code, a status message, the names of each period over which the model was run and the values of each result specified by the modeller at export time. A failed call will result in the same data structure being returned, but the period name and result arrays will be empty.

Sample response from the RunModel method

A caller should first examine the status value. This will be 0 if the model was run successfully. If the status code is non-zero then it will contain a value that may be useful to Implied Logic engineers in determining what failure occurred. In this non-zero case, the statusString value will contain a message suitable for presentation to non-technical users explaining what problem caused the run to fail.

Each ScenarioPeriodLabels object within the periodNames field will contain the names by which you should refer to each period over which the model was run when dealing with a particular scenario and consolidation mode. These are intended to be useful when displaying results to users. Different scenarios could have different numbers of periods and these could be differently named. There will always be one ScenarioPeriodLabels object for each consolidation of each scenario of the model from which any results were exported.

The results field will contain an array of SingleResult objects giving the actual results of the run that a user will want to see. There will be one SingleResult object for each result named in WebServiceModelConfig.txt. The SingleResult contains the name of the scenario that was run to generate it (including sensitivity name, parameter and step if relevant), the consolidation mode under which the result was generated, the name of the element of the model to which it applies, the name of the result and an array of values. The name of the result will correspond to either a result defined by STEM, in which case you can determine what it means by reading the main STEM user guide, or a result defined by the modeller in their .cnf file, in which case the modeller should be able to explain the meaning. The array of values contains the value of the result as calculated for each period over which the scenario was run, after any consolidation is applied. These are always in chronological order, which is the same order as the names of the periods given in the corresponding ScenarioPeriodLabels object.

As with the inputs, the public interface gives no indication beyond the result name of the meaning of a particular result. The actual meaning of any particular result is highly dependent upon the context in which it was generated and so the modeller who chose to export the result is likely to be the best person to explain it. You should be able to obtain the labelling that the modeller chose to use within the Results Program before export by examining the HTML interface generated by the STEM export. In particular, in stem_presentation.htm you will find a table of expected results in a <div> element with ID "hidden_results_data" and chart placeholders giving the titles of each data series in a number of <div> elements with class "chart_container". The linkage between the data source table and the chart placeholders is supplied by JavaScript functions called from the parse_results_xml function in assets\js\stem_model.js.

 

© Implied Logic Limited