|
|
@@ -2,7 +2,6 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
-using System.Security.Cryptography.X509Certificates;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using FluentResults;
|
|
|
@@ -222,6 +221,27 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
public bool IsMoving { get => this.refObjects.Drive.IsDriveMoving(); }
|
|
|
|
|
|
+ private bool batteryChargeState;
|
|
|
+
|
|
|
+ public bool BatteryChargeState
|
|
|
+ {
|
|
|
+ get { return batteryChargeState; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if ( SetField( ref batteryChargeState, value ) )
|
|
|
+ {
|
|
|
+ if ( value )
|
|
|
+ {
|
|
|
+ this.OnChargingStart?.Invoke();
|
|
|
+ LockUtils.Wait( 200 );
|
|
|
+ this.OnCharging?.Invoke();
|
|
|
+ }
|
|
|
+ //else
|
|
|
+ // this.OnChargingFull?.Invoke();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#region Battery Property
|
|
|
|
|
|
double batteryVoltage;
|
|
|
@@ -268,14 +288,17 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public double 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;
|
|
|
public double BatteryStateOfHealth
|
|
|
{
|
|
|
get { return this.batteryStateOfHealth; }
|
|
|
- set { this.SetField( ref this.batteryStateOfHealth, value ); }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if ( this.SetField( ref this.batteryStateOfHealth, value ) ) { }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
double batteryCapacity;
|
|
|
@@ -373,6 +396,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
get { return this.rearTorque; }
|
|
|
set { SetField( ref this.rearTorque, value ); }
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region Event
|
|
|
@@ -783,7 +807,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
this.DriveControlEventPublish( msg );
|
|
|
}
|
|
|
- #endregion
|
|
|
+ #endregion
|
|
|
|
|
|
#region Thread
|
|
|
void ThreadStart()
|
|
|
@@ -869,6 +893,10 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.CurrentSubCommand = subCmd;
|
|
|
this.BatteryCharge( subCmd );
|
|
|
break;
|
|
|
+ case eSubCommandType.Cancel:
|
|
|
+ this.CurrentSubCommand = subCmd;
|
|
|
+ CancelCommand( subCmd );
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -885,6 +913,18 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
logger.D( "Vehicle - _ThSubCmdWorker Dispose" );
|
|
|
}
|
|
|
|
|
|
+ private void CancelCommand( SubCmd subCmd )
|
|
|
+ {
|
|
|
+ this.refObjects.Drive.CancelCommand( subCmd );
|
|
|
+
|
|
|
+ var cmd = sql.CommandDAL.GetById( subCmd.CmdID );
|
|
|
+ cmd.State = eCommandState.Complete;
|
|
|
+ sql.CommandDAL.Update( cmd );
|
|
|
+ sql.SubCmdDAL.Clean();
|
|
|
+
|
|
|
+ logger.D( $"[Cancel Command] {cmd.TargetID} / {cmd.Type}" );
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region Control Action Method
|
|
|
@@ -903,7 +943,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
{
|
|
|
//Move 시작 시 충전 중이면 충전 중지 실행.
|
|
|
int result = 0;
|
|
|
- if ( this.IsCharging() || this.VehicleStateProperty == eVehicleState.Charge )
|
|
|
+ if ( this.CheckBatteryCharge() || this.VehicleStateProperty == eVehicleState.Charge || this.BatteryChargeState)
|
|
|
{
|
|
|
result = this.StopBatteryCharge();
|
|
|
if ( result != 0 )
|
|
|
@@ -923,10 +963,12 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ sql.SubCmdDAL.Clean();
|
|
|
+
|
|
|
this.taskMoveCancel.Cancel();
|
|
|
this.taskMoveCancel.WaitAll();
|
|
|
|
|
|
- sql.SubCmdDAL.Clean();
|
|
|
+ logger.D( $"[Move Command Complete] {sub.TargetID}" );
|
|
|
}
|
|
|
|
|
|
int MoveTo( SubCmd sub )
|
|
|
@@ -982,7 +1024,6 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
if ( SwUtils.Gt( st, waitTime ) )
|
|
|
{
|
|
|
- //Todo: 이동시간 초과 시 동작들.
|
|
|
logger.D( "Wait4MoveDone Time Over" );
|
|
|
return 39;
|
|
|
}
|
|
|
@@ -1057,13 +1098,18 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.PIOSensorOff();
|
|
|
|
|
|
//Load, Unload 가 끝나면 메인 Command 를 완료 했다고 판단.
|
|
|
- var cmd = sql.CommandDAL.GetById( sub.CmdID );
|
|
|
- cmd.State = eCommandState.Complete;
|
|
|
- sql.CommandDAL.Update( cmd );
|
|
|
sql.SubCmdDAL.Clean();
|
|
|
+ var cmd = sql.CommandDAL.GetById( sub.CmdID );
|
|
|
+ if ( cmd != null )
|
|
|
+ {
|
|
|
+ cmd.State = eCommandState.Complete;
|
|
|
+ sql.CommandDAL.Update( cmd );
|
|
|
+ }
|
|
|
|
|
|
- LockUtils.Wait( 1000 );
|
|
|
- this.OnLoadComplete?.Invoke(); //일찍 주면 다음 명령을 500ms 안에 주는 현상 있음. 그러니까 천천히 주자
|
|
|
+ TimerUtils.Once( 1000, this.OnLoadComplete );
|
|
|
+
|
|
|
+ //LockUtils.Wait( 1000 );
|
|
|
+ //this.OnLoadComplete?.Invoke(); //일찍 주면 다음 명령을 500ms 안에 주는 현상 있음. 그러니까 천천히 주자
|
|
|
this.VehicleStateProperty = eVehicleState.Idle;
|
|
|
|
|
|
return true;
|
|
|
@@ -1107,13 +1153,18 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
this.PIOSensorOff();
|
|
|
|
|
|
- var cmd = sql.CommandDAL.GetById( sub.CmdID );
|
|
|
- cmd.State = eCommandState.Complete;
|
|
|
- sql.CommandDAL.Update( cmd );
|
|
|
sql.SubCmdDAL.Clean();
|
|
|
+ var cmd = sql.CommandDAL.GetById( sub.CmdID );
|
|
|
+ if ( cmd != null )
|
|
|
+ {
|
|
|
+ cmd.State = eCommandState.Complete;
|
|
|
+ sql.CommandDAL.Update( cmd );
|
|
|
+ }
|
|
|
+
|
|
|
+ TimerUtils.Once( 1000, this.OnUnloadComplete );
|
|
|
|
|
|
- LockUtils.Wait( 1000 );
|
|
|
- this.OnUnloadComplete?.Invoke(); //일찍 주면 다음 명령을 500ms 안에 주는 현상 있음. 그러니까 천천히 주자
|
|
|
+ //LockUtils.Wait( 1000 );
|
|
|
+ //this.OnUnloadComplete?.Invoke(); //일찍 주면 다음 명령을 500ms 안에 주는 현상 있음. 그러니까 천천히 주자
|
|
|
this.VehicleStateProperty = eVehicleState.Idle;
|
|
|
|
|
|
logger.D( $"[Unloading End]--------------------------------------" );
|
|
|
@@ -1128,10 +1179,14 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
if ( result != ConstInt.EXECUTE_SUCCESS )
|
|
|
this.OccurVehicleAlarm( result );
|
|
|
|
|
|
+ sql.SubCmdDAL.Clean();
|
|
|
+
|
|
|
var cmd = sql.CommandDAL.GetById( subCmd.CmdID );
|
|
|
+ if ( cmd == null )
|
|
|
+ return;
|
|
|
+
|
|
|
cmd.State = eCommandState.Complete;
|
|
|
sql.CommandDAL.Update( cmd );
|
|
|
- sql.SubCmdDAL.Clean();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1250,6 +1305,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
return 0;
|
|
|
#else
|
|
|
this.PIOSensorOn();
|
|
|
+ LockUtils.Wait( 500 );
|
|
|
|
|
|
var pioTimeout = Convert.ToInt32( sql.ConfigDal.GetById( ConstString.PIOTimeOut ).Value );
|
|
|
|
|
|
@@ -1267,7 +1323,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
|
|
|
loggerPIO.I( "[Vehicle] - 4 Receivable" );
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 20000, "IN_PIO_SEND_RUN" ) )
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 5000, "IN_PIO_SEND_RUN" ) )
|
|
|
{
|
|
|
PIOClear();
|
|
|
loggerPIO.E( "[Port] - 5 Sending Run Time Out" );
|
|
|
@@ -1326,7 +1382,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", true );
|
|
|
loggerPIO.I( "[Vehicle] Receive Complete On" );
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, 10000, "IN_PIO_SEND_COMPLITE" ) )
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 5000, "IN_PIO_SEND_COMPLITE" ) )
|
|
|
{
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", false );
|
|
|
loggerPIO.E( "[Port] IN_PIO_SEND_COMPLITE On Time Out" );
|
|
|
@@ -1339,6 +1395,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
this.PIOSensorOff();
|
|
|
|
|
|
+ this.OnChargingFull?.Invoke();
|
|
|
this.VehicleStateProperty = eVehicleState.Idle;
|
|
|
|
|
|
return 0;
|
|
|
@@ -1353,7 +1410,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_SAFETY" ) || this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_ERROR" ) )
|
|
|
{
|
|
|
this.ObstacleStateProperty = eObstacleState.Abnormal;
|
|
|
- this.OccurVehicleAlarm( 9999 );
|
|
|
+ this.OccurVehicleAlarm( 42 );
|
|
|
}
|
|
|
else if ( this.refObjects.IO.IsOff( "IN_OBSTRUCTION_DETECT_STOP" ) )
|
|
|
{
|
|
|
@@ -1368,7 +1425,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.ObstacleStateProperty = eObstacleState.Normal;
|
|
|
}
|
|
|
|
|
|
- this.refObjects.Drive.SetObstacleState( this.ObstacleStateProperty );
|
|
|
+ //this.refObjects.Drive.SetObstacleState( this.ObstacleStateProperty );
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
@@ -1405,7 +1462,25 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
/// 이걸 보고 판단 하자. 충전 단자 전진 상태임.
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public bool IsCharging() => this.refObjects.IO.IsOn( "IN_PIO_SEND_RUN" ) && this.refObjects.IO.IsOn( "IN_PIO_SENDABLE" );
|
|
|
+ public bool CheckBatteryCharge()
|
|
|
+ {
|
|
|
+ this.PIOSensorOn();
|
|
|
+ LockUtils.Wait( 500 );
|
|
|
+
|
|
|
+ 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();
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region Drive
|
|
|
@@ -1445,6 +1520,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
Thread.Sleep( 1000 );
|
|
|
this.OnLoadComplete?.Invoke();
|
|
|
#else
|
|
|
+ loggerPIO.I( $"Start Load PIO - [{targetName}]" );
|
|
|
+
|
|
|
this.PIOSensorOn();
|
|
|
LockUtils.Wait( 500 );
|
|
|
|
|
|
@@ -1461,8 +1538,26 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
if ( this.refObjects.Conveyor.IsInverterError() )
|
|
|
return 16;
|
|
|
|
|
|
- if ( !this.refObjects.Conveyor.IsLifterPositinCheck() )
|
|
|
- return 14;
|
|
|
+ if ( this.refObjects.Conveyor.IsDetectedCenter() )
|
|
|
+ {
|
|
|
+ this.OnFailReport?.Invoke( eFailCode.Load_VehicleHasCarrier );
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 40 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
+ {
|
|
|
+ loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ return 0; //14
|
|
|
+ }
|
|
|
+
|
|
|
+ //if ( !this.refObjects.Conveyor.IsLifterPositinCheck() )
|
|
|
+ //{
|
|
|
+ // loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
+ // this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ // return 0; //14
|
|
|
+ //}
|
|
|
|
|
|
//Todo: Sensor Setting 이 후 주석 풀기.
|
|
|
//if ( !this.IsLifterDuplication() )
|
|
|
@@ -1471,24 +1566,18 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
// return 0;
|
|
|
//}
|
|
|
|
|
|
- if ( this.refObjects.Conveyor.IsDetectedCenter() )
|
|
|
- {
|
|
|
- this.OnFailReport?.Invoke( eFailCode.Load_VehicleHasCarrier );
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
PIOClear();
|
|
|
- loggerPIO.I( $"Start Load PIO - [{targetName}]" );
|
|
|
this.OnPIOStart?.Invoke( true );
|
|
|
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
|
|
|
loggerPIO.I( "[Vehicle] - 4 Receivable" );
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_SENDABLE" ) )
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_PIO_SENDABLE" ) )
|
|
|
{
|
|
|
PIOClear();
|
|
|
loggerPIO.E( "[Port] - 4 Ready Time Out" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
return 0;
|
|
|
}
|
|
|
loggerPIO.E( "[Port] - 4 Ready On" );
|
|
|
@@ -1505,7 +1594,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.refObjects.Conveyor.OnOffConveyor( false, true );
|
|
|
PIOClear();
|
|
|
loggerPIO.E( "[Port] - 5 Sending Run Time Out" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
return 0;
|
|
|
}
|
|
|
loggerPIO.I( "[Port] - 5 Sending Run On" );
|
|
|
@@ -1521,7 +1611,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
PIOClear();
|
|
|
this.refObjects.Conveyor.OnOffConveyor( false, true );
|
|
|
loggerPIO.E( "[Vehicle] Conveyor Wait Time Out" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.LoadPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.LoadPIOInterlockTimeout );
|
|
|
|
|
|
if ( this.refObjects.Conveyor.IsDetectedLoadStart() ) // 감지가 시작 되었으면 이동중 Error 로 판단 설비를 정지 상태로
|
|
|
return 10; //Conveyor Moving Timeout
|
|
|
@@ -1601,6 +1692,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
Thread.Sleep( 1000 );
|
|
|
this.OnUnloadComplete?.Invoke();
|
|
|
#else
|
|
|
+ loggerPIO.E( $"Start Unload PIO -[{targetName}]" );
|
|
|
this.PIOSensorOn();
|
|
|
LockUtils.Wait( 500 );
|
|
|
|
|
|
@@ -1619,32 +1711,46 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
if ( !this.refObjects.Conveyor.IsDetectedCenter() )
|
|
|
{
|
|
|
- this.OnFailReport?.Invoke( eFailCode.Unload_VehicleHasNotCarrier );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.Unload_VehicleHasNotCarrier );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.Unload_VehicleHasNotCarrier );
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if ( !this.refObjects.Conveyor.IsLifterPositinCheck() )
|
|
|
- return 13;
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 40 * ConstUtils.ONE_SECOND, "IN_LIFTER_POSITION_DETECT" ) )
|
|
|
+ {
|
|
|
+ loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ //if ( !this.refObjects.Conveyor.IsLifterPositinCheck() )
|
|
|
+ //{
|
|
|
+ // loggerPIO.E( "[Port] - Lift Position Check Error" );
|
|
|
+ // this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout ); //Unloading Fail Code 를 Time Out 으로 하자. 정의 된 코드 없음.
|
|
|
+ // return 0; //13 -> Alarm Code 보고 없음. 경알람 상태 이므로 한번 보고 후 정상 동작
|
|
|
+ //}
|
|
|
|
|
|
PIOClear();
|
|
|
- loggerPIO.I( $"Start Unload PIO - [{targetName}]" );
|
|
|
this.OnPIOStart?.Invoke( false );
|
|
|
|
|
|
- if ( !this.refObjects.IO.IsOn( "IN_PIO_READY" ) )
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 20 * ConstUtils.ONE_SECOND, "IN_PIO_READY" ) )
|
|
|
{
|
|
|
loggerPIO.E( "[Port] - 1 Ready not On" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
this.refObjects.IO.WriteOutputIO( "OUT_PIO_READY", true );
|
|
|
loggerPIO.I( "[Vehicle] - 1 Ready On" );
|
|
|
|
|
|
- if ( !this.refObjects.IO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_RECEIVE_RUN" ) )
|
|
|
+ if ( !this.refObjects.IO.WaitChangeInputIO( true, 10 * ConstUtils.ONE_SECOND, "IN_PIO_RECEIVE_RUN" ) )
|
|
|
{
|
|
|
PIOClear();
|
|
|
loggerPIO.E( "[Port] - 2 Receive CV Run Timeout" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
return 0;
|
|
|
}
|
|
|
loggerPIO.E( "[Port] - 2 Receive CV Run On" );
|
|
|
@@ -1671,12 +1777,25 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
PIOClear();
|
|
|
this.refObjects.Conveyor.OnOffConveyor( false, true );
|
|
|
loggerPIO.E( "[Port] Conveyor Wait Time Out" );
|
|
|
- this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ TimerUtils.Once( 1000, this.OnFailReport, eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
+ //this.OnFailReport?.Invoke( eFailCode.UnlaodPIOInterlockTimeout );
|
|
|
|
|
|
if ( this.refObjects.Conveyor.IsDetectedLoadStart() || this.refObjects.Conveyor.IsDetectedCenter() ) //중간에 걸려 있다고 생각해서 알람 처리.
|
|
|
return 12; //Conveyor Moving Timeout
|
|
|
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;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1718,6 +1837,37 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
#endregion
|
|
|
|
|
|
#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>
|
|
|
/// 현재 Point 가 변경될때 장애물 감지 센서의 패턴을 변경한다.
|
|
|
@@ -1855,54 +2005,60 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
case eDataKind.Voltage:
|
|
|
this.BatteryVoltage = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.Current:
|
|
|
this.BatteryCurrent = (double)obj.Value;
|
|
|
+ if ( BatteryCurrent > 0 )
|
|
|
+ this.BatteryChargeState = true;
|
|
|
+ else
|
|
|
+ this.BatteryChargeState = false;
|
|
|
+
|
|
|
break;
|
|
|
case eDataKind.BatteryState:
|
|
|
- if ( obj.Value == null )
|
|
|
- return;
|
|
|
this.BatteryState = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.ChargeCompleteTime:
|
|
|
- if ( obj.Value == null /*|| obj.Value <= 0 */)
|
|
|
- return;
|
|
|
this.BatteryChargeTime = (double)obj.Value;
|
|
|
- if ( this.BatteryChargeTime > 0 )
|
|
|
- this.VehicleStateProperty = eVehicleState.Charge;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.DisChargeCompleteTime:
|
|
|
- if ( obj.Value == null || obj.Value <= 0 )
|
|
|
- return;
|
|
|
this.BatteryDisChargeTime = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.SOC:
|
|
|
this.BatteryStateOfCharge = (double)obj.Value;
|
|
|
- if ( this.BatteryStateOfCharge >= 80 )
|
|
|
- {
|
|
|
- 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() )
|
|
|
- {
|
|
|
- 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;
|
|
|
+
|
|
|
case eDataKind.SOH:
|
|
|
this.BatteryStateOfHealth = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.ResidualCapacity:
|
|
|
this.BatteryCapacity = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.ResidualEnergy:
|
|
|
this.BatteryEnergy = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
case eDataKind.Temperature:
|
|
|
this.BatteryTemperature = (double)obj.Value;
|
|
|
break;
|
|
|
+
|
|
|
default:
|
|
|
break;
|
|
|
}
|