.. _measurement_setup_view:

Measurement Setup view
======================

The Measurement Setup view shows the current configuration, i.e. which Kvaser interfaces that are currently configured to be used and how to handle the data they receive. The configuration is illustrated as a node graph that is orientated from left to right, where a node corresponds to a specific Kvaser interface or a feature such as logging messages. The Measurement Setup view opens automatically after creating a new or selecting a saved project, but can also be opened from the vertical tool bar to the left of the application.

An example of a measurement setup is provided below. It contains two Kvaser virtual CAN channels, a Traffic Generator node for generating data on CAN 2 and a pass-through filter on CAN 1. The data is transmitted to a stream.

.. image:: ../images/Example_measurement_setup.png
  :scale: 80%
  :alt: An example of a measurement setup using Kvaser virtual CAN channels.

A measurement can optionally be kept running in the background even if the Kvaser CanKing application is closed. This can be configured in the :ref:`user settings <settings>`.

.. _nodes:

Nodes
-----

A node has one of three types:

* Source
* Data processor
* Target

All Kvaser interfaces are source nodes, but there is also a source node for replaying log files and generating CAN traffic. A data processor parses the data transmitted from a source node and may for example consist of a database (.dbc file) or a filter. A target node, on the other hand, could be a Message Logger or Signal Logger. All data is also transmitted to a stream (denoted as 'UI Streams' in the Measurement Setup view). For a list of all available nodes, sorted according to type, see :ref:`standard_nodes`.

A node may be enabled or disabled in a measurement setup.

.. _standard_nodes:

Standard nodes
~~~~~~~~~~~~~~

Available source nodes are:

* CAN Channel
* LIN Channel
* Traffic Generator
* Log Replay

The CAN Channel source node is used for configuring a connected Kvaser CAN interface or Kvaser virtual CAN channel, whilst the LIN Channel source node sets up a connected Kvaser LIN interface, optionally with a LIN database attached to it (.ldf file).

For generating data to be transmitted on the bus, either the Traffic Generator or Log Replay source node can be used. The Traffic Generator source node is able to generate data for a configured CAN Channel node. To generate data for a LIN channel see the LIN Send and LIN Message Update views in the :ref:`standard_panes` section (corresponding CAN views may be used for CAN Channel nodes instead of the Traffic Generator). To replay a previously saved log file and thereby be able to receive the same data at the same time again, the Log Replay source node is added to the measurement setup.

There is also an 'All Connected CAN Channels' option when adding a source node which provides a shortcut to adding all CAN channels at once instead of adding one at the time using the 'CAN Channel' source node.

Available data processing nodes are:

* CAN Message Filter
* Databases
* Interpreter
* Extension

The CAN Message Filter data processor is used for filtering messages according to their CAN identifiers (standard and/ or extended).

The Databases data processor is used for adding .dbc and .ldf files to specific CAN or LIN channels, whilst the Interpreter data processor handles interpretation of the data on a specific channel according to a certain protocol, like J1939.

Lastly, there is an Extension data processor. It is used for adding and configuring service extensions, see :ref:`customized_nodes` for more information.

Available target nodes are:

* Message Logger
* Signal Logger

The Message Logger and Signal Logger target nodes both handles logging to files. The former is logging messages, whilst the latter logs signals.

Supported file formats for the Message Logger target node are:

=============         =========         =================================
Format                Extension         Description
=============         =========         =================================
CSV Frame             csv               CAN frames in CSV format
KME 2.4               kme               Kvaser binary format (KME 2.4)
KME 2.5               kme25             Kvaser binary format (KME 2.5)
KME 4.0               kme40             Kvaser binary format (KME 4.0)
KME 5.0               kme50             Kvaser binary format (KME 5.0)
MDF                   log               CAN frames in MDF format
MDF v4.x              mf4               CAN frames in MDF v4.x format
Plain text            txt               CAN frames in plain text format
Vector ASCII          asc               CAN frames in Vector ASCII format
Vector BLF FD         blf               CAN frames in Vector BLF format
=============         =========         =================================


Supported file formats for the Signal Logger target node are:

===============           =========           ======================================
Format                    Extension           Description
===============           =========           ======================================
CSV Signal                csv                 Selected signals in CSV format
FAMOS                     dat                 Selected signals in FAMOS format
Matlab                    mat                 Selected signals in Matlab format
MDF Signal                mdf                 Selected signals in MDF format
MDF v4.x Signal           mf4                 Selected signals in MDF v4.x format
===============           =========           ======================================

.. _customized_nodes:

Customized nodes
~~~~~~~~~~~~~~~~

A user may create customized nodes to be able to get additional functionality, like for example a protocol that is not already available in the Interpreter data processing node. Such extension can be written in any programming language given that they can be made into `Wasm <https://component-model.bytecodealliance.org/introduction.html>`_ components.

For more information about service extensions, including examples and how to install them, see the separate guide found in the tool bar in the Kvaser CanKing application by selecting *Help* followed by *CanKing Service Extensions SDK Help...*.
