SmartCGMS developer zone

Device event

A device event is a primary messaging structure, which is used to communicate between entities (primarily filters). The SDK defines the structure scgms::TDevice_Event with the following memory layout:

struct TDevice_Event {
	NDevice_Event_Code event_code;

	GUID device_id;
	GUID signal_id;

	double device_time;
	int64_t logical_time;

	uint64_t segment_id;

	union {
		double level = 0.0;
		IModel_Parameter_Vector* parameters;
		refcnt::wstr_container* info;
	};
};

The meaning of all structure members are:

  • event_code - the identifier of data contained within this device event, see below for possible values
  • device_id - GUID of device (filter, model) that produced this device event
  • signal_id - GUID of signal, that is carried by this device event
  • device_time - rat time of this device event creation, see time and time segments page
  • logical_time - logical time of this device event; increasing sequence of numbers are assigned, preferably by a single global arbiter (the scgms library achieves that by centralizing the device event creation)
  • segment_id - ID of time segment, see time and time segments page
  • value union
    • level - holds a signal level value
    • parameters - holds a vector of parameters
    • info - holds a string

The event_code field contains one of the values from scgms::NDevice_Event_Code enumeration:

  • Nothing - this value is considered invalid outside the entity context; this should only represent an internal device event
  • Shut_Down - shuts down the entity operation and releases it from memory, if possible
  • Level - holds signal value
  • Masked_Level - holds masked signal value ("hidden" level, masked by a masking filter in order to create e.g.; testing dataset)
  • Parameters - holds the newest set of parameters of a model
  • Parameters_Hint - holds the hint for a model parameters (a set of previously identified parameters used e.g.; as an initial population member in solvers)
  • Suspend_Parameter_Solving - suspends parameter solving in filters, that solves parameters repeatedly during simulation
  • Resume_Parameter_Solving - resumes parameter solving in filters, that solves parameters repeatedly during simulation
  • Solve_Parameters - explicitly requests the solver to be run on a given parameter-solving filter
  • Time_Segment_Start - marks the start of a time segment, see time and time segments page for more info
  • Time_Segment_Stop - marks the end of a time segment, see time and time segments page for more info
  • Warm_Reset - resets the entity to an initial state, but preserving any useful data (e.g.; solved parameters)
  • Information - holds the information string
  • Warning - reports warning, holds the warning detail string
  • Error - reports a runtime error, holds the error detail string