Skip to main content

Model Actions

Model actions are complex data actions designed to be used with the XINA Data Model Standards.

MODEL_MN_IMPORT

The MODEL_MN_IMPORT action mnemonic data for a single model into XINA.

Property Value
action "model_mn_import"
model model group specifier
object_id object ID of CSV data file
t time data type (optional, default to model type)
mn_database mnemonic database specifier (optional, default <model>.data.mn.full)
on_overlapbehavior for time overlap with database, fail, delete, ignore, (optional, default fail)

Unlike standard XINA insert operations, this action can have impacts across multiple databases. The imported data file must contain three columns:

column description
t / time time
mn / mn_id / mnemonic / hk / hk_id / name / label mnemonic name or ID
v / value value, empty string, or null

The time column may either be a zoned ISO8601 timestamp or Unix time. If Unix time it will be interpretted according to the type set to t in the action.

If the mn column is an integer it will be interpretted as a literal mnemonic ID. Otherwise the name will be parsed from this format:

<name>[(<unit>[;n0=v0|n1=v1|...])]

<name> will be used for the mnemonic name lookup. The comparison is case insensitive and any whitespace is treated as a single underscore. <unit> is optional. If provided, it must match the unit of an associated mnemonic definition, otherwise an error is thrown. The section after unit defines discrete value mapping.

When a data set is imported the XINA server will run the following steps:

  • For each row:
    • validate time and value
    • process mnemonic
      • If mnemonic ID
        • If found in definitions database:
          • If mnemonic is deprecated, throw error
          • Else, use mnemonic for row
        • Else, throw error due to unrecognized ID
      • Else, parse name and optional unit
        • If name match found:
          • If unit is provided and does not match, throw error
          • If mnemonic is deprecated, throw error
          • Else, use mnemonic for row
        • Else, mnemonic is new, create new temporary mnemonic definition based on provided information
  • If any rows contain same mnemonic and time, throw error
  • Check for time overlap in database
    • If found
      • If on_overlap = fail, throw error
      • Else If on_overlap = delete, delete all data from database in time range of imported data
      • Else (on_overlap = ignore), do nothing
  • If new mnemonic definitions created, insert into mnemonic definition database
  • Insert data into mnemonic database

Examples