diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDate.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDate.cs
index aee78090..2d2a2ad9 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDate.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDate.cs
@@ -50,7 +50,6 @@ ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
_plcReadRequestData = WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName);
return _plcReadRequestData;
}
-
}
///
@@ -58,7 +57,19 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
{
get
{
- _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDateTIA(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ case eTargetProjectPlatform.SIMATICAX:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ default:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ }
+
return _plcWriteRequestData;
}
}
@@ -87,8 +98,30 @@ private DateOnly GetFromBinary(string value)
private DateOnly GetFromBinary(long value)
{
- var val = value / 100;
- return DateOnly.FromDateTime(DateTime.FromBinary(val).AddYears(1969));
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ int val = ((int)value) - 1;
+ return DateOnly.FromDayNumber(val).AddYears(1989);
+
+ case eTargetProjectPlatform.SIMATICAX:
+ var valAx = value / 100;
+ return DateOnly.FromDateTime(DateTime.FromBinary(valAx).AddYears(1969));
+
+ default:
+ var valdef = value / 100;
+ return DateOnly.FromDateTime(DateTime.FromBinary(valdef).AddYears(1969));
+ }
+ }
+
+ private long GetFromDateTIA(DateOnly date)
+ {
+ if (date <= TIAMinValue)
+ date = TIAMinValue;
+
+ var retval = date.ToDateTime(TimeOnly.MinValue) - TIAMinValue.ToDateTime(TimeOnly.MinValue);
+
+ return (long)retval.TotalDays;
}
private string GetFromDate(DateOnly date)
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDateTime.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDateTime.cs
index 0f605e79..b2466cc1 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDateTime.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiDateTime.cs
@@ -42,7 +42,7 @@ public WebApiDateTime(ITwinObject parent,
///
ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite, _webApiConnector.DBName);
-
+
///
ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
{
@@ -51,7 +51,6 @@ ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
_plcReadRequestData = WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName);
return _plcReadRequestData;
}
-
}
///
@@ -59,7 +58,21 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
{
get
{
- _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetTIAJObjectFromDate(CyclicToWrite), _webApiConnector.DBName);
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ break;
+
+ default:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, GetFromDate(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ }
+
return _plcWriteRequestData;
}
}
@@ -67,7 +80,20 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
///
public void Read(string value)
{
- UpdateRead(GetFromBinary(value));
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ UpdateRead(ParseFromTIAJson(value));
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ UpdateRead(GetFromBinary(value));
+ break;
+
+ default:
+ UpdateRead(GetFromBinary(value));
+ break;
+ }
}
///
@@ -76,6 +102,29 @@ public override async Task GetAsync()
return await _webApiConnector.ReadAsync(this);
}
+ private DateTime ParseFromTIAJson(string value)
+ {
+ try
+ {
+ var val = Newtonsoft.Json.JsonConvert.DeserializeObject(value);
+ return new DateTime(val.year, val.month, val.day, val.hour, val.minute, (int)(val.second), (int)((val.second * 1000) % 1000), DateTimeKind.Local);
+ }
+ catch (Exception)
+ {
+ //swallow
+ }
+
+ return MinValueTIA;
+ }
+
+ private JObject GetTIAJObjectFromDate(DateTime dateTime)
+ {
+ if (dateTime <= MinValueTIA)
+ dateTime = MinValueTIA;
+
+ return JObject.FromObject(new DateTimeTia(dateTime));
+ }
+
private DateTime GetFromBinary(string value)
{
if (long.TryParse(value, out var val))
@@ -106,4 +155,29 @@ public override async Task SetAsync(DateTime value)
{
return await _webApiConnector.WriteAsync(this, value);
}
+}
+
+public class DateTimeTia
+{
+ public DateTimeTia()
+ {
+ }
+
+ public DateTimeTia(DateTime fromDateTime)
+ {
+ this.year = fromDateTime.Year;
+ this.month = fromDateTime.Month;
+ this.day = fromDateTime.Day;
+ this.hour = fromDateTime.Hour;
+ this.minute = fromDateTime.Minute;
+ this.second = (double)fromDateTime.Second;
+ this.second = second + (((double)fromDateTime.Millisecond) / 1000);
+ }
+
+ public int year { get; set; }
+ public int month { get; set; }
+ public int day { get; set; }
+ public int hour { get; set; }
+ public int minute { get; set; }
+ public double second { get; set; }
}
\ No newline at end of file
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiLTimeOfDay.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiLTimeOfDay.cs
index 192d5e77..3502fd4f 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiLTimeOfDay.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiLTimeOfDay.cs
@@ -42,8 +42,7 @@ public WebApiLTimeOfDay(ITwinObject parent,
///
ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite, _webApiConnector.DBName);
-
-
+
///
ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
{
@@ -52,7 +51,6 @@ ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
_plcReadRequestData = WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName);
return _plcReadRequestData;
}
-
}
///
@@ -60,7 +58,21 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
{
get
{
- _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite.TotalNanoseconds.ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ break;
+
+ default:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ break;
+ }
+
return _plcWriteRequestData;
}
}
@@ -68,9 +80,28 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
///
public void Read(string value)
{
- if (long.TryParse(value, out var val))
+ switch (_webApiConnector.TargetPlatform)
{
- UpdateRead(TimeSpan.FromMilliseconds(val / 1000000));
+ case eTargetProjectPlatform.TIAPORTAL:
+ if (long.TryParse(value, out var valTia))
+ {
+ UpdateRead(TimeSpan.FromMicroseconds(valTia / 1000)); // value in nanoseconds
+ }
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ if (long.TryParse(value, out var valAx))
+ {
+ UpdateRead(TimeSpan.FromMilliseconds(valAx / 1000000));
+ }
+ break;
+
+ default:
+ if (long.TryParse(value, out var valdef))
+ {
+ UpdateRead(TimeSpan.FromMilliseconds(valdef / 1000000));
+ }
+ break;
}
}
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTime.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTime.cs
index 412bb1f2..d0e344d8 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTime.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTime.cs
@@ -59,8 +59,21 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
{
get
{
- // TODO: review this casting to string... reason: there is some problem while creating reuqest from long.
- _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, ToMicroSeconds(CyclicToWrite), _webApiConnector.DBName);
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, ToMilliseconds(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ case eTargetProjectPlatform.SIMATICAX:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, ToMicroSeconds(CyclicToWrite), _webApiConnector.DBName);
+ break;
+ default:
+ // TODO: review this casting to string... reason: there is some problem while creating reuqest from long.
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, ToMicroSeconds(CyclicToWrite), _webApiConnector.DBName);
+ break;
+
+ }
+
return _plcWriteRequestData;
}
}
@@ -72,10 +85,10 @@ public void Read(string value)
{
switch (_webApiConnector.TargetPlatform)
{
- case eTargetPlatform.S71500:
+ case eTargetProjectPlatform.TIAPORTAL:
UpdateRead(TimeSpan.FromMilliseconds(val));
break;
- case eTargetPlatform.SIMATICAX:
+ case eTargetProjectPlatform.SIMATICAX:
UpdateRead(TimeSpan.FromMilliseconds(ToMilliseconds(val)));
break;
@@ -84,6 +97,12 @@ public void Read(string value)
}
+ private long ToMilliseconds(TimeSpan value)
+ {
+ return (long)value.TotalMilliseconds;
+ }
+
+
private long ToMilliseconds(long nanoseconds)
{
return nanoseconds / 1000000L;
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTimeOfDay.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTimeOfDay.cs
index 9ad2404f..63fa4e6a 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTimeOfDay.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/BuiltInWrappers/WebApiTimeOfDay.cs
@@ -43,7 +43,7 @@ public WebApiTimeOfDay(ITwinObject parent,
///
ApiPlcWriteRequest IWebApiPrimitive.PeekPlcWriteRequestData => _plcWriteRequestData ?? WebApiConnector.CreateWriteRequest(Symbol, CyclicToWrite, _webApiConnector.DBName);
-
+
///
ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
{
@@ -52,7 +52,6 @@ ApiPlcReadRequest IWebApiPrimitive.PlcReadRequestData
_plcReadRequestData = WebApiConnector.CreateReadRequest(Symbol, _webApiConnector.DBName);
return _plcReadRequestData;
}
-
}
///
@@ -60,7 +59,21 @@ ApiPlcWriteRequest IWebApiPrimitive.PlcWriteRequestData
{
get
{
- _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (long)CyclicToWrite.TotalMilliseconds, _webApiConnector.DBName);
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ break;
+
+ default:
+ _plcWriteRequestData = WebApiConnector.CreateWriteRequest(Symbol, (CyclicToWrite.TotalMilliseconds * 1000000).ToString(CultureInfo.InvariantCulture), _webApiConnector.DBName);
+ break;
+ }
+
return _plcWriteRequestData;
}
}
@@ -70,7 +83,20 @@ public void Read(string value)
{
if (long.TryParse(value, out var val))
{
- UpdateRead(TimeSpan.FromMilliseconds(val / 1000000));
+ switch (_webApiConnector.TargetPlatform)
+ {
+ case eTargetProjectPlatform.TIAPORTAL:
+ UpdateRead(TimeSpan.FromMilliseconds(val));
+ break;
+
+ case eTargetProjectPlatform.SIMATICAX:
+ UpdateRead(TimeSpan.FromMilliseconds(val / 1000000));
+ break;
+
+ default:
+ UpdateRead(TimeSpan.FromMilliseconds(val / 1000000));
+ break;
+ }
}
}
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnector.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnector.cs
index 23f2568e..f03f683e 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnector.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnector.cs
@@ -53,7 +53,7 @@ public class WebApiConnector : Connector
/// Root DB name (AX uses 'TGlobalVariablesDB')
public WebApiConnector(string ipAddress, string userName, string password,
Func? customServerCertHandler,
- eTargetPlatform platform = eTargetPlatform.SIMATICAX,
+ eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX,
string dbName = "\"TGlobalVariablesDB\"")
{
IPAddress = ipAddress;
@@ -76,25 +76,25 @@ public WebApiConnector(string ipAddress, string userName, string password,
/// Password.
/// When set to 'true' the connection will ignore SSL errors.
/// Root DB name (AX uses 'TGlobalVariablesDB')
- public WebApiConnector(string ipAddress, string userName, string password, bool ignoreSSLErros, eTargetPlatform platform = eTargetPlatform.SIMATICAX,
+ public WebApiConnector(string ipAddress, string userName, string password, bool ignoreSSLErros, eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX,
string dbName = "\"TGlobalVariablesDB\"")
{
IPAddress = ipAddress;
DBName = dbName;
TargetPlatform = platform;
-
+
if (ignoreSSLErros)
ServerCertificateCallback.CertificateCallback =
(sender, cert, chain, sslPolicyErrors) => true;
var serviceFactory = new ApiStandardServiceFactory();
- Client = serviceFactory.GetHttpClient(ipAddress, userName, password);
+ Client = serviceFactory.GetHttpClient(ipAddress, userName, password ?? string.Empty);
requestHandler = new ApiHttpClientRequestHandler(Client,
new ApiRequestFactory(ReqIdGenerator, RequestParameterChecker), ApiResponseChecker);
requestHandler.ApiLogout();
- requestHandler.ApiLogin(userName, password, true);
+ requestHandler.ApiLogin(userName, password ?? string.Empty, true);
NumberOfInstances++;
}
@@ -494,5 +494,5 @@ internal override async Task WriteBatchAsyncCyclic(IEnumerable p
await WriteBatchAsync(primitives);
}
- public eTargetPlatform TargetPlatform { get; } = eTargetPlatform.SIMATICAX;
+ public eTargetProjectPlatform TargetPlatform { get; } = eTargetProjectPlatform.SIMATICAX;
}
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorExtensions.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorExtensions.cs
index 081b68e6..d4ea6817 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorExtensions.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorExtensions.cs
@@ -28,7 +28,7 @@ public static class WebApiConnectorExtensions
/// Connector adapter for WebAPI connection.
public static ConnectorAdapter CreateWebApi(this ConnectorAdapterBuilder adapter,
string ipAddress, string userName, string password, bool ignoreSSLErros,
- eTargetPlatform platform = eTargetPlatform.SIMATICAX,
+ eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX,
string dbName = "\"TGlobalVariablesDB\"")
{
return new ConnectorAdapter(typeof(WebApiConnectorFactory))
@@ -48,7 +48,7 @@ public static ConnectorAdapter CreateWebApi(this ConnectorAdapterBuilder adapter
public static ConnectorAdapter CreateWebApi(this ConnectorAdapterBuilder adapter,
string ipAddress, string userName, string password,
Func? customServerCertHandler,
- eTargetPlatform platform = eTargetPlatform.SIMATICAX,
+ eTargetProjectPlatform platform = eTargetProjectPlatform.SIMATICAX,
string dbName = "\"TGlobalVariablesDB\"")
{
return new ConnectorAdapter(typeof(WebApiConnectorFactory))
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorFactory.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorFactory.cs
index 532bb728..af76c1d2 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorFactory.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/WebApiConnectorFactory.cs
@@ -19,7 +19,7 @@ public override Connector CreateConnector(object[] parameters)
(string)parameters[1],
(string)parameters[2],
(bool)parameters[3],
- (eTargetPlatform)parameters[4],
+ (eTargetProjectPlatform)parameters[4],
(string)parameters[5]);
}
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetPlatform.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetPlatform.cs
deleted file mode 100644
index 6e563b84..00000000
--- a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetPlatform.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// AXSharp.Connector.S71500.WebAPI
-// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved.
-// Contributors: https://github.com/ix-ax/axsharp/graphs/contributors
-// See the LICENSE file in the repository root for more information.
-// https://github.com/ix-ax/axsharp/blob/dev/LICENSE
-// Third party licenses: https://github.com/ix-ax/axsharp/blob/master/notices.md
-
-namespace AXSharp.Connector.S71500.WebApi;
-
-public enum eTargetPlatform
-{
- S71500,
- SIMATICAX
-}
\ No newline at end of file
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetProjectPlatform.cs b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetProjectPlatform.cs
new file mode 100644
index 00000000..e312a47f
--- /dev/null
+++ b/src/AXSharp.connectors/src/AXSharp.Connector.S71500.WebAPI/eTargetProjectPlatform.cs
@@ -0,0 +1,5 @@
+public enum eTargetProjectPlatform
+{
+ TIAPORTAL,
+ SIMATICAX
+}
\ No newline at end of file
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDate.cs b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDate.cs
index f800cac3..94c591d0 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDate.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDate.cs
@@ -44,11 +44,22 @@ public OnlinerDate(ITwinObject parent, string readableTail, string symbolTail)
///
public static DateOnly MaxValue { get; } = new(2262, 4, 11);
+ ///
+ /// Gets the max value of for TIA project.
+ ///
+ public static DateOnly TIAMaxValue { get; } = new(2169, 6, 6);
+
///
/// Gets the min value of .
///
public static DateOnly MinValue { get; } = new(1970, 01, 1);
+
+ ///
+ /// Gets the min value of for TIA project.
+ ///
+ public static DateOnly TIAMinValue { get; } = new(1990, 01, 1);
+
///
/// Gets the max value for this instance.
///
diff --git a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDateTime.cs b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDateTime.cs
index bed87548..a97c0890 100644
--- a/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDateTime.cs
+++ b/src/AXSharp.connectors/src/AXSharp.Connector/ValueTypes/Onlines/OnlinerDateTime.cs
@@ -27,6 +27,18 @@ public class OnlinerDateTime : OnlinerBase, IOnlineDateTime, IShadowDa
///
public static readonly DateTime MinValue = new(1970, 01, 01, 0, 0, 0, 0);
+
+ ///
+ /// Gets the max value of for TIA project.
+ ///
+ public static readonly DateTime MaxValueTIA = new(2089, 12, 31, 23, 59, 59, 999);
+
+ ///
+ /// Gets the min value of for TIA project.
+ ///
+ public static readonly DateTime MinValueTIA = new(1990, 01, 01, 0, 0, 0, 0);
+
+
///
/// Initializes a new instance of the class.
///
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/AXPseoudoProjectGenerator.cs b/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/AXPseoudoProjectGenerator.cs
index 78fa53de..bb65ba61 100644
--- a/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/AXPseoudoProjectGenerator.cs
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/AXPseoudoProjectGenerator.cs
@@ -17,6 +17,7 @@ public static void Create(string baseDirectory, string outputProject, IEnumerabl
var generator = new AXPseoudoProjectGenerator();
generator.CreateProjectStructure(baseDirectory, outputProject, options);
+ generator.AddTiaDataTypes(baseDirectory, outputProject, options);
var srcFolderPath = Path.Combine(baseDirectory, outputProject, "src");
@@ -40,6 +41,7 @@ public static void Create(string baseDirectory, string outputProject, IEnumerabl
foreach (var dbName in generator.GetDbNames(tranformed))
{
configurationBuilder.AppendLine($"\t{{#ix-attr: [DBAttribute()]}}");
+ configurationBuilder.AppendLine($"\t{{S7.extern=ReadWrite}}");
configurationBuilder.AppendLine($"\t{dbName} : {options.Namespace}.{dbName};");
}
}
@@ -93,17 +95,55 @@ private void CreateProjectStructure(string baseDirectory, string outputProject,
string apaxFilePath = Path.Combine(projectDirectory, "apax.yml");
// Content for the apax.yml file
- string apaxContent = $@"name: ""{option.Namespace}""
+ string apaxContent = $@"name: ""{option.Namespace.ToLower()}""
version: 0.0.0
type: app
targets:
- - axunit-llvm
+ - '1500'
+ # - plcsim
+ # - llvm
+ # - swcpu
+ # - vplc
+
devDependencies:
- ""@ax/sdk"": ^4.0.8
+ ""@ax/sdk"": ^2311.0.1
";
// Write the apax content to the file
File.WriteAllText(apaxFilePath, apaxContent);
}
+ private void AddTiaDataTypes(string baseDirectory, string outputProject, Options option)
+ {
+ // Combine paths to create the full directory paths
+ string projectDirectory = Path.Combine(baseDirectory, outputProject);
+ string srcDirectory = Path.Combine(projectDirectory, "src");
+
+ // Create the src and test directories
+ EnsureDirectory(srcDirectory);
+
+ string filePath = Path.Combine(srcDirectory, "DTL.st");
+
+ // Content for DLT type
+ string content = $@"NAMESPACE {option.Namespace.ToLower()}
+ TYPE
+ {{S7.extern=ReadWrite}}
+ DTL :
+ STRUCT
+ YEAR : UINT;
+ MONTH : USINT;
+ DAY: USINT;
+ WEEKDAY: USINT;
+ HOUR: USINT;
+ MINUTE: USINT;
+ SECOND: USINT;
+ NANOSECOND: UDINT;
+ END_STRUCT;
+ END_TYPE
+END_NAMESPACE
+";
+
+ // Write the apax content to the file
+ File.WriteAllText(filePath, content);
+ }
}
}
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/TIA2AXTypeTransformer.cs b/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/TIA2AXTypeTransformer.cs
index ff422ac9..517c7b7c 100644
--- a/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/TIA2AXTypeTransformer.cs
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.Tranformer/TIA2AXTypeTransformer.cs
@@ -14,8 +14,9 @@ public class TIA2AXTypeTransformer
{
// IEC61131-3 primitive types
"BOOL", "SINT", "INT", "DINT", "LINT", "USINT", "UINT", "UDINT", "ULINT",
- "REAL", "LREAL", "TIME", "DATE", "TOD", "DT", "STRING", "BYTE", "WORD",
- "DWORD", "LWORD"
+ "REAL", "LREAL", "STRING", "BYTE", "WORD",
+ "DWORD", "LWORD",
+ "TIME", "DATE", "TIME_OF_DAY", "LTIME_OF_DAY","DATE_AND_TIME", "LDATE_AND_TIME","DTL"
};
public static string GetTransformation(string input, Options options)
@@ -27,6 +28,7 @@ private string Tranform(string input, Options options)
{
string output = TransformTypes(input);
output = ConvertDataBlocksToStructs(output);
+
output = RemoveUnknownTypeDeclarations(output);
output = $"NAMESPACE {options.Namespace}\n {output} \nEND_NAMESPACE";
return output;
@@ -38,20 +40,31 @@ private string RemoveUnknownTypeDeclarations(string code)
var lines = code.Replace("\r\n", "\n").Split('\n');
var firstPassCode = new List();
+ bool allTypesFounded = false;
// First pass to collect all type names
- foreach (var line in lines)
+ for (int i = 0; i < lines.Length; i++)
{
- var trimmedLine = line.Trim();
+ var trimmedLine = lines[i].Trim();
- if (trimmedLine.StartsWith("TYPE ", StringComparison.OrdinalIgnoreCase) && trimmedLine.Contains(":"))
+ if (trimmedLine.Equals("TYPE", StringComparison.OrdinalIgnoreCase) )
{
- var typeName = trimmedLine.Split(new[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries)[1];
- knownTypes.Add(typeName); // Collect type names
+ if ((i+3) > lines.Length)
+ {
+ allTypesFounded |= true;
+ break;
+ }
+
+ var dateType = lines[i+2].Trim().Split(new[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries)[0];
+
+ knownTypes.Add(dateType); // Collect type names
}
+
}
+
// Second pass to remove unknown type declarations
var cleanedCode = new List();
+
var insideTypeDeclaration = false;
foreach (var line in lines)
@@ -59,7 +72,7 @@ private string RemoveUnknownTypeDeclarations(string code)
var trimmedLine = line.Trim();
// Detect the beginning of a type declaration
- if (trimmedLine.StartsWith("TYPE ", StringComparison.OrdinalIgnoreCase))
+ if (trimmedLine.StartsWith("TYPE", StringComparison.OrdinalIgnoreCase))
{
insideTypeDeclaration = true;
cleanedCode.Add(line); // Add the type declaration line
@@ -158,7 +171,7 @@ public string TransformTypes(string input)
}
// Remove quotation marks around type name and add a colon
- input = Regex.Replace(input, @"TYPE\s*""(\w+)""", "TYPE $1 :");
+ input = Regex.Replace(input, @"TYPE\s*""(\w+)""", "TYPE\n{S7.extern=ReadWrite}\n$1 :");
// Remove the VERSION line
input = Regex.Replace(input, @"\s*VERSION\s*:\s*\d+(\.\d+)?\s*\r?\n", "\n", RegexOptions.Multiline);
@@ -167,8 +180,25 @@ public string TransformTypes(string input)
// This pattern looks for the quote marks around words and removes them.
input = Regex.Replace(input, @"\""(.*?)\""", "$1");
- // Remove strings within curly braces, including the braces themselves
- input = Regex.Replace(input, @"\s*{[^}]*}", "");
+ // replad LTD tia portal type to LDATE_AND_TIME of ax
+ // https://console.simatic-ax.siemens.io/docs/axcode/xlad/lad-editor/data-types#ldate_and_time
+ input = Regex.Replace(input, @"(:\s*)LDT(\s*;)", "$1LDATE_AND_TIME$2", RegexOptions.Multiline);
+
+ // move pragmas to new line before..
+ input = Regex.Replace(input, @"(.+){(.*?)}(.+)", "\t\t{$2}\n$1$3");
+
+ //DTL - clear pragmas and
+ input = Regex.Replace(input, @"(?=\{[^}]*?InstructionName\s*:=\s*'DTL';).*?{(.*?;)?\s*(.*?;)?\s*([^;{}]+)}", m =>
+ {
+ if (m.Groups.Count == 4)
+ {
+ if (m.Groups[2].Length > 1)
+ {
+ return "{" + m.Groups[3].Value.Trim() + "}";
+ }
+ }
+ return "";
+ });
return input;
}
@@ -189,7 +219,7 @@ public string ConvertDataBlocksToStructs(string fileContent)
string name = match.Groups[2].Value;
// Create pragma directive with the name of the data block
- string pragmaDirective = $"{{#ix-db: {name}}}\n";
+ string pragmaDirective = $"{{#ix-db: {name}}}\n{{S7.extern=ReadWrite}}\n";
// Replace DATA_BLOCK and any modifiers with CLASS PUBLIC and the name, removing DATA_BLOCK modifiers
string transformedBlock = Regex.Replace(blockContent, @"DATA_BLOCK\s+\w+", $"CLASS PUBLIC {name} ");
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXPseoudoProjectGeneratorTests.cs b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXPseoudoProjectGeneratorTests.cs
index f9f12b41..1fff54d5 100644
--- a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXPseoudoProjectGeneratorTests.cs
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXPseoudoProjectGeneratorTests.cs
@@ -12,652 +12,24 @@ namespace AXSharp.TIA2AX.Transformer.Tests
{
public class AXPseoudoProjectGeneratorTests
{
+
+
[Fact()]
public void CreateTest()
{
var assemblyLocation = new FileInfo(Assembly.GetExecutingAssembly().Location);
- AXPseoudoProjectGenerator.Create(assemblyLocation.DirectoryName,
- "output",
- new string[] { Path.Combine(assemblyLocation.DirectoryName, "samples", "ExportViacDbBezInstancneho.db") }, new Options() { Namespace = "nmspc"});
+ AXPseoudoProjectGenerator.Create(assemblyLocation.DirectoryName,
+ "output",
+ new string[] { Path.Combine(assemblyLocation.DirectoryName, "samples", "ExportViacDbBezInstancneho.db") }, new Options() { Namespace = "nmspc" });
- var expectedConfiguration = @"CONFIGURATION MyConfiguration
-TASK Main(Interval := T#10ms, Priority := 1);
-PROGRAM P1 WITH Main: MyProgram;
- VAR_GLOBAL
- {#ix-attr: [DBAttribute()]}
- DB_StorageNok : nmspc.DB_StorageNok;
- {#ix-attr: [DBAttribute()]}
- DBRivetingSetup : nmspc.DBRivetingSetup;
- {#ix-attr: [DBAttribute()]}
- DB_Storage : nmspc.DB_Storage;
- {#ix-attr: [DBAttribute()]}
- DbData : nmspc.DbData;
- END_VAR
-END_CONFIGURATION
-PROGRAM MyProgram
- VAR
-
- END_VAR
- ;
-END_PROGRAM";
+ var expectedConfiguration = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "Expected", "configuration.st"));
var actualConfiguration = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "output", "src", "configuration.st"));
Assert.Equal(expectedConfiguration, actualConfiguration);
-
- var expectedTypes = @"NAMESPACE nmspc
- TYPE tGlobalData_22 :
-STRUCT
- TraceabilityActive : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tGlobalData_21 :
-STRUCT
- TraceabilityActive : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_20 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_19 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_18 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_17 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_2_16 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_1_15 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_14 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_13 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_4_12 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_3_11 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_2_10 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_1_9 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_3_8 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_2_7 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_1_6 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_5 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tdigital_4 :
-STRUCT
- Required : Bool;
- Measured : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tanalog_3 :
-STRUCT
- Min : Real;
- Measured : Real;
- Max : Real;
- END_STRUCT;
-END_TYPE
-
-TYPE tdata_2 :
-STRUCT
- Required : String[128];
- Measured : String[128];
- StarNotationEnabled : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tanalog_1 :
-STRUCT
- Min : Real;
- Measured : Real;
- Max : Real;
- END_STRUCT;
-END_TYPE
-
-TYPE tCheckDataAnalog_1 :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- analog : tanalog_1;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeaderResults :
- STRUCT
- InProgress : Bool;
- IsPassed : Bool;
- IsFailed : Bool;
- IsReset : Bool;
- IsRework : Bool;
- IsMaster : Bool;
- IsSkipped : Bool;
- wasManual : Bool;
- wasReset : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataData :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- data : tdata_2;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataAnalog :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- analog : tanalog_1;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataDigital :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- digital : tdigital_4;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tRivetingData :
- STRUCT
- RivetingExclusion : Bool;
- InitialHeightCheck : tCheckDataAnalog_1;
- InitialPulseLenght : Time; // pociatocny pulz, nech sa urychli nahrievanie
- InitialPulseDutyCycle : Real; // plnenie 0-100percent
- WorkingPulseLenghtMax : Time; // pracovny kde sa tavi material, stop ked dosiahne potrebnu vysku
- WorkingPulseDutyCycle : Real; // plnenie 0-100percent
- DeatachPulseDutyCycle : Real; // plnenie 0-100percent
- PrePinCoolingStandBy : Time;
- PinCoolingTime : Time;
- SwitchOffHeatingHeight : Real;
- EndHeightCheck : tCheckDataAnalog_1;
- DeatachPulseTime : Time; // odtrhove nahriatie taviacej ihly, aby neotrhlo hlavicku
- RivetingTimingCheck : Time;
- PostCooling : Time;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeaderCu :
- STRUCT
- NextOnPassed : UInt;
- NextOnFailed : UInt;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu20Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- DataCheck_Priklad_10 : tCheckDataData;
- GearAdjusterFront : tCheckDataDigital;
- GearAdjusterInputFront : tCheckDataDigital;
- GearAdjusterBack : tCheckDataDigital;
- GearAdjusterInputBack : tCheckDataDigital;
- StudBallBack : tCheckDataDigital;
- StudBallTop : tCheckDataDigital;
- SlideLevelingMotor : tCheckDataDigital;
- SlideHorizontal : tCheckDataDigital;
- GearAdjusterFrontPressingOK : tCheckDataDigital;
- GearAdjusterBackPressingOK : tCheckDataDigital;
- ScrewingBackStatus : tCheckDataDigital;
- ScrewingTopStatus : tCheckDataDigital;
- ScrewingBackTorque : tCheckDataAnalog;
- ScrewingTopTorque : tCheckDataAnalog;
- ScrewingBackAngle : tCheckDataAnalog;
- ScrewingTopAngle : tCheckDataAnalog;
- RivetingResult : tCheckDataDigital;
- InitialHeightCheck : tCheckDataAnalog;
- EndHeightCheck : tCheckDataAnalog;
- PresentPCB : tCheckDataDigital;
- PCB_DATA : tCheckDataData;
- HotRivetingActive : Bool;
- HotRivetingSetup : Int;
- HotRivetingData : tRivetingData;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tLightType :
- STRUCT
- ID_Type : String[32];
- ID_Part : String[32];
- Type_empty : Bool;
- Type_Base : Bool;
- Type_Mid : Bool;
- Type_High : Bool;
- Type_4 : Bool;
- Type_5 : Bool;
- Type_6 : Bool;
- Type_7 : Bool;
- Type_8 : Bool;
- LHD : Bool; // EU verzia svetla
- RHD : Bool; // UK verzia svetla
- Muster : Bool;
- Rework : Bool;
- LH : Bool;
- RH : Bool;
- PartINStation : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeader :
- STRUCT
- Identificator : String[50];
- Reference : String[50];
- NextStation : UInt;
- LastStation : UInt;
- OpenOnStation : UInt;
- Carrier : UInt;
- Results : tHeaderResults;
- Result : Byte;
- FailureCode : UDInt;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu10Data :
- STRUCT
- Flow : tHeaderCu;
- LabelRefText : String[32];
- LabelDMC : String[32];
- SerialNO : String[8];
- LabelName : String[16]; // nazovetikety v tlaciarni
- sufix : String[2];
- TempDMC : String[32];
- Label : tCheckDataData;
- SMI_Screewing_1 : tSMI_Screewing_1_6;
-
- SMI_Screewing_2 : tSMI_Screewing_2_7;
-
- SMI_Screewing_3 : tSMI_Screewing_3_8;
-
- SMI_Code : tCheckDataData;
- LDM_Screewing_1 : tLDM_Screewing_1_9;
-
- LDM_Screewing_2 : tLDM_Screewing_2_10;
-
- LDM_Screewing_3 : tLDM_Screewing_3_11;
-
- LDM_Screewing_4 : tLDM_Screewing_4_12;
-
- LDM_Code : tCheckDataData;
- HoleHigh : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu30Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- CameraCheckConnector : tCheckDataDigital;
- CameraJob : Int;
- CameraExcluded : Bool;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu40Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- LDM_Screewing_1 : tLDM_Screewing_1_9;
-
- LDM_Screewing_2 : tLDM_Screewing_2_10;
-
- LDM_Code : tCheckDataData;
- SBL_Code : tCheckDataData;
- ReflectorProjector_Code : tCheckDataData;
- Reflector : tCheckDataDigital;
- BaseLDMModul : tCheckDataDigital;
- HighSBLModul : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu50Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- svetlopritomnost_15 : tCheckDataDigital;
- FTI_Code : tCheckDataData;
- CameraCheckConnector : tCheckDataDigital;
- CameraCheckGuma : tCheckDataDigital;
- CameraCheckLight : tCheckDataDigital;
- CameraJob : Int;
- CameraExcluded : Bool;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu60Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlopritomnost : tCheckDataDigital;
- ATE_ResultTest : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu70Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu80Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- CasOfukovania : Time;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tTier :
- STRUCT
- FirstRun : Bool;
- Progress : UInt;
- PreviousProgress : UInt;
- CycleCounter : UInt;
- ActualCycleCounter : UInt;
- ProgressTime : Time;
- Message : String[50];
- END_STRUCT;
-
-END_TYPE
-
-TYPE tDataManager :
- STRUCT
- RequiredReference : String[50];
- PreviousReference : String[50];
- RequiredReferenceAck : String[50];
- ActiveStationNo : Int;
- HmiRequest : Int;
- ProcessingStatus : Byte;
- ReferenceLoadStart : Bool;
- ReferenceLoadDone : Bool;
- DataChangedOnHmi : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tData :
- STRUCT
- EntityHeader : tHeader;
- LightType : tLightType;
- GlobalData : tGlobalData_21;
-
- Cu10 : tCu10Data;
- Cu20 : tCu20Data;
- Cu30 : tCu30Data;
- Cu40 : tCu40Data;
- Cu50 : tCu50Data;
- Cu60 : tCu60Data;
- Cu70 : tCu70Data;
- Cu80 : tCu80Data;
- ReferenceNo : Int;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHmiButtonMts :
- STRUCT
- Appearance : Int;
- ControlEnable : Bool;
- Visibility : Bool;
- ClickSetBit : Bool;
- ClickSwitchBit : Bool;
- PressReleaseBit : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tData_bobock :
- STRUCT
- EntityHeader : tHeader;
- LightType : tLightType;
- GlobalData : tGlobalData_21;
-
- ReferenceNo : Int;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tReference :
- STRUCT
- Manager : tDataManager;
- Data : tData;
- tier : tTier;
- END_STRUCT;
-
-END_TYPE
-
-{#ix-db: DB_StorageNok}
-CLASS PUBLIC DB_StorageNok
- VAR PUBLIC
- Data : Array[0..2] of tData_bobock;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DBRivetingSetup}
-CLASS PUBLIC DBRivetingSetup
-
- VAR PUBLIC
- SadyParametrov : Array[0..20] of tRivetingData;
- SadaNaHmi : tRivetingData;
- END_VAR
- VAR PUBLIC
- ButtonLoadFromData : tHmiButtonMts;
- ButtonSaveToData : tHmiButtonMts;
- END_VAR
- VAR PUBLIC
- AcviteIndex : Int;
- AnalogRetainTareData : Array[0..10] of Real;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DB_Storage}
-CLASS PUBLIC DB_Storage
- VAR PUBLIC
- Data : Array[0..50] of tData_bobock;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DbData}
-CLASS PUBLIC DbData
-
- VAR PUBLIC
- Reference : Array[0..10] of tReference;
- Station : Array[0..10] of tData;
- Carrier : Array[0..10] of tData;
- CarrierAtStation : Array[0..10] of UInt;
- END_VAR
-END_CLASS
-
-
-
-END_NAMESPACE";
-
-
+
+ var expectedTypes = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "Expected", "ExportViacDbBezInstancneho.st"));
var actualTypes = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "output", "src", "ExportViacDbBezInstancneho.db.st"));
-
Assert.Equal(expectedTypes.Split('\n').Length, actualTypes.Split('\n').Length);
var exp = expectedTypes.Split('\n').Select(p => p.Trim()).ToArray();
@@ -666,11 +38,6 @@ VAR PUBLIC
{
Assert.Equal(exp[i], act[i]);
}
-
-
-
-
-
}
[Fact()]
@@ -717,7 +84,7 @@ public void RunToolWithArguments()
Console.WriteLine("Error:");
Console.WriteLine(error);
}
-
+
process.WaitForExit();
}
}
@@ -728,641 +95,14 @@ public void RunToolWithArguments()
Console.WriteLine(ex.Message);
throw ex;
}
-
- var expectedConfiguration = @"CONFIGURATION MyConfiguration
-TASK Main(Interval := T#10ms, Priority := 1);
-PROGRAM P1 WITH Main: MyProgram;
- VAR_GLOBAL
- {#ix-attr: [DBAttribute()]}
- DB_StorageNok : nmspc.DB_StorageNok;
- {#ix-attr: [DBAttribute()]}
- DBRivetingSetup : nmspc.DBRivetingSetup;
- {#ix-attr: [DBAttribute()]}
- DB_Storage : nmspc.DB_Storage;
- {#ix-attr: [DBAttribute()]}
- DbData : nmspc.DbData;
- END_VAR
-END_CONFIGURATION
-PROGRAM MyProgram
- VAR
-
- END_VAR
- ;
-END_PROGRAM";
+ var expectedConfiguration = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "Expected", "configuration.st"));
+
var actualConfiguration = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "PseudoAX", "src", "configuration.st"));
Assert.Equal(expectedConfiguration, actualConfiguration);
- var expectedTypes = @"NAMESPACE nmspc
- TYPE tGlobalData_22 :
-STRUCT
- TraceabilityActive : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tGlobalData_21 :
-STRUCT
- TraceabilityActive : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_20 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_19 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_18 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_17 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_2_16 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_1_15 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_14 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_13 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_4_12 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_3_11 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_2_10 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tLDM_Screewing_1_9 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_3_8 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_2_7 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tSMI_Screewing_1_6 :
-STRUCT
- Status : tCheckDataDigital;
- Torque : tCheckDataAnalog;
- Angle : tCheckDataAnalog;
- END_STRUCT;
-END_TYPE
-
-TYPE tBasicType_5 :
-STRUCT
- tempBool : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tdigital_4 :
-STRUCT
- Required : Bool;
- Measured : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tanalog_3 :
-STRUCT
- Min : Real;
- Measured : Real;
- Max : Real;
- END_STRUCT;
-END_TYPE
-
-TYPE tdata_2 :
-STRUCT
- Required : String[128];
- Measured : String[128];
- StarNotationEnabled : Bool;
- END_STRUCT;
-END_TYPE
-
-TYPE tanalog_1 :
-STRUCT
- Min : Real;
- Measured : Real;
- Max : Real;
- END_STRUCT;
-END_TYPE
-
-TYPE tCheckDataAnalog_1 :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- analog : tanalog_1;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeaderResults :
- STRUCT
- InProgress : Bool;
- IsPassed : Bool;
- IsFailed : Bool;
- IsReset : Bool;
- IsRework : Bool;
- IsMaster : Bool;
- IsSkipped : Bool;
- wasManual : Bool;
- wasReset : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataData :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- data : tdata_2;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataAnalog :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- analog : tanalog_1;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCheckDataDigital :
- STRUCT
- IsExcluded : Bool;
- IsVisible : Bool;
- Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
- digital : tdigital_4;
-
- PassedTime : Time := T#50ms;
- FailedTime : Time := T#100ms;
- Result : Byte;
- NumberOfRetries : UInt;
- AllowedNumberOfRetries : UInt;
- SourceID : UInt; // identifikator stanice/kroku/rezimu
- END_STRUCT;
-
-END_TYPE
-
-TYPE tRivetingData :
- STRUCT
- RivetingExclusion : Bool;
- InitialHeightCheck : tCheckDataAnalog_1;
- InitialPulseLenght : Time; // pociatocny pulz, nech sa urychli nahrievanie
- InitialPulseDutyCycle : Real; // plnenie 0-100percent
- WorkingPulseLenghtMax : Time; // pracovny kde sa tavi material, stop ked dosiahne potrebnu vysku
- WorkingPulseDutyCycle : Real; // plnenie 0-100percent
- DeatachPulseDutyCycle : Real; // plnenie 0-100percent
- PrePinCoolingStandBy : Time;
- PinCoolingTime : Time;
- SwitchOffHeatingHeight : Real;
- EndHeightCheck : tCheckDataAnalog_1;
- DeatachPulseTime : Time; // odtrhove nahriatie taviacej ihly, aby neotrhlo hlavicku
- RivetingTimingCheck : Time;
- PostCooling : Time;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeaderCu :
- STRUCT
- NextOnPassed : UInt;
- NextOnFailed : UInt;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu20Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- DataCheck_Priklad_10 : tCheckDataData;
- GearAdjusterFront : tCheckDataDigital;
- GearAdjusterInputFront : tCheckDataDigital;
- GearAdjusterBack : tCheckDataDigital;
- GearAdjusterInputBack : tCheckDataDigital;
- StudBallBack : tCheckDataDigital;
- StudBallTop : tCheckDataDigital;
- SlideLevelingMotor : tCheckDataDigital;
- SlideHorizontal : tCheckDataDigital;
- GearAdjusterFrontPressingOK : tCheckDataDigital;
- GearAdjusterBackPressingOK : tCheckDataDigital;
- ScrewingBackStatus : tCheckDataDigital;
- ScrewingTopStatus : tCheckDataDigital;
- ScrewingBackTorque : tCheckDataAnalog;
- ScrewingTopTorque : tCheckDataAnalog;
- ScrewingBackAngle : tCheckDataAnalog;
- ScrewingTopAngle : tCheckDataAnalog;
- RivetingResult : tCheckDataDigital;
- InitialHeightCheck : tCheckDataAnalog;
- EndHeightCheck : tCheckDataAnalog;
- PresentPCB : tCheckDataDigital;
- PCB_DATA : tCheckDataData;
- HotRivetingActive : Bool;
- HotRivetingSetup : Int;
- HotRivetingData : tRivetingData;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tLightType :
- STRUCT
- ID_Type : String[32];
- ID_Part : String[32];
- Type_empty : Bool;
- Type_Base : Bool;
- Type_Mid : Bool;
- Type_High : Bool;
- Type_4 : Bool;
- Type_5 : Bool;
- Type_6 : Bool;
- Type_7 : Bool;
- Type_8 : Bool;
- LHD : Bool; // EU verzia svetla
- RHD : Bool; // UK verzia svetla
- Muster : Bool;
- Rework : Bool;
- LH : Bool;
- RH : Bool;
- PartINStation : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHeader :
- STRUCT
- Identificator : String[50];
- Reference : String[50];
- NextStation : UInt;
- LastStation : UInt;
- OpenOnStation : UInt;
- Carrier : UInt;
- Results : tHeaderResults;
- Result : Byte;
- FailureCode : UDInt;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu10Data :
- STRUCT
- Flow : tHeaderCu;
- LabelRefText : String[32];
- LabelDMC : String[32];
- SerialNO : String[8];
- LabelName : String[16]; // nazovetikety v tlaciarni
- sufix : String[2];
- TempDMC : String[32];
- Label : tCheckDataData;
- SMI_Screewing_1 : tSMI_Screewing_1_6;
-
- SMI_Screewing_2 : tSMI_Screewing_2_7;
-
- SMI_Screewing_3 : tSMI_Screewing_3_8;
-
- SMI_Code : tCheckDataData;
- LDM_Screewing_1 : tLDM_Screewing_1_9;
-
- LDM_Screewing_2 : tLDM_Screewing_2_10;
-
- LDM_Screewing_3 : tLDM_Screewing_3_11;
-
- LDM_Screewing_4 : tLDM_Screewing_4_12;
-
- LDM_Code : tCheckDataData;
- HoleHigh : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu30Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- CameraCheckConnector : tCheckDataDigital;
- CameraJob : Int;
- CameraExcluded : Bool;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu40Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- LDM_Screewing_1 : tLDM_Screewing_1_9;
-
- LDM_Screewing_2 : tLDM_Screewing_2_10;
-
- LDM_Code : tCheckDataData;
- SBL_Code : tCheckDataData;
- ReflectorProjector_Code : tCheckDataData;
- Reflector : tCheckDataDigital;
- BaseLDMModul : tCheckDataDigital;
- HighSBLModul : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu50Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlovyska : tCheckDataAnalog;
- svetlopritomnost : tCheckDataDigital;
- svetlopritomnost_15 : tCheckDataDigital;
- FTI_Code : tCheckDataData;
- CameraCheckConnector : tCheckDataDigital;
- CameraCheckGuma : tCheckDataDigital;
- CameraCheckLight : tCheckDataDigital;
- CameraJob : Int;
- CameraExcluded : Bool;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu60Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- svetlopritomnost : tCheckDataDigital;
- ATE_ResultTest : tCheckDataDigital;
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu70Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- END_STRUCT;
-
-END_TYPE
-
-TYPE tCu80Data :
- STRUCT
- Flow : tHeaderCu;
- BasicType : tBasicType_5;
-
- DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
- DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
- DummyCheckData : tCheckDataData; // DataCheckData
- CasOfukovania : Time;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tTier :
- STRUCT
- FirstRun : Bool;
- Progress : UInt;
- PreviousProgress : UInt;
- CycleCounter : UInt;
- ActualCycleCounter : UInt;
- ProgressTime : Time;
- Message : String[50];
- END_STRUCT;
-
-END_TYPE
-
-TYPE tDataManager :
- STRUCT
- RequiredReference : String[50];
- PreviousReference : String[50];
- RequiredReferenceAck : String[50];
- ActiveStationNo : Int;
- HmiRequest : Int;
- ProcessingStatus : Byte;
- ReferenceLoadStart : Bool;
- ReferenceLoadDone : Bool;
- DataChangedOnHmi : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tData :
- STRUCT
- EntityHeader : tHeader;
- LightType : tLightType;
- GlobalData : tGlobalData_21;
-
- Cu10 : tCu10Data;
- Cu20 : tCu20Data;
- Cu30 : tCu30Data;
- Cu40 : tCu40Data;
- Cu50 : tCu50Data;
- Cu60 : tCu60Data;
- Cu70 : tCu70Data;
- Cu80 : tCu80Data;
- ReferenceNo : Int;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tHmiButtonMts :
- STRUCT
- Appearance : Int;
- ControlEnable : Bool;
- Visibility : Bool;
- ClickSetBit : Bool;
- ClickSwitchBit : Bool;
- PressReleaseBit : Bool;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tData_bobock :
- STRUCT
- EntityHeader : tHeader;
- LightType : tLightType;
- GlobalData : tGlobalData_21;
-
- ReferenceNo : Int;
- END_STRUCT;
-
-END_TYPE
-
-TYPE tReference :
- STRUCT
- Manager : tDataManager;
- Data : tData;
- tier : tTier;
- END_STRUCT;
-
-END_TYPE
-
-{#ix-db: DB_StorageNok}
-CLASS PUBLIC DB_StorageNok
- VAR PUBLIC
- Data : Array[0..2] of tData_bobock;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DBRivetingSetup}
-CLASS PUBLIC DBRivetingSetup
-
- VAR PUBLIC
- SadyParametrov : Array[0..20] of tRivetingData;
- SadaNaHmi : tRivetingData;
- END_VAR
- VAR PUBLIC
- ButtonLoadFromData : tHmiButtonMts;
- ButtonSaveToData : tHmiButtonMts;
- END_VAR
- VAR PUBLIC
- AcviteIndex : Int;
- AnalogRetainTareData : Array[0..10] of Real;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DB_Storage}
-CLASS PUBLIC DB_Storage
- VAR PUBLIC
- Data : Array[0..50] of tData_bobock;
- END_VAR
-END_CLASS
-
-
-{#ix-db: DbData}
-CLASS PUBLIC DbData
-
- VAR PUBLIC
- Reference : Array[0..10] of tReference;
- Station : Array[0..10] of tData;
- Carrier : Array[0..10] of tData;
- CarrierAtStation : Array[0..10] of UInt;
- END_VAR
-END_CLASS
-
-
-
-END_NAMESPACE";
+ var expectedTypes = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "Expected", "ExportViacDbBezInstancneho.st"));
var actualTypes = File.ReadAllText(Path.Combine(assemblyLocation.DirectoryName, "PseudoAX", "src", "ExportViacDbBezInstancneho.db.st"));
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXSharp.TIA2AX.TransformerTests.csproj b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXSharp.TIA2AX.TransformerTests.csproj
index 6490cad7..288320b4 100644
--- a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXSharp.TIA2AX.TransformerTests.csproj
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/AXSharp.TIA2AX.TransformerTests.csproj
@@ -10,12 +10,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -23,9 +23,18 @@
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/ExportViacDbBezInstancneho.st b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/ExportViacDbBezInstancneho.st
new file mode 100644
index 00000000..8e93cdbb
--- /dev/null
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/ExportViacDbBezInstancneho.st
@@ -0,0 +1,713 @@
+NAMESPACE nmspc
+ TYPE tGlobalData_22 :
+STRUCT
+ TraceabilityActive : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tGlobalData_21 :
+STRUCT
+ TraceabilityActive : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_20 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_19 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_18 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_17 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_2_16 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_1_15 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_14 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_13 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_4_12 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_3_11 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_2_10 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tLDM_Screewing_1_9 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tSMI_Screewing_3_8 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ Torque : tCheckDataAnalog;
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tSMI_Screewing_2_7 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ Torque : tCheckDataAnalog;
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tSMI_Screewing_1_6 :
+STRUCT
+ { S7_SetPoint := 'False'}
+ Status : tCheckDataDigital;
+ { S7_SetPoint := 'False'}
+ Torque : tCheckDataAnalog;
+ { S7_SetPoint := 'False'}
+ Angle : tCheckDataAnalog;
+ END_STRUCT;
+END_TYPE
+
+TYPE tBasicType_5 :
+STRUCT
+ tempBool : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tdigital_4 :
+STRUCT
+ Required : Bool;
+ Measured : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tanalog_3 :
+STRUCT
+ Min : Real;
+ Measured : Real;
+ Max : Real;
+ END_STRUCT;
+END_TYPE
+
+TYPE tdata_2 :
+STRUCT
+ Required : String[128];
+ Measured : String[128];
+ StarNotationEnabled : Bool;
+ END_STRUCT;
+END_TYPE
+
+TYPE tanalog_1 :
+STRUCT
+ Min : Real;
+ Measured : Real;
+ Max : Real;
+ END_STRUCT;
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCheckDataAnalog_1 :
+ STRUCT
+ IsExcluded : Bool;
+ IsVisible : Bool;
+ Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
+
+ PassedTime : Time := T#50ms;
+ FailedTime : Time := T#100ms;
+ Result : Byte;
+ NumberOfRetries : UInt;
+ AllowedNumberOfRetries : UInt;
+ SourceID : UInt; // identifikator stanice/kroku/rezimu
+ TimeStamp : Date_And_Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tHeaderResults :
+ STRUCT
+ InProgress : Bool;
+ IsPassed : Bool;
+ IsFailed : Bool;
+ IsReset : Bool;
+ IsRework : Bool;
+ IsMaster : Bool;
+ IsSkipped : Bool;
+ wasManual : Bool;
+ wasReset : Bool;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCheckDataData :
+ STRUCT
+ IsExcluded : Bool;
+ IsVisible : Bool;
+ Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
+
+ PassedTime : Time := T#50ms;
+ FailedTime : Time := T#100ms;
+ Result : Byte;
+ NumberOfRetries : UInt;
+ AllowedNumberOfRetries : UInt;
+ SourceID : UInt; // identifikator stanice/kroku/rezimu
+ TimeStamp : Date_And_Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCheckDataAnalog :
+ STRUCT
+ IsExcluded : Bool;
+ IsVisible : Bool;
+ Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
+
+ PassedTime : Time := T#50ms;
+ FailedTime : Time := T#100ms;
+ Result : Byte;
+ NumberOfRetries : UInt;
+ AllowedNumberOfRetries : UInt;
+ SourceID : UInt; // identifikator stanice/kroku/rezimu
+ TimeStamp : Date_And_Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCheckDataDigital :
+ STRUCT
+ IsExcluded : Bool;
+ IsVisible : Bool;
+ Typecheck : Int; // 0=inactive, 1-logic,2-analog,3:data
+
+ PassedTime : Time := T#50ms;
+ FailedTime : Time := T#100ms;
+ Result : Byte;
+ NumberOfRetries : UInt;
+ AllowedNumberOfRetries : UInt;
+ SourceID : UInt; // identifikator stanice/kroku/rezimu
+ TimeStamp : Date_And_Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tRivetingData :
+ STRUCT
+ RivetingExclusion : Bool;
+ { S7_SetPoint := 'False'}
+ InitialHeightCheck : tCheckDataAnalog_1;
+ InitialPulseLenght : Time; // pociatocny pulz, nech sa urychli nahrievanie
+ InitialPulseDutyCycle : Real; // plnenie 0-100percent
+ WorkingPulseLenghtMax : Time; // pracovny kde sa tavi material, stop ked dosiahne potrebnu vysku
+ WorkingPulseDutyCycle : Real; // plnenie 0-100percent
+ DeatachPulseDutyCycle : Real; // plnenie 0-100percent
+ PrePinCoolingStandBy : Time;
+ PinCoolingTime : Time;
+ SwitchOffHeatingHeight : Real;
+ { S7_SetPoint := 'False'}
+ EndHeightCheck : tCheckDataAnalog_1;
+ DeatachPulseTime : Time; // odtrhove nahriatie taviacej ihly, aby neotrhlo hlavicku
+ RivetingTimingCheck : Time;
+ PostCooling : Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tHeaderCu :
+ STRUCT
+ NextOnPassed : UInt;
+ NextOnFailed : UInt;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu20Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ { S7_SetPoint := 'False'}
+ svetlovyska : tCheckDataAnalog;
+ svetlopritomnost : tCheckDataDigital;
+ DataCheck_Priklad_10 : tCheckDataData;
+ GearAdjusterFront : tCheckDataDigital;
+ GearAdjusterInputFront : tCheckDataDigital;
+ GearAdjusterBack : tCheckDataDigital;
+ GearAdjusterInputBack : tCheckDataDigital;
+ StudBallBack : tCheckDataDigital;
+ StudBallTop : tCheckDataDigital;
+ SlideLevelingMotor : tCheckDataDigital;
+ SlideHorizontal : tCheckDataDigital;
+ GearAdjusterFrontPressingOK : tCheckDataDigital;
+ GearAdjusterBackPressingOK : tCheckDataDigital;
+ ScrewingBackStatus : tCheckDataDigital;
+ ScrewingTopStatus : tCheckDataDigital;
+ ScrewingBackTorque : tCheckDataAnalog;
+ ScrewingTopTorque : tCheckDataAnalog;
+ ScrewingBackAngle : tCheckDataAnalog;
+ ScrewingTopAngle : tCheckDataAnalog;
+ RivetingResult : tCheckDataDigital;
+ InitialHeightCheck : tCheckDataAnalog;
+ EndHeightCheck : tCheckDataAnalog;
+ PresentPCB : tCheckDataDigital;
+ PCB_DATA : tCheckDataData;
+ { S7_SetPoint := 'True'}
+ HotRivetingActive : Bool;
+ HotRivetingSetup : Int;
+ HotRivetingData : tRivetingData;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tLightType :
+ STRUCT
+ ID_Type : String[32];
+ ID_Part : String[32];
+ Type_empty : Bool;
+ Type_Base : Bool;
+ Type_Mid : Bool;
+ Type_High : Bool;
+ Type_4 : Bool;
+ Type_5 : Bool;
+ Type_6 : Bool;
+ Type_7 : Bool;
+ Type_8 : Bool;
+ LHD : Bool; // EU verzia svetla
+ RHD : Bool; // UK verzia svetla
+ Muster : Bool;
+ Rework : Bool;
+ LH : Bool;
+ RH : Bool;
+ PartINStation : Bool;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tHeader :
+ STRUCT
+ Identificator : String[50];
+ Reference : String[50];
+ NextStation : UInt;
+ LastStation : UInt;
+ OpenOnStation : UInt;
+ Carrier : UInt;
+ { S7_SetPoint := 'False'}
+ Results : tHeaderResults;
+ { S7_SetPoint := 'True'}
+ Result : Byte;
+
+ TimeStampLast : DTL;
+ FailureCode : UDInt;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu10Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+ LabelRefText : String[32];
+ LabelDMC : String[32];
+ SerialNO : String[8];
+ LabelName : String[16]; // nazovetikety v tlaciarni
+ sufix : String[2];
+ TempDMC : String[32];
+ { S7_SetPoint := 'False'}
+ Label : tCheckDataData;
+
+
+
+ { S7_SetPoint := 'False'}
+ SMI_Code : tCheckDataData;
+
+
+
+
+ LDM_Code : tCheckDataData;
+ HoleHigh : tCheckDataDigital;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu30Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ { S7_SetPoint := 'False'}
+ svetlovyska : tCheckDataAnalog;
+ svetlopritomnost : tCheckDataDigital;
+ CameraCheckConnector : tCheckDataDigital;
+ { S7_SetPoint := 'True'}
+ CameraJob : Int;
+ CameraExcluded : Bool;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu40Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ { S7_SetPoint := 'False'}
+ svetlovyska : tCheckDataAnalog;
+ svetlopritomnost : tCheckDataDigital;
+
+
+ LDM_Code : tCheckDataData;
+ SBL_Code : tCheckDataData;
+ ReflectorProjector_Code : tCheckDataData;
+ { S7_SetPoint := 'False'}
+ Reflector : tCheckDataDigital;
+ BaseLDMModul : tCheckDataDigital;
+ HighSBLModul : tCheckDataDigital;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu50Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ { S7_SetPoint := 'False'}
+ svetlovyska : tCheckDataAnalog;
+ svetlopritomnost : tCheckDataDigital;
+ svetlopritomnost_15 : tCheckDataDigital;
+ FTI_Code : tCheckDataData;
+ CameraCheckConnector : tCheckDataDigital;
+ CameraCheckGuma : tCheckDataDigital;
+ CameraCheckLight : tCheckDataDigital;
+ { S7_SetPoint := 'True'}
+ CameraJob : Int;
+ CameraExcluded : Bool;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu60Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ svetlopritomnost : tCheckDataDigital;
+ ATE_ResultTest : tCheckDataDigital;
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu70Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tCu80Data :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Flow : tHeaderCu;
+
+ DummyCheckDigital : tCheckDataDigital; // DigitalCheckData
+ DummyCheckAnalog : tCheckDataAnalog; // AnalogCheckData
+ DummyCheckData : tCheckDataData; // DataCheckData
+ { S7_SetPoint := 'True'}
+ CasOfukovania : Time;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tTier :
+ STRUCT
+ FirstRun : Bool;
+ Progress : UInt;
+ PreviousProgress : UInt;
+ { S7_SetPoint := 'True'}
+ CycleCounter : UInt;
+ { S7_SetPoint := 'True'}
+ ActualCycleCounter : UInt;
+ { S7_SetPoint := 'True'}
+ ProgressTime : Time;
+ {InstructionName := 'TON_TIME'; LibVersion := '1.0'; S7_SetPoint := 'False'}
+ { S7_SetPoint := 'True'}
+ Message : String[50];
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tDataManager :
+ STRUCT
+ RequiredReference : String[50];
+ PreviousReference : String[50];
+ RequiredReferenceAck : String[50];
+ ActiveStationNo : Int;
+ HmiRequest : Int;
+ ProcessingStatus : Byte;
+ ReferenceLoadStart : Bool;
+ ReferenceLoadDone : Bool;
+ DataChangedOnHmi : Bool;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tData :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ EntityHeader : tHeader;
+ { S7_SetPoint := 'False'}
+ LightType : tLightType;
+
+ Cu10 : tCu10Data;
+ Cu20 : tCu20Data;
+ Cu30 : tCu30Data;
+ Cu40 : tCu40Data;
+ Cu50 : tCu50Data;
+ Cu60 : tCu60Data;
+ Cu70 : tCu70Data;
+ Cu80 : tCu80Data;
+ { S7_SetPoint := 'True'}
+ ReferenceNo : Int;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tHmiButtonMts :
+ STRUCT
+ Appearance : Int;
+ ControlEnable : Bool;
+ Visibility : Bool;
+ ClickSetBit : Bool;
+ ClickSwitchBit : Bool;
+ PressReleaseBit : Bool;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tData_bobock :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ EntityHeader : tHeader;
+ { S7_SetPoint := 'False'}
+ LightType : tLightType;
+
+ { S7_SetPoint := 'True'}
+ ReferenceNo : Int;
+ END_STRUCT;
+
+END_TYPE
+
+TYPE
+{S7.extern=ReadWrite}
+tReference :
+ STRUCT
+ { S7_SetPoint := 'False'}
+ Manager : tDataManager;
+ Data : tData;
+ tier : tTier;
+ END_STRUCT;
+
+END_TYPE
+
+{#ix-db: DB_StorageNok}
+{S7.extern=ReadWrite}
+CLASS PUBLIC DB_StorageNok
+{ S7_Optimized_Access := 'TRUE' }
+ VAR PUBLIC
+ Data : Array[0..2] of tData_bobock;
+ END_VAR
+END_CLASS
+
+
+{#ix-db: DBRivetingSetup}
+{S7.extern=ReadWrite}
+CLASS PUBLIC DBRivetingSetup
+{ S7_Optimized_Access := 'TRUE' }
+
+ VAR PUBLIC
+ { S7_SetPoint := 'False'}
+ SadyParametrov : Array[0..20] of tRivetingData;
+ SadaNaHmi : tRivetingData;
+ END_VAR
+ VAR PUBLIC
+ { S7_SetPoint := 'False'}
+ ButtonLoadFromData : tHmiButtonMts;
+ ButtonSaveToData : tHmiButtonMts;
+ END_VAR
+ VAR PUBLIC
+ { S7_SetPoint := 'True'}
+ AcviteIndex : Int;
+ AnalogRetainTareData : Array[0..10] of Real;
+ END_VAR
+END_CLASS
+
+
+{#ix-db: DB_Storage}
+{S7.extern=ReadWrite}
+CLASS PUBLIC DB_Storage
+{ DB_Accessible_From_OPC_UA := 'FALSE' ;
+ S7_Optimized_Access := 'TRUE' }
+ VAR PUBLIC
+ { S7_SetPoint := 'False'}
+ Data : Array[0..50] of tData_bobock;
+ END_VAR
+END_CLASS
+
+
+{#ix-db: DbData}
+{S7.extern=ReadWrite}
+CLASS PUBLIC DbData
+{ S7_Optimized_Access := 'TRUE' }
+
+ VAR PUBLIC
+ { S7_SetPoint := 'False'}
+ Reference : Array[0..10] of tReference;
+ { S7_SetPoint := 'False'}
+ Station : Array[0..10] of tData;
+ Carrier : Array[0..10] of tData;
+ { S7_SetPoint := 'True'}
+ CarrierAtStation : Array[0..10] of UInt;
+ END_VAR
+END_CLASS
+
+
+
+END_NAMESPACE
\ No newline at end of file
diff --git a/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/configuration.st b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/configuration.st
new file mode 100644
index 00000000..d6d94183
--- /dev/null
+++ b/src/AXSharp.tools/src/AXSharp.TIA2AX.TranformerTests/Expected/configuration.st
@@ -0,0 +1,24 @@
+CONFIGURATION MyConfiguration
+TASK Main(Interval := T#10ms, Priority := 1);
+PROGRAM P1 WITH Main: MyProgram;
+ VAR_GLOBAL
+ {#ix-attr: [DBAttribute()]}
+ {S7.extern=ReadWrite}
+ DB_StorageNok : nmspc.DB_StorageNok;
+ {#ix-attr: [DBAttribute()]}
+ {S7.extern=ReadWrite}
+ DBRivetingSetup : nmspc.DBRivetingSetup;
+ {#ix-attr: [DBAttribute()]}
+ {S7.extern=ReadWrite}
+ DB_Storage : nmspc.DB_Storage;
+ {#ix-attr: [DBAttribute()]}
+ {S7.extern=ReadWrite}
+ DbData : nmspc.DbData;
+ END_VAR
+END_CONFIGURATION
+PROGRAM MyProgram
+ VAR
+
+ END_VAR
+ ;
+END_PROGRAM
\ No newline at end of file
diff --git a/src/tests.integrations/integrated/src/ax/apax-lock.json b/src/tests.integrations/integrated/src/ax/apax-lock.json
index 86dd5fa5..b27a95c8 100644
--- a/src/tests.integrations/integrated/src/ax/apax-lock.json
+++ b/src/tests.integrations/integrated/src/ax/apax-lock.json
@@ -523,62 +523,6 @@
],
"dependencies": {}
},
- "@ax/stc-win-x64": {
- "name": "@ax/stc-win-x64",
- "version": "6.0.146",
- "integrity": "sha512-4hTgmIG54MaWhgxBV8gygU19yilVLfieizhUb08aRXz2o1+YKqd6ifgz1NBAT9RVOgnMj0IJcUynuLo998i1zg==",
- "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-6.0.146.tgz",
- "os": [
- "win32"
- ],
- "cpu": [
- "x64"
- ],
- "dependencies": {
- "@ax/st-docs": "6.0.146"
- }
- },
- "@ax/stc-linux-x64": {
- "name": "@ax/stc-linux-x64",
- "version": "6.0.146",
- "integrity": "sha512-Cy8psrCe2TB+bCZrCzU4qtPxf0UWzCpdmxOCBC4fEVKnKW6MaBOBt85PAbz6MtAriH4boJY9gMMuPspWlKavPA==",
- "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-6.0.146.tgz",
- "os": [
- "linux"
- ],
- "cpu": [
- "x64"
- ],
- "dependencies": {
- "@ax/st-docs": "6.0.146"
- }
- },
- "@ax/st-ls-win-x64": {
- "name": "@ax/st-ls-win-x64",
- "version": "3.0.113",
- "integrity": "sha512-dPj6b2aRhnelCe0BpIcLMLvHbUj2zhfQOtu4jzdZFDPhKICdB9+fTebuYRmP2vna4ogTke22e6f2buwR6VO1Vw==",
- "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-ls-win-x64/-/st-ls-win-x64-3.0.113.tgz",
- "os": [
- "win32"
- ],
- "cpu": [
- "x64"
- ],
- "dependencies": {}
- },
- "@ax/st-ls-linux-x64": {
- "name": "@ax/st-ls-linux-x64",
- "version": "3.0.113",
- "integrity": "sha512-/QUsNMJrMPRVcCrCD7gkw/xl0VvZ8YEJXxQMWGwkWol3JgxiPjWW/fb7EqpzDU+ij45xy85rBdx29MMHQ3Of9Q==",
- "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-ls-linux-x64/-/st-ls-linux-x64-3.0.113.tgz",
- "os": [
- "linux"
- ],
- "cpu": [
- "x64"
- ],
- "dependencies": {}
- },
"@ax/system-strings": {
"name": "@ax/system-strings",
"version": "6.0.94",
@@ -667,11 +611,60 @@
],
"dependencies": {}
},
- "@ax/st-docs": {
- "name": "@ax/st-docs",
+ "@ax/stc-win-x64": {
+ "name": "@ax/stc-win-x64",
"version": "6.0.146",
- "integrity": "sha512-KUs6JC/dWedgnaxH7UrqAOuJm6rKS4gzXTLguqXbtWHKdDKOceIw1yODyjty4iuOm6TkDm2UX4ya6QFC84eBHA==",
- "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-6.0.146.tgz",
+ "integrity": "sha512-4hTgmIG54MaWhgxBV8gygU19yilVLfieizhUb08aRXz2o1+YKqd6ifgz1NBAT9RVOgnMj0IJcUynuLo998i1zg==",
+ "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-6.0.146.tgz",
+ "os": [
+ "win32"
+ ],
+ "cpu": [
+ "x64"
+ ],
+ "dependencies": {
+ "@ax/st-docs": "6.0.146"
+ }
+ },
+ "@ax/stc-linux-x64": {
+ "name": "@ax/stc-linux-x64",
+ "version": "6.0.146",
+ "integrity": "sha512-Cy8psrCe2TB+bCZrCzU4qtPxf0UWzCpdmxOCBC4fEVKnKW6MaBOBt85PAbz6MtAriH4boJY9gMMuPspWlKavPA==",
+ "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-6.0.146.tgz",
+ "os": [
+ "linux"
+ ],
+ "cpu": [
+ "x64"
+ ],
+ "dependencies": {
+ "@ax/st-docs": "6.0.146"
+ }
+ },
+ "@ax/st-ls-win-x64": {
+ "name": "@ax/st-ls-win-x64",
+ "version": "3.0.113",
+ "integrity": "sha512-dPj6b2aRhnelCe0BpIcLMLvHbUj2zhfQOtu4jzdZFDPhKICdB9+fTebuYRmP2vna4ogTke22e6f2buwR6VO1Vw==",
+ "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-ls-win-x64/-/st-ls-win-x64-3.0.113.tgz",
+ "os": [
+ "win32"
+ ],
+ "cpu": [
+ "x64"
+ ],
+ "dependencies": {}
+ },
+ "@ax/st-ls-linux-x64": {
+ "name": "@ax/st-ls-linux-x64",
+ "version": "3.0.113",
+ "integrity": "sha512-/QUsNMJrMPRVcCrCD7gkw/xl0VvZ8YEJXxQMWGwkWol3JgxiPjWW/fb7EqpzDU+ij45xy85rBdx29MMHQ3Of9Q==",
+ "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-ls-linux-x64/-/st-ls-linux-x64-3.0.113.tgz",
+ "os": [
+ "linux"
+ ],
+ "cpu": [
+ "x64"
+ ],
"dependencies": {}
},
"@ax/system-math": {
@@ -687,6 +680,13 @@
"integrity": "sha512-8xn57nA5NfZ6ImTxmFGvzFp7wLL38JdUgjsuEg+xbzs29e8ftvbTCNqaWMVdX05N4QNAqohq2BlEkIyFtDH8Qg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/system-datetime/-/system-datetime-6.0.94.tgz",
"dependencies": {}
+ },
+ "@ax/st-docs": {
+ "name": "@ax/st-docs",
+ "version": "6.0.146",
+ "integrity": "sha512-KUs6JC/dWedgnaxH7UrqAOuJm6rKS4gzXTLguqXbtWHKdDKOceIw1yODyjty4iuOm6TkDm2UX4ya6QFC84eBHA==",
+ "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-6.0.146.tgz",
+ "dependencies": {}
}
},
"workspaces": {}