Browse Source

add srd2 beckhoff and safety power status

chenzk 5 days ago
parent
commit
39d520ecab

+ 49 - 1
PunkHPX8_MainPages/ViewModels/SystemSafetyViewModel.cs

@@ -32,6 +32,20 @@ namespace PunkHPX8_MainPages.ViewModels
         #region VPW
         private bool _isVpw1RotationOn;
         private bool _isVpw2RotationOn;
+        
+        private bool _isSrd1RotationOn;
+        private bool _isSrd2RotationOn;
+        
+        private bool _isPlatingCell1RotationOn;
+        private bool _isPlatingCell2RotationOn;
+        private bool _isPlatingCell3RotationOn;
+        private bool _isPlatingCell4RotationOn;
+        
+        private bool _isPlatingCell1_2VerticalOn;
+        private bool _isPlatingCell3_4VerticalOn;
+
+
+
         #endregion
 
         #endregion
@@ -41,7 +55,19 @@ namespace PunkHPX8_MainPages.ViewModels
         #region VPW
         public bool IsVpw1RotationOn { get { return _isVpw1RotationOn; } set { SetProperty(ref _isVpw1RotationOn, value); } }
         public bool IsVpw2RotationOn { get { return _isVpw2RotationOn; } set { SetProperty(ref _isVpw2RotationOn, value); } }
-    
+        
+        public bool IsSRD1RotationOn { get { return _isSrd1RotationOn; } set { SetProperty(ref _isSrd1RotationOn, value); } }
+        public bool IsSRD2RotationOn { get { return _isSrd2RotationOn; } set { SetProperty(ref _isSrd2RotationOn, value); } }
+        
+        public bool IsPlatingCell1RotationOn { get { return _isPlatingCell1RotationOn; } set { SetProperty(ref _isPlatingCell1RotationOn, value); } }
+        public bool IsPlatingCell2RotationOn { get { return _isPlatingCell2RotationOn; } set { SetProperty(ref _isPlatingCell2RotationOn, value); } }
+        public bool IsPlatingCell3RotationOn { get { return _isPlatingCell3RotationOn; } set { SetProperty(ref _isPlatingCell3RotationOn, value); } }
+        public bool IsPlatingCell4RotationOn { get { return _isPlatingCell4RotationOn; } set { SetProperty(ref _isPlatingCell4RotationOn, value); } }
+        
+        public bool IsPlatingCell1_2VerticalOn { get { return _isPlatingCell1_2VerticalOn; } set { SetProperty(ref _isPlatingCell1_2VerticalOn, value); } }
+        public bool IsPlatingCell3_4VerticalOn { get { return _isPlatingCell3_4VerticalOn; } set { SetProperty(ref _isPlatingCell3_4VerticalOn, value); } }
+
+
         #endregion
 
         public SafetyData CommonSafetyData { get { return _commonSafetyData; } set { SetProperty(ref _commonSafetyData, value); } }
@@ -110,6 +136,17 @@ namespace PunkHPX8_MainPages.ViewModels
 
             _rtDataKeys.Add($"VPW1.Rotation.{IS_SWITCH_ON}");
             _rtDataKeys.Add($"VPW2.Rotation.{IS_SWITCH_ON}");
+            
+            _rtDataKeys.Add($"SRD1.Rotation.{IS_SWITCH_ON}");
+            _rtDataKeys.Add($"SRD2.Rotation.{IS_SWITCH_ON}");
+            
+            _rtDataKeys.Add($"PlatingCell1_2.Vertical.{IS_SWITCH_ON}");
+            _rtDataKeys.Add($"PlatingCell3_4.Vertical.{IS_SWITCH_ON}");
+            
+            _rtDataKeys.Add($"PlatingCell1.Rotation.{IS_SWITCH_ON}");
+            _rtDataKeys.Add($"PlatingCell2.Rotation.{IS_SWITCH_ON}");
+            _rtDataKeys.Add($"PlatingCell3.Rotation.{IS_SWITCH_ON}");
+            _rtDataKeys.Add($"PlatingCell4.Rotation.{IS_SWITCH_ON}");
 
 
 
@@ -149,6 +186,17 @@ namespace PunkHPX8_MainPages.ViewModels
                     IsVpw1RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"VPW1.Rotation.{IS_SWITCH_ON}");
                     IsVpw2RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"VPW2.Rotation.{IS_SWITCH_ON}");
                     
+                    IsSRD1RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"SRD1.Rotation.{IS_SWITCH_ON}");
+                    IsSRD2RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"SRD2.Rotation.{IS_SWITCH_ON}");
+                    
+                    IsPlatingCell1RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell1.Rotation.{IS_SWITCH_ON}");
+                    IsPlatingCell2RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell2.Rotation.{IS_SWITCH_ON}");
+                    IsPlatingCell3RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell3.Rotation.{IS_SWITCH_ON}");
+                    IsPlatingCell4RotationOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell4.Rotation.{IS_SWITCH_ON}");
+
+                    IsPlatingCell1_2VerticalOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell1_2.Vertical.{IS_SWITCH_ON}");
+                    IsPlatingCell3_4VerticalOn = CommonFunction.GetValue<bool>(_rtDataValueDic, $"PlatingCell3_4.Vertical.{IS_SWITCH_ON}");
+                   
                     //判断电机Moving状态
                     JudgeMoving();
                 }

+ 8 - 8
PunkHPX8_MainPages/Views/SystemSafetyView.xaml

@@ -484,21 +484,21 @@
                     <Ellipse Grid.Row="2" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.VpwCell1RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="3" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsVpw2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="3" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.VpwCell2RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="4" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="4" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell1RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="4" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell1RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="5" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="5" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="5" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell2RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="6" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="6" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell3RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="6" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell3RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="7" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="7" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell4RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="7" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell4RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="8" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="8" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell1_2VerticalOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="8" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell12VerticalStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="9" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="9" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsPlatingCell3_4VerticalOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="9" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.PlatingCell34VerticalStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="10" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="10" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSRD1RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="10" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.Srd1RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
-                    <Ellipse Grid.Row="11" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSrd2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
+                    <Ellipse Grid.Row="11" Grid.Column="1"  Width="16" Height="16"  Fill="{Binding IsSRD2RotationOn,Converter={StaticResource boolToColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                     <Ellipse Grid.Row="11" Grid.Column="2"  Width="16" Height="16"  Fill="{Binding CommonSafetyData.Srd2RotationStoEdm,Converter={StaticResource boolToErrorColor}}" Stroke="Silver" HorizontalAlignment="Center"/>
                 </Grid>
             </GroupBox>

+ 73 - 1
PunkHPX8_RT/Config/Devices/Beckhoffcfg - plctask.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <BeckhoffCfg>
-	<Controller Name="MASTER" IPAddress="192.168.0.200.1.1" PortAddress="851">
+	<Controller Name="MASTER" IPAddress="10.4.6.75.1.1" PortAddress="851">
 
 		<!-- Need to have at least one input and one output before Axis stuff -->
 
@@ -690,6 +690,78 @@
 			<FeedforwardAcceleration>0</FeedforwardAcceleration>
 			<OffOnError>0</OffOnError>
 		</Axis>
+		<Axis Name="SRD2.Rotation" MotorType="Kollmorgen" COEAddress="192.168.0.14.4.1" COEPort="1016" DebugLogging="false">
+			<Input Address="MAIN.SRD2RotationStatusWord" Type="StatusWord" DataType="uint"/>
+			<Input Address="MAIN.SRD2RotationDigitalInputs" Type="DigitalInputs" DataType="udint"/>
+			<Input Address="MAIN.SRD2RotationMotorPosition" Type="MotorPosition" DataType="dint"/>
+			<Input Address="MAIN.SRD2RotationPositionError" Type="PositionError" DataType="dint"/>
+			<Input Address="MAIN.SRD2RotationActualVelocity" Type="ActualVelocity" DataType="dint"/>
+			<Input Address="MAIN.SRD2RotationActualTorque" Type="ActualTorque" DataType="int"/>
+			<!-- Input Address="MAIN.Loader1Rotation_DigitalOutputs" Type="DigitalOutputs" DataType="dint"/ -->
+			<Input Address="0x607D:01" Type="SoftwareLimitMinus" DataType="dint"/>
+			<Input Address="0x607D:02" Type="SoftwareLimitPlus" DataType="dint"/>
+			<Input Address="0x6098:00" Type="HomingMethod" DataType="byte"/>
+			<Input Address="0x607C:00" Type="HomeOffset" DataType="dint"/>
+			<Input Address="0x6099:01" Type="HomingVelocity" DataType="dint"/>
+			<Input Address="0x6099:02" Type="HomingVelocitySlow" DataType="dint"/>
+			<Input Address="0x609A:00" Type="HomingAccel" DataType="dint"/>
+			<Input Address="0x2403:00" Type="NegativeTorqueLimit" DataType="uint"/>
+			<Input Address="0x2402:00" Type="PositiveTorqueLimit" DataType="uint"/>
+			<Input Address="0x6085:00" Type="EStopDecel" DataType="udint"/>
+			<Input Address="0x2406:00" Type="EStopTorque" DataType="uint"/>
+			<Input Address="0x607F:00" Type="VelocityLimit" DataType="udint"/>
+			<Input Address="0x2522:00" Type="PositionWindow" DataType="udint"/>
+			<Input Address="0x2520:00" Type="FollowingErrorWindow" DataType="udint"/>
+			<Input Address="0x603F:00" Type="ErrorCode" DataType="uint"/>
+
+			<Output Address="MAIN.SRD2RotationControlWord" Type="ControlWord" DataType="uint"/>
+			<Output Address="MAIN.SRD2RotationModeOfOperation" Type="ModeOfOperation" DataType="byte"/>
+			<Output Address="MAIN.SRD2RotationTargetPosition" Type="TargetPosition" DataType="dint"/>
+			<Output Address="MAIN.SRD2RotationProfileVelocity" Type="ProfileVelocity" DataType="dint"/>
+			<Output Address="MAIN.SRD2RotationProfileAccel" Type="ProfileAccel" DataType="dint"/>
+			<Output Address="MAIN.SRD2RotationProfileDecel" Type="ProfileDecel" DataType="dint"/>
+			<!-- Output Address="MAIN.Loader1Rotation_DigitalOutputs" Type="DigitalOutputs" DataType="dint"/ -->
+			<Output Address="0x607D:01" Type="SoftwareLimitMinus" DataType="dint"/>
+			<Output Address="0x607D:02" Type="SoftwareLimitPlus" DataType="dint"/>
+			<Output Address="0x607C:00" Type="HomeOffset" DataType="dint"/>
+			<Output Address="0x6098:00" Type="HomingMethod" DataType="byte"/>
+			<Output Address="0x6099:01" Type="HomingVelocity" DataType="dint"/>
+			<Output Address="0x6099:02" Type="HomingVelocitySlow" DataType="dint"/>
+			<Output Address="0x609A:00" Type="HomingAccel" DataType="dint"/>
+			<Output Address="0x2403:00" Type="NegativeTorqueLimit" DataType="uint"/>
+			<Output Address="0x2402:00" Type="PositiveTorqueLimit" DataType="uint"/>
+			<MotorType>Servo</MotorType>
+			<MotorDriveDirection>0</MotorDriveDirection>
+			<EncoderFeedbackDirectionMValue>0</EncoderFeedbackDirectionMValue>
+			<EncoderFeedbackDirectionNValue>0</EncoderFeedbackDirectionNValue>
+			<ReverseLimitSwitchPolarity>0</ReverseLimitSwitchPolarity>
+			<ForwardLimitSwitchPolarity>0</ForwardLimitSwitchPolarity>
+			<HomeSwitchPolarity>0</HomeSwitchPolarity>
+			<HomingMethod>24</HomingMethod>
+			<HomeConfig>0</HomeConfig>
+			<HomingOffset>0</HomingOffset>
+			<HomingSpeedHomeSwitch>1500000</HomingSpeedHomeSwitch>
+			<HomingSpeedEncoderIndex>0</HomingSpeedEncoderIndex>
+			<HomingAccelDecel>10000000</HomingAccelDecel>
+			<HomingTimeOut>60000</HomingTimeOut>
+			<ProportionalGain>0</ProportionalGain>
+			<IntegralGain>0</IntegralGain>
+			<DerivativeGain>0</DerivativeGain>
+			<IntegralLimit>0</IntegralLimit>
+			<ErrorLimit>6766</ErrorLimit>
+			<VoltageOffset>0</VoltageOffset>
+			<!-- -193 degrees * 169161 = -32648073 -->
+			<ReverseSoftwareLimit>0</ReverseSoftwareLimit>
+			<!-- 13 degrees * 169161 = 2199093 -->
+			<ForwardSoftwareLimit>0</ForwardSoftwareLimit>
+			<Speed>360</Speed>
+			<Acceleration>1000</Acceleration>
+			<Deceleration>1000</Deceleration>
+			<Jerk>0</Jerk>
+			<FeedforwardVelocity>0</FeedforwardVelocity>
+			<FeedforwardAcceleration>0</FeedforwardAcceleration>
+			<OffOnError>0</OffOnError>
+		</Axis>
 		<Axis Name="PlatingCell1_2.Vertical" MotorType="Yaskawa" COEAddress="192.168.0.14.4.1" COEPort="1016" DebugLogging="false">
 			<Input Address="MAIN.PlatingCell1_2Vertical_StatusWord" Type="StatusWord" DataType="uint"/>
 			<Input Address="MAIN.PlatingCell1_2Vertical_DigitalInputs" Type="DigitalInputs" DataType="udint"/>