Ver código fonte

IoDevice IoMagnet Add

hecl 1 ano atrás
pai
commit
0b8a98a845

+ 1 - 0
Venus/Framework/Common/Common.csproj

@@ -191,6 +191,7 @@
     <Compile Include="CommonData\DeviceData\AITHighTemperatureHeaterData.cs" />
     <Compile Include="CommonData\DeviceData\AITHVData.cs" />
     <Compile Include="CommonData\DeviceData\AITLidData.cs" />
+    <Compile Include="CommonData\DeviceData\AITMagnetData.cs" />
     <Compile Include="CommonData\DeviceData\AITMfcData.cs" />
     <Compile Include="CommonData\DeviceData\AITPendulumValveData.cs" />
     <Compile Include="CommonData\DeviceData\AITPressureControlData.cs" />

+ 68 - 0
Venus/Framework/Common/CommonData/DeviceData/AITMagnetData.cs

@@ -0,0 +1,68 @@
+using Aitex.Core.Common.DeviceData;
+using MECF.Framework.Common.CommonData;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MECF.Framework.Common.CommonData.DeviceData
+{
+    [DataContract]
+    [Serializable]
+    public class AITMagnetData
+    {
+
+        [DataMember]
+        public float Magnet1UFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float Magnet1VFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float Magnet1WFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float Magnet2UFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float Magnet2VFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float Magnet2WFeedBack
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public bool IsMagnetOn
+        {
+            get;
+            set;
+        }
+        [DataMember]
+        public float MagnetIntensity
+        {
+            get;
+            set;
+        }
+    }
+}
+
+

+ 1 - 1
Venus/Framework/Common/DataCenter/IQueryDataService.cs

@@ -63,7 +63,7 @@ namespace MECF.Framework.Common.DataCenter
 	[ServiceKnownType(typeof(AITRfMatchData))]
 
     [ServiceKnownType(typeof(AITHVData))]
-
+    [ServiceKnownType(typeof(AITMagnetData))]
 
     [ServiceKnownType(typeof(FlowMeterAlarmItem))]
 

+ 1 - 0
Venus/Venus_Core/EventDefine.cs

@@ -101,5 +101,6 @@ namespace Aitex.Core.RT.Log{
 		WARN_LL = 6002,
 		ERR_FA = 6003,
 		WARN_FA = 6004,
+		INFO_DEVICE_IO_MAGNET = 6005,
 	}
 }

+ 41 - 4
Venus/Venus_MainPages/ViewModels/OverVenusDEViewModel.cs

@@ -6,7 +6,6 @@ using System.Linq;
 using System.Text;
 using System.Windows;
 using System.Threading.Tasks;
-using static Venus_Themes.UserControls.EFEM;
 using Venus_Core;
 using OpenSEMI.ClientBase;
 using Venus_MainPages.Unity;
@@ -92,13 +91,14 @@ namespace Venus_MainPages.ViewModels
         private bool m_Valve12Visible;
         private bool m_Valve11Visible;
         private float m_SRFFwdPowerSetpoint;
+        private float m_MagnetSetpoint;
         private float m_BRFFwdPowerSetpoint;
 
         private float m_SRFMatchC1;
         private float m_SRFMatchC2;
         private float m_BRFMatchC1;
         private float m_BRFMatchC2;
-
+        private float m_MagnetIntensity;
         private double m_MFC1SetPoint;
         private double m_MFC2SetPoint;
         private double m_MFC3SetPoint;
@@ -134,6 +134,7 @@ namespace Venus_MainPages.ViewModels
         private AITMfcData m_MFCN2Data;
 
         private AITHeaterData m_ValveHeaterData;
+        private AITMagnetData m_MagnetData;
         private AITHeaterData m_ForelineHeaterData;
         private AITHeaterData m_WallHeaterData;
 
@@ -675,6 +676,11 @@ namespace Venus_MainPages.ViewModels
             get { return m_ValveHeaterData; }
             set { SetProperty(ref m_ValveHeaterData, value); }
         }
+        public AITMagnetData MagnetData
+        {
+            get { return m_MagnetData; }
+            set { SetProperty(ref m_MagnetData, value); }
+        }
         public AITHeaterData ForelineHeaterData
         {
             get { return m_ForelineHeaterData; }
@@ -981,6 +987,11 @@ namespace Venus_MainPages.ViewModels
             get { return m_BRFFwdPowerSetpoint; }
             set { SetProperty(ref m_BRFFwdPowerSetpoint, value); }
         }
+        public float MagnetSetpoint
+        {
+            get { return m_MagnetSetpoint; }
+            set { SetProperty(ref m_MagnetSetpoint, value); }
+        }
         public int ESCVoltage
         {
             get { return m_ESCVoltage; }
@@ -1003,6 +1014,11 @@ namespace Venus_MainPages.ViewModels
             get { return m_BRFMatchC1; }
             set { SetProperty(ref m_BRFMatchC1, value); }
         }
+        public float MagnetIntensity
+        {
+            get { return m_MagnetIntensity; }
+            set { SetProperty(ref m_MagnetIntensity, value); }
+        }
         public float BRFMatchC2
         {
             get { return m_BRFMatchC2; }
@@ -1134,6 +1150,11 @@ namespace Venus_MainPages.ViewModels
         public DelegateCommand SetBRfCommand =>
             _SetBRfCommand ?? (_SetBRfCommand = new DelegateCommand(OnSetBRf));
 
+
+        private DelegateCommand _SetMagnetCommand;
+        public DelegateCommand SetMagnetCommand =>
+            _SetMagnetCommand ?? (_SetMagnetCommand = new DelegateCommand(OnSetMagnet));
+
         private DelegateCommand _OpenButterflyValveViewCommand;
         public DelegateCommand OpenButterflyValveViewCommand =>
             _OpenButterflyValveViewCommand ?? (_OpenButterflyValveViewCommand = new DelegateCommand(OnOpenButterflyValveView));
@@ -1484,6 +1505,21 @@ namespace Venus_MainPages.ViewModels
                 }
             }
         }
+        private async void OnSetMagnet()
+        {
+
+            if (MagnetData.IsMagnetOn == true)
+            {
+                InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetMagnet", MagnetIntensity, false);
+            }
+            else
+            {
+                if (true)
+                {
+                    InvokeClient.Instance.Service.DoOperation($"{ModuleName}.SetMagnet", MagnetIntensity, true);
+                }
+            }
+        }
 
         private void OnPMAbort()
         {
@@ -1779,6 +1815,7 @@ namespace Venus_MainPages.ViewModels
                 SecondPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, $"{ModuleName}.ValveSecondPurge.IsOpen");
 
                 ValveHeaterData = (AITHeaterData)RtDataValues[$"{ModuleName}.ValveHeater.DeviceData"];
+                MagnetData= CommonFunction.GetValue<AITMagnetData>(RtDataValues, $"{ModuleName}.AIoMagnet.DeviceData");
                 ForelineHeaterData = (AITHeaterData)RtDataValues[$"{ModuleName}.ForelineHeater.DeviceData"];
                 //WallHeaterData = (AITHeaterData)RtDataValues[$"{ModuleName}.WallHeater.DeviceData"];
                 MainPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, $"{ModuleName}.ValveMainPurge.IsOpen");
@@ -1957,8 +1994,8 @@ namespace Venus_MainPages.ViewModels
             m_RtDataKeys.Add($"{ModuleName}.{VenusDevice.BiasMatch}.C2");
 
             m_RtDataKeys.Add($"{ModuleName}.{VenusDevice.PendulumValve}.DeviceData");
-            m_RtDataKeys.Add($"{ModuleName}.{VenusDevice.ESCHV}.DeviceData");
-
+            m_RtDataKeys.Add($"{ModuleName}.{VenusDevice.ESCHV}.DeviceData");          
+            m_RtDataKeys.Add($"{ModuleName}.AIoMagnet.DeviceData");
             m_RtDataKeys.Add($"{ModuleName}.TurboPumpRotationalSpeed");
 
             m_RtDataKeys.Add($"{ModuleName}.GetPVPosition");

+ 14 - 12
Venus/Venus_MainPages/Views/OverVenusDEView.xaml

@@ -183,8 +183,8 @@
                 <ColumnDefinition Width="Auto"/>
             </Grid.ColumnDefinitions>
 
-            <TextBlock Text="Bias RF Fan"    Margin="5,0,5,0" Grid.Column="0" FontSize="15"  HorizontalAlignment="Center" VerticalAlignment="Center" />
-            <Ellipse                     Grid.Column="1" Width="16" Height="16"  Fill="{Binding BiasRFFanInterlock,Converter={StaticResource boolToColor4}}"   Stroke="Silver"  StrokeThickness="2"></Ellipse>
+            <!--<TextBlock Text="Bias RF Fan"    Margin="5,0,5,0" Grid.Column="0" FontSize="15"  HorizontalAlignment="Center" VerticalAlignment="Center" />
+            <Ellipse                     Grid.Column="1" Width="16" Height="16"  Fill="{Binding BiasRFFanInterlock,Converter={StaticResource boolToColor4}}"   Stroke="Silver"  StrokeThickness="2"></Ellipse>-->
 
             <TextBlock Text="Water Leak"   Margin="15,0,5,0"  Grid.Column="2" FontSize="15"  HorizontalAlignment="Center" VerticalAlignment="Center" />
             <Ellipse                     Grid.Column="3" Width="16" Height="16"  Fill="{Binding IsWLK,Converter={StaticResource boolToColor4}}"   Stroke="Silver" StrokeThickness="2"></Ellipse>
@@ -1655,10 +1655,12 @@
             <!--<TextBlock Grid.Row="10" Grid.Column="2" Width="Auto" Height="Auto" Text="0.0"  Background="#E8E8E8" TextBlock.TextAlignment="Center" VerticalAlignment="Center" Block.TextAlignment="Center"/>-->
 
         </Grid>
+        <Ellipse Width="20" Height="20" Fill="{Binding BRFData.IsRfOn,Converter={StaticResource boolToColor}}"  Canvas.Left="500" Canvas.Top="514" Stroke="Silver" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Top"/>
+        <Button Height="20" Width="100" Content="BRF ON/OFF" Canvas.Left="530" Canvas.Top="514" Command="{Binding SetBRfCommand}"  Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" HorizontalAlignment="Center" VerticalAlignment="Top"/>
         <!--<Ellipse Width="20" Height="20" Fill="{Binding SRFData.IsRfOn,Converter={StaticResource boolToColor}}"  Canvas.Left="500" Canvas.Top="375" Stroke="Silver" StrokeThickness="2"/>
         <Button Height="20" Width="100" Content="SRF ON/OFF" Canvas.Left="530" Canvas.Top="375" Command="{Binding SetSRfCommand}"  Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}"/>-->
-        <Ellipse Width="20" Height="20" Fill="{Binding BRFData.IsRfOn,Converter={StaticResource boolToColor}}"  Canvas.Left="500" Canvas.Top="508" Stroke="Silver" StrokeThickness="2"/>
-        <Button Height="20" Width="100" Content="BRF ON/OFF" Canvas.Left="530" Canvas.Top="508" Command="{Binding SetBRfCommand}"  Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
+        <Ellipse Width="20" Height="20" Fill="{Binding MagnetData.IsMagnetOn,Converter={StaticResource boolToColor}}"  Canvas.Left="501" Canvas.Top="374" Stroke="Silver" StrokeThickness="2" HorizontalAlignment="Left" VerticalAlignment="Top"/>
+        <Button Height="20" Width="100" Content="Magnet ON/OFF" Canvas.Left="530" Canvas.Top="374" Command="{Binding SetMagnetCommand}"  Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" HorizontalAlignment="Center" VerticalAlignment="Top"/>
 
         <Ellipse Width="20" Height="20" Fill="{Binding ESCHVData.IsOn,Converter={StaticResource boolToColor}}" Canvas.Left="501" Canvas.Top="247" Stroke="Silver" StrokeThickness="2"/>
         <Button Height="20" Width="100" Content="HV ON/OFF" Canvas.Left="531" Canvas.Top="247" Command="{Binding HVCommand}" CommandParameter="True" Style="{StaticResource SysBtnStyle}"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}"/>
@@ -1700,7 +1702,7 @@
 
 
         </Grid>
-        <Grid Width="300" Height="101"  Background="#E8E8E8" unity:GridOptions.LineBrush="#afb4db" unity:GridOptions.ShowBorder="True" Canvas.Left="500" Canvas.Top="388" HorizontalAlignment="Center" VerticalAlignment="Top">
+        <Grid Width="300" Height="101"  Background="#E8E8E8" unity:GridOptions.LineBrush="#afb4db" unity:GridOptions.ShowBorder="True" Canvas.Left="500" Canvas.Top="400" HorizontalAlignment="Center" VerticalAlignment="Top">
             <Grid.RowDefinitions>
                 <RowDefinition/>
                 <RowDefinition/>
@@ -1716,22 +1718,22 @@
             <TextBlock Grid.Row="2" Text="Magnet1(A)" FontSize="15" VerticalAlignment="Bottom" HorizontalAlignment="Left" Padding="1,0,0,0" Margin="1,0,0,1"/>
             <TextBlock Grid.Row="3" Text="Magnet2(A)" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="1,0,0,0"/>
             <!--<TextBlock Grid.Row="4" Text="Wall Temp.(°C)" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="1,0,0,0"/>-->
-            <TextBox Grid.Row="1" Grid.Column="1" Width="Auto" Height="20" Text="0.0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderBrush="White"  BorderThickness="0" VerticalAlignment="Top" />
+            <TextBox Grid.Row="1" Grid.Column="1" Width="Auto" Height="25" Text="{Binding MagnetIntensity,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" BorderBrush="White"  BorderThickness="0" VerticalAlignment="Center" />
             <TextBlock Grid.Row="2"  Grid.Column="1" Width="Auto" Height="Auto" TextBlock.TextAlignment="Center" VerticalAlignment="Center" Block.TextAlignment="Center">
                 <TextBlock.Text>
                     <MultiBinding StringFormat="{}{0}/{1}/{2}">
-                        <Binding Path="ESCHVData.PositiveOutputCurrent"></Binding>
-                        <Binding Path="ESCHVData.NegativeOutputCurrent"></Binding>
-                        <Binding Path="ESCHVData.Leak"></Binding>
+                        <Binding Path="MagnetData.Magnet1UFeedBack"></Binding>
+                        <Binding Path="MagnetData.Magnet1VFeedBack"></Binding>
+                        <Binding Path="MagnetData.Magnet1WFeedBack"></Binding>
                     </MultiBinding>
                 </TextBlock.Text>
             </TextBlock>
             <TextBlock Grid.Row="3"  Grid.Column="1" Width="Auto" Height="Auto"   TextBlock.TextAlignment="Center" VerticalAlignment="Bottom" Block.TextAlignment="Center" Margin="0,0,0,4">
                 <TextBlock.Text>
                     <MultiBinding StringFormat="{}{0}/{1}/{2}">
-                        <Binding Path="ESCHVData.PositiveOutputCurrent"></Binding>
-                        <Binding Path="ESCHVData.NegativeOutputCurrent"></Binding>
-                        <Binding Path="ESCHVData.Leak"></Binding>
+                        <Binding Path="MagnetData.Magnet2UFeedBack"></Binding>
+                        <Binding Path="MagnetData.Magnet2VFeedBack"></Binding>
+                        <Binding Path="MagnetData.Magnet2WFeedBack"></Binding>
                     </MultiBinding>
                 </TextBlock.Text>
             </TextBlock>

+ 9 - 0
Venus/Venus_RT/Config/LogDefine.json

@@ -899,5 +899,14 @@
     "GlobalDescription_en": "{0}",
     "Module": "FA",
     "Note": "FA warning"
+  },
+  {
+    "Id": 6005,
+    "Level": "Info",
+    "LogEnum": "INFO_DEVICE_IO_MAGNET",
+    "GlobalDescription_zh": "IO Magnet Log: {0}",
+    "GlobalDescription_en": "IO Magnet Log: {0}",
+    "Module": "PM",
+    "Note": "IO Magnet Info"
   }
 ]

+ 24 - 0
Venus/Venus_RT/Config/PM/VenusDE/VenusDEDeviceModel.xml

@@ -295,4 +295,28 @@
 
               scSetPointLimit="WallHeaterSetPointLimit" />-->
   </IoHeaters>
+  <IoMagnets assembly="Venus_RT" classType="Venus_RT.Devices.IODevices.IoMagnet">
+    <IoMagnet id="AIoMagnet" display="Valve IoMagnet" schematicId="" unit="A"
+           doPowerOn="DO_Magnets_Contact_ON"
+           doMagnets1A="DO_Magnets_1A_coil_OFF"
+           doMagnets1B="DO_Magnets_1B_coil_OFF"
+           doMagnets2A="DO_Magnets_2A_coil_OFF"
+           doMagnets2B="DO_Magnets_2B_coil_OFF"
+           diMagnetsCoils="DI_Magnets_Coils_ON_FB"
+           diOTSwitch="DI_Magnets_Coils_OT_Switch_Alarm"
+           diDriver1="DI_Magnets_Driver1_Current_overload_alarm"
+           diDriver2="DI_Magnets_Driver2_Current_overload_alarm"
+           aiMagnet1U="AI_Magnet_Driver_1_Phase_U_Current"
+           aiMagnet1V="AI_Magnet Driver_1_Phase_V_Current"
+           aiMagnet1W="AI_Magnet Driver_1_Phase_W_Current"
+           aiMagnet2U="AI_Magnet_Driver_2_Phase_U_Current"
+           aiMagnet2V="AI_Magnet_Driver_2_Phase_V_Current"
+           aiMagnet2W="AI_Magnet_Driver_2_Phase_W_Current"
+           aoSetPoint="AO_Magnet_voltage_amplitude"
+           aoWaveSsquare="AO_Magnet_sine_wave_square_switch"
+           aoCurrentLimit="AO_Magnet_Driver_Current_Limit_Setpoint"
+           aoCycletime="AO_Magnet_cycle_time"
+           />
+  </IoMagnets>
+  
 </DeviceModelDefine>

+ 2 - 2
Venus/Venus_RT/Config/PM/VenusDE/VenusDEInterlock.xml

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Interlock xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
-  <Action do="DO_Magnets_ON" value="true" tip="Magnets ON" tip.zh-CN=""  tip.en-US="DO-80" >
+  <Action do="DO_Magnets_Contact_ON" value="true" tip="Magnets ON" tip.zh-CN=""  tip.en-US="DO-80" >
     <Limit di="DI_Lid_Closed"		value="true" tip="DI Lid Closed"			tip.zh-CN="" tip.en-US="DI-0" />
-    <Limit di="DI_Magnets_Coils_OT_Switch_Alarm"	value="true" tip="Magnets Coils OT Switch Alarm"	tip.zh-CN="" tip.en-US="DI-90" />
+    <Limit di="DI_Magnets_Coils_OT_Switch_Alarm"	value="false" tip="Magnets Coils OT Switch Alarm"	tip.zh-CN="" tip.en-US="DI-90" />
   </Action>
 
   <Action do="DO_Slit_Door_Open_Enable" value="true" tip="Magnets ON" tip.zh-CN=""  tip.en-US="DO-47" >

+ 1 - 1
Venus/Venus_RT/Config/PM/VenusDE/VenusDEIoDefine.xml

@@ -198,7 +198,7 @@
     <DO_ITEM Index="77" Name="" />
     <DO_ITEM Index="78" Name="" />
     <DO_ITEM Index="79" Name="" />
-    <DO_ITEM Index="80" Name="DO_Magnets_ON" Device="" Addr="w5.00"/>
+    <DO_ITEM Index="80" Name="DO_Magnets_Contact_ON"  Device="" Addr="w5.00"/>
     <DO_ITEM Index="81" Name="DO_Magnets_1A_coil_OFF" Device="" Addr="w5.01"/>
     <DO_ITEM Index="82" Name="DO_Magnets_1B_coil_OFF" Device="" Addr="w5.02" />
     <DO_ITEM Index="83" Name="DO_Magnets_2A_coil_OFF" Device="" Addr="w5.03" />

+ 9 - 8
Venus/Venus_RT/Config/System_VenusSE.sccfg

@@ -22,9 +22,10 @@
     <config default="10"  name="CheckResourceInterval" nameView="CheckResourceInterval" description="进程资源监视间隔,单位为分钟,0为不监视" max="60" min="0" paramter="" tag="" unit="min" type="Integer"/>
     <config default="1000"  name="DataCollectionInterval" nameView="DataCollectionInterval" description="插入数据时间间隔" max="2000" min="200" paramter="" tag="" unit="ms" type="Integer"/>
     <config default="false" name="IsEnableEthercat" nameView="Is Enable Ethercat" description="是否开启凌华Ethercat" max="" min="" paramter="" tag="" unit="" type="Bool" visible="false"/>
-	<config default="false" name="IsLogExcludeInfoType" nameView="Log Exclude Info Type" description="TopView Log排除info类型信息" max="" min="" paramter="" tag="" unit="" type="Bool" />
+	  <config default="false" name="IsLogExcludeInfoType" nameView="Log Exclude Info Type" description="TopView Log排除info类型信息" max="" min="" paramter="" tag="" unit="" type="Bool" />
     <configs name="SetUp" nameView="Set Up" visible="false">
-      <config default="true" name="EPDInstalled" nameView="Is EPD installed" description="EPD是否安装" max="" min="" paramter="" tag="" unit="" type="Bool" />
+    <config default="VenusSE" name="Name" nameView="Name" description="Name" tag="" unit="" type="String" />
+    <config default="true" name="EPDInstalled" nameView="Is EPD installed" description="EPD是否安装" max="" min="" paramter="" tag="" unit="" type="Bool" />
     </configs>
 
     <configs name="EndPoint" nameView="EndPoint" visible="false">
@@ -510,12 +511,12 @@
     <configs name="Magnet" nameView="Magnet" visible="true">
       <config default="1" name="Magnetwareform" nameView="Magnet wareform" description="厂商, 0:SIN,1:Squre,2:Single" max="2" min="0" paramter="" tag="" unit="" type="Integer" visible="true"/>
       <config default="0.25" name="MagentFieldRatio" nameView="Magent Field Ratio" description="" max="1" min="0" paramter="" tag="" unit="" type="Integer" visible="true"/>
-      <config default="4s" name="Magnetcycleperiod" nameView="Magnet cycle period" description="serial port name of pump" max="10" min="0" paramter="" tag="" unit="s" type="String" visible="true"/>
-      <config default="50" name="Magnet 1A output full scale" nameView="Magnet 1A output full scale" description="" max="100" min="50" paramter="" tag="" unit="gs" type="Double" visible="true"/>
-      <config default="50" name="Magnet 1B output full scale" nameView="Magnet 1B output full scale" description="" max="100" min="0" paramter="" tag="" unit="gs" type="Integer" visible="true" />
-      <config default="50" name="Magnet 2A output full scale" nameView="Magnet 2A output full scale" description="" max="100" min="0" paramter="" tag="" unit="gs" type="Integer" visible="true" />
-      <config default="50" name="Magnet 2B output full scale" nameView="Magnet 2B output full scale" description="" max="100" min="0" paramter="" tag="" unit="gs" type="Integer" visible="true" />
-      <config default="3" name="Min Magnet Coil current" nameView="Min Magnet Coil current" description="" max="100" min="0" paramter="" tag="" unit="A" type="Integer" visible="true" />
+      <config default="4" name="Magnetcycleperiod" nameView="Magnet cycle period" description="serial port name of pump" max="10" min="0" paramter="" tag="" unit="s" type="String" visible="true"/>
+      <config default="50" name="Magnet_1A_output_full_scale" nameView="Magnet 1A output full scale" description="" max="100" min="50" paramter="" tag="" unit="gs" type="Double" visible="true"/>
+      <config default="50" name="Magnet_1B_output_full_scale" nameView="Magnet 1B output full scale" description="" max="100" min="50" paramter="" tag="" unit="gs" type="Integer" visible="true" />
+      <config default="50" name="Magnet_2A_output_full_scale" nameView="Magnet 2A output full scale" description="" max="100" min="50" paramter="" tag="" unit="gs" type="Integer" visible="true" />
+      <config default="50" name="Magnet_2B_output_full_scale" nameView="Magnet 2B output full scale" description="" max="100" min="50" paramter="" tag="" unit="gs" type="Integer" visible="true" />
+      <config default="3" name="Min_Magnet_Coil_Current" nameView="Min Magnet Coil current" description="" max="100" min="0" paramter="" tag="" unit="A" type="Integer" visible="true" />
     </configs>
     <configs name="Rf" nameView="Source RF"  visible="false">
       <config default="1" name="MFG" nameView="MFG" description="厂商, 1:AdTec; 2:Comet" max="10" min="0" paramter="" tag="" unit="" type="Integer" />

+ 218 - 0
Venus/Venus_RT/Devices/IODevices/IoMagnet.cs

@@ -0,0 +1,218 @@
+using Aitex.Core.Common.DeviceData;
+using Aitex.Core.RT.DataCenter;
+using Aitex.Core.RT.Device;
+using Aitex.Core.RT.IOCore;
+using Aitex.Core.RT.Log;
+using Aitex.Core.RT.SCCore;
+using Aitex.Core.RT.Tolerance;
+using Aitex.Core.UI.View.Common;
+using Aitex.Core.Util;
+using MECF.Framework.Common.CommonData.DeviceData;
+using MECF.Framework.Common.Equipment;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using Venus_Core;
+
+namespace Venus_RT.Devices.IODevices
+{
+    public class IoMagnet : BaseDevice, IDevice
+    {
+
+        public enum MagnetStatus
+        {
+            Unknown,
+            OFF,
+            ON,
+            ERROR
+        }
+        public IoMagnet(string module, XmlElement node, string ioModule = "") 
+        {
+            base.Module = module;
+            Name = "AIoMagnet";
+            //base.Name = node.GetAttribute("id");
+            base.Display = node.GetAttribute("display");
+            base.DeviceID = node.GetAttribute("schematicId");
+            this.Status = MagnetStatus.Unknown;
+            _aiMagnet1U = ParseAiNode("aiMagnet1U", node, ioModule);
+            _aiMagnet1V = ParseAiNode("aiMagnet1V", node, ioModule);
+            _aiMagnet1W = ParseAiNode("aiMagnet1W", node, ioModule);
+            _aiMagnet2V = ParseAiNode("aiMagnet2V", node, ioModule);
+            _aiMagnet2U = ParseAiNode("aiMagnet2U", node, ioModule);
+            _aiMagnet2W = ParseAiNode("aiMagnet2W", node, ioModule);
+            _doMagnetOn = ParseDoNode("doPowerOn", node, ioModule);
+            _aoMagnetintensity= ParseAoNode("aoSetPoint", node, ioModule);
+            _aoMagnetWaveForm = ParseAoNode("aoWaveSsquare", node, ioModule);
+           // _aoMagnetFieldRadio = ParseAoNode("aoSetPoint", node, ioModule);
+            _aoMagnetCycle = ParseAoNode("aoCycletime", node, ioModule);
+            _aoMinMagnet = ParseAoNode("aoCurrentLimit", node, ioModule);
+
+        }
+        private SCConfigItem _scMagnetWaveForm;
+        private SCConfigItem _scMagnetFieldRadio;
+        private SCConfigItem _scMagnetCycle;
+        private SCConfigItem _scMinMagnet;
+        public MagnetStatus Status { get; set; }
+        private readonly AIAccessor _aiMagnet1U;    
+        private readonly AIAccessor _aiMagnet1V;
+        private readonly AIAccessor _aiMagnet1W;
+        private readonly AIAccessor _aiMagnet2U;
+        private readonly AIAccessor _aiMagnet2V;
+        private readonly AIAccessor _aiMagnet2W;
+        private readonly DOAccessor _doMagnetOn;
+        private readonly AOAccessor _aoMagnetintensity;
+        private readonly AOAccessor _aoMagnetWaveForm;
+        private readonly AOAccessor _aoMagnetFieldRadio;
+        private readonly AOAccessor _aoMagnetCycle;
+        private readonly AOAccessor _aoMinMagnet;
+        private ToleranceChecker _toleranceChecker = new ToleranceChecker();
+        public bool Initialize()
+        {
+            DATA.Subscribe($"{Module}.AIoMagnet.DeviceData", () => DeviceData, SubscriptionAttribute.FLAG.IgnoreSaveDB);
+            _SetRealFloat(_aoMagnetWaveForm, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetwareform").Value));          
+            _SetRealFloat(_aoMagnetCycle, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Magnetcycleperiod").Value));
+            _SetRealFloat(_aoMinMagnet, Convert.ToSingle(SC.GetConfigItem($"{Module}.Magnet.Min_Magnet_Coil_Current").Value));
+            return true;
+        }
+
+        public AITMagnetData DeviceData
+        {
+            get
+            {
+                AITMagnetData deviceData = new AITMagnetData
+                {
+                    Magnet1UFeedBack = Magent1U,
+                    Magnet1VFeedBack = Magent1V,
+                    Magnet1WFeedBack = Magent1W,
+                    Magnet2UFeedBack = Magent2U,
+                    Magnet2VFeedBack = Magent2V,
+                    Magnet2WFeedBack = Magent2W,
+                    IsMagnetOn = MagnetOn,
+                    MagnetIntensity= MagnetPowerIntensity
+
+                };
+
+                return deviceData;
+            }
+        }
+        public void Monitor()
+        {
+            //throw new NotImplementedException();
+        }
+        [Subscription(AITMfcDataPropertyName.FeedBack)]
+        public float Magent1V
+        {
+            get
+            {
+                if (_aiMagnet1V == null) return -1;
+                float real = _GetRealFloat(_aiMagnet1V);
+                return real;
+            }
+        }
+        public float Magent1U
+        {
+            get
+            {
+                if (_aiMagnet1U == null) return -1;
+                float real = _GetRealFloat(_aiMagnet1U);
+                return real;
+            }
+        }
+        public float Magent1W
+        {
+            get
+            {
+                if (_aiMagnet1W == null) return -1;
+                float real = _GetRealFloat(_aiMagnet1W);
+                return real;
+            }
+        }
+        public float Magent2U
+        {
+            get
+            {
+                if (_aiMagnet2U == null) return -1;
+                float real = _GetRealFloat(_aiMagnet2U);
+                return real;
+            }
+        }
+        public float Magent2V
+        {
+            get
+            {
+                if (_aiMagnet2V == null) return -1;
+                float real = _GetRealFloat(_aiMagnet2V);
+                return real;
+            }
+        }
+        public bool MagnetOn
+        {
+            get => Status == MagnetStatus.ON;
+            set { }
+        }
+        public bool SetMagnetOnOff(bool on, out string str)
+        {
+            str = "";
+            var _chamber = DEVICE.GetDevice<JetPMBase>(Module);
+            //if (on && !_chamber.CheckGeneratorAndHVInterlock(VenusDevice.Rf))
+            //{
+            //    return false;
+            //}
+
+            
+            if (!_doMagnetOn.SetValue(on, out string reason))
+            {
+                LOG.Write(eEvent.INFO_DEVICE_IO_MAGNET, ModuleHelper.Converter(Module), reason);
+                return false;
+            }
+
+            LOG.Write(eEvent.INFO_DEVICE_IO_MAGNET, ModuleHelper.Converter(Module), $"Set  Magnet Contact {(on ? "ON" : "OFF")}");
+            if (on)
+            {
+                Status = MagnetStatus.ON;
+            }
+            else
+            {
+                Status = MagnetStatus.OFF;  
+            }
+           
+            return true;
+        }
+        public bool SetMagnetPower(float val)
+        {
+            _SetRealFloat(_aoMagnetintensity, val);
+            return true;  
+        }
+        public float Magent2W
+        {
+            get
+            {
+                if (_aiMagnet2W == null) return -1;
+                float real = _GetRealFloat(_aiMagnet2W);
+                return real;
+            }
+        }
+        public float MagnetPowerIntensity
+        {
+            get
+            {
+                if (_aoMagnetintensity == null) return -1;
+                float real = _GetRealFloat(_aoMagnetintensity);
+                return real;
+            }
+        }
+        public void Reset()
+        {
+            _toleranceChecker.Reset(21);
+        }
+
+        public void Terminate()
+        {
+            //throw new NotImplementedException();
+        }
+    }
+}

+ 20 - 1
Venus/Venus_RT/Devices/JetPMBase.cs

@@ -293,6 +293,22 @@ namespace Venus_RT.Devices
                 return true;
             });
 
+            OP.Subscribe($"{Module}.SetMagnet", (cmd, args) =>
+            {
+
+                var ison = (bool)args[1];
+                if (ison == true)
+                {
+                    MagnetPowerOn(true);
+
+                    MagnetSetpower((float)args[0]);
+                }
+                else
+                {
+                    MagnetPowerOn(false);
+                }
+                return true;
+            });
 
             OP.Subscribe($"{Module}.SetSlitDoor", (cmd, args) =>
             {
@@ -551,7 +567,10 @@ namespace Venus_RT.Devices
 
         public virtual bool GeneratorBiasPowerOn(bool on)
         { return false; }
-
+        public virtual bool MagnetPowerOn(bool on)
+        { return false; }
+        public virtual bool MagnetSetpower(float val)
+        { return false; }
         public virtual bool GeneratorBiasSetpower(float val)
         { return false; }
 

+ 16 - 3
Venus/Venus_RT/Devices/JetVenusDEPM.cs

@@ -116,7 +116,7 @@ namespace Venus_RT.Devices
         private readonly IoGasStick[] _gasLines;
         private readonly IoGasStick _gasLineN2;
         private readonly IoBacksideHe _backsideHe;
-
+        private readonly IoMagnet _Magnet;
         private readonly IoMfc _heMfc;
 
         private readonly double _foreline_interlock_pressure = 750;
@@ -200,7 +200,7 @@ namespace Venus_RT.Devices
 
             _ForelineTC = DEVICE.GetDevice<IoHeater>($"{Module}.ForelineHeater");
             _WallTC = DEVICE.GetDevice<IoHeater>($"{Module}.WallHeater");
-
+            
 
             _CDAPressure = DEVICE.GetDevice<IoSensor>($"{Module}.SensorCDAPressureOk");
             _pressureController = DEVICE.GetDevice<IoPressureControl>($"{Module}.{VenusDevice.PressureControl}");
@@ -288,6 +288,7 @@ namespace Venus_RT.Devices
 
 
             _foreline_interlock_pressure = SC.GetValue<double>($"{Module}.ForelineInterlockPressure");
+            _Magnet = DEVICE.GetDevice<IoMagnet>($"{Module}.AIoMagnet");
             Valve2IO = new Dictionary<ValveType, IoValve>()
             {
                 { ValveType.PVN21, _PVN21Valve },
@@ -878,7 +879,12 @@ namespace Venus_RT.Devices
 
             return _GeneratorBias.SetPowerOnOff(on, out _);
         }
+        public override bool MagnetPowerOn(bool on)
+        {
+            if (_Magnet == null) return false;
 
+            return _Magnet.SetMagnetOnOff(on, out _);
+        }
         public override bool GeneratorBiasSetMatchMode(bool val)
         {
             if (_GeneratorBias == null) return false;
@@ -917,7 +923,14 @@ namespace Venus_RT.Devices
                 _Generator.SetPower((ushort)val);
             return true;
         }
+        public override bool MagnetSetpower(float val)
+        {
+            if (_Magnet == null) return false;
 
+            if (Math.Abs(val) > 0.01)
+                _Magnet.SetMagnetPower( val);
+            return true;
+        }
         public override float GetPVPosition()
         {
             return _pendulumValve.Position;
@@ -1188,7 +1201,7 @@ namespace Venus_RT.Devices
             }
             if (!SetLinerDoor(true, out reason))
             {
-                LOG.Write(eEvent.ERR_PM, Module, $"Set Slit Door Open failed:{reason}");
+                LOG.Write(eEvent.ERR_PM, Module, $"Set Liner Door Open failed:{reason}");
                 return false;
             }
             if (!SetLiftPin(MovementPosition.Up, out reason))

+ 1 - 1
Venus/Venus_RT/Devices/TruPlasmaRF.cs

@@ -30,8 +30,8 @@ namespace Venus_RT.Devices
         public override bool Initialize()
         {
             base.Initialize();
+            DATA.Subscribe($"{Module}.{Name}.DeviceData", () => DeviceData);
 
-           
             if (_serial.Open())
             {
                 _serial.OnDataChanged += SerialPortDataReceived;

+ 1 - 0
Venus/Venus_RT/Venus_RT.csproj

@@ -194,6 +194,7 @@
     <Compile Include="Devices\EPD\EPDClient.cs" />
     <Compile Include="Devices\ESC5HighVoltage.cs" />
     <Compile Include="Devices\FinsPlc.cs" />
+    <Compile Include="Devices\IODevices\IoMagnet.cs" />
     <Compile Include="Devices\IODevices\IoBacksideHe.cs" />
     <Compile Include="Devices\IODevices\IoCylinder.cs" />
     <Compile Include="Devices\IODevices\IoGasStick.cs" />

+ 1 - 1
Venus/Venus_Simulator/Config/_ioDefineVenusDE.xml

@@ -198,7 +198,7 @@
     <DO_ITEM Index="77" Name="" />
     <DO_ITEM Index="78" Name="" />
     <DO_ITEM Index="79" Name="" />
-    <DO_ITEM Index="80" Name="DO_Magnets_ON" Device="" Addr="w5.00"/>
+    <DO_ITEM Index="80" Name="DO_Magnets_Contact_ON" Device="" Addr="w5.00"/>
     <DO_ITEM Index="81" Name="DO_Magnets_1A_coil_OFF" Device="" Addr="w5.01"/>
     <DO_ITEM Index="82" Name="DO_Magnets_1B_coil_OFF" Device="" Addr="w5.02" />
     <DO_ITEM Index="83" Name="DO_Magnets_2A_coil_OFF" Device="" Addr="w5.03" />