A model is either a signal model or a discrete model. Both shares the same descriptor structure and library interface.
The main difference between a signal model and a discrete model is, that a signal model is stateless. The discrete model has a state and therefore requires an additional (constant) memory. As a result of this difference, a discrete model is purely of an incremental character - once the state is updated, the model is not able to produce past values. The signal model, having all required reference signal values, is able to produce values from any requested time. Both types are further described in their respective subpages.
Every model is described by its descriptor (scgms::TModel_Descriptor
):
struct TModel_Descriptor {
const GUID id;
const NModel_Flags flags;
const wchar_t *description;
const wchar_t *db_table_name;
const size_t number_of_parameters;
const NModel_Parameter_Value *parameter_types;
const wchar_t **parameter_ui_names;
const wchar_t **parameter_db_column_names;
const double *lower_bound;
const double *default_values;
const double *upper_bound;
const size_t number_of_calculated_signals;
const GUID* calculated_signal_ids;
const GUID* reference_signal_ids;
};
id
in an unique model GUIDflags
represents a model feature flags, a value of NModel_Flags
, see belowdescription
is a string representing model name, displayed in user interface; it must not be nullptr
and must contain a valid zero-terminated stringdb_table_name
(deprecated) identifies database table name used to store this model parametersnumber_of_parameters
is a number of model parameters (and a size of following 6 arrays), must be greater than 0parameter_types
is an array of size number_of_parameters
, containing parameter types from NModel_Parameter_Value
enumerator (see below)parameter_ui_names
is an array of size number_of_parameters
, containing the human-readable parameter names of each parameterparameter_db_column_names
(deprecated) is an array of size number_of_parameters
, containing the database table column names of each parameterlower_bound
is an array of size number_of_parameters
, containing each parameter lower bound (for e.g. optimalization)default_values
is an array of size number_of_parameters
, containing a default value of each parameterupper_bound
is an array of size number_of_parameters
, containing each parameter upper bound (for e.g. optimalization)number_of_calculated_signals
is a number of signals this model may produce (and size of following 2 arrays)calculated_signal_ids
is an array of size number_of_calculated_signals
, containing GUIDs of calculated signals (the signal GUIDs that this model may emit at any time)reference_signal_ids
is an array of size number_of_calculated_signals
, containing GUIDs of reference signals for each calculated signal (to e.g. calculate signal errors by appropriate filters)
The NModel_Flags
enumerator currently contains only two values: Signal_Model
to identify a signal model and Discrete_Model
to identify discrete model. The use of these
two flags are not exclusive. Therefore, a model could be both signal model and discrete model, although it is not a common scenario.
The NModel_Parameter_Value
enumerator values serve as a semantic marker for each parameter. All parameters are internally stored as double precision floating point values. This enumerator
disambiguates between the following types:
mptDouble
- an ordinary double-precision floating point numbermptTime
- a double-precision floating point number representing rat timemptBool
- a boolean value; zero value is interpreted as false
, any other value as true
As stated above, a model defines a set of signals it produces. The philosophy is different for each type of model. A signal model defines its distinct set of signals, which it must produce, and a discrete model defines a set of any signals (already existing or newly introduced ones) it may produce.