Skip to content

Commit 6e08c91

Browse files
committed
Added bundle for collect process data
1 parent f18f1e8 commit 6e08c91

31 files changed

+707
-16
lines changed

Directory.Build.targets

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
<!-- Package versions for package references across all projects -->
1818
<ItemGroup>
1919
<!--3rd party dependencies-->
20-
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.8.0" />
20+
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.11.0" />
2121
<PackageReference Update="Moq" Version="4.16.1" />
22-
<PackageReference Update="NUnit" Version="3.13.1" />
23-
<PackageReference Update="NUnit3TestAdapter" Version="3.17.0" />
22+
<PackageReference Update="NUnit" Version="3.13.2" />
23+
<PackageReference Update="NUnit3TestAdapter" Version="4.1.0" />
2424

2525
<!--Platform dependencies-->
2626
<PackageReference Update="Moryx" Version="$(MoryxCoreVersion)" />
27-
<PackageReference Update="Moryx.Model.InMemory" Version="$(MoryxCoreVersion)" />
27+
<PackageReference Update="Moryx.TestTools.UnitTest" Version="$(MoryxCoreVersion)" />
2828

2929
<!--AbstractionLayer dependencies-->
3030
<PackageReference Update="Moryx.AbstractionLayer" Version="$(MoryxAbstractionLayerVersion)" />

MoryxFactory.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2424
VERSION = VERSION
2525
EndProjectSection
2626
EndProject
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.ProcessData", "src\Moryx.ProcessData\Moryx.ProcessData.csproj", "{20B81D48-887A-4C51-9AD4-E044C382D99C}"
28+
EndProject
29+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.ProcessData.Tests", "src\Tests\Moryx.ProcessData.Tests\Moryx.ProcessData.Tests.csproj", "{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}"
30+
EndProject
2731
Global
2832
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2933
Debug|Any CPU = Debug|Any CPU
@@ -46,12 +50,21 @@ Global
4650
{6398F1FB-3D75-4AF7-BED5-5DE447DD68F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
4751
{6398F1FB-3D75-4AF7-BED5-5DE447DD68F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
4852
{6398F1FB-3D75-4AF7-BED5-5DE447DD68F6}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{20B81D48-887A-4C51-9AD4-E044C382D99C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{20B81D48-887A-4C51-9AD4-E044C382D99C}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{20B81D48-887A-4C51-9AD4-E044C382D99C}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{20B81D48-887A-4C51-9AD4-E044C382D99C}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58+
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Debug|Any CPU.Build.0 = Debug|Any CPU
59+
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Release|Any CPU.ActiveCfg = Release|Any CPU
60+
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587}.Release|Any CPU.Build.0 = Release|Any CPU
4961
EndGlobalSection
5062
GlobalSection(SolutionProperties) = preSolution
5163
HideSolutionNode = FALSE
5264
EndGlobalSection
5365
GlobalSection(NestedProjects) = preSolution
5466
{85AB14FF-3CC9-4A34-892B-EE8655392ECB} = {3252DE2B-F017-498C-AC45-20C777DF13AF}
67+
{8E9609B6-9AF6-4F8E-A8DD-0B98E8B3B587} = {3252DE2B-F017-498C-AC45-20C777DF13AF}
5568
EndGlobalSection
5669
GlobalSection(ExtensibilityGlobals) = postSolution
5770
SolutionGuid = {3A74EE28-4BA6-4A6D-81BC-1D8866F13620}

MoryxFactory.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=measurand/@EntryIndexedValue">True</s:Boolean>
3+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Moryx/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This repository contains the APIs, domain objects and developer documentation fo
3030
| `Moryx.ControlSystem` | [![NuGet](https://img.shields.io/nuget/v/Moryx.ControlSystem.svg)](https://www.nuget.org/packages/Moryx.ControlSystem/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.ControlSystem)](https://www.myget.org/feed/moryx/package/nuget/Moryx.ControlSystem) |
3131
| `Moryx.Orders` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Orders.svg)](https://www.nuget.org/packages/Moryx.Orders/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Orders)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Orders) |
3232
| `Moryx.Users` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Users.svg)](https://www.nuget.org/packages/Moryx.Users/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Users)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Users) |
33+
| `Moryx.ProcessData` | [![NuGet](https://img.shields.io/nuget/v/Moryx.ProcessData.svg)](https://www.nuget.org/packages/Moryx.ProcessData/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.ProcessData)](https://www.myget.org/feed/moryx/package/nuget/Moryx.ProcessData) |
3334

3435
## Contribute
3536

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
4.1.0

src/Moryx.ControlSystem/Moryx.ControlSystem.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
4+
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Description>Bundle assembly for ControlSystem and extensions</Description>
77
<CreatePackage>true</CreatePackage>

src/Moryx.Orders/Moryx.Orders.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
4+
<TargetFrameworks>net45;netstandard2.0;net5.0</TargetFrameworks>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Description>Bundle assembly for Orders and extensions</Description>
77
<CreatePackage>true</CreatePackage>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) 2021, Phoenix Contact GmbH & Co. KG
2+
// Licensed under the Apache License, Version 2.0
3+
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using Moryx.Bindings;
7+
using Moryx.ProcessData.Configuration;
8+
9+
namespace Moryx.ProcessData.Bindings
10+
{
11+
/// <summary>
12+
/// Applies a collection of measurement binding configurations and applies them to the given measurement
13+
/// </summary>
14+
public class MeasurementBindingProcessor
15+
{
16+
private readonly ResolverDescription[] _resolvers;
17+
18+
/// <summary>
19+
/// Creates a new instance of the <see cref="MeasurementBindingProcessor"/>
20+
/// </summary>
21+
public MeasurementBindingProcessor(IBindingResolverFactory resolverFactory, IEnumerable<MeasurementBinding> bindings)
22+
{
23+
_resolvers = bindings.Select(config => new ResolverDescription
24+
{
25+
Name = config.Name,
26+
BindingResolver = resolverFactory.Create(config.Binding),
27+
IsField = config.ValueTarget == ValueTarget.Field
28+
}).ToArray();
29+
}
30+
31+
/// <summary>
32+
/// Applies the binding to the given measurement
33+
/// </summary>
34+
public void Apply(Measurement measurement, object source)
35+
{
36+
foreach (var resolver in _resolvers)
37+
{
38+
var value = resolver.BindingResolver.Resolve(source);
39+
if (value == null)
40+
continue;
41+
42+
if (resolver.IsField)
43+
measurement.Add(new DataField(resolver.Name, value));
44+
else
45+
measurement.Add(new DataTag(resolver.Name, value.ToString()));
46+
}
47+
}
48+
49+
private class ResolverDescription
50+
{
51+
public string Name { get; set; }
52+
53+
public IBindingResolver BindingResolver { get; set; }
54+
55+
public bool IsField { get; set; }
56+
}
57+
}
58+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) 2021, Phoenix Contact GmbH & Co. KG
2+
// Licensed under the Apache License, Version 2.0
3+
4+
using System.ComponentModel;
5+
using System.Runtime.Serialization;
6+
7+
namespace Moryx.ProcessData.Configuration
8+
{
9+
/// <summary>
10+
/// Binding configuration for a measurement
11+
/// </summary>
12+
[DataContract]
13+
public class MeasurementBinding
14+
{
15+
/// <summary>
16+
/// Process data value name
17+
/// </summary>
18+
[DataMember]
19+
[Description("Process data value name")]
20+
public string Name { get; set; }
21+
22+
/// <summary>
23+
/// Binding string e.g. Process.Id
24+
/// </summary>
25+
[DataMember]
26+
[Description("Binding string e.g. Process.Id")]
27+
public string Binding { get; set; }
28+
29+
/// <summary>
30+
/// Target of the binding value. Tags or fields.
31+
/// </summary>
32+
[DataMember]
33+
[Description("Target of the binding value. Tags or fields.")]
34+
public ValueTarget ValueTarget { get; set; }
35+
36+
/// <inheritdoc />
37+
public override string ToString() => $"{Name}: {Binding}";
38+
}
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2021, Phoenix Contact GmbH & Co. KG
2+
// Licensed under the Apache License, Version 2.0
3+
4+
namespace Moryx.ProcessData.Configuration
5+
{
6+
/// <summary>
7+
/// Enum for selecting target for binding values
8+
/// </summary>
9+
public enum ValueTarget
10+
{
11+
/// <summary>
12+
/// Target of the value should be measurement fields
13+
/// </summary>
14+
Field,
15+
16+
/// <summary>
17+
/// Target of the value should be measurement tags
18+
/// </summary>
19+
Tag
20+
}
21+
}

0 commit comments

Comments
 (0)