Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

93 update libraries #95

Merged
merged 11 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions NodeSetToAML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class NodeSetToAML
private const string IsSource = "IsSource";
private const string ForwardPrefix = "f";
private const string ReversePrefix = "r";
private const string RoleClassPrefix = "rc";
private const string Enumeration = "Enumeration";
private ModelManager m_modelManager;
private CAEXDocument m_cAEXDocument;
Expand Down Expand Up @@ -158,6 +159,7 @@ public T FindNode<T>(NodeId sourceId) where T : UANode

public void CreateAML(string modelPath, string modelName = null)
{
DateTime startTime = DateTime.UtcNow;
string modelUri = m_modelManager.LoadModel(modelPath, null, null);
structureNode = m_modelManager.FindNodeByName("Structure");
if (modelName == null)
Expand Down Expand Up @@ -261,7 +263,7 @@ public void CreateAML(string modelPath, string modelName = null)
AddLibraryHeaderInfo(atl as CAEXBasicObject, modelInfo);
}

atl.AttributeType.Insert( dicEntry.Value, false); // insert into the AML document in alpha order
atl.AttributeType.Insert( dicEntry.Value, asFirst: false, asIs: true );
}

foreach( var dicEntry in SortedDataTypes) // cteate the ListOf versions
Expand Down Expand Up @@ -302,9 +304,8 @@ public void CreateAML(string modelPath, string modelName = null)
icl = m_cAEXDocument.CAEXFile.InterfaceClassLib.Append(ICLPrefix + modelInfo.NamespaceUri);
AddLibraryHeaderInfo(icl as CAEXBasicObject, modelInfo);
}
icl.Insert(ict, false);
icl.Insert(ict, asFirst: false, asIs: true);
}

}

Utils.LogInfo( "Processing SystemUnitClass Types" );
Expand All @@ -327,7 +328,7 @@ public void CreateAML(string modelPath, string modelName = null)
scl = m_cAEXDocument.CAEXFile.SystemUnitClassLib.Append(SUCPrefix + modelInfo.NamespaceUri);
AddLibraryHeaderInfo(scl as CAEXBasicObject, modelInfo);
}
scl.Insert(sft, false);
scl.Insert(sft, asFirst: false, asIs: true );
}

string rclpath = BuildLibraryReference(RCLPrefix, modelInfo.NamespaceUri, obType.Key);
Expand All @@ -339,7 +340,7 @@ public void CreateAML(string modelPath, string modelName = null)
rcl = m_cAEXDocument.CAEXFile.RoleClassLib.Append(RCLPrefix + modelInfo.NamespaceUri);
AddLibraryHeaderInfo(rcl as CAEXBasicObject, modelInfo);
}
rcl.Insert(rft, false);
rcl.Insert(rft, asFirst: false, asIs: true );
}
}
}
Expand All @@ -363,8 +364,10 @@ public void CreateAML(string modelPath, string modelName = null)
container.AddRoot(m_cAEXDocument.SaveToStream(true), new Uri("/" + internalFileInfo.Name + ".aml", UriKind.Relative));
container.Close();

Utils.LogInfo( "Amlx Container Created for model " + modelName );

DateTime endTime = DateTime.UtcNow;
TimeSpan totalTime = endTime - startTime;
Utils.LogInfo( "Amlx Container Created for model " + modelName +
" (Time in creation " + totalTime.ToString() + ")" );
}

private void AddLibraryHeaderInfo(CAEXBasicObject bo, ModelInfo modelInfo = null)
Expand Down Expand Up @@ -1691,8 +1694,8 @@ private string AmlIDFromNodeId(NodeId nodeId, string prefix = null)
private InternalElementType CreateClassInstanceWithIDReplacement(string prefix, SystemUnitFamilyType child)
{
InternalElementType internalElementType = child.CreateClassInstance();
CompareLinksToExternaInterfaces(child, internalElementType);

CompareLinksToExternaInterfaces( child, internalElementType);

InternalElementSequence originalInternalElements = child.InternalElement;
InternalElementSequence createdInternalElements = internalElementType.InternalElement;
Expand Down Expand Up @@ -2116,13 +2119,13 @@ InternalElementType GetReferenceInternalElement(

foreach (ExternalInterfaceType externalInterface in usedInterfaces.Values)
{
typeDefSucCreated.ExternalInterface.Insert(externalInterface);
typeDefSucCreated.ExternalInterface.Insert( externalInterface, asFirst: false, asIs: true );
}

foreach (KeyValuePair<string, InternalElementsAndLinks> entry in usedInternalElements)
{
typeDefSucCreated.InternalElement.Insert(entry.Value.ElementType);
typeDefSucCreated.InternalLink.Insert(entry.Value.LinkType);
typeDefSucCreated.InternalElement.Insert(entry.Value.ElementType, asFirst: false, asIs: true );
typeDefSucCreated.InternalLink.Insert(entry.Value.LinkType, asFirst: false, asIs: true );
}

CompareLinksToExternaInterfaces(typeDefSucCreated, typeDefSucCreated);
Expand Down Expand Up @@ -2199,7 +2202,7 @@ private void RebuildExternalInterfaces(
systemUnitClass.ExternalInterface.Remove();
foreach( ExternalInterfaceType externalInterface in newTypes.Values )
{
systemUnitClass.ExternalInterface.Insert( externalInterface );
systemUnitClass.ExternalInterface.Insert( externalInterface, asFirst: false, asIs: true );
}
}

Expand Down Expand Up @@ -2345,7 +2348,7 @@ SystemUnitFamilyType FindOrAddSUC(ref SystemUnitClassLibType scl, ref RoleClassL
if (m_modelManager.IsTypeOf(nodeId, BaseInterfaceNodeId) == true)
{
var rc = rcl.New_RoleClass(refnode.DecodedBrowseName.Name); // create a RoleClass for UA interfaces
rc.ID = AmlIDFromNodeId(nodeId);
rc.ID = AmlIDFromNodeId(nodeId, RoleClassPrefix);
if (nodeId == BaseInterfaceNodeId)
rc.RefBaseClassPath = RCLPrefix + MetaModelName + "/" + UaBaseRole;
else
Expand Down
5 changes: 2 additions & 3 deletions Opc2Aml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aml.Engine" Version="3.1.1" />
<PackageReference Include="Aml.Engine.Resources" Version="3.0.0" />
<PackageReference Include="Aml.Engine" Version="4.4.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.1" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.5.374.158" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.5.375.443" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 8 additions & 9 deletions SystemTest/SystemTest.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -8,17 +8,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aml.Engine" Version="3.2.1" />
<PackageReference Include="Aml.Engine.Resources" Version="3.0.0" />
<PackageReference Include="Aml.Engine.Services" Version="3.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="Aml.Engine" Version="4.4.0" />
<PackageReference Include="Aml.Engine.Services" Version="4.2.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.7.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.3" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.5.374.158" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua" Version="1.5.375.443" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions SystemTest/TestComplexNonRootNamespace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ public void TestLevelOne()
TestValue( value, "Guid", "13131313-1313-1313-1313-131313131313", "xs:string" );
TestValue( value, "ByteString", "MTQxNDE0MTQ=", "xs:base64Binary" );

string unknownDataType = "";
TestValue( value, "XmlElement",
"<TheFifteenthElement xmlns=\"http://opcfoundation.org/UA/FX/AML/TESTING/LevelOne/Types.xsd\">Fifteen</TheFifteenthElement>",
unknownDataType );
"xs:string" );

ValidateNodeId( value, "NodeId", GetUri( 2 ), new NodeId( 16 ) );
ValidateNodeId( value, "ExpandedNodeId", GetUri( 2 ), new NodeId( 17 ) );
Expand Down