|
@@ -236,8 +236,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
LockUtils.Wait( 200 );
|
|
LockUtils.Wait( 200 );
|
|
|
this.OnCharging?.Invoke();
|
|
this.OnCharging?.Invoke();
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
- this.OnChargingFull?.Invoke();
|
|
|
|
|
|
|
+ //else
|
|
|
|
|
+ // this.OnChargingFull?.Invoke();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -288,14 +288,17 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public double BatteryStateOfCharge
|
|
public double BatteryStateOfCharge
|
|
|
{
|
|
{
|
|
|
get { return this.batteryStateOfCharge; }
|
|
get { return this.batteryStateOfCharge; }
|
|
|
- set { this.SetField( ref this.batteryStateOfCharge, value ); }
|
|
|
|
|
|
|
+ set { if ( this.SetField( ref this.batteryStateOfCharge, value ) ) { this.BatteryChargeStateLED( value ); } }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
double batteryStateOfHealth;
|
|
double batteryStateOfHealth;
|
|
|
public double BatteryStateOfHealth
|
|
public double BatteryStateOfHealth
|
|
|
{
|
|
{
|
|
|
get { return this.batteryStateOfHealth; }
|
|
get { return this.batteryStateOfHealth; }
|
|
|
- set { this.SetField( ref this.batteryStateOfHealth, value ); }
|
|
|
|
|
|
|
+ set
|
|
|
|
|
+ {
|
|
|
|
|
+ if ( this.SetField( ref this.batteryStateOfHealth, value ) ) { }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
double batteryCapacity;
|
|
double batteryCapacity;
|
|
@@ -804,7 +807,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
|
|
this.DriveControlEventPublish( msg );
|
|
this.DriveControlEventPublish( msg );
|
|
|
}
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
|
|
#region Thread
|
|
#region Thread
|
|
|
void ThreadStart()
|
|
void ThreadStart()
|
|
@@ -940,7 +943,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
{
|
|
{
|
|
|
//Move 시작 시 충전 중이면 충전 중지 실행.
|
|
//Move 시작 시 충전 중이면 충전 중지 실행.
|
|
|
int result = 0;
|
|
int result = 0;
|
|
|
- if ( this.IsCharging() || this.VehicleStateProperty == eVehicleState.Charge || this.BatteryChargeState)
|
|
|
|
|
|
|
+ if ( this.CheckBatteryCharge() || this.VehicleStateProperty == eVehicleState.Charge || this.BatteryChargeState)
|
|
|
{
|
|
{
|
|
|
result = this.StopBatteryCharge();
|
|
result = this.StopBatteryCharge();
|
|
|
if ( result != 0 )
|
|
if ( result != 0 )
|
|
@@ -1392,6 +1395,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
|
|
this.PIOSensorOff();
|
|
this.PIOSensorOff();
|
|
|
|
|
|
|
|
|
|
+ this.OnChargingFull?.Invoke();
|
|
|
this.VehicleStateProperty = eVehicleState.Idle;
|
|
this.VehicleStateProperty = eVehicleState.Idle;
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1406,7 +1410,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_SAFETY" ) || this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_ERROR" ) )
|
|
if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_SAFETY" ) || this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_ERROR" ) )
|
|
|
{
|
|
{
|
|
|
this.ObstacleStateProperty = eObstacleState.Abnormal;
|
|
this.ObstacleStateProperty = eObstacleState.Abnormal;
|
|
|
- this.OccurVehicleAlarm( 9999 );
|
|
|
|
|
|
|
+ this.OccurVehicleAlarm( 42 );
|
|
|
}
|
|
}
|
|
|
else if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_STOP" ) )
|
|
else if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_STOP" ) )
|
|
|
{
|
|
{
|
|
@@ -1421,7 +1425,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.ObstacleStateProperty = eObstacleState.Normal;
|
|
this.ObstacleStateProperty = eObstacleState.Normal;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.refObjects.Drive.SetObstacleState( this.ObstacleStateProperty );
|
|
|
|
|
|
|
+ //this.refObjects.Drive.SetObstacleState( this.ObstacleStateProperty );
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -1458,12 +1462,21 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
/// 이걸 보고 판단 하자. 충전 단자 전진 상태임.
|
|
/// 이걸 보고 판단 하자. 충전 단자 전진 상태임.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
- public bool IsCharging()
|
|
|
|
|
|
|
+ public bool CheckBatteryCharge()
|
|
|
{
|
|
{
|
|
|
this.PIOSensorOn();
|
|
this.PIOSensorOn();
|
|
|
LockUtils.Wait( 500 );
|
|
LockUtils.Wait( 500 );
|
|
|
|
|
|
|
|
- var ret = this.refObjects.IO.IsOn( "OUT_PIO_RECEIVABLE", false ) && this.refObjects.IO.IsOn( "OUT_PIO_RECEIVE_RUN", false );
|
|
|
|
|
|
|
+ if ( this.BatteryChargeState || this.VehicleStateProperty == eVehicleState.Charge )
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //var ret = this.refObjects.IO.IsOn( "OUT_PIO_RECEIVABLE", false )
|
|
|
|
|
+ // && this.refObjects.IO.IsOn( "OUT_PIO_RECEIVE_RUN", false )
|
|
|
|
|
+ // && this.refObjects.IO.IsOn( "IN_PIO_SEND_RUN" );
|
|
|
|
|
+
|
|
|
|
|
+ var ret = this.refObjects.IO.IsOn( "IN_PIO_SEND_RUN" );
|
|
|
//this.PIOSensorOff();
|
|
//this.PIOSensorOff();
|
|
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
@@ -1531,7 +1544,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
|
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 40 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
{
|
|
{
|
|
|
loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
@@ -1559,7 +1572,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
|
|
|
loggerPIO.I( "[Vehicle] - 4 Receivable" );
|
|
loggerPIO.I( "[Vehicle] - 4 Receivable" );
|
|
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 10 * ConstUtils.ONE_SECOND, "IN_PIO_SENDABLE" ) )
|
|
|
|
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_PIO_SENDABLE" ) )
|
|
|
{
|
|
{
|
|
|
PIOClear();
|
|
PIOClear();
|
|
|
loggerPIO.E( "[Port] - 4 Ready Time Out" );
|
|
loggerPIO.E( "[Port] - 4 Ready Time Out" );
|
|
@@ -1703,7 +1716,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
|
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 40 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
{
|
|
{
|
|
|
loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
@@ -1721,7 +1734,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
PIOClear();
|
|
PIOClear();
|
|
|
this.OnPIOStart?.Invoke( false );
|
|
this.OnPIOStart?.Invoke( false );
|
|
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 5 * ConstUtils.ONE_SECOND, "IN_PIO_READY" ) )
|
|
|
|
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_PIO_READY" ) )
|
|
|
{
|
|
{
|
|
|
loggerPIO.E( "[Port] - 1 Ready not On" );
|
|
loggerPIO.E( "[Port] - 1 Ready not On" );
|
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
@@ -1770,7 +1783,19 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
if ( this.refObjects.Conveyor.IsDetectedLoadStart() || this.refObjects.Conveyor.IsDetectedCenter() ) //중간에 걸려 있다고 생각해서 알람 처리.
|
|
if ( this.refObjects.Conveyor.IsDetectedLoadStart() || this.refObjects.Conveyor.IsDetectedCenter() ) //중간에 걸려 있다고 생각해서 알람 처리.
|
|
|
return 12; //Conveyor Moving Timeout
|
|
return 12; //Conveyor Moving Timeout
|
|
|
else
|
|
else
|
|
|
- return 0;
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ if ( this.refObjects.Conveyor.IsDetectedCenter() ) //Time Out 후 아직 Tray 가 있으면 다시 Clamp Lock.
|
|
|
|
|
+ {
|
|
|
|
|
+ result = this.refObjects.Clamp.Unlock_Sync();
|
|
|
|
|
+ if ( result != 0 )
|
|
|
|
|
+ {
|
|
|
|
|
+ this.OccurVehicleAlarm( result );
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1812,6 +1837,37 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region Help Method
|
|
#region Help Method
|
|
|
|
|
+ void BatteryChargeStateLED(double percent )
|
|
|
|
|
+ {
|
|
|
|
|
+ if ( percent > 65 )
|
|
|
|
|
+ {
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_00", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_01", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_02", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_03", true );
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( percent > 50 )
|
|
|
|
|
+ {
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_00", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_01", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_02", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_03", false );
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ( percent > 40 )
|
|
|
|
|
+ {
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_00", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_01", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_02", false );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_03", false );
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_00", true );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_01", false );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_02", false );
|
|
|
|
|
+ this.refObjects.IO.WriteOutputIO( "OUT_BATTERY_LED_03", false );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 현재 Point 가 변경될때 장애물 감지 센서의 패턴을 변경한다.
|
|
/// 현재 Point 가 변경될때 장애물 감지 센서의 패턴을 변경한다.
|
|
@@ -1949,6 +2005,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
case eDataKind.Voltage:
|
|
case eDataKind.Voltage:
|
|
|
this.BatteryVoltage = (double)obj.Value;
|
|
this.BatteryVoltage = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.Current:
|
|
case eDataKind.Current:
|
|
|
this.BatteryCurrent = (double)obj.Value;
|
|
this.BatteryCurrent = (double)obj.Value;
|
|
|
if ( BatteryCurrent > 0 )
|
|
if ( BatteryCurrent > 0 )
|
|
@@ -1958,58 +2015,50 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
|
|
break;
|
|
break;
|
|
|
case eDataKind.BatteryState:
|
|
case eDataKind.BatteryState:
|
|
|
- if ( obj.Value == null )
|
|
|
|
|
- return;
|
|
|
|
|
this.BatteryState = (double)obj.Value;
|
|
this.BatteryState = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
- case eDataKind.ChargeCompleteTime:
|
|
|
|
|
- if ( obj.Value == null /*|| obj.Value <= 0 */)
|
|
|
|
|
- return;
|
|
|
|
|
|
|
|
|
|
|
|
+ case eDataKind.ChargeCompleteTime:
|
|
|
this.BatteryChargeTime = (double)obj.Value;
|
|
this.BatteryChargeTime = (double)obj.Value;
|
|
|
-
|
|
|
|
|
- //if ( this.BatteryChargeTime > 0 )
|
|
|
|
|
- //{
|
|
|
|
|
- // //this.OnCharging?.Invoke();
|
|
|
|
|
- // this.VehicleStateProperty = eVehicleState.Charge;
|
|
|
|
|
- //}
|
|
|
|
|
- //else
|
|
|
|
|
- // //this.OnChargingFull?.Invoke();
|
|
|
|
|
-
|
|
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.DisChargeCompleteTime:
|
|
case eDataKind.DisChargeCompleteTime:
|
|
|
- if ( obj.Value == null || obj.Value <= 0 )
|
|
|
|
|
- return;
|
|
|
|
|
this.BatteryDisChargeTime = (double)obj.Value;
|
|
this.BatteryDisChargeTime = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.SOC:
|
|
case eDataKind.SOC:
|
|
|
this.BatteryStateOfCharge = (double)obj.Value;
|
|
this.BatteryStateOfCharge = (double)obj.Value;
|
|
|
- if ( this.BatteryStateOfCharge >= 78 )
|
|
|
|
|
- {
|
|
|
|
|
- if ( this.autoManager.AutoModeStateProperty != eAutoModeState.Run )
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ //if ( this.BatteryStateOfCharge >= 78 )
|
|
|
|
|
+ //{
|
|
|
|
|
+ // if ( this.autoManager.AutoModeStateProperty != eAutoModeState.Run )
|
|
|
|
|
+ // return;
|
|
|
|
|
|
|
|
- if ( this.VehicleStateProperty == eVehicleState.Charge || this.IsCharging() || this.BatteryChargeState )
|
|
|
|
|
- {
|
|
|
|
|
- int result = ConstInt.EXECUTE_SUCCESS;
|
|
|
|
|
- result = this.StopBatteryCharge();
|
|
|
|
|
- if ( result != ConstInt.EXECUTE_SUCCESS )
|
|
|
|
|
- this.OccurVehicleAlarm( result );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if ( this.VehicleStateProperty == eVehicleState.Charge || this.CheckBatteryCharge() || this.BatteryChargeState )
|
|
|
|
|
+ // {
|
|
|
|
|
+ // int result = ConstInt.EXECUTE_SUCCESS;
|
|
|
|
|
+ // result = this.StopBatteryCharge();
|
|
|
|
|
+ // if ( result != ConstInt.EXECUTE_SUCCESS )
|
|
|
|
|
+ // this.OccurVehicleAlarm( result );
|
|
|
|
|
+ // }
|
|
|
|
|
+ //}
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.SOH:
|
|
case eDataKind.SOH:
|
|
|
this.BatteryStateOfHealth = (double)obj.Value;
|
|
this.BatteryStateOfHealth = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.ResidualCapacity:
|
|
case eDataKind.ResidualCapacity:
|
|
|
this.BatteryCapacity = (double)obj.Value;
|
|
this.BatteryCapacity = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.ResidualEnergy:
|
|
case eDataKind.ResidualEnergy:
|
|
|
this.BatteryEnergy = (double)obj.Value;
|
|
this.BatteryEnergy = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
case eDataKind.Temperature:
|
|
case eDataKind.Temperature:
|
|
|
this.BatteryTemperature = (double)obj.Value;
|
|
this.BatteryTemperature = (double)obj.Value;
|
|
|
break;
|
|
break;
|
|
|
|
|
+
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|