sendmessage.Rd
Messages are the mechanism used to get data from Hector model components and to set values within components.
sendmessage(core, msgtype, capability, date, value, unit)
a Hector instance
(String) type of message. Usually either GETDATA or SETDATA
(String) capability being targeted by the message. The core will use this information to look up the component to route the message to.
(NumericVector) Date for which to set/get the variable. Use NA if there is no applicable date.
(NumericVector) Numeric portion of the optional data (in case of setting a value this will be the value to set). The length of this vector should match that of the time, or it should be length 1 (in which case it will be recycled).
(String) Unit for the value vector.
A message comprises a type (e.g. GETDATA to retrieve data from a component, or SETDATA to set data in a component), a capability, which identifies the information to be operated on (e.g. Atmospheric CO2 concentration, or global total radiative forcing), and an optional structure of extra data (comprising a date and a numerical value with units).
The arguments to this function are organized in a slightly more R-friendly way. The message type and capability are each passed as a single string. The date portion of the extra data is passed as a numeric vector (one message will be generated for each date). The value portion of the extra data is a numeric vector with a length of either 1 or the same length as the date vector. The units portion is a single string (we don't support sending a vector of values with heterogeneous units in a single call.
Either the date or the value (or both) may be NA. The date should be NA in cases where the parameter being referenced doesn't change with time. The value should be NA in cases where the optional data will be ignored.