Zixuan 2 weeks ago
parent
commit
062c930c63

+ 7 - 0
CommunicationProtocols/TwinCatADS/Class1.cs

@@ -0,0 +1,7 @@
+namespace TwinCatADS
+{
+    public class Class1
+    {
+
+    }
+}

+ 9 - 0
CommunicationProtocols/TwinCatADS/TwinCatADS.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 7 - 7
Minics.sln

@@ -31,8 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mini8Communicator", "Commun
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mini8CommunicatorData", "Communicators\Mini8Communicator\Mini8CommunicatorData\Mini8CommunicatorData.csproj", "{263CA868-29B5-16E1-2F1D-C17F13F53066}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mini8CommunicatorEthercat", "Communicators\Mini8Communicator\Mini8CommunicatorEthercat\Mini8CommunicatorEthercat.csproj", "{13BA5D96-0998-30E1-A829-2F479A2821B3}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mini8CommunicatorModbus", "Communicators\Mini8Communicator\Mini8CommunicatorModbus\Mini8CommunicatorModbus.csproj", "{97F78E0D-E2CC-593E-8F94-C774DEEE1387}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mini8CommunicatorSim", "Communicators\Mini8Communicator\Mini8CommunicatorSim\Mini8CommunicatorSim.csproj", "{D71B4A8D-DAEA-5360-1FB5-B04B703E243B}"
@@ -89,6 +87,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModBusTcp", "CommunicationP
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocalGeneral", "CommunicationProtocols\ProtocalGeneral\ProtocalGeneral.csproj", "{55EC57EB-3DA4-4289-803F-4661A6EAE1B9}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwinCatADS", "CommunicationProtocols\TwinCatADS\TwinCatADS.csproj", "{81EA7F4C-9379-4314-B8DC-F907F86D8535}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -123,10 +123,6 @@ Global
 		{263CA868-29B5-16E1-2F1D-C17F13F53066}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{263CA868-29B5-16E1-2F1D-C17F13F53066}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{263CA868-29B5-16E1-2F1D-C17F13F53066}.Release|Any CPU.Build.0 = Release|Any CPU
-		{13BA5D96-0998-30E1-A829-2F479A2821B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{13BA5D96-0998-30E1-A829-2F479A2821B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{13BA5D96-0998-30E1-A829-2F479A2821B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{13BA5D96-0998-30E1-A829-2F479A2821B3}.Release|Any CPU.Build.0 = Release|Any CPU
 		{97F78E0D-E2CC-593E-8F94-C774DEEE1387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{97F78E0D-E2CC-593E-8F94-C774DEEE1387}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{97F78E0D-E2CC-593E-8F94-C774DEEE1387}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -223,6 +219,10 @@ Global
 		{55EC57EB-3DA4-4289-803F-4661A6EAE1B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{55EC57EB-3DA4-4289-803F-4661A6EAE1B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{55EC57EB-3DA4-4289-803F-4661A6EAE1B9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{81EA7F4C-9379-4314-B8DC-F907F86D8535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{81EA7F4C-9379-4314-B8DC-F907F86D8535}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{81EA7F4C-9379-4314-B8DC-F907F86D8535}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{81EA7F4C-9379-4314-B8DC-F907F86D8535}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -233,7 +233,6 @@ Global
 		{0047308D-3A8B-459C-BD90-574AE9FF139F} = {4497907C-A40A-4DDA-A2BC-C8335CF34963}
 		{C00B2DEB-A002-61D9-6665-590831707DA0} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{263CA868-29B5-16E1-2F1D-C17F13F53066} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
-		{13BA5D96-0998-30E1-A829-2F479A2821B3} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{97F78E0D-E2CC-593E-8F94-C774DEEE1387} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{D71B4A8D-DAEA-5360-1FB5-B04B703E243B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{E01EF058-A268-B0AE-ACE3-A67E6C7C1981} = {E90BDF7A-5771-4F44-A2B6-BDC51F9A73A9}
@@ -256,6 +255,7 @@ Global
 		{85D48105-88EC-4B80-B394-76DB988F6DD4} = {165A518A-753D-4062-A100-9367AF27F900}
 		{6B500EDB-EB90-4AA6-A0EB-90241292D370} = {165A518A-753D-4062-A100-9367AF27F900}
 		{55EC57EB-3DA4-4289-803F-4661A6EAE1B9} = {165A518A-753D-4062-A100-9367AF27F900}
+		{81EA7F4C-9379-4314-B8DC-F907F86D8535} = {165A518A-753D-4062-A100-9367AF27F900}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {2E8CB4A6-1AFA-4CB2-BA42-1BAFC71AD68B}

+ 2 - 2
MinicsConsole/Helper/RawDataFilter/ChannelDataBaseHelper.cs

@@ -29,7 +29,7 @@ public class ChannelDataBaseHelper(byte mini8Index,ILog log)
         {
             ChannelIndex = mini8Output.ChannelIndex,
             DateTime = mini8Output.CollectTime,
-            AlarmType = AlarmType.SensorBrake,
+            AlarmType = AlarmType.OverRange,
             PV = mini8Output.PV,
             Caps = channelData.Caps,
             Floor = channelData.Floor,
@@ -43,7 +43,7 @@ public class ChannelDataBaseHelper(byte mini8Index,ILog log)
         {
             ChannelIndex = mini8Output.ChannelIndex,
             DateTime = mini8Output.CollectTime,
-            AlarmType = AlarmType.OverRange,
+            AlarmType = AlarmType.SensorBrake,
             PV = mini8Output.PV,
             Caps = channelData.Caps,
             Floor = channelData.Floor,

+ 24 - 33
MinicsConsole/Helper/RawDataFilter/Mini8Provider.cs

@@ -1,38 +1,34 @@
 namespace MinicsConsole.Helper.RawDataFilter;
 
-public class Mini8Provider : IMini8Provider, IMini8DataFilter, IDisposable
+public class Mini8Provider : IMini8Provider, IMini8DataFilter
 {
     public Mini8Provider(byte mini8Index, ILog log, BasicInfo basicInfo, IDictionary<byte, ChannelData> channels, Mini8DataDispatcher dataDispatcher)
     {
-        _log = log;
-        _channels = channels;
-        _mini8Index = mini8Index;
-        _dataDispatcher = dataDispatcher;
+        this._log = log;
+        this._channels = channels;
+        this._mini8Index = mini8Index;
+        this._dataDispatcher = dataDispatcher;
+        ChannelDataBaseHelper dataBaseHelper = new(mini8Index, log);
 
-        _Mini8DataQueue = new();
-        _DataBaseHelper = new(mini8Index, log);
-        _ApplyAutoTurnLayer = new(mini8Index, log);
-        _DataRecorderLayer = new(mini8Index, log, dataDispatcher);
-        _AlarmLayer = new(mini8Index, log, basicInfo, dataDispatcher)
-        {
-            DataBaseHelper = _DataBaseHelper
-        };
-        _DataRecorderLayer.DataBaseHelper = _DataBaseHelper;
-        _ = (IMini8DataFilter)this >> _Mini8DataQueue >> _DataRecorderLayer >> _ApplyAutoTurnLayer >> _AlarmLayer;
+        Mini8DataQueue mini8DataQueue = new();
+        AutoApplyAutoTurnLayer applyAutoTurn = new(mini8Index, log);
+        Mini8DataRecorderLayer dataRecorder = new(mini8Index, log, dataDispatcher) { DataBaseHelper = dataBaseHelper };
+        AlarmHelperLayer alarmHelper = new(mini8Index, log, basicInfo, dataDispatcher) { DataBaseHelper = dataBaseHelper };
+
+        _ = (IMini8DataFilter)this >> mini8DataQueue >> dataRecorder >> applyAutoTurn >> alarmHelper;
+
+        this._DataBaseHelper = dataBaseHelper;
+        this._ApplyAutoTurnLayer = applyAutoTurn;
     }
 
     private readonly ILog _log;
     private readonly byte _mini8Index;
     private readonly Mini8DataDispatcher _dataDispatcher;
-    private readonly IDictionary<byte, ChannelData> _channels;
-
     private readonly ChannelDataBaseHelper _DataBaseHelper;
-
-    private readonly AlarmHelperLayer _AlarmLayer;
-    private readonly Mini8DataQueue _Mini8DataQueue;
-    private readonly Mini8DataRecorderLayer _DataRecorderLayer;
+    private readonly IDictionary<byte, ChannelData> _channels;
     private readonly AutoApplyAutoTurnLayer _ApplyAutoTurnLayer;
 
+
     public bool IsConnect { get; private set; } = false;
     public IDataSender? NextSender { get; set; }
 
@@ -44,25 +40,20 @@ public class Mini8Provider : IMini8Provider, IMini8DataFilter, IDisposable
         if (!_channels.TryGetValue(channel, out ChannelData? channelData) || channelData is null)
             return;
 
-        NextSender?.Send(mini8Output, channelData, default);
+        this.NextSender?.Send(mini8Output, channelData, default);
     }
 
     void IMini8ConnectNotify.OnConnected(string IP, int port)
     {
-        IsConnect = true;
-        _log.Info($"{IP}:{port} Connected");
-        _dataDispatcher.Mini8Connect(_mini8Index);
+        this.IsConnect = true;
+        this._log.Info($"{IP}:{port} Connected");
+        this._dataDispatcher.Mini8Connect(_mini8Index);
     }
 
     void IMini8ConnectNotify.OnDisconnected(string IP, int port)
     {
-        IsConnect = false;
-        _log.Warning($"{IP}:{port} Disconnected");
-        _dataDispatcher.Mini8Disconnect(_mini8Index);
-    }
-
-    public void Dispose()
-    {
-        _Mini8DataQueue?.Dispose();
+        this.IsConnect = false;
+        this._log.Warning($"{IP}:{port} Disconnected");
+        this._dataDispatcher.Mini8Disconnect(_mini8Index);
     }
 }

+ 6 - 2
MinicsUI/ViewModels/LoadingViewModel.cs

@@ -4,17 +4,19 @@ internal partial class LoadingViewModel : ObservableObject
 {
     public LoadingViewModel(IEventAggregator eventAggregator,
         LanguageLoader languageLoader,
-        HubSender connector)
+        HubSender connector, UserInformation userInfo)
     {
         this.languageLoader = languageLoader;
         this.eventAggregator = eventAggregator;
         this.connector = connector;
+        this.userInformation = userInfo;
         Task.Factory.StartNew(Init);
     }
 
     private readonly IEventAggregator eventAggregator;
     private readonly LanguageLoader languageLoader;
     private readonly HubSender connector;
+    private readonly UserInformation userInformation;
 
     private async void Init()
     {
@@ -53,7 +55,9 @@ internal partial class LoadingViewModel : ObservableObject
         UpdateProgerssBar(100, "Loading settings");
         Thread.Sleep(500);
 
-        eventAggregator.GetEvent<WindowSwitch>().Page = Pages.Login;
+        this.userInformation.UserName = UserAuthority.Engineer.ToString();
+        this.userInformation.Authority = UserAuthority.Engineer;
+        eventAggregator.GetEvent<WindowSwitch>().Page = Pages.MainWindow;
         eventAggregator.GetEvent<WindowSwitch>().Publish();
     }
 

+ 6 - 6
MinicsUI/Views/Status.xaml

@@ -119,7 +119,7 @@
                         <!--<Button  Style="{StaticResource FunctionButton}" Command="{Binding LanguageOperationCommand}">
                             <Image Source="{StaticResource Language}" Width="22" VerticalAlignment="Center"/>
                         </Button>-->
-                        <Popup IsOpen="{Binding PopLanguage}" StaysOpen="False" AllowsTransparency="True">
+                        <!--<Popup IsOpen="{Binding PopLanguage}" StaysOpen="False" AllowsTransparency="True">
                             <Border BorderBrush="{StaticResource DarkBorderColor}" BorderThickness="2" Background="{StaticResource BackgroundDarkColor}" CornerRadius="8">
                                 <ItemsControl ItemsSource="{Binding Language.Languages}" Margin="8">
                                     <ItemsControl.ItemTemplate>
@@ -133,17 +133,17 @@
                                     </ItemsControl.ItemTemplate>
                                 </ItemsControl>
                             </Border>
-                        </Popup>
+                        </Popup>-->
 
-                        <Button Grid.Column="2" Style="{StaticResource FunctionButton}" Command="{Binding UserOperationCommand}">
+                        <!--<Button Grid.Column="2" Style="{StaticResource FunctionButton}" Command="{Binding UserOperationCommand}">
                             <StackPanel Orientation="Horizontal">
                                 <Image Source="{StaticResource Icon_User}" Height="20"/>
                                 <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource TextColor}" Margin="4,0,0,0" Text="{Binding User.UserName}"/>
                             </StackPanel>
-                        </Button>
-                        <Popup Width="auto" Height="auto" PopupAnimation="Slide" IsOpen="{Binding PopUser}"  StaysOpen="False" AllowsTransparency="True" Placement="Bottom">
+                        </Button>-->
+                        <!--<Popup Width="auto" Height="auto" PopupAnimation="Slide" IsOpen="{Binding PopUser}"  StaysOpen="False" AllowsTransparency="True" Placement="Bottom">
                             <controls:UserInfo SwitchUserCommand="{Binding SwitchUserCommand}" User="{Binding User}"/>
-                        </Popup>
+                        </Popup>-->
 
                         <Button Grid.Column="4" Style="{StaticResource FunctionButton}" Command="{Binding ExitCommand}">
                             <StackPanel Orientation="Horizontal">