Adding SMV streams

Adding SMV streams

This page describes the steps to write a complete working configuration using the sample measured values and phasor plugin.

Creating a basic configuration structure

Before adding any datapoints to describe each Sample Measured Values(SMVv), it’s required to create a minimum configuration. Here we will assume that the phasor and the smv plugins will run in different runtimes.

So we create a file structure like this:

        • smv_plugin.json
      • runtime.json
        • phasor_plugin.json
      • runtime.json
  • ui_config.json
  • config.json
  • Then we define the files for the general configuration of the gateway and UI.

    {
      "datapoints": []
    }
    {
      "assets": [],
      "asset_widget_mapping": [],
      "widgets": []
    }

    Then we define the configuration of each runtime

    { 
      "description": "The runtime for the SMV plugin", 
      "runtime_name": "publisher"
    }
    { 
      "description": "The runtime for the phasor plugin", 
      "runtime_name": "subscriber"
    }

    Finally, we define the configuration of the plugins:

    {
        "use_concurrent_publisher": false,
        "plugin_name": "libphasor_plugin.so",
        "plugin_instance_name": "phasor_plugin",
        "plugin_specific_config": {
            "streams": [
            ]
        },
        "datapoint_subscriptions": [],
        "datapoint_publications": []
    }
    {
        "use_concurrent_publisher": false,
        "plugin_name": "libsmv_subscriber.so",
        "plugin_instance_name": "smv_plugin",
        "plugin_specific_config": {
            "ethernet_interface": "ens2f0np0",
            "smv_subscribers": []
        },
        "datapoint_subscriptions": [],
        "datapoint_publications": []
    }

    With these, we have the most basic configuration. This is enough to run the gateway, but obviously none of the plugins will interact with anything so there is no data to be shown.

    Adding a new data stream

    Now we are gonna add a new data stream to be received and decoded by the SMV plugin, sent it to be processed by the phasor plugin and be shown as an asset (with widgets) in the web interface. In this specific scenario we are adding a new stream composed of 3 currents and 3 voltages, at 4800 samples per second and will arrive with 0x4001 APPID.

    ⚠️
    Currently, when setting up widgets and assets, it is required to provide a neutral current and voltage. If the input stream doesn’t have any of those, an empty datapoint should be created and reference on the neutral current and voltage.

    Configure the SMV plugin

    To configure the SMV plugin in smv_plugin.json, first we need to specify it’s dataset and also, how to map them to a datapoint. First we add a new JSON element to the plugin_specific_config.smv_subscribers:

    smv_subscribers
    {
                    "smv_id": "smv",
                    "app_id": "4001",
                    "src_mac": "58:47:ca:78:e0:84",
                    "dst_mac": "d8:3a:dd:36:ce:7c",
                    "sample_rate": 4800,
                    "conf_rev": "0",
                    "dataset": [
                        {
                            "obj_ref": "IED1MU01/TCTR1.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 0
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR1.AmpSv.q",
                            "type": "Quality",
                            "idx": 1
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR2.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 2
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR2.AmpSv.q",
                            "type": "Quality",
                            "idx": 3
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR3.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 4
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR3.AmpSv.q",
                            "type": "Quality",
                            "idx": 5
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR4.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 6
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR4.AmpSv.q",
                            "type": "Quality",
                            "idx": 7
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR1.VolSv.instMag.i",
                            "type": "INT32",
                            "idx": 8
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR1.VolSv.q",
                            "type": "Quality",
                            "idx": 9
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR2.VolSv.instMag.i",
                            "type": "INT32",
                            "idx": 10
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR2.VolSv.q",
                            "type": "Quality",
                            "idx": 11
                        }
                    ],
                    "datapoint_mappings": [
                        {
                            "datapoint": "smv_4001_voltage_a",
                            "value_idx": "0",
                            "quality_idx": "1"
                        },
                        {
                            "datapoint": "smv_4001_voltage_b",
                            "value_idx": "2",
                            "quality_idx": "3"
                        },
                        {
                            "datapoint": "smv_4001_voltage_c",
                            "value_idx": "4",
                            "quality_idx": "5"
                        },
                        {
                            "datapoint": "smv_4001_current_a",
                            "value_idx": "6",
                            "quality_idx": "7"
                        },
                        {
                            "datapoint": "smv_4001_current_b",
                            "value_idx": "8",
                            "quality_idx": "9"
                        },
                        {
                            "datapoint": "smv_4001_current_c",
                            "value_idx": "10",
                            "quality_idx": "11"
                        }
                    ]
                }

    Then we need to specify which datapoints will this plugin publish to the framework, so we add the following the “datapoint_publications” array:

    datapoint_publications
            {
                "name": "smv_4001_voltage_a"
            },
            {
                "name": "smv_4001_voltage_b"
            },
            {
                "name": "smv_4001_voltage_c"
            },
            {
                "name": "smv_4001_current_a"
            },
            {
                "name": "smv_4001_current_b"
            },
            {
                "name": "smv_4001_current_c"
            }

    <button class=“hextra-code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50” title=“Copy code”

    <div class="copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4"></div>
    <div class="success-icon hx-hidden group-[.copied]/copybtn:hx-block hx-pointer-events-none hx-h-4 hx-w-4"></div>
    

    With this we are done with the SMV plugin. After all changes, assuming that there wasn’t already any stream configured, the full configuration should look like:

    smv_plugins.json
    {
        "use_concurrent_publisher": false,
        "plugin_name": "libsmv_subscriber.so",
        "plugin_instance_name": "smv_plugin_ens2f0np0",
        "plugin_specific_config": {
            "ethernet_interface": "ens2f0np0",
            "smv_subscribers": [
                {
                    "smv_id": "smv",
                    "app_id": "4001",
                    "src_mac": "58:47:ca:78:e0:84",
                    "dst_mac": "d8:3a:dd:36:ce:7c",
                    "sample_rate": 4800,
                    "conf_rev": "0",
                    "dataset": [
                        {
                            "obj_ref": "IED1MU01/TCTR1.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 0
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR1.AmpSv.q",
                            "type": "Quality",
                            "idx": 1
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR2.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 2
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR2.AmpSv.q",
                            "type": "Quality",
                            "idx": 3
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR3.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 4
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR3.AmpSv.q",
                            "type": "Quality",
                            "idx": 5
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR4.AmpSv.instMag.i",
                            "type": "INT32",
                            "idx": 6
                        },
                        {
                            "obj_ref": "IED1MU01/TCTR4.AmpSv.q",
                            "type": "Quality",
                            "idx": 7
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR1.VolSv.instMag.i",
                            "type": "INT32",
                            "idx": 8
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR1.VolSv.q",
                            "type": "Quality",
                            "idx": 9
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR2.VolSv.instMag.i",
                            "type": "INT32",
                            "idx": 10
                        },
                        {
                            "obj_ref": "IED1MU01/TVTR2.VolSv.q",
                            "type": "Quality",
                            "idx": 11
                        }
                    ],
                    "datapoint_mappings": [
                        {
                            "datapoint": "smv_4001_voltage_a",
                            "value_idx": "0",
                            "quality_idx": "1"
                        },
                        {
                            "datapoint": "smv_4001_voltage_b",
                            "value_idx": "2",
                            "quality_idx": "3"
                        },
                        {
                            "datapoint": "smv_4001_voltage_c",
                            "value_idx": "4",
                            "quality_idx": "5"
                        },
                        {
                            "datapoint": "smv_4001_current_a",
                            "value_idx": "6",
                            "quality_idx": "7"
                        },
                        {
                            "datapoint": "smv_4001_current_b",
                            "value_idx": "8",
                            "quality_idx": "9"
                        },
                        {
                            "datapoint": "smv_4001_current_c",
                            "value_idx": "10",
                            "quality_idx": "11"
                        }
                    ]
                }
            ]
        },
        "datapoint_subscriptions": [],
        "datapoint_publications": [
            {
                "name": "smv_4001_voltage_a"
            },
            {
                "name": "smv_4001_voltage_b"
            },
            {
                "name": "smv_4001_voltage_c"
            },
            {
                "name": "smv_4001_current_a"
            },
            {
                "name": "smv_4001_current_b"
            },
            {
                "name": "smv_4001_current_c"
            }
        ]
    }

    For more information about each property SMV specific check SMV plugin specification

    Configure the Phasor plugin

    To configure the Phasor plugin in phasor_plugin.json we just need to map each channel’s or datapoint’s input to 3 different output datapoint (RMS, Phase, Frequency) First we add a new JSON element to the plugin_specific_config.streams:

    streams
    {
                    "smv_datapoint_name": "smv_4001_voltage_a",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_a_rms",
                    "freq_datapoint_name": "smv_4001_voltage_a_freq",
                    "phase_datapoint_name": "smv_4001_voltage_a_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_voltage_b",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_b_rms",
                    "freq_datapoint_name": "smv_4001_voltage_b_freq",
                    "phase_datapoint_name": "smv_4001_voltage_b_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_voltage_c",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_c_rms",
                    "freq_datapoint_name": "smv_4001_voltage_c_freq",
                    "phase_datapoint_name": "smv_4001_voltage_c_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_a",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_a_rms",
                    "freq_datapoint_name": "smv_4001_current_a_freq",
                    "phase_datapoint_name": "smv_4001_current_a_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_b",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_b_rms",
                    "freq_datapoint_name": "smv_4001_current_b_freq",
                    "phase_datapoint_name": "smv_4001_current_b_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_c",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_c_rms",
                    "freq_datapoint_name": "smv_4001_current_c_freq",
                    "phase_datapoint_name": "smv_4001_current_c_phase"
                }

    Then, just like before, we also have to reference the datapoints published:

    datapoint_publications
            {
                "name": "smv_4001_voltage_a_freq"
            },
            {
                "name": "smv_4001_voltage_a_rms"
            },
            {
                "name": "smv_4001_voltage_a_phase"
            },
            {
                "name": "smv_4001_voltage_b_freq"
            },
            {
                "name": "smv_4001_voltage_b_rms"
            },
            {
                "name": "smv_4001_voltage_b_phase"
            },
            {
                "name": "smv_4001_voltage_c_freq"
            },
            {
                "name": "smv_4001_voltage_c_rms"
            },
            {
                "name": "smv_4001_voltage_c_phase"
            },
            {
                "name": "smv_4001_current_a_freq"
            },
            {
                "name": "smv_4001_current_a_rms"
            },
            {
                "name": "smv_4001_current_a_phase"
            },
            {
                "name": "smv_4001_current_b_freq"
            },
            {
                "name": "smv_4001_current_b_rms"
            },
            {
                "name": "smv_4001_current_b_phase"
            },
            {
                "name": "smv_4001_current_c_freq"
            },
            {
                "name": "smv_4001_current_c_rms"
            },
            {
                "name": "smv_4001_current_c_phase"
            }

    <button class=“hextra-code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50” title=“Copy code”

    <div class="copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4"></div>
    <div class="success-icon hx-hidden group-[.copied]/copybtn:hx-block hx-pointer-events-none hx-h-4 hx-w-4"></div>
    

    In this plugin, we also need to specify which datapoints are gonna be used:

    datapoint_subscriptions
            {
                "name": "smv_4001_voltage_a",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_voltage_b",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_voltage_c",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_a",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_b",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_c",
                "mode": "SYNC"
            }

    <button class=“hextra-code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50” title=“Copy code”

    <div class="copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4"></div>
    <div class="success-icon hx-hidden group-[.copied]/copybtn:hx-block hx-pointer-events-none hx-h-4 hx-w-4"></div>
    

    After all changes, assuming that there wasn’t already any stream configured, the full configuration should look like:

    phasor_plugin.json
    {
        "use_concurrent_publisher": false,
        "plugin_name": "libphasor_plugin.so",
        "plugin_instance_name": "phasor_plugin",
        "plugin_specific_config": {
            "streams": [
                {
                    "smv_datapoint_name": "smv_4001_voltage_a",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_a_rms",
                    "freq_datapoint_name": "smv_4001_voltage_a_freq",
                    "phase_datapoint_name": "smv_4001_voltage_a_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_voltage_b",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_b_rms",
                    "freq_datapoint_name": "smv_4001_voltage_b_freq",
                    "phase_datapoint_name": "smv_4001_voltage_b_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_voltage_c",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_voltage_c_rms",
                    "freq_datapoint_name": "smv_4001_voltage_c_freq",
                    "phase_datapoint_name": "smv_4001_voltage_c_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_a",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_a_rms",
                    "freq_datapoint_name": "smv_4001_current_a_freq",
                    "phase_datapoint_name": "smv_4001_current_a_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_b",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_b_rms",
                    "freq_datapoint_name": "smv_4001_current_b_freq",
                    "phase_datapoint_name": "smv_4001_current_b_phase"
                },
                {
                    "smv_datapoint_name": "smv_4001_current_c",
                    "smv_sample_rate": 4800,
                    "smv_data_type": "INT32",
                    "phasor_frequency": 50,
                    "cycles_per_phasor_sample": 1,
                    "rms_datapoint_name": "smv_4001_current_c_rms",
                    "freq_datapoint_name": "smv_4001_current_c_freq",
                    "phase_datapoint_name": "smv_4001_current_c_phase"
                }
            ]
        },
        "datapoint_subscriptions": [
            {
                "name": "smv_4001_voltage_a",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_voltage_b",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_voltage_c",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_a",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_b",
                "mode": "SYNC"
            },
            {
                "name": "smv_4001_current_c",
                "mode": "SYNC"
            }
        ],
        "datapoint_publications": [
            {
                "name": "smv_4001_voltage_a_freq"
            },
            {
                "name": "smv_4001_voltage_a_rms"
            },
            {
                "name": "smv_4001_voltage_a_phase"
            },
            {
                "name": "smv_4001_voltage_b_freq"
            },
            {
                "name": "smv_4001_voltage_b_rms"
            },
            {
                "name": "smv_4001_voltage_b_phase"
            },
            {
                "name": "smv_4001_voltage_c_freq"
            },
            {
                "name": "smv_4001_voltage_c_rms"
            },
            {
                "name": "smv_4001_voltage_c_phase"
            },
            {
                "name": "smv_4001_current_a_freq"
            },
            {
                "name": "smv_4001_current_a_rms"
            },
            {
                "name": "smv_4001_current_a_phase"
            },
            {
                "name": "smv_4001_current_b_freq"
            },
            {
                "name": "smv_4001_current_b_rms"
            },
            {
                "name": "smv_4001_current_b_phase"
            },
            {
                "name": "smv_4001_current_c_freq"
            },
            {
                "name": "smv_4001_current_c_rms"
            },
            {
                "name": "smv_4001_current_c_phase"
            }
        ]
    }

    For more information about each property SMV specific check Phasor plugin specification

    Add the datapoints to the main configuration file

    Now we need to add the definition for each datapoints used before. So we just need to add them to the datapoints property in the config.json. If it doesn’t contain any dapoints already, it will look like this:

    config.json
    { “datapoints”: [ { “name”: “smv_4001_voltage_a_phase”, “description”: “Datapoint smv_4001_voltage_a_phase”, “unit”: “rad” }, { “name”: “smv_4001_voltage_a_rms”, “description”: “Datapoint smv_4001_voltage_a_rms”, “unit”: “V” }, { “name”: “smv_4001_voltage_a_freq”, “description”: “Datapoint smv_4001_voltage_a_freq”, “unit”: “Hz” }, { “name”: “smv_4001_voltage_b_phase”, “description”: “Datapoint smv_4001_voltage_b_phase”, “unit”: “rad” }, { “name”: “smv_4001_voltage_b_rms”, “description”: “Datapoint smv_4001_voltage_b_rms”, “unit”: “V” }, { “name”: “smv_4001_voltage_b_freq”, “description”: “Datapoint smv_4001_voltage_b_freq”, “unit”: “Hz” }, { “name”: “smv_4001_voltage_c_phase”, “description”: “Datapoint smv_4001_voltage_c_phase”, “unit”: “rad” }, { “name”: “smv_4001_voltage_c_rms”, “description”: “Datapoint smv_4001_voltage_c_rms”, “unit”: “V” }, { “name”: “smv_4001_voltage_c_freq”, “description”: “Datapoint smv_4001_voltage_c_freq”, “unit”: “Hz” }, { “name”: “smv_4001_current_a_phase”, “description”: “Datapoint smv_4001_current_a_phase”, “unit”: “rad” }, { “name”: “smv_4001_current_a_rms”, “description”: “Datapoint smv_4001_current_a_rms”, “unit”: “mA” }, { “name”: “smv_4001_current_a_freq”, “description”: “Datapoint smv_4001_current_a_freq”, “unit”: “Hz” }, { “name”: “smv_4001_current_b_phase”, “description”: “Datapoint smv_4001_current_b_phase”, “unit”: “rad” }, { “name”: “smv_4001_current_b_rms”, “description”: “Datapoint smv_4001_current_b_rms”, “unit”: “mA” }, { “name”: “smv_4001_current_b_freq”, “description”: “Datapoint smv_4001_current_b_freq”, “unit”: “Hz” }, { “name”: “smv_4001_current_c_phase”, “description”: “Datapoint smv_4001_current_c_phase”, “unit”: “rad” }, { “name”: “smv_4001_current_c_rms”, “description”: “Datapoint smv_4001_current_c_rms”, “unit”: “mA” }, { “name”: “smv_4001_current_c_freq”, “description”: “Datapoint smv_4001_current_c_freq”, “unit”: “Hz” }, { “name”: “smv_4001_voltage_a”, “description”: “Datapoint smv_4001_voltage_a”, “unit”: “V”, “buffer_size”: 1000 }, { “name”: “smv_4001_voltage_b”, “description”: “Datapoint smv_4001_voltage_b”, “unit”: “V”, “buffer_size”: 1000 }, { “name”: “smv_4001_voltage_c”, “description”: “Datapoint smv_4001_voltage_c”, “unit”: “V”, “buffer_size”: 1000 }, { “name”: “smv_4001_voltage_neut”, “description”: “Datapoint smv_4001_voltage_neut”, “unit”: “V”, “buffer_size”: 1000 }, { “name”: “smv_4001_current_a”, “description”: “Datapoint smv_4001_current_a”, “unit”: “mA”, “buffer_size”: 1000 }, { “name”: “smv_4001_current_b”, “description”: “Datapoint smv_4001_current_b”, “unit”: “mA”, “buffer_size”: 1000 }, { “name”: “smv_4001_current_c”, “description”: “Datapoint smv_4001_current_c”, “unit”: “mA”, “buffer_size”: 1000 }, { “name”: “smv_4001_current_neut”, “description”: “Datapoint smv_4001_current_neut”, “unit”: “mA”, “buffer_size”: 1000 } ] }

    More details about each property can be found in the specification.

    Add the asset and widgets

    This part is optional and is only required if to visualize the data in the web interface. Now we need to add some information ui_config.json so that the frontend know which datapoints to display.

    First we add an asset representing the stream to the assets array:

    assets
    {
                "id": "asset_4001",
                "display_name": "Asset 4001",
                "description": "",
                "type": "smv_stream",
                "datapoints": {
                    {
                        "key": "current_a",
                        "datapoint": "smv_4001_current_a"
                    },
                    {
                        "key": "current_b",
                        "datapoint": "smv_4001_current_b"
                    },
                    {
                        "key": "current_c",
                        "datapoint": "smv_4001_current_c"
                    },
                    {
                        "key": "current_neut",
                        "datapoint": "smv_4001_current_neut"
                    },
                    {
                        "key": "voltage_a",
                        "datapoint": "smv_4001_voltage_a"
                    },
                    {
                        "key": "voltage_b",
                        "datapoint": "smv_4001_voltage_b"
                    },
                    {
                        "key": "voltage_c",
                        "datapoint": "smv_4001_voltage_c"
                    },
                    {
                        "key": "voltage_neut",
                        "datapoint": "smv_4001_voltage_neut"
                    },
                    {
                        "key": "va_phase",
                        "datapoint": "smv_4001_voltage_a_phase"
                    },
                    {
                        "key": "va_magnitude",
                        "datapoint": "smv_4001_voltage_a_rms"
                    },
                    {
                        "key": "vb_phase",
                        "datapoint": "smv_4001_voltage_b_phase"
                    },
                    {
                        "key": "vb_magnitude",
                        "datapoint": "smv_4001_voltage_b_rms"
                    },
                    {
                        "key": "vc_phase",
                        "datapoint": "smv_4001_voltage_c_phase"
                    },
                    {
                        "key": "vc_magnitude",
                        "datapoint": "smv_4001_voltage_c_rms"
                    },
                    {
                        "key": "ia_phase",
                        "datapoint": "smv_4001_current_a_phase"
                    },
                    {
                        "key": "ia_magnitude",
                        "datapoint": "smv_4001_current_a_rms"
                    },
                    {
                        "key": "ib_phase",
                        "datapoint": "smv_4001_current_b_phase"
                    },
                    {
                        "key": "ib_magnitude",
                        "datapoint": "smv_4001_current_b_rms"
                    },
                    {
                        "key": "ic_phase",
                        "datapoint": "smv_4001_current_c_phase"
                    },
                    {
                        "key": "ic_magnitude",
                        "datapoint": "smv_4001_current_c_rms"
                    }
    
                },
                "metadata": {
                    "app_id": "4001",
                    "sample_rate": "4800",
                    "sv_id": "SV_4001",
                    "frequency": 50
                }
            }

    Then we need to add the dashboard view to the dashboard property:

    widgets
    {
            "id": "phasor-dashboard",
            "title": "Phasor Monitoring - ${selected_asset}",
            "description": "Dashboard for monitoring phasor measurements from merging units",
            "variables": [
                {
                    "id": "selected_asset",
                    "default": "asset_4001",
                    "label": "Selected Asset",
                    "description": "Selected SMV stream asset"
                },
                {
                    "id": "selected_stream_type",
                    "default": "smv_stream",
                    "label": "Selected Stream Type",
                    "description": "Selected stream type"
                }
            ],
            "grid": {
                "columns": 12,
                "rows": 24
            },
            "widgets": [
                {
                    "id": "asset-counter",
                    "title": "Sample Measured Value Streams",
                    "type": "asset_count",
                    "position": {
                        "x": 0,
                        "y": 0,
                        "w": 2,
                        "h": 2
                    },
                    "datapoints": [
                    ],
                    "options": {
                        "on_click": []
                    }
                },
                {
                    "id": "assets-table",
                    "type": "asset_table",
                    "title": "SMV Streams",
                    "position": {
                        "x": 0,
                        "y": 2,
                        "w": 4,
                        "h": 8
                    },
                    "datapoints": [],
                    "options": {
                        "asset_type": "smv_stream",
                        "on_click": [
                            {
                                "variable": "selected_asset",
                                "asset_property_path": "id"
                            }
                        ],
                        "columns": [
                            {
                                "name": "AppID",
                                "asset_property_path": "metadata.app_id"
                            },
                            {
                                "name": "SV ID",
                                "asset_property_path": "metadata.sv_id"
                            },
                            {
                                "name": "Smp Rate (Hz)",
                                "asset_property_path": "metadata.sample_rate"
                            },
                            {
                                "name": "Frequency (Hz)",
                                "asset_property_path": "metadata.frequency"
                            }
                        ]
                    }
                },
                {
                    "id": "phasor-line-view",
                    "title": "Current and Voltage Waveforms - ${selected_asset}",
                    "type": "line_chart",
                    "position": {
                        "x": 4,
                        "y": 2,
                        "w": 8,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "key": "current_a",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_a"
                        },
                        {
                            "key": "current_b",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_b"
                        },
                        {
                            "key": "current_c",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_c"
                        },
                        {
                            "key": "voltage_a",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_a"
                        },
                        {
                            "key": "voltage_b",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_b"
                        },
                        {
                            "key": "voltage_c",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_c"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Ia",
                                "datapoint_id": "current_a"
                            },
                            {
                                "label": "Ib",
                                "datapoint_id": "current_b"
                            },
                            {
                                "label": "Ic",
                                "datapoint_id": "current_c"
                            },
                            {
                                "label": "Va",
                                "datapoint_id": "voltage_a"
                            },
                            {
                                "label": "Vb",
                                "datapoint_id": "voltage_b"
                            },
                            {
                                "label": "Vc",
                                "datapoint_id": "voltage_c"
                            }
                        ],
                        "cycles_to_show": 1,
                        "sample_rate": 4800,
                        "frequency": 50
                    }
                },
                {
                    "id": "phasor-circular-currents",
                    "title": "Currents \u2013 ${selected_asset}",
                    "type": "phasor_diagram",
                    "position": {
                        "x": 4,
                        "y": 6,
                        "w": 4,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ia_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ia_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ib_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ib_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ic_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ic_magnitude"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Ia",
                                "phase_datapoint": "${selected_asset}.ia_phase",
                                "magnitude_datapoint": "${selected_asset}.ia_magnitude"
                            },
                            {
                                "label": "Ib",
                                "phase_datapoint": "${selected_asset}.ib_phase",
                                "magnitude_datapoint": "${selected_asset}.ib_magnitude"
                            },
                            {
                                "label": "Ic",
                                "phase_datapoint": "${selected_asset}.ic_phase",
                                "magnitude_datapoint": "${selected_asset}.ic_magnitude"
                            }
                        ]
                    }
                },
                {
                    "id": "phasor-circular-voltages",
                    "title": "Voltages \u2013 ${selected_asset}",
                    "type": "phasor_diagram",
                    "position": {
                        "x": 8,
                        "y": 6,
                        "w": 4,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "va_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "va_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vb_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vb_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vc_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vc_magnitude"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Va",
                                "phase_datapoint": "${selected_asset}.va_phase",
                                "magnitude_datapoint": "${selected_asset}.va_magnitude"
                            },
                            {
                                "label": "Vb",
                                "phase_datapoint": "${selected_asset}.vb_phase",
                                "magnitude_datapoint": "${selected_asset}.vb_magnitude"
                            },
                            {
                                "label": "Vc",
                                "phase_datapoint": "${selected_asset}.vc_phase",
                                "magnitude_datapoint": "${selected_asset}.vc_magnitude"
                            }
                        ]
                    }
                },
                {
                    "id": "measurements-table",
                    "title": "Datapoint list",
                    "type": "table",
                    "position": {
                        "x": 0,
                        "y": 10,
                        "w": 12,
                        "h": 10
                    },
                    "datapoints": [
                        {
                            "asset": "asset_4001"
                        }
                    ],
                    "options": {
                        "precision": 2,
                        "columns": [
                            {
                                "name": "Datapoint",
                                "datapoint_name": true
                            },
                            {
                                "name": "Asset",
                                "asset_property_path": "display_name"
                            },
                            {
                                "name": "Type",
                                "asset_property_path": "type"
                            },
                            {
                                "name": "Current Value",
                                "datapoint_value": true
                            }
                        ]
                    }
                }
            ]
        }

    Finaly the entire ui_config.json will look like:

    ui_config.json
    {
        "assets": [
            {
                "id": "asset_4001",
                "display_name": "Asset 4001",
                "description": "",
                "type": "smv_stream",
                "datapoints": {
                    {
                        "key": "current_a",
                        "datapoint": "smv_4001_current_a"
                    },
                    {
                        "key": "current_b",
                        "datapoint": "smv_4001_current_b"
                    },
                    {
                        "key": "current_c",
                        "datapoint": "smv_4001_current_c"
                    },
                    {
                        "key": "current_neut",
                        "datapoint": "smv_4001_current_neut"
                    },
                    {
                        "key": "voltage_a",
                        "datapoint": "smv_4001_voltage_a"
                    },
                    {
                        "key": "voltage_b",
                        "datapoint": "smv_4001_voltage_b"
                    },
                    {
                        "key": "voltage_c",
                        "datapoint": "smv_4001_voltage_c"
                    },
                    {
                        "key": "voltage_neut",
                        "datapoint": "smv_4001_voltage_neut"
                    },
                    {
                        "key": "va_phase",
                        "datapoint": "smv_4001_voltage_a_phase"
                    },
                    {
                        "key": "va_magnitude",
                        "datapoint": "smv_4001_voltage_a_rms"
                    },
                    {
                        "key": "vb_phase",
                        "datapoint": "smv_4001_voltage_b_phase"
                    },
                    {
                        "key": "vb_magnitude",
                        "datapoint": "smv_4001_voltage_b_rms"
                    },
                    {
                        "key": "vc_phase",
                        "datapoint": "smv_4001_voltage_c_phase"
                    },
                    {
                        "key": "vc_magnitude",
                        "datapoint": "smv_4001_voltage_c_rms"
                    },
                    {
                        "key": "ia_phase",
                        "datapoint": "smv_4001_current_a_phase"
                    },
                    {
                        "key": "ia_magnitude",
                        "datapoint": "smv_4001_current_a_rms"
                    },
                    {
                        "key": "ib_phase",
                        "datapoint": "smv_4001_current_b_phase"
                    },
                    {
                        "key": "ib_magnitude",
                        "datapoint": "smv_4001_current_b_rms"
                    },
                    {
                        "key": "ic_phase",
                        "datapoint": "smv_4001_current_c_phase"
                    },
                    {
                        "key": "ic_magnitude",
                        "datapoint": "smv_4001_current_c_rms"
                    }
    
                },
                "metadata": {
                    "app_id": "4001",
                    "sample_rate": "4800",
                    "sv_id": "SV_4001",
                    "frequency": 50
                }
            }
        ],
        "dashboard": {
            "id": "phasor-dashboard",
            "title": "Phasor Monitoring - ${selected_asset}",
            "description": "Dashboard for monitoring phasor measurements from merging units",
            "variables": [
                {
                    "id": "selected_asset",
                    "default": "asset_4001",
                    "label": "Selected Asset",
                    "description": "Selected SMV stream asset"
                },
                {
                    "id": "selected_stream_type",
                    "default": "smv_stream",
                    "label": "Selected Stream Type",
                    "description": "Selected stream type"
                }
            ],
            "grid": {
                "columns": 12,
                "rows": 24
            },
            "widgets": [
                {
                    "id": "asset-counter",
                    "title": "Sample Measured Value Streams",
                    "type": "asset_count",
                    "position": {
                        "x": 0,
                        "y": 0,
                        "w": 2,
                        "h": 2
                    },
                    "datapoints": [
                    ],
                    "options": {
                        "on_click": []
                    }
                },
                {
                    "id": "assets-table",
                    "type": "asset_table",
                    "title": "SMV Streams",
                    "position": {
                        "x": 0,
                        "y": 2,
                        "w": 4,
                        "h": 8
                    },
                    "datapoints": [],
                    "options": {
                        "asset_type": "smv_stream",
                        "on_click": [
                            {
                                "variable": "selected_asset",
                                "asset_property_path": "id"
                            }
                        ],
                        "columns": [
                            {
                                "name": "AppID",
                                "asset_property_path": "metadata.app_id"
                            },
                            {
                                "name": "SV ID",
                                "asset_property_path": "metadata.sv_id"
                            },
                            {
                                "name": "Smp Rate (Hz)",
                                "asset_property_path": "metadata.sample_rate"
                            },
                            {
                                "name": "Frequency (Hz)",
                                "asset_property_path": "metadata.frequency"
                            }
                        ]
                    }
                },
                {
                    "id": "phasor-line-view",
                    "title": "Current and Voltage Waveforms - ${selected_asset}",
                    "type": "line_chart",
                    "position": {
                        "x": 4,
                        "y": 2,
                        "w": 8,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "key": "current_a",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_a"
                        },
                        {
                            "key": "current_b",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_b"
                        },
                        {
                            "key": "current_c",
                            "asset": "${selected_asset}",
                            "datapoint_key": "current_c"
                        },
                        {
                            "key": "voltage_a",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_a"
                        },
                        {
                            "key": "voltage_b",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_b"
                        },
                        {
                            "key": "voltage_c",
                            "asset": "${selected_asset}",
                            "datapoint_key": "voltage_c"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Ia",
                                "datapoint_id": "current_a"
                            },
                            {
                                "label": "Ib",
                                "datapoint_id": "current_b"
                            },
                            {
                                "label": "Ic",
                                "datapoint_id": "current_c"
                            },
                            {
                                "label": "Va",
                                "datapoint_id": "voltage_a"
                            },
                            {
                                "label": "Vb",
                                "datapoint_id": "voltage_b"
                            },
                            {
                                "label": "Vc",
                                "datapoint_id": "voltage_c"
                            }
                        ],
                        "cycles_to_show": 1,
                        "sample_rate": 4800,
                        "frequency": 50
                    }
                },
                {
                    "id": "phasor-circular-currents",
                    "title": "Currents \u2013 ${selected_asset}",
                    "type": "phasor_diagram",
                    "position": {
                        "x": 4,
                        "y": 6,
                        "w": 4,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ia_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ia_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ib_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ib_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ic_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "ic_magnitude"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Ia",
                                "phase_datapoint": "${selected_asset}.ia_phase",
                                "magnitude_datapoint": "${selected_asset}.ia_magnitude"
                            },
                            {
                                "label": "Ib",
                                "phase_datapoint": "${selected_asset}.ib_phase",
                                "magnitude_datapoint": "${selected_asset}.ib_magnitude"
                            },
                            {
                                "label": "Ic",
                                "phase_datapoint": "${selected_asset}.ic_phase",
                                "magnitude_datapoint": "${selected_asset}.ic_magnitude"
                            }
                        ]
                    }
                },
                {
                    "id": "phasor-circular-voltages",
                    "title": "Voltages \u2013 ${selected_asset}",
                    "type": "phasor_diagram",
                    "position": {
                        "x": 8,
                        "y": 6,
                        "w": 4,
                        "h": 4
                    },
                    "datapoints": [
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "va_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "va_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vb_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vb_magnitude"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vc_phase"
                        },
                        {
                            "asset": "${selected_asset}",
                            "datapoint_key": "vc_magnitude"
                        }
                    ],
                    "options": {
                        "series": [
                            {
                                "label": "Va",
                                "phase_datapoint": "${selected_asset}.va_phase",
                                "magnitude_datapoint": "${selected_asset}.va_magnitude"
                            },
                            {
                                "label": "Vb",
                                "phase_datapoint": "${selected_asset}.vb_phase",
                                "magnitude_datapoint": "${selected_asset}.vb_magnitude"
                            },
                            {
                                "label": "Vc",
                                "phase_datapoint": "${selected_asset}.vc_phase",
                                "magnitude_datapoint": "${selected_asset}.vc_magnitude"
                            }
                        ]
                    }
                },
                {
                    "id": "measurements-table",
                    "title": "Datapoint list",
                    "type": "table",
                    "position": {
                        "x": 0,
                        "y": 10,
                        "w": 12,
                        "h": 10
                    },
                    "datapoints": [
                        {
                            "asset": "asset_4001"
                        }
                    ],
                    "options": {
                        "precision": 2,
                        "columns": [
                            {
                                "name": "Datapoint",
                                "datapoint_name": true
                            },
                            {
                                "name": "Asset",
                                "asset_property_path": "display_name"
                            },
                            {
                                "name": "Type",
                                "asset_property_path": "type"
                            },
                            {
                                "name": "Current Value",
                                "datapoint_value": true
                            }
                        ]
                    }
                }
            ]
        }
    }

    More details about each property can be found in the specification.