STEM help

8.8.1 Sending input values

A call to the RunModel method should include a string input named configId that provides the model’s ID string and an array of inputs. A sample RunModel call might look like this (note that there may be any number of Input objects):

Sample RunModel call

The configId input is a string representation of a 128-bit GUID which you can obtain from the first line of the export_info.xml file created when exporting a model from the STEM Editor. The inputs you provide must be a subset of those listed for the model in its WebServiceModelConfig.txt file (corresponding to values that the modeller chose to export from the STEM Editor). Any unexpected inputs will cause the web service to fail the call without even trying to run the model. Any inputs not explicitly mentioned will be run with default values from the original model stored on the server.

Each input consists of three strings. The element and field strings specify which value within the STEM model will be set by the input. The value string gives the value to be set. If the input exported by the modeller was a scalar value then the value string must be a string representation of a single floating point value (e.g., “123.456”). If the input exported by the modeller was an interpolated series then you must provide a floating point value for each period defined in the exported series. These are provided in a semi-colon separated list of pairs of period-name and value. For example if the exported series had values defined for year 2 and for year 6 then your value string might look like “Y2; 0.0; Y6; 12.5”. There should be exactly one semicolon and one space between each value in the string. The period labels match those displayed in the STEM Editor.

There is no way to tell from the public interface of the web service what inputs it expects, what values are valid or what the meaning of the values is. To obtain such information you must either ask the modeller what values each input named in WebServiceModelConfig.txt may have, or you can determine such information by examining the user interface that was generated by STEM alongside the exported server files (the generated code will contain a function named get_inputs() that retrieves the inputs from the user interface and packages them into an array of Input objects).

 

© Implied Logic Limited