DNV.Vista.SDK.System.Text.Json 0.3.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package DNV.Vista.SDK.System.Text.Json --version 0.3.2
                    
NuGet\Install-Package DNV.Vista.SDK.System.Text.Json -Version 0.3.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DNV.Vista.SDK.System.Text.Json" Version="0.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DNV.Vista.SDK.System.Text.Json" Version="0.3.2" />
                    
Directory.Packages.props
<PackageReference Include="DNV.Vista.SDK.System.Text.Json" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DNV.Vista.SDK.System.Text.Json --version 0.3.2
                    
#r "nuget: DNV.Vista.SDK.System.Text.Json, 0.3.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DNV.Vista.SDK.System.Text.Json@0.3.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DNV.Vista.SDK.System.Text.Json&version=0.3.2
                    
Install as a Cake Addin
#tool nuget:?package=DNV.Vista.SDK.System.Text.Json&version=0.3.2
                    
Install as a Cake Tool

Vista SDK - C# Implementation

NuGet current NuGet prerelease C# Workflow Status GitHub

The C# implementation of the Vista SDK. For an overview of the SDK and its concepts, see the main README.

๐Ÿ“ฆ Installation

Prerequisites

  • .NET 8.0 or later

NuGet Installation

dotnet add package DNV.Vista.SDK

Additional Packages

# JSON serialization support (System.Text.Json)
dotnet add package DNV.Vista.SDK.System.Text.Json

# MQTT integration
dotnet add package DNV.Vista.SDK.Mqtt

๐Ÿš€ Quick Start

๐Ÿ’ก For more complete examples, see the samples directory and samples README for detailed descriptions of each example.

Basic Usage

using Vista.SDK;

// Initialize VIS instance
var version = VisVersion.v3_4a;
var gmod = VIS.Instance.GetGmod(version);
var codebooks = VIS.Instance.GetCodebooks(version);

// Get a GMOD node by lookup
var node = gmod["411.1"];
Console.WriteLine($"Node code: {node.Code}");
Console.WriteLine($"Node common name: {node.Metadata.CommonName}");

// Get a GMOD node by TryGet pattern
if(gmod.TryGetNode("411.1", out var node2))
{
    Console.WriteLine($"Node code: {node2.Code}");
    Console.WriteLine($"Node common name: {node2.Metadata.CommonName}");
}
else
{
    Console.WriteLine("Node not found");
}

// Parse a GMOD path
if (gmod.TryParsePath("411.1/C101.31-2", out var path))
{
    Console.WriteLine($"Parsed path: {path}");
    Console.WriteLine($"Node: {path.Node.Metadata.CommonName}");
}

// Build a Local ID
var quantityTag = codebooks[CodebookName.Quantity].CreateTag("temperature");
var contentTag = codebooks[CodebookName.Content].CreateTag("exhaust.gas");
var positionTag = codebooks[CodebookName.Position].CreateTag("inlet");

var localId = LocalIdBuilder.Create(version)
    .WithPrimaryItem(path)
    .WithMetadataTag(quantityTag)
    .WithMetadataTag(contentTag)
    .WithMetadataTag(positionTag)
    .Build();

Console.WriteLine($"Local ID: {localId}");

// Parse an existing Local ID
var localIdStr = "/dnv-v2/vis-3-4a/411.1/C101.31-2/meta/qty-temperature";
if (LocalId.TryParse(localIdStr, out var errors, out var parsedLocalId))
{
    Console.WriteLine($"Parsed: {parsedLocalId}");
    Console.WriteLine($"Primary item: {parsedLocalId.PrimaryItem}");
}

Working with Codebooks

using Vista.SDK;

var codebooks = VIS.Instance.GetCodebooks(VisVersion.v3_4a);

// Get a specific codebook
var positionCodebook = codebooks[CodebookName.Position];

// Create metadata tags
var positionTag = positionCodebook.CreateTag("centre");
var quantityTag = codebooks[CodebookName.Quantity].CreateTag("temperature");

Console.WriteLine($"Position tag: {positionTag}");
Console.WriteLine($"Quantity tag: {quantityTag}");

// Check if values are valid
Console.WriteLine($"Is 'centre' valid? {positionCodebook.HasStandardValue("centre")}");

GMOD Path Operations

using Vista.SDK;

var gmod = VIS.Instance.GetGmod(VisVersion.v3_4a);

// Parse a path
var path = gmod.ParsePath("411.1/C101.31-2");

// Get path information
Console.WriteLine($"Path depth: {path.Length}");
Console.WriteLine($"End node: {path.Node}");
Console.WriteLine($"Short path: {path}");
Console.WriteLine($"Full path: {path.ToFullPathString()}");

// Traverse the path
foreach (var (depth, node) in path.GetFullPath())
{
    Console.WriteLine($"Depth {depth}: {node.Code} - {node.Metadata.CommonName}");
}

Version Conversion

using Vista.SDK;

var sourceVersion = VisVersion.v3_4a;
var targetVersion = VisVersion.v3_5a;

var gmod = VIS.Instance.GetGmod(sourceVersion);
var path = gmod.ParsePath("411.1/C101.72/I101");

try
{
    var newPath = VIS.Instance.ConvertPath(sourceVersion, path, targetVersion);
    Console.WriteLine($"Converted: {path} -> {newPath}");
}
catch (Exception e)
{
    Console.WriteLine($"Conversion failed: {e.Message}");
}

๐Ÿ“š Core Components

For a detailed overview of VIS concepts (GMOD, Codebooks, Locations, etc.), see the main README.

VIS (Vessel Information Structure)

The main entry point for accessing VIS data via VIS.Instance.

Local ID Builder

Construct standardized local identifiers:

using Vista.SDK;

var version = VisVersion.v3_4a;
var gmod = VIS.Instance.GetGmod(version);
var codebooks = VIS.Instance.GetCodebooks(version);

var path = gmod.ParsePath("411.1/C101.31");
var quantityTag = codebooks[CodebookName.Quantity].CreateTag("temperature");
var contentTag = codebooks[CodebookName.Content].CreateTag("cooling.water");
var stateTag = codebooks[CodebookName.State].CreateTag("high");

var localId = LocalIdBuilder.Create(version)
    .WithPrimaryItem(path)
    .WithMetadataTag(quantityTag)
    .WithMetadataTag(contentTag)
    .WithMetadataTag(stateTag)
    .Build();

Builder Pattern Support

The SDK follows a fluent builder pattern:

  • With*() - Add or set values (throws on invalid input)
  • TryWith*() - Only applies valid changes; returns builder for chaining
  • Without*() - Remove specific components
// Using With - throws on failure
var builder = LocalIdBuilder.Create(version)
    .WithPrimaryItem(path)
    .WithMetadataTag(quantityTag);

// Using TryWith - silently ignores invalid input, allows chaining
builder = builder
    .TryWithMetadataTag(contentTag)
    .TryWithMetadataTag(stateTag);

// Using Without - removes property
builder = builder.WithoutState();

๐Ÿ”ง Advanced Usage

Parsing Local IDs

using Vista.SDK;

var localIdStr = "/dnv-v2/vis-3-4a/411.1/C101.31-2/meta/qty-temperature";

if (LocalId.TryParse(localIdStr, out var errors, out var localId))
{
    Console.WriteLine($"Parsed Local ID: {localId}");
    Console.WriteLine($"Primary item: {localId.PrimaryItem}");
    Console.WriteLine($"Quantity: {localId.Quantity}");
}
else
{
    Console.WriteLine($"Failed to parse: {errors}");
}

ISO 19848 Transport

using Vista.SDK;
using Vista.SDK.Transport.Json;
using Domain = Vista.SDK.Transport.DataChannel;

// Create a DataChannelList
var dcList = new Domain.DataChannelList();
var localId = LocalId.Parse("/dnv-v2/vis-3-4a/411.1/C101.63/S206/meta/qty-temperature");
var dcId = new Domain.DataChannelId { LocalId = localId, ShortId = "TEMP001" };
var property = new Domain.Property
{
    DataChannelType = new Domain.DataChannelType { Type = "Inst" },
    Name = "Temperature Sensor",
    Unit = new Domain.Unit { UnitSymbol = "ยฐC" }
};
dcList.Add(new Domain.DataChannel { DataChannelId = dcId, Property = property });

// Serialize to JSON
var jsonDto = dcList.ToJsonDto();
var json = jsonDto.Serialize();

// Deserialize from JSON
var loadedDto = Serializer.DeserializeDataChannelList(json);
var domainModel = loadedDto.ToDomainModel();

GMOD Traversal

using Vista.SDK;

var gmod = VIS.Instance.GetGmod(VisVersion.v3_4a);

// Traverse the entire GMOD tree
gmod.Traverse((parents, node) =>
{
    var depth = parents.Length;
    var indent = new string(' ', depth * 2);
    Console.WriteLine($"{indent}{node.Code}: {node.Metadata.CommonName}");
    return TraversalHandlerResult.Continue;
});

// Traverse from a specific node
var rootNode = gmod["400"];
gmod.Traverse(rootNode, (parents, node) =>
{
    Console.WriteLine($"{node.Code}");
    return TraversalHandlerResult.Continue;
});

๐Ÿงช Testing

Running Tests

# Run all tests
dotnet test

# Run specific test project
dotnet test test/Vista.SDK.Tests

# Run with coverage
dotnet test --collect:"XPlat Code Coverage"

Running Samples

# Run a specific sample
dotnet run --project samples/BasicUsage

# Run all samples
dotnet run --project samples/BasicUsage
dotnet run --project samples/CodebooksExample
dotnet run --project samples/GmodOperations
dotnet run --project samples/AdvancedLocalIds
dotnet run --project samples/LocalIdQuery
dotnet run --project samples/GmodSubset
dotnet run --project samples/SensorDataFlow
dotnet run --project samples/Iso19848Json

๐Ÿ“ˆ Performance

The C# implementation includes comprehensive benchmarks. See benchmark/README.md for details.

Running Benchmarks

cd benchmark/Vista.SDK.Benchmarks
dotnet run -c Release

๐Ÿ› ๏ธ Development

Setting up Development Environment

# Clone the repository
git clone https://github.com/dnv-opensource/vista-sdk.git
cd vista-sdk/csharp

# Build the solution
dotnet build Vista.SDK.sln

# Run tests
dotnet test Vista.SDK.sln

# Run a sample
dotnet run --project samples/BasicUsage

Project Structure

csharp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ Vista.SDK/                  # Core SDK library
โ”‚   โ”œโ”€โ”€ Vista.SDK.System.Text.Json/ # JSON serialization
โ”‚   โ”œโ”€โ”€ Vista.SDK.Mqtt/             # MQTT integration
โ”‚   โ””โ”€โ”€ Vista.SDK.SourceGenerator/  # Source generation
โ”œโ”€โ”€ test/
โ”‚   โ”œโ”€โ”€ Vista.SDK.Tests/            # Unit tests
โ”‚   โ””โ”€โ”€ Vista.SDK.SmokeTests/       # Integration tests
โ”œโ”€โ”€ samples/                        # Usage examples
โ””โ”€โ”€ benchmark/                      # Performance benchmarks

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite (dotnet test)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Support

For questions and support:

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DNV.Vista.SDK.System.Text.Json:

Package Downloads
DNV.Vista.Gateway.Client

The Vista Gateway Client provides a configured client to enable and support users and implementers ingest data to DNV.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.3-preview-2 109 8/12/2026
0.3.3-preview-1 108 7/6/2026
0.3.2 748 7/6/2026
0.3.2-preview-4 108 7/6/2026
0.3.2-preview-3 101 7/6/2026
0.3.2-preview-2 119 7/6/2026
0.3.2-preview-1 118 7/1/2026
0.3.1 134 7/1/2026
0.3.1-preview-7 118 6/29/2026
0.3.1-preview-5 122 6/10/2026
0.3.1-preview-4 119 4/27/2026
0.3.1-preview-3 131 3/10/2026
0.3.0-preview-265 133 3/10/2026
0.2.0 446 3/10/2026
0.2.0-preview-263 131 3/10/2026
0.2.0-preview-260 121 2/24/2026
0.2.0-preview-255 123 1/28/2026
0.2.0-preview-254 126 1/28/2026
0.2.0-preview-252 153 1/5/2026
0.2.0-preview-250 309 12/4/2025
Loading failed