aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-09-14 11:52:07 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-09-14 11:52:07 +0300
commitcf2ff4168ce5da36f2353805bb09d2cd1dc5347f (patch)
treef5cf89d5d5f11fd707d6a0f1f2f8f0a4b5ead658 /Software
parentd2341eb3059629ae98ef4d53f341bda6bc84e325 (diff)
parent71f91b8aad2bde92eec659852a87dbb5a895d108 (diff)
downloadTango-cf2ff4168ce5da36f2353805bb09d2cd1dc5347f.tar.gz
Tango-cf2ff4168ce5da36f2353805bb09d2cd1dc5347f.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.c45
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.h8
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.c19
-rw-r--r--Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.h4
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c1
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h8
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c427
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c112
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.c5
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c37
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c220
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs24
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs16
-rw-r--r--Software/Visual_Studio/Tango.CSV/CsvFile.cs14
-rw-r--r--Software/Visual_Studio/Tango.CSV/CsvFileReader.cs3
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs74
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs27
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs17
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs71
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs19
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs53
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs17
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs116
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/DynamicSealingAnalyzer.cs23
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs27
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PressureBuildUpAnalyser.cs22
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PrimingAnalyzer.cs22
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/ProcessAnalyser.cs137
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/SealingAnalyzer.cs22
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml69
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml.cs4
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/DispenserSample.cs2
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ISample.cs12
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessCsvRow.cs17
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessSample.cs25
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Settings.cs29
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj14
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml245
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs143
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs115
43 files changed, 1656 insertions, 645 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
index bf2c4e98d..a607fedcb 100644
--- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
+++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
@@ -20,7 +20,7 @@ typedef struct
} TangoVersion_t;
-TangoVersion_t _gTangoVersion = {1,4,6,44};
+TangoVersion_t _gTangoVersion = {1,5,0,1};
#define BUILD_DATE __DATE__
char Dat[50] = BUILD_DATE;
char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//e
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.c
index b151bea09..3a3aadd3b 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.c
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.c
@@ -52,7 +52,7 @@ void progress_request__free_unpacked
assert(message->base.descriptor == &progress_request__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-static const ProtobufCFieldDescriptor progress_request__field_descriptors[2] =
+static const ProtobufCFieldDescriptor progress_request__field_descriptors[5] =
{
{
"",
@@ -78,15 +78,54 @@ static const ProtobufCFieldDescriptor progress_request__field_descriptors[2] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(ProgressRequest, has_param1),
+ offsetof(ProgressRequest, param1),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(ProgressRequest, has_param2),
+ offsetof(ProgressRequest, param2),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(ProgressRequest, has_param3),
+ offsetof(ProgressRequest, param3),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned progress_request__field_indices_by_name[] = {
0, /* field[0] = Amount */
1, /* field[1] = Delay */
+ 2, /* field[2] = Param1 */
+ 3, /* field[3] = Param2 */
+ 4, /* field[4] = Param3 */
};
static const ProtobufCIntRange progress_request__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 2 }
+ { 0, 5 }
};
const ProtobufCMessageDescriptor progress_request__descriptor =
{
@@ -96,7 +135,7 @@ const ProtobufCMessageDescriptor progress_request__descriptor =
"",
"",
sizeof(ProgressRequest),
- 2,
+ 5,
progress_request__field_descriptors,
progress_request__field_indices_by_name,
1, progress_request__number_ranges,
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.h
index 1ce2b6d6b..da8eac4f1 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressRequest.pb-c.h
@@ -30,10 +30,16 @@ struct _ProgressRequest
int32_t amount;
protobuf_c_boolean has_delay;
int32_t delay;
+ protobuf_c_boolean has_param1;
+ uint32_t param1;
+ protobuf_c_boolean has_param2;
+ uint32_t param2;
+ protobuf_c_boolean has_param3;
+ uint32_t param3;
};
#define PROGRESS_REQUEST__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&progress_request__descriptor) \
- , 0, 0, 0, 0 }
+ , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
/* ProgressRequest methods */
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.c
index 537f8e763..ff0667e61 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.c
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.c
@@ -52,7 +52,7 @@ void progress_response__free_unpacked
assert(message->base.descriptor == &progress_response__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-static const ProtobufCFieldDescriptor progress_response__field_descriptors[1] =
+static const ProtobufCFieldDescriptor progress_response__field_descriptors[2] =
{
{
"",
@@ -66,14 +66,27 @@ static const ProtobufCFieldDescriptor progress_response__field_descriptors[1] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(ProgressResponse, has_info),
+ offsetof(ProgressResponse, info),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned progress_response__field_indices_by_name[] = {
+ 1, /* field[1] = Info */
0, /* field[0] = Progress */
};
static const ProtobufCIntRange progress_response__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 1 }
+ { 0, 2 }
};
const ProtobufCMessageDescriptor progress_response__descriptor =
{
@@ -83,7 +96,7 @@ const ProtobufCMessageDescriptor progress_response__descriptor =
"",
"",
sizeof(ProgressResponse),
- 1,
+ 2,
progress_response__field_descriptors,
progress_response__field_indices_by_name,
1, progress_response__number_ranges,
diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.h
index de5201ee5..bd1a3141a 100644
--- a/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.h
+++ b/Software/Embedded_SW/Embedded/Communication/PMR/Stubs/ProgressResponse.pb-c.h
@@ -28,10 +28,12 @@ struct _ProgressResponse
ProtobufCMessage base;
protobuf_c_boolean has_progress;
double progress;
+ protobuf_c_boolean has_info;
+ uint32_t info;
};
#define PROGRESS_RESPONSE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&progress_response__descriptor) \
- , 0, 0 }
+ , 0, 0, 0, 0 }
/* ProgressResponse methods */
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
index f8e8d7b9e..6e38cc68a 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
@@ -443,6 +443,7 @@ bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch)
case I2C_HEADCARD_COVER_LS_FRONT:
case I2C_HEADCARD_ARC_LS_ACTUATOR:
LM_Status = !(Head_I2C_EXP4_0x46.bits.INPUT_LS_FRONT_ARC_ACT);
+ LM_Status -= 1;
break;
case I2C_HEADCARD_COVER_LS_REAR:
case I2C_HEADCARD_COVER_LS_ARC:
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
index e6947a8d4..00cada255 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.h
@@ -312,6 +312,7 @@ uint32_t MotorStop(TimerMotors_t _motorId, STOP_TYPE_ENUM StopType);
uint32_t MotorMove(TimerMotors_t _motorId,bool direction, uint32_t Steps);
uint32_t MotorMoveWithCallback (TimerMotors_t _motorId,bool direction, uint32_t Steps, callback_fptr callback,uint32_t timeout);
+uint32_t MotorRunWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Freq, callback_fptr callback,uint32_t timeout);
uint32_t MotorGotoWithCallback (TimerMotors_t MotorId, uint32_t Steps, uint32_t LimitSwitchId,callback_fptr callback,uint32_t timeout); //TODO
uint32_t MotorGotoWithBusyCallback (TimerMotors_t MotorId,bool direction, uint32_t Steps, callback_fptr callback,uint32_t timeout); //TODO
@@ -352,7 +353,12 @@ uint32_t MotorMovetoBreakSensor (TimerMotors_t _motorId,bool direction, uint32_t
uint32_t MotorMovetoDancerPosition (TimerMotors_t _motorId,bool direction, uint32_t Freq,uint32_t DancerId,bool dancervaluedirection, callback_fptr callback,uint32_t timeout);
uint32_t MotorAbortMovetoLimitSwitch (TimerMotors_t _motorId);
uint32_t MotorMoveToStopper (TimerMotors_t _motorId,bool direction, uint32_t Speed, callback_fptr callback,uint32_t backlash,uint32_t timeout);
-uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callback,uint32_t timeout, bool direction);
+uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callback,uint32_t timeout, bool direction,uint32_t speed);
+uint32_t LoadingArmReset (callback_fptr callback,uint32_t timeout);
+uint32_t LoadingStopArmReset (void);
+
+float Calculate_Arm_Angle(uint32_t Drier_Center,uint32_t Current_Angle);
+int Calculate_Arm_Distance(uint32_t Drier_Center,uint32_t Current_Angle);
uint32_t MotorStopAction (TimerMotors_t MotorId); //Stop the controlled action of a motor
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
index f33edee50..9e8ef25fc 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c
@@ -39,11 +39,26 @@
//callback_fptr MotorMovetoLimitSwitchCallback[NUM_OF_MOTORS];
callback_fptr MotorCallback[NUM_OF_MOTORS];
ControlCBFunction MotorControlCallback[NUM_OF_MOTORS];
+uint32_t DrierZeroPosition = 0;
+//uint32_t DryerBackLash = 0;
+//bool DrierBackLashDirection = false;
+uint32_t Arm_Drier_Center = 0;
+callback_fptr UnloadingReset = NULL;
+/*int CallbackCalls=0;
+int FirstCall = 0;
+#define MAX_CONTROL_SAMPLES 10*/
+int32_t ArmSamples[MAX_CONTROL_SAMPLES] = {0};
+int ArmSamplePointer = {0};
+int StoredavreageSampleValue = 0;
+uint32_t CallbackCalls = 0;
+int32_t Initialcurrentposition =0;
+int cycles = 0;
uint32_t MotorMoveCallBackFunction(uint32_t deviceId, uint32_t BusyFlag);
uint32_t MotorSetSpeedCallBackFunction(uint32_t deviceId, uint32_t BusyFlag);
uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag);
uint32_t MotorMoveToLimitSwitchCallBackFunction(uint32_t IfIndex, uint32_t LimitSwitch);
+uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag);
//uint32_t MotorMoveControlId[NUM_OF_MOTORS];
//uint32_t MotorSetSpeedControlId[NUM_OF_MOTORS];
//uint32_t MotorMovetoLimitSwitchControlId[NUM_OF_MOTORS];
@@ -206,6 +221,172 @@ uint32_t MotorGotoWithBusyCallback (TimerMotors_t MotorId,bool direction, uint32
int32_t AccumulatedArmMovement = 0;
int32_t InitialArmLocation = 0;
bool ArmDirection = true;
+int failCounter = 0;
+uint32_t MotorRunWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Freq, callback_fptr callback,uint32_t timeout) //TODO
+{
+ ReportWithPackageFilter(GeneralFilter,"MotorRunWithCallback",__FILE__,direction,MotorId,RpMessage,Freq,0);
+
+ //call driver action to device id with the parameter
+ //SetMotorSpeed (deviceId, parameter);
+ MotorCallback[MotorId] = callback;
+ MotorTimeout[MotorId] = 0;
+ MotorTimeLag[MotorId] = 20;
+ MotorTimeLimit[MotorId] = timeout;
+ if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ {
+ InitialArmLocation = Read_Dryer_ENC_Position(0,0);
+ AccumulatedArmMovement = 0;
+ ArmDirection = direction;
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierZeroPosition);
+ failCounter = 0;
+ MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,direction);
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Freq);
+ }
+ else
+ {
+ return ERROR;
+ }
+ MotorControlId[MotorId] = AddControlCallback(NULL, MotorRunCallBackFunction, /*eTenMillisecond*/20, MotorControlGetnBusyState,(IfTypeMotors*0x100+MotorId), MotorId, 0 );
+ MotorControlCallback[MotorId] = MotorMoveCallBackFunction;
+ return MotorControlId[MotorId];
+}
+uint32_t MotorRunCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
+{
+ uint32_t MotorId,encoder,temp = 0;
+ uint32_t Busy = BusyFlag;
+ int angle;
+
+ if (IfIndex>>8 != IfTypeMotors)
+ {
+ LOG_ERROR (IfIndex, "Wrong Interface type");
+ return 0xFFFFFFFF;
+ }
+ MotorId = IfIndex&0xFF;
+ CallbackCalls++;
+
+ if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ {
+ encoder = Read_Dryer_ENC_Position(0,0);
+ if (ArmDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize) //unloading - numbers going down
+ {
+ //previous number is bigger than current
+ if (InitialArmLocation>encoder)
+ {
+ temp = InitialArmLocation-encoder;
+ if ((temp>25)&&(temp<1000))
+ {
+ AccumulatedArmMovement+=temp;
+ InitialArmLocation=encoder;
+ }
+ }
+ else if (InitialArmLocation<encoder)//rollover
+ {
+ temp = 0x3FFF + InitialArmLocation - encoder;
+ if ((temp>25)&&(temp<1000))
+ {
+ AccumulatedArmMovement+=temp;
+ InitialArmLocation=encoder;
+ }
+ }
+ }
+ else //loading - going up
+ {
+ //previous number is smaller than current
+ if (InitialArmLocation<encoder)
+ {
+ temp = encoder-InitialArmLocation;
+ if ((temp>25)&&(temp<1000))
+ {
+ AccumulatedArmMovement+=temp;
+ InitialArmLocation=encoder;
+ }
+ }
+ else if (InitialArmLocation>encoder)//rollover
+ {
+ temp = 0x3FFF + encoder -InitialArmLocation;
+ if ((temp>25)&&(temp<1000))
+ {
+ AccumulatedArmMovement+=temp;
+ InitialArmLocation=encoder;
+ }
+ }
+ }
+ if (((temp>1000)||(temp<20))&&(CallbackCalls>10))
+ {
+ Report("MotorRunCallBackFunctionMotorRunCallBackFunction temp curr prev small",__FILE__,encoder,InitialArmLocation,RpWarning,temp,0);
+ failCounter++;
+ if (failCounter>=20)
+ {
+ Report("arm stopped",__FILE__,failCounter,encoder,RpWarning,temp,0);
+ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Hiz);
+ BusyFlag = NOTBUSY;
+ }
+ }
+ else
+ {
+ failCounter = 0;
+ BusyFlag = BUSY;
+ }
+ if (CallbackCalls%50 == 0)
+ {
+ //encoder = Read_Dryer_ENC_Position(0,0);
+ Report("MotorRunCallBackFunctionMotorRunCallBackFunction periodic curr prev total",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0);
+ }
+ if (CallbackCalls%200 == 0)
+ {
+ //encoder = Read_Dryer_ENC_Position(0,0);
+ Report("MotorRunCallBackFunctionMotorRunCallBackFunction",__FILE__,__LINE__,encoder,RpWarning,CallbackCalls,0);
+ }
+ }
+ else
+ {
+ if (CallbackCalls%100 == 1)
+ {
+ Report("MotorRunCallBackFunction wrong motor",__FILE__,MotorId,MotorTimeout[MotorId],RpWarning,MotorTimeLimit[MotorId],0);
+ return ERROR;
+ }
+ }
+ MotorTimeout[MotorId]+=MotorTimeLag[MotorId];
+
+ if ((BusyFlag == NOTBUSY)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)))
+ {
+ if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ {
+ angle = Calculate_Arm_Distance(Arm_Drier_Center,temp);
+
+ if ((angle<400)||(angle>16000))
+ {
+ BusyFlag = NOTBUSY;
+ }
+ else
+ {
+ BusyFlag = BUSY;
+ }
+ Report("arm stopped call",__FILE__,failCounter,encoder,RpWarning,abs(DrierZeroPosition-encoder),0);
+ }
+ //stop this control loop
+ Report("MotorControlGetnBusyState stop",__FILE__,MotorId,BusyFlag,RpMessage,MotorCallback[MotorId],0);
+ SafeRemoveControlCallback(MotorControlId[MotorId], MotorRunCallBackFunction );
+ MotorControlCallback[MotorId] = 0;
+ MotorControlId[MotorId] = 0xFF;
+ //possibly: start regular control (speed etc)
+ //uint32_t ControlId = AddControlCallback(NULL,ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+MotorId), deviceId, Parameter );
+ if ((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0))
+ {
+ Report("motor timeout",__FILE__,__LINE__,MotorId,RpMessage,MotorTimeout[MotorId],0);
+ Busy = BUSY;
+ }
+ Report("MotorRunCallBackFunctionMotorRunCallBackFunction curr prev return",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0);
+ //call the module callback
+ if (MotorCallback[MotorId])
+ {
+ MotorCallback[MotorId](MotorId,Busy);
+ }
+
+ }
+ return OK;
+}
+
uint32_t MotorMoveWithCallback (TimerMotors_t MotorId,bool direction, uint32_t Steps, callback_fptr callback,uint32_t timeout) //TODO
{
@@ -224,31 +405,28 @@ uint32_t MotorMoveWithCallback (TimerMotors_t MotorId,bool direction, uint32_t S
MotorTimeout[MotorId] = 0;
MotorTimeLag[MotorId] = 20;
MotorTimeLimit[MotorId] = timeout;
- if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ /*if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
{
InitialArmLocation = Read_Dryer_ENC_Position(0,0);
AccumulatedArmMovement = 0;
ArmDirection = direction;
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierZeroPosition);
+ failCounter = 0;
+ MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].maxfrequency);
+ }
+ else*/
+ {
+ //MotorStop(MotorId,Hard_Hiz );
+ MotorMove(MotorId,direction,Steps );
+ }
+ if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ {
+ Task_sleep (100);
}
-
- //MotorStop(MotorId,Hard_Hiz );
- MotorMove(MotorId,direction,Steps );
MotorControlId[MotorId] = AddControlCallback(NULL, MotorMoveCallBackFunction, /*eTenMillisecond*/20, MotorControlGetnBusyState,(IfTypeMotors*0x100+MotorId), MotorId, 0 );
MotorControlCallback[MotorId] = MotorMoveCallBackFunction;
return MotorControlId[MotorId];
}
-uint32_t DryerBackLash = 0;
-uint32_t DrierZeroPosition = 0;
-bool DrierBackLashDirection = false;
-int CallbackCalls=0;
-int FirstCall = 0;
-#define MAX_CONTROL_SAMPLES 10
-int32_t ArmSamples[MAX_CONTROL_SAMPLES] = {0};
-int ArmSamplePointer = {0};
-int StoredavreageSampleValue = 0;
-
-int32_t Initialcurrentposition =0;
-int cycles = 0;
uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) //TODO
{
uint32_t MotorId;
@@ -262,6 +440,7 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) /
MotorId = IfIndex&0xFF;
MotorPosition = ArmPosition;
CallbackCalls++;
+
if (CallbackCalls%20 == 0)
{
// REPORT_MSG(MotorPosition,"MotorVerifiedCallBackFunction");
@@ -276,11 +455,6 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) /
Read_Dryer_ENC_Position(); //trigger the next call
ArmSamples[ArmSamplePointer] = MotorPosition;//(-1 * TranslatedReadValue);
- if (FirstCall<5)
- {
- FirstCall++;
- return OK;
- }
ArmSamples[ArmSamplePointer] = MotorPosition;//(-1 * TranslatedReadValue);
ArmSamplePointer++;
if (ArmSamplePointer >= MAX_CONTROL_SAMPLES)
@@ -320,13 +494,13 @@ uint32_t MotorVerifiedCallBackFunction(uint32_t IfIndex, uint32_t ArmPosition) /
Task_sleep(5);*/
// MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CENTER,DrierZeroPosition);
- Report("MotorVerifiedCallBackFunction",__FILE__,__LINE__,DrierZeroPosition,RpWarning,DryerBackLash,0);
+ Report("MotorVerifiedCallBackFunction",__FILE__,__LINE__,DrierZeroPosition,RpWarning,avreageSampleValue,0);
//call the module callback
if (MotorCallback[MotorId])
MotorCallback[MotorId](MotorId,ArmPosition);
MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,NULL,1000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,NULL,1000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,40);
DrierZeroPosition = Read_Dryer_ENC_Position(); //trigger the next call
}
@@ -359,12 +533,8 @@ uint32_t MotorMoveToStopper (TimerMotors_t MotorId,bool direction, uint32_t Spee
MotorStop(MotorId,Hard_Hiz );
Task_sleep(5);
- DryerBackLash = backlash;
- DrierBackLashDirection = 1-direction;
MotorSetDirection( MotorId, direction);
- CallbackCalls = 0;
- FirstCall = 0;
MotorGetPositionFromFPGA(MotorId);
memset(ArmSamples,0,sizeof(ArmSamples));
ArmSamplePointer = 0;
@@ -422,11 +592,14 @@ uint32_t MotorMoveToDrierPositionCallBackFunction(uint32_t IfIndex, uint32_t Rea
//call the module callback
if (MotorCallback[MotorId])
+ {
+ Report("MotorMoveToDrierPosition callback",__FILE__,__LINE__,MotorCallback[MotorId],RpWarning,ReadValue,0);
MotorCallback[MotorId](MotorId,ReadValue);
+ }
}
return OK;
}
-uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callback,uint32_t timeout, bool direction)
+uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callback,uint32_t timeout, bool direction,uint32_t speed)
{
//assert (callback);
uint32_t currentposition = 0;
@@ -446,6 +619,7 @@ uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callb
currentposition = Control_Read_Dryer_Position(0,0);
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&DrierZeroPosition);
Report("MotorMovetoEncoderPosition",__FILE__,__LINE__,DrierZeroPosition,RpWarning,currentposition,0);
+ Report("MotorMovetoEncoderPosition callback",__FILE__,__LINE__,callback,RpWarning,speed,0);
if (abs(currentposition - DrierZeroPosition)<5)
{
if (callback)
@@ -456,7 +630,7 @@ uint32_t MotorMovetoEncoderPosition (TimerMotors_t MotorId, callback_fptr callb
//MotorSetDirection( MotorId, direction);
MotorSetDirection(MotorId,direction);
- MotorSetSpeed (MotorId, 30);
+ MotorSetSpeed (MotorId, speed);
MotorControlId[MotorId] = AddControlCallback(NULL, MotorMoveToDrierPositionCallBackFunction, 2,Control_Read_Dryer_Position,(IfTypeMotors*0x100+MotorId), MotorId, 0 );
MotorControlCallback[MotorId] = MotorMoveToDrierPositionCallBackFunction;
MotorTimeout[MotorId] = 0;
@@ -480,78 +654,22 @@ uint32_t MotorSetSpeedWithCallback (TimerMotors_t MotorId, uint32_t _freq, callb
}
uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
{
- uint32_t MotorId,encoder,temp = 0,tt;
+ uint32_t MotorId;
uint32_t Busy = BusyFlag;
+
if (IfIndex>>8 != IfTypeMotors)
{
LOG_ERROR (IfIndex, "Wrong Interface type");
return 0xFFFFFFFF;
}
MotorId = IfIndex&0xFF;
-
CallbackCalls++;
+
if (MotorId ==HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
{
- encoder = Read_Dryer_ENC_Position(0,0);
- tt=InitialArmLocation;
- if (ArmDirection == 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize) //unloading - numbers going down
- {
- //previous number is bigger than current
- if (InitialArmLocation>encoder)
- {
- temp = InitialArmLocation-encoder;
- if ((temp>25)&&(temp<1000))
- {
- AccumulatedArmMovement+=temp;
- InitialArmLocation=encoder;
- }
- }
- else if (InitialArmLocation<encoder)//rollover
- {
- temp = 0x3FFF + InitialArmLocation - encoder;
- if ((temp>25)&&(temp<1000))
- {
- AccumulatedArmMovement+=temp;
- InitialArmLocation=encoder;
- InitialArmLocation=encoder;
- }
- }
- }
- else //loading - going up
- {
- //previous number is smaller than current
- if (InitialArmLocation<encoder)
- {
- temp = encoder-InitialArmLocation;
- if ((temp>25)&&(temp<1000))
- {
- AccumulatedArmMovement+=temp;
- InitialArmLocation=encoder;
- }
- }
- else if (InitialArmLocation>encoder)//rollover
- {
- temp = 0x3FFF + encoder -InitialArmLocation;
- if ((temp>25)&&(temp<1000))
- {
- AccumulatedArmMovement+=temp;
- InitialArmLocation=encoder;
- }
- }
- }
- /*if (temp>1000)
- {
- Report("MotorMoveCallBackFunction temp curr prev total",__FILE__,encoder,tt,RpWarning,temp,0);
- }*/
- if (CallbackCalls%50 == 0)
- {
- //encoder = Read_Dryer_ENC_Position(0,0);
- Report("MotorMoveCallBackFunction periodic curr prev total",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0);
- }
if (CallbackCalls%200 == 0)
{
- //encoder = Read_Dryer_ENC_Position(0,0);
- Report("MotorMoveCallBackFunction",__FILE__,__LINE__,encoder,RpWarning,CallbackCalls,0);
+ Report("MotorMoveCallBackFunction",__FILE__,__LINE__,MotorId,RpWarning,Read_Dryer_ENC_Position(0,0),0);
}
}
else
@@ -565,10 +683,6 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
if ((BusyFlag == NOTBUSY)||((MotorTimeout[MotorId]>=MotorTimeLimit[MotorId])&&(MotorTimeLimit[MotorId]>0)))
{
- /*if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
- {
- printBusy = false;
- }*/
//stop this control loop
Report("MotorControlGetnBusyState stop",__FILE__,MotorId,BusyFlag,RpMessage,MotorTimeout[MotorId],0);
SafeRemoveControlCallback(MotorControlId[MotorId], MotorMoveCallBackFunction );
@@ -581,7 +695,6 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
Report("motor timeout",__FILE__,__LINE__,MotorId,RpMessage,MotorTimeout[MotorId],0);
Busy = BUSY;
}
- Report("MotorMoveCallBackFunction curr prev total",__FILE__,encoder,temp,RpWarning,AccumulatedArmMovement,0);
//call the module callback
if (MotorCallback[MotorId])
{
@@ -780,7 +893,9 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t
ReportWithPackageFilter(GeneralFilter,"calling DeActivateHeadMagnet",__FILE__,timeout,direction,RpMessage,Freq,0);
if (direction == MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DH_LID].directionthreadwize)
{
- CloseMagnet = true;
+ if (Head_Type != HEAD_TYPE_ARC) {
+ CloseMagnet = true;
+ }
/*if (Head_Type == HEAD_TYPE_FLAT)
{
Report("Close_actuators",__FILE__,__LINE__,LOW,RpMessage,true,0);
@@ -977,6 +1092,14 @@ uint32_t MotorAbortMovetoLimitSwitch (TimerMotors_t MotorId)
}
//call driver action to device id with the parameter
//SetMotorSpeed (deviceId, parameter);
+ if (MotorId == HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM)
+ {
+ if (UnloadingReset)
+ {
+ UnloadingReset(MotorId, BUSY);
+ UnloadingReset = NULL;
+ }
+ }
MotorStop(MotorId,Hard_Hiz);
MotorCallback[MotorId] = NULL;
@@ -984,7 +1107,121 @@ uint32_t MotorAbortMovetoLimitSwitch (TimerMotors_t MotorId)
return OK;
}
+float Calculate_Arm_Angle(uint32_t Drier_Center,uint32_t Current_Angle)
+{
+ float angle;
+ float Calc_angle;
+ if (Current_Angle >= Drier_Center)
+ angle = Current_Angle - Drier_Center;
+ else
+ angle = Current_Angle + 0x3FFF - Drier_Center;
+ Calc_angle = (float)(angle/0x3FFF);
+ MCU_E2PromProgram(EEPROM_DRIER_LOADING_ARM_ANGLE,Calc_angle);
+ ReportWithPackageFilter(DiagnosticsFilter,"Calculate_Arm_Angle",__FILE__,(int)(Calc_angle*1000),Current_Angle,RpMessage,Drier_Center,0);
+ return Calc_angle;
+}
+int Calculate_Arm_Distance(uint32_t Drier_Center,uint32_t Current_Angle)
+{
+ int angle;
+ if (Current_Angle >= Drier_Center)
+ angle = Current_Angle - Drier_Center;
+ else
+ angle = Current_Angle + 0x3FFF - Drier_Center;
+ ReportWithPackageFilter(DiagnosticsFilter,"Calculate_Arm_Distance",__FILE__,angle,Current_Angle,RpMessage,Drier_Center,0);
+ return angle;
+}
+uint32_t LoadingArmReset_Callback_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
+{
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset_Callback_Stopper_Callback time",__FILE__,__LINE__,msec_millisecondCounter,RpMessage,0,0);
+
+ if (UnloadingReset)
+ {
+ UnloadingReset(deviceID, BusyFlag);
+ UnloadingReset = NULL;
+ }
+
+ return OK;
+}
+
+uint32_t LoadingArmReset_Callback(uint32_t MotorId, uint32_t ReadValue)
+{
+ bool direction;
+ int angle = 0;
+
+ uint32_t temp = Read_Dryer_ENC_Position();
+ angle = Calculate_Arm_Distance(Arm_Drier_Center,temp);
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset_Callback",__FILE__,angle,temp,RpMessage,Arm_Drier_Center,0);
+ //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0);
+ //if ((AccumulatedArmMovement>8000 )&&(ReadValue == NOTBUSY)) // OK - take another round
+ if (ReadValue == NOTBUSY) // OK - take another round
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset_Callback OK",__FILE__,__LINE__,Arm_Drier_Center,RpMessage,ReadValue,0);
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0);
+ if ((angle<400)||(angle>16000))
+ //if (fabs(angle)<0.2)
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"drier center proximity",__FILE__,temp,Arm_Drier_Center,RpMessage,angle,0);
+ if (angle<400)
+ direction = 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
+ else
+ direction = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,LoadingArmReset_Callback_Stopper_Callback,/*3000*/16000,direction,10);
+
+ }
+ else
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset_Callback Fail",__FILE__,__LINE__,Arm_Drier_Center,RpMessage,ReadValue,0);
+ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop);
+ if (UnloadingReset)
+ {
+ UnloadingReset(MotorId, ReadValue);
+ UnloadingReset = NULL;
+ }
+ }
+
+ }
+ else //timeout or no movement
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"Unloading drier - halted",__FILE__,__LINE__,Arm_Drier_Center,RpMessage,0,0);
+ //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm
+
+ ReportWithPackageFilter(DiagnosticsFilter,"Drier unloading timeout(1) or no movement",__FILE__,temp,Arm_Drier_Center,RpWarning,ReadValue,0);
+ if (UnloadingReset)
+ {
+ UnloadingReset(MotorId, ReadValue);
+ UnloadingReset = NULL;
+ }
+ }
+ return OK;
+}
+
+uint32_t LoadingArmReset (callback_fptr callback,uint32_t timeout) //TODO
+{
+ uint32_t temp;
+
+ if (UnloadingReset == NULL)
+ UnloadingReset = callback;
+ else
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset is active",__FILE__,__LINE__,timeout,RpMessage, 0,0);
+ return ERROR;
+ }
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
+ Arm_Drier_Center = temp;
+ ReportWithPackageFilter(DiagnosticsFilter,"LoadingArmReset",__FILE__,__LINE__,timeout,RpMessage, 0,0);
+
+ MotorRunWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius, LoadingArmReset_Callback, 300000);
+
+ return OK;
+
+}
+uint32_t LoadingStopArmReset(void)
+{
+ return MotorAbortMovetoLimitSwitch(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM);
+
+}
void MotorActionsInit(void)
{
int i;
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
index b40bbe4c7..9eba08678 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsHoming.c
@@ -133,7 +133,7 @@ uint32_t LoadArmRounds;
uint32_t D_numberOfSteps = 0;
float D_numberOfCycles = 0;
-double D_DrierPrevLocation = 0;
+uint32_t D_DrierPrevLocation = 0;
uint32_t MotorHomingRequestFunc(MessageContainer* requestContainer)
@@ -465,30 +465,33 @@ return OK;
/********************************************************************************
* Drier Loading Arm Homing
********************************************************************************/
-uint32_t Drier_Center = 0;
-float Calculate_Arm_Angle(uint32_t Current_Angle)
-{
- uint32_t angle;
- float Calc_angle;
- if (Current_Angle >= Drier_Center)
- angle = Current_Angle - Drier_Center;
- else
- angle = Current_Angle + 0x3FFF - Drier_Center;
- Calc_angle = angle/0x3FFF;
- MCU_E2PromProgram(EEPROM_DRIER_LOADING_ARM_ANGLE,Calc_angle);
- ReportWithPackageFilter(DiagnosticsFilter,"Calculate_Arm_Angle",__FILE__,(int)(Calc_angle*1000),Current_Angle,RpMessage,Drier_Center,0);
- return Calc_angle;
-}
+uint32_t Drier_Center_read = 0;
uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
{
MessageContainer responseContainer;
MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT;
+ uint32_t angle, temp = Read_Dryer_ENC_Position();
+ angle = Calculate_Arm_Distance(D_DrierPrevLocation,temp);
+
+ if ((angle<14000 )||(ReadValue == BUSY)) // OK - take another round
+ {
+ responseContainer.has_error = true;
+ responseContainer.error = ERROR_CODE__GENERAL_ERROR;
+
+ }
ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Set_Load_Arm_To_Stopper time",__FILE__,__LINE__,msec_millisecondCounter,RpMessage,0,0);
+ if (HomingControlId[deviceID] != 0xff)
+ {
+ ReportWithPackageFilter(DiagnosticsFilter,"MotorHomingProgressReport stopped",__FILE__,__LINE__,deviceID,RpMessage,HomingCounter[deviceID],0);
+ RemoveControlCallback(HomingControlId[deviceID],MotorHomingProgressReport);
+ HomingControlId[deviceID] = 0xff;
+ }
//NumberOfDrierLoaderCycles=0;
//storeLoadArmParameters();
- SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
+ //SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
+ ThreadLoadingRestartReport();
responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, HomingToken[deviceID], true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size);
responseContainer.has_continuous = true;
responseContainer.continuous = true;
@@ -501,45 +504,50 @@ uint32_t Diagnostics_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_
return OK;
}
-uint32_t Diagnostics_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
+/*uint32_t Diagnostics_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
{
+ bool direction;
+
D_numberOfCycles++;
uint32_t temp = Read_Dryer_ENC_Position();
ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading_Callback",__FILE__,ReadValue,temp,RpMessage,D_DrierPrevLocation,0);
//ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading_Callback details",__FILE__,(int)(TotalLoadedLen),D_numberOfCycles,RpMessage,CallbackCounter,0);
- if ((AccumulatedArmMovement>8000 )&&(ReadValue == NOTBUSY)) // OK - take another round
-// if (ReadValue == NOTBUSY) // OK - take another round
+ //if ((AccumulatedArmMovement>8000 )&&(ReadValue == NOTBUSY)) // OK - take another round
+ if (ReadValue == NOTBUSY) // OK - take another round
{
- D_DrierPrevLocation = temp;
ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_UnLoading cycles",__FILE__,D_numberOfCycles,LoadArmRounds,RpMessage,0,0);
- if (D_numberOfCycles<LoadArmRounds)
+ MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0);
+ ReportWithPackageFilter(DiagnosticsFilter,"Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ if (abs(temp -Drier_Center_read)<200)
{
- MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-D_numberOfCycles);
- MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps, Diagnostics_Dryer_UnLoading_Callback, 10000);
- }
- else //done enough cycles, go to the center point
- {
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Set_Load_Arm_To_Stopper_Callback,15000,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
- MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-D_numberOfCycles);
- ReportWithPackageFilter(DiagnosticsFilter,"Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ ReportWithPackageFilter(DiagnosticsFilter,"drier center proximity",__FILE__,temp,Drier_Center_read,RpMessage,abs(temp -Drier_Center_read),0);
+ if (temp<Drier_Center_read)
+ direction = 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
+ else
+ direction = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Set_Load_Arm_To_Stopper_Callback,3000,direction,10);
+
}
+ else
+ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Stop);
+
}
else //timeout or no movement
{
ReportWithPackageFilter(DiagnosticsFilter,"Unloading drier - halted",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
- MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm
+ //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,LoadArmRounds-(D_numberOfCycles-2));//it takes two cycles to identify a stop of the arm
ReportWithPackageFilter(DiagnosticsFilter,"Drier unloading timeout(1) or no movement",__FILE__,temp,D_DrierPrevLocation,RpWarning,ReadValue,0);
+ Diagnostics_Set_Load_Arm_To_Stopper_Callback(MotorId, ReadValue);
}
return OK;
-}
+}*/
uint32_t Diagnostics_Dryer_UnLoading(void)
{
- uint32_t temp;
+ D_DrierPrevLocation = Read_Dryer_ENC_Position();
- D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
- D_numberOfCycles = 0;
+ LoadingArmReset(Diagnostics_Set_Load_Arm_To_Stopper_Callback,300000);
+ /*uint32_t temp;
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds);
if (LoadArmRounds == 0) //prev trial stopped
@@ -549,16 +557,21 @@ uint32_t Diagnostics_Dryer_UnLoading(void)
if (LoadArmRounds <= 2)
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds);
+ D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+ D_numberOfCycles = 0;
+
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
- Drier_Center = temp;
+ Drier_Center_read = temp;
D_DrierPrevLocation = temp;
ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Set_Load_Arm_To_Start_Position",__FILE__,__LINE__,D_DrierPrevLocation,RpMessage, LoadArmRounds,0);
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/6*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius);
+
// status |= MotorMoveToStopper(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, (1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize),
// MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/4, Diagnostics_Set_Load_Arm_To_Stopper_Callback,0,1000);
- MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps-800, Diagnostics_Dryer_UnLoading_Callback, 10000);
-
+ //MotorRunWithCallback
+ MotorRunWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
+ MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/6*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius, Diagnostics_Dryer_UnLoading_Callback, 300000);
+*/
return OK;
}
uint32_t Diagnostics_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint32_t ReadValue)
@@ -566,7 +579,7 @@ uint32_t Diagnostics_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint
MessageContainer responseContainer;
MotorHomingResponse response = MOTOR_HOMING_RESPONSE__INIT;
- ReportWithPackageFilter(DiagnosticsFilter,"Store angle of arm drier - ended",__FILE__,__LINE__,(int)(Calculate_Arm_Angle(ReadValue)*360),RpMessage,D_numberOfCycles,0);
+ ReportWithPackageFilter(DiagnosticsFilter,"Store angle of arm drier - ended",__FILE__,__LINE__,(int)(Calculate_Arm_Angle(Drier_Center_read,ReadValue)*360),RpMessage,D_numberOfCycles,0);
//ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_MovetoEncoderPosition_Callback",__FILE__,__LINE__,0,RpMessage,CallbackCounter,0);
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
responseContainer = createContainer(MESSAGE_TYPE__MotorHomingResponse, HomingToken[MotorId], true, &response, &motor_homing_response__pack, &motor_homing_response__get_packed_size);
@@ -584,12 +597,15 @@ uint32_t Diagnostics_Dryer_MovetoEncoderPosition_Callback(uint32_t MotorId, uint
uint32_t Diagnostics_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue)
{
D_numberOfCycles++;
+ uint32_t angle, temp = Read_Dryer_ENC_Position();
- ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,(int)D_numberOfCycles,(int)D_DrierPrevLocation,RpMessage,ReadValue,0);
+ angle = Calculate_Arm_Distance(D_DrierPrevLocation,temp);
+ ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,(int)angle,(int)ReadValue,RpMessage,temp,0);
MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,D_numberOfCycles);
- if (ReadValue == NOTBUSY)
+ if ((angle>14000 )&&(ReadValue == NOTBUSY)) // OK - take another round
{
+ D_DrierPrevLocation = temp;
//ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
//ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading_Callback details",__FILE__,(int)(TotalLoadedLen),numberOfCycles,RpMessage,CallbackCounter,0);
if (D_numberOfCycles<LoadArmRounds)
@@ -599,14 +615,14 @@ uint32_t Diagnostics_Dryer_Loading_Callback(uint32_t MotorId, uint32_t ReadValue
}
else
{
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Dryer_MovetoEncoderPosition_Callback,15000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Diagnostics_Dryer_MovetoEncoderPosition_Callback,15000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,40);
ReportWithPackageFilter(DiagnosticsFilter,"Store Number of cycles in drier",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
}
}
else
{
ReportWithPackageFilter(DiagnosticsFilter,"Loading drier - halted",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
- ReportWithPackageFilter(DiagnosticsFilter,"Store angle of arm drier - halted",__FILE__,__LINE__,(int)(Calculate_Arm_Angle(ReadValue)*360),RpMessage,D_numberOfCycles,0);
+ ReportWithPackageFilter(DiagnosticsFilter,"Store angle of arm drier - halted",__FILE__,__LINE__,(int)(Calculate_Arm_Angle(Drier_Center_read,ReadValue)*360),RpMessage,D_numberOfCycles,0);
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, 200);
}
return OK;
@@ -620,17 +636,17 @@ uint32_t Diagnostics_Dryer_Loading(void)
LoadArmRounds = (int)dryerbufferlength;
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&D_DrierPrevLocation);
//MCU_E2PromProgram(EEPROM_DRIER_LOADING_ARM_ANGLE,Calc_angle);
- //ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading request: current ",__FILE__,__LINE__,D_numberOfCycles,RpMessage,LoadArmRounds,0);
- Drier_Center = D_DrierPrevLocation;
+ ReportWithPackageFilter(DiagnosticsFilter,"Diagnostics_Dryer_Loading request: current ",__FILE__,D_DrierPrevLocation,D_numberOfCycles,RpMessage,LoadArmRounds,0);
+ Drier_Center_read = D_DrierPrevLocation;
D_numberOfCycles = 0;
D_numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
-
+ D_numberOfSteps -= 100;
MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/6*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius);
//6 seconds per round
//SetMotHome(ThreadMotorIdToMotorId[Motor_i]);
MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- D_numberOfSteps-800, Diagnostics_Dryer_Loading_Callback, 10000);
+ D_numberOfSteps, Diagnostics_Dryer_Loading_Callback, 10000);
return OK;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
index 328ff3203..569071c3a 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
@@ -402,7 +402,10 @@ uint32_t ButtonLoadCBFunction(uint32_t IfIndex, uint32_t ReadValue)
case LONGPB:
ReportWithPackageFilter(GeneralFilter,"------------ thread loading LONGPB -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0);
if (ThreadLoadingActive() == false)
- ThreadLoadButton(0); //INIT
+ {
+ ReportWithPackageFilter(GeneralFilter,"------------ NOT starting loading from button -----------------", __FILE__,__LINE__,0, RpMessage, 0, 0);
+ ThreadLoadButton(0); //INIT CHANGE HERE FOR 1.4.6.44
+ }
else
Thread_Load_End(); //END
break;
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index 3c7248204..a6b7bff86 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -218,13 +218,12 @@ void initializeArrays(void)
HeaterId2PT100Id[HEATER_TYPE__HeaterZone1] = HEAD_PT100_ZONE_1_0X80_0;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone2] = HEAD_PT100_ZONE_2_0X80_1;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone3] = HEAD_PT100_ZONE_3_0X82_0;
- /*
- HeaterId2PT100Id[HEATER_TYPE__HeaterZone4] = HEAD_PT100_ZONE_4_0X82_1;
+ //HeaterId2PT100Id[HEATER_TYPE__HeaterZone4] = HEAD_PT100_ZONE_4_0X82_1;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone5] = HEAD_PT100_ZONE_5_0X84_0;
- HeaterId2PT100Id[HEATER_TYPE__HeaterZone6] = HEAD_PT100_ZONE_6_0X84_1;*/
+ //HeaterId2PT100Id[HEATER_TYPE__HeaterZone6] = HEAD_PT100_ZONE_6_0X84_1;*/
HeaterId2PT100Id[HEATER_TYPE__MixerHeater] = HEAD_PT100_MIXER_0X8E_0;
- /*HeaterId2PT100Id[HEATER_TYPE__HeaterZone7] = HEAD_PT100_ZONE_7_0X86_0;
- HeaterId2PT100Id[HEATER_TYPE__HeaterZone8] = HEAD_PT100_ZONE_8_0X86_1;
+ HeaterId2PT100Id[HEATER_TYPE__HeaterZone7] = HEAD_PT100_ZONE_7_0X86_0;
+ /*HeaterId2PT100Id[HEATER_TYPE__HeaterZone8] = HEAD_PT100_ZONE_8_0X86_1;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone9] = HEAD_PT100_ZONE_9_0X88_0;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone10] = HEAD_PT100_ZONE_10_0X88_1;
HeaterId2PT100Id[HEATER_TYPE__HeaterZone11] = HEAD_PT100_ZONE_11_0X8A_0;
@@ -239,13 +238,12 @@ void initializeArrays(void)
HeaterId2CurrentId[HEATER_TYPE__HeaterZone1] = HEAD_CURRENT_ZONE_1;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone2] = HEAD_CURRENT_ZONE_2;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone3] = HEAD_CURRENT_ZONE_3;
- /*
- HeaterId2CurrentId[HEATER_TYPE__HeaterZone4] = HEAD_CURRENT_ZONE_4;
+ //HeaterId2CurrentId[HEATER_TYPE__HeaterZone4] = HEAD_CURRENT_ZONE_4;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone5] = HEAD_CURRENT_ZONE_5;
- HeaterId2CurrentId[HEATER_TYPE__HeaterZone6] = HEAD_CURRENT_ZONE_6;*/
+ //HeaterId2CurrentId[HEATER_TYPE__HeaterZone6] = HEAD_CURRENT_ZONE_6;
HeaterId2CurrentId[HEATER_TYPE__MixerHeater] = HEAD_CURRENT_MIXER;
- /*HeaterId2CurrentId[HEATER_TYPE__HeaterZone7] = HEAD_CURRENT_ZONE_7;
- HeaterId2CurrentId[HEATER_TYPE__HeaterZone8] = HEAD_CURRENT_ZONE_8;
+ HeaterId2CurrentId[HEATER_TYPE__HeaterZone7] = HEAD_CURRENT_ZONE_7;
+ /*HeaterId2CurrentId[HEATER_TYPE__HeaterZone8] = HEAD_CURRENT_ZONE_8;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone9] = HEAD_CURRENT_ZONE_9;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone10] = HEAD_CURRENT_ZONE_10;
HeaterId2CurrentId[HEATER_TYPE__HeaterZone11] = HEAD_CURRENT_ZONE_11;
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c
index 8856d873a..5da52f590 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Progress.c
@@ -66,6 +66,7 @@ extern uint16_t Head_Fan_Tach[2];
extern bool doorState;
bool RestartNeeded = false;
+uint32_t temp1,temp2;
void Stub_ProgressRequest(MessageContainer* requestContainer)
{
@@ -1105,6 +1106,42 @@ void Stub_ProgressRequest(MessageContainer* requestContainer)
response.has_progress = true;
}
else
+ if(request->amount == 0xB11) //fast refresh for pressure
+ {
+ temp1 = Read_Dryer_ENC_Position();
+ temp2 = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius/4;
+
+ MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Hard_Hiz);
+ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,200);
+ //6 seconds per round
+ Report("Arm movement test",__FILE__,request->delay,request->delay/2*2,RpWarning,(int)request->delay%2,0);
+
+ //SetMotHome(ThreadMotorIdToMotorId[Motor_i]);
+ MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, request->delay%2,request->delay/2*2, NULL, 12000);
+
+ response.progress = temp2;
+ response.has_progress = true;
+ }
+ else
+ if(request->amount == 0xB12) //fast refresh for pressure
+ {
+
+ temp2 = Calculate_Arm_Distance(temp1,Read_Dryer_ENC_Position());
+ Report("Arm movement test calc",__FILE__,temp2,temp1,RpWarning,Read_Dryer_ENC_Position(),0);
+
+ response.progress = temp2;
+ response.has_progress = true;
+ }
+ else
+ if(request->amount == 0xB13) //TryThreadLoadingRequest
+ {
+ TryThreadLoadingFunc(NULL);
+ Report("TryThreadLoadingFunc",__FILE__,temp2,temp1,RpWarning,Read_Dryer_ENC_Position(),0);
+
+ response.progress = 0xB13;
+ response.has_progress = true;
+ }
+ else
if(request->amount == 0xC3) //suspend I2C task
{
if (request->delay == 0)
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index cd7c146fe..d16683967 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -126,6 +126,7 @@
uint32_t Thread_Load_Dryer_UnLoading(void);
uint32_t ThreadLoadingReport(void);
+ uint32_t ThreadLoadingRestartReport(void); //sending after a failure in the finalizing stage
bool ThreadLoaded(void);
bool ThreadLoadingActive(void)
{
@@ -245,38 +246,41 @@
}
uint32_t Thread_Load_Set_Load_Arm_To_Stopper_Callback(uint32_t deviceID, uint32_t BusyFlag)
{
+ uint32_t angle, temp = Read_Dryer_ENC_Position();
- /*if(PullerControlId != 0xFF)
- {
- MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz);
- RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction );
- PullerControlId = 0xFF;
- }*/
- if(WinderControlId != 0xFF)
+ ReportWithPackageFilter(DiagnosticsFilter,"Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,(int)numberOfCycles,(int)DrierPrevLocation,RpMessage,temp,0);
+
+ angle = Calculate_Arm_Distance(DrierPrevLocation,temp);
+
+ DrierPrevLocation = temp;
+ if (CallbackCounter)
{
- MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz);
- RemoveControlCallback(WinderControlId, ThreadLoadControlCBFunction );
- WinderControlId = 0xFF;
+ CallbackCounter--;
}
+ if ((angle>14000 )&&(BusyFlag == NOTBUSY)) // OK - take another round
+ {
+ Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0);
- MotorAbortMovetoLimitSwitch(HARDWARE_MOTOR_TYPE__MOTO_SCREW);
- /*Task_sleep(5)
- MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
- MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);*/
+ Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
+ NumberOfDrierLoaderCycles=0;
+ //storeLoadArmParameters();
+ LoadStages++;
- MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz);
+ ThreadLoadStateMachine(LoadStages);
+ }
+ else
+ {
+ load.color = fastBILNK;
+ usnprintf(LoadErrorMsg, 100, "Stage %s - %s timeout",LoadStagesStr[LoadStages], MotorStr[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM]);
+ Report(LoadErrorMsg,__FILE__,__LINE__,LoadStages,RpWarning,TimeoutsCounter,0);
+
+ LoadStatus = ERROR;
+ ThreadLoadingReport();
+ TryAgain = true;
+ //ThreadLoadButton(LoadStages);
+ }
//move to exact location?
// Report("Thread Load State Machine Callback.",__FILE__,__LINE__,LoadStages,RpMessage,NumberOfDrierLoaderCycles,0);
- CallbackCounter = 0;
- Report("Thread_Load_Set_Load_Arm_To_Stopper time",__FILE__,msec_millisecondCounter - UnloadingStart,msec_millisecondCounter,RpMessage,UnloadingStart,0);
-
- Report("Thread_Load_Set_Load_Arm_To_Stopper_Callback",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0);
- NumberOfDrierLoaderCycles=0;
- //storeLoadArmParameters();
- LoadStages++;
- SetMotHome(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM); //set this point as the spool home
-
- ThreadLoadStateMachine(LoadStages);
return OK;
}
uint32_t Thread_Load_HomingCallback(uint32_t MotorId, uint32_t ReadValue)
@@ -484,6 +488,8 @@
CallbackCounter++;
MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_RDANCER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_RDANCER].directionthreadwize, 15, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_RDANCER], Thread_Load_HomingCallback,10000);
+ Report("Thread_Load_Close dancers tension",__FILE__,__LINE__,(int)windertension,RpMessage,(int)pullertension,0);
+
// MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000);
status |= MCU_E2PromRead(EEPROM_WINDER_TENSION_POSITION,&current);
@@ -666,7 +672,7 @@
}
else
{
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,30000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Dryer_MovetoEncoderPosition_Callback,30000,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,40);
Report("Store Number of cycles in drier",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0);
}
}
@@ -826,6 +832,7 @@
ThreadLoadControlId = 0xFF;
}
+ LoadingStopArmReset();
MotorStopAction(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM);
MotorStopAction(HARDWARE_MOTOR_TYPE__MOTO_RLOADING);
MotorStopAction(HARDWARE_MOTOR_TYPE__MOTO_LLOADING);
@@ -860,7 +867,7 @@
return OK;
}
- uint32_t Thread_Load_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
+ /*uint32_t Thread_Load_Dryer_UnLoading_Callback(uint32_t MotorId, uint32_t ReadValue)
{
bool direction;
numberOfCycles++;
@@ -884,7 +891,7 @@
}
else //done enough cycles, go to the center point
{
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_Callback,30000,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_Callback,30000,1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,40);
MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,0);
Report("Store Number of cycles in drier",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0);
}
@@ -902,7 +909,7 @@
direction = 1-MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
else
direction = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize;
- MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_OnError_Callback,3000,direction);
+ MotorMovetoEncoderPosition(HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM,Thread_Load_Set_Load_Arm_To_Stopper_OnError_Callback,3000,direction,10);
}
else
@@ -911,12 +918,6 @@
TimeoutsCounter = 0;
CallbackCounter = 0;
- /*if(PullerControlId != 0xFF)
- {
- MotorStop(ThreadMotorIdToMotorId[POOLER_MOTOR],Hard_Hiz);
- RemoveControlCallback(PullerControlId, ThreadLoadControlCBFunction );
- PullerControlId = 0xFF;
- }*/
if(WinderControlId != 0xFF)
{
MotorStop(ThreadMotorIdToMotorId[WINDER_MOTOR],Hard_Hiz);
@@ -925,9 +926,6 @@
}
MotorAbortMovetoLimitSwitch(HARDWARE_MOTOR_TYPE__MOTO_SCREW);
- /*Task_sleep(5)
- MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);
- MotorStop(ThreadMotorIdToMotorId[FEEDER_MOTOR],Hard_Hiz);*/
MotorStop(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,Hard_Hiz);
load.color = fastBILNK;
@@ -940,79 +938,24 @@
//ThreadLoadButton(LoadStages);
}
return OK;
- }
+ }*/
uint32_t Thread_Load_Dryer_UnLoading(void)
{
uint32_t temp;
REPORT_MSG(LoadStages, "Thread Load State Machine step Dryer Unloading");
//LoadArmRounds = 0;
//uint32_t numberOfSteps = 0;
- //Start Feeder Pid, Rotate Loading Arm Counter Thread Direction X Circles According To Rml. Feeder Speed Is 40
- SetOriginMotorSpeed(22);
-// OriginalMotorSpd_2PPS[FEEDER_MOTOR] = 1000;
-// CurrentControlledSpeed[FEEDER_MOTOR] = 1000;
-
-// Rockers are up already, so puller handling is not needed
- //numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround*LoadArmRounds*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
- /*MotorControlConfig[POOLER_MOTOR].m_params.MAX = 1;
- MotorControlConfig[POOLER_MOTOR].m_params.MIN = MotorsControl[POOLER_MOTOR].outputproportionalpowerlimit*-1;
- MotorControlConfig[POOLER_MOTOR].m_params.Kd = MotorsControl[POOLER_MOTOR].derivativetime;
- MotorControlConfig[POOLER_MOTOR].m_params.Kp = MotorsControl[POOLER_MOTOR].proportionalgain;
- MotorControlConfig[POOLER_MOTOR].m_params.Ki = 0;//MotorsControl[POOLER_MOTOR].integraltime;
- MotorControlConfig[POOLER_MOTOR].m_params.IntegralErrorMultiplier = MotorsControl[POOLER_MOTOR].setpointramprateorsoftstartramp;
- MotorControlConfig[POOLER_MOTOR].m_params.ProportionalErrorMultiplier = MotorsControl[POOLER_MOTOR].outputonoffhysteresisvalue;
- MotorControlConfig[POOLER_MOTOR].m_params.epsilon = MotorsControl[POOLER_MOTOR].epsilon;
- MotorControlConfig[POOLER_MOTOR].m_params.dt = MotorsControl[POOLER_MOTOR].controloutputtype;
- MotorControlConfig[POOLER_MOTOR].m_ingnoreValue = MotorsControl[POOLER_MOTOR].sensorcorrectionadjustment; // the minimal change required to change the motor speed in pulses
- MotorControlConfig[POOLER_MOTOR].m_calculatedError = 0;
- MotorControlConfig[POOLER_MOTOR].m_integral = 0;
- MotorControlConfig[POOLER_MOTOR].m_isEnabled = true;
- MotorControlConfig[POOLER_MOTOR].m_isReady = true;
- MotorControlConfig[POOLER_MOTOR].m_mesuredParam = 0;
- MotorControlConfig[POOLER_MOTOR].m_preError = 0;
- MotorControlConfig[POOLER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage
- MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDRIVING].directionthreadwize);
-
- PullerControlId = AddControlCallback(ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+POOLER_MOTOR),POOLER_DANCER,POOLER_MOTOR);
- Report("AddControlCallback Puller",__FILE__,__LINE__,PullerControlId,RpMessage,IfTypeThread*0x100+POOLER_MOTOR,0);*/
-////////////////////////
- MotorControlConfig[WINDER_MOTOR].m_params.MAX = 1;
- MotorControlConfig[WINDER_MOTOR].m_params.MIN = MotorsControl[WINDER_MOTOR].outputproportionalpowerlimit*-1;
- MotorControlConfig[WINDER_MOTOR].m_params.Kd = MotorsControl[WINDER_MOTOR].derivativetime;
- MotorControlConfig[WINDER_MOTOR].m_params.Kp = MotorsControl[WINDER_MOTOR].proportionalgain;
- MotorControlConfig[WINDER_MOTOR].m_params.Ki = 0;//MotorsControl[WINDER_MOTOR].integraltime;
- MotorControlConfig[WINDER_MOTOR].m_params.IntegralErrorMultiplier = MotorsControl[WINDER_MOTOR].setpointramprateorsoftstartramp;
- MotorControlConfig[WINDER_MOTOR].m_params.ProportionalErrorMultiplier = MotorsControl[WINDER_MOTOR].outputonoffhysteresisvalue;
- MotorControlConfig[WINDER_MOTOR].m_params.epsilon = MotorsControl[WINDER_MOTOR].epsilon;
- MotorControlConfig[WINDER_MOTOR].m_params.dt = MotorsControl[WINDER_MOTOR].controloutputtype;
- MotorControlConfig[WINDER_MOTOR].m_ingnoreValue = MotorsControl[WINDER_MOTOR].sensorcorrectionadjustment; // the minimal change required to change the motor speed in pulses
- MotorControlConfig[WINDER_MOTOR].m_calculatedError = 0;
- MotorControlConfig[WINDER_MOTOR].m_integral = 0;
- MotorControlConfig[WINDER_MOTOR].m_isEnabled = true;
- MotorControlConfig[WINDER_MOTOR].m_isReady = true;
- MotorControlConfig[WINDER_MOTOR].m_mesuredParam = 0;
- MotorControlConfig[WINDER_MOTOR].m_preError = 0;
- MotorControlConfig[WINDER_MOTOR].m_SetParam = 0;//need to update SetParams on presegment stage
- MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_WINDER,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].directionthreadwize);
-
- WinderControlId = AddControlCallback(NULL,ThreadLoadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+WINDER_MOTOR),WINDER_DANCER,WINDER_MOTOR);
- Report("AddControlCallback Winder",__FILE__,__LINE__,WinderControlId,RpMessage,IfTypeThread*0x100+WINDER_MOTOR,0);
-
-////////////////////////
- MotorSetDirection(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING].directionthreadwize);
- MotorSetSpeed(HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING, OriginalMotorSpd_2PPS[DRYER_MOTOR]);
CallbackCounter++;
- //MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize,
- // numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000);
- //Report("Store Number of cycles in drier - halted",__FILE__,__LINE__,numberOfCycles,RpMessage,LoadArmRounds,0);
- //MCU_E2PromProgram(EEPROM_STORAGE_DRYER_CYCLES,numberOfCycles);
-//shlomo
- UnloadingStart = msec_millisecondCounter;
- numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
- numberOfCycles = 0;
- if (SecondTry == true)
+ MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
+ DrierCenterLocation = DrierPrevLocation;
+ DrierPrevLocation = temp;
+ UnloadingStart = msec_millisecondCounter;
+ //numberOfSteps = MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulseperround/**LoadArmRounds*/*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].microstep*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].pulleyradius;
+ //numberOfCycles = 0;
+ LoadingArmReset(Thread_Load_Set_Load_Arm_To_Stopper_Callback,300000);
+ /*if (SecondTry == true)
{
MCU_E2PromRead(EEPROM_STORAGE_DRYER_CYCLES,&LoadArmRounds);
if (LoadArmRounds == 0) //prev trial stopped
@@ -1028,8 +971,8 @@
{
LoadArmRounds = (int)dryerbufferlength;
}
- }
- MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
+ }*/
+ /*MCU_E2PromRead(EEPROM_STORAGE_DRYER_CENTER,&temp);
DrierCenterLocation = DrierPrevLocation;
DrierPrevLocation = temp;
Report("Thread_Load_Set_Load_Arm_To_Start_Position",__FILE__,UnloadingStart,DrierPrevLocation,RpMessage, LoadArmRounds,0);
@@ -1046,6 +989,8 @@
//Keep Notation How Many Rotations In The Dryer
//LoadArmRounds = (int)dryerbufferlength;
+ *
+ */
load.color = BLINK;
return OK;
}
@@ -1172,6 +1117,8 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
LoadStatus = OK;
SecondTry = true;
load.color = BLINK;
+ if (LoadStages > THREAD_LOAD_INITIAL_TENSION)
+ ThreadLoadingRestartReport();
Report("Calling State machine retry",__FILE__,LoadStages,LoadStatus,RpMessage,SecondTry,0);
ThreadLoadStateMachine(LoadStages);
}
@@ -1180,6 +1127,8 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
SecondTry = false;
Report("Calling State machine 2nd try",__FILE__,LoadStages,LoadStatus,RpMessage,SecondTry,0);
load.color = BLINK;
+ if (LoadStages > THREAD_LOAD_INITIAL_TENSION)
+ ThreadLoadingRestartReport();
ThreadLoadStateMachine(LoadStages+1);
}
else //((SecondTry == false)&&(TryAgain == false))???????
@@ -1191,6 +1140,8 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
else
{
Report("Calling State machine status OK",__FILE__,ReadValue,LoadStatus,RpMessage,SecondTry,0);
+ if (LoadStages > THREAD_LOAD_INITIAL_TENSION)
+ ThreadLoadingRestartReport();
ThreadLoadStateMachine(LoadStages);
SecondTry = false;
}
@@ -1521,22 +1472,53 @@ uint32_t ThreadLoadingReport(void)
return OK;
}
+bool ThreadLoadingRestartFlag = false;
+uint32_t ThreadLoadingRestartReport(void) //sending after a failure in the finalizing stage
+{
+ MessageContainer responseContainer;
+ StartThreadLoadingResponse response = START_THREAD_LOADING_RESPONSE__INIT;
+
+ if (ThreadLoadingToken[0] == 0)
+ return OK;
+ ThreadLoadingRestartFlag = true;
+
+ response.has_state = true;
+ response.state = THREAD_LOADING_STATE__ReadyForLoading;
+ response.errorreason = DefaultErrSrt;
+ Report("ThreadLoadingReport",__FILE__,MessageState,response.state,RpWarning,(int)LoadStages,0);
+ //-------------------------------------------------------------------------------------------
+ responseContainer = createContainer(MESSAGE_TYPE__StartThreadLoadingResponse, ThreadLoadingToken, false, &response, &start_thread_loading_response__pack, &start_thread_loading_response__get_packed_size);
+ responseContainer.has_continuous = true;
+ responseContainer.continuous = true;
+ uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ my_free(responseContainer.data.data);
+ SendChars((char*)container_buffer, container_size);
+
+ return OK;
+
+}
uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer)
{
- TryThreadLoadingRequest *request = try_thread_loading_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+ TryThreadLoadingRequest *request;
TryThreadLoadingResponse Cresponse = TRY_THREAD_LOADING_RESPONSE__INIT;
MessageContainer responseContainer;
- MessageState = 2;
+ //MessageState = 2;
+ if (requestContainer)
+ request = try_thread_loading_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
ThreadLoadingReport();
Report("TryThreadLoadingFunc",__FILE__,__LINE__,MESSAGE_TYPE__TryThreadLoadingResponse,RpWarning,(int)LoadStages,0);
- responseContainer = createContainer(MESSAGE_TYPE__TryThreadLoadingResponse, requestContainer->token, true, &Cresponse, &try_thread_loading_response__pack, &try_thread_loading_response__get_packed_size);
- responseContainer.continuous = false;
- uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
- size_t container_size = message_container__pack(&responseContainer, container_buffer);
- my_free(responseContainer.data.data);
- SendChars((char*)container_buffer, container_size);
+ if (requestContainer)
+ {
+ responseContainer = createContainer(MESSAGE_TYPE__TryThreadLoadingResponse, requestContainer->token, true, &Cresponse, &try_thread_loading_response__pack, &try_thread_loading_response__get_packed_size);
+ responseContainer.continuous = false;
+ uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ my_free(responseContainer.data.data);
+ SendChars((char*)container_buffer, container_size);
+ }
ThreadLoadButton(LoadStages);
return OK;
@@ -1544,7 +1526,8 @@ uint32_t TryThreadLoadingFunc(MessageContainer* requestContainer)
uint32_t ThreadUpdateCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
{
- ThreadLoadingReport();
+ if(ThreadLoadingActive())
+ ThreadLoadingReport();
return OK;
}
@@ -1567,13 +1550,16 @@ uint32_t ContinueThreadLoadingFunc(MessageContainer* requestContainer)
MessageContainer responseContainer;
MessageState = 2;
ThreadLoadingReport();
- if (request->processparameters)
+ if (ThreadLoadingRestartFlag == false)
{
- dryerbufferlength = request->processparameters->dryerbufferlength;
- LoadArmRounds = (int)(request->processparameters->dryerbufferlength);
+ if (request->processparameters)
+ {
+ dryerbufferlength = request->processparameters->dryerbufferlength;
+ LoadArmRounds = (int)(request->processparameters->dryerbufferlength);
+ }
+ Report("ContinueThreadLoadingFunc",__FILE__,__LINE__,(int)(request->processparameters->dryerbufferlength),RpWarning,(int)LoadStages,0);
}
- Report("ContinueThreadLoadingFunc",__FILE__,__LINE__,(int)(request->processparameters->dryerbufferlength),RpWarning,(int)LoadStages,0);
responseContainer = createContainer(MESSAGE_TYPE__ContinueThreadLoadingResponse, requestContainer->token, true, &Cresponse, &continue_thread_loading_response__pack, &continue_thread_loading_response__get_packed_size);
responseContainer.continuous = false;
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index 275e7e5b7..d7bfb1b6e 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -162,7 +162,7 @@ int FeederSpeedIndex = 0,Speed_i;
void ThreadUpdateProcessLength (double length, void *Funcptr)
{
- REPORT_MSG(length,"ThreadUpdateProcessLength");
+ ReportWithPackageFilter(ThreadFilter,"ThreadUpdateProcessLength.",__FILE__,__LINE__,(int)length,RpMessage,(int)dyeingspeed,0);
CurrentRequestedLength = length*100;//Centimetres
CurrentProcessedLength = 0;
ProcessedLengthFuncPtr = (ProcessedLengthFunc)Funcptr;
@@ -337,7 +337,10 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
}**/
//}
-
+#ifdef FOUR_WINDERS
+ if (CurrentControlledSpeed[WINDER_MOTOR]>100)
+ length = dyeingspeed/10;
+#endif
PoolerTotalProcessedLength+= (length/100);
TempPoolerTotalProcessedLength = PoolerTotalProcessedLength;
#ifndef FEEDER_LENGTH_CALCULATION
@@ -642,11 +645,12 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
{
c++;
}
- if ((index == WINDER_2_MOTOR)||(index == WINDER_3_MOTOR))
+ //if ((index == WINDER_2_MOTOR)||(index == WINDER_3_MOTOR)||(index == WINDER_4_MOTOR))
+ /*if (index >= WINDER_MOTOR)
{
//pooler dancer is right sided: data is opposite
TranslatedReadValue = (-1*TranslatedReadValue);
- }
+ }*/
#endif
if (index == POOLER_MOTOR)
{
@@ -738,12 +742,12 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*CurrentControlledSpeed[index];
//if (0)//(JobCounter % 1000 == 0)
#ifdef FOUR_WINDERS
- if (JobCounter % 500 < 4)//(FirstCalcInJob == true)
+ if (0)//(JobCounter % 500 < 7)//(FirstCalcInJob == true)
{
if (index >= WINDER_MOTOR)
{
// FirstCalcInJob = false;
- len = usnprintf(ATMessage[index], 150, "index %d read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d",index,
+ len = usnprintf(ATMessage[index], 150, "index %d read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d",index-WINDER_MOTOR+1,
TranslatedReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000),
(int)(MotorControlConfig[index].m_integral*1000000000),(int)((MotorControlConfig[index].m_mesuredParam*MotorControlConfig[index].m_params.dt)*1000000000),
(int)(MotorControlConfig[index].m_calculatedError*1000),(int)calculated_speed, (int)(InitialDryerSpeed*100/OriginalMotorSpd_2PPS[DRYER_MOTOR]));
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 4205e5246..8f5c67f96 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -41,6 +41,7 @@ using RealTimeGraphX.WPF;
using Tango.Core.ExtensionMethods;
using System.Diagnostics;
using Tango.BL.Builders;
+using Tango.Core;
namespace Tango.MachineStudio.Technician.ViewModels
{
@@ -83,6 +84,9 @@ namespace Tango.MachineStudio.Technician.ViewModels
private DateTime _diagnosticsStartTime;
private DateTime _diagnosticsNowTime;
+ private ProducerConsumerQueue<StartDiagnosticsResponse> _framesQueue;
+ private Thread _populateFramesThread;
+
#region Properties
private ObservableCollection<MachineTechTabVM> _tabs;
@@ -314,6 +318,8 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="notificationProvider">The notification provider.</param>
public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger)
{
+ _framesQueue = new ProducerConsumerQueue<StartDiagnosticsResponse>();
+
Tabs = new ObservableCollection<MachineTechTabVM>();
Tabs.Add(new MachineTechTabVM() { IsSelected = true, Name = "Untitled" });
SelectedTab = Tabs.First();
@@ -448,13 +454,22 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="response">The response.</param>
private void DiagnosticsFrameProvider_FrameReceived(object sender, StartDiagnosticsResponse response)
{
- PopulateDiagnosticsData(response);
+ _framesQueue.BlockEnqueue(response);
}
#endregion
#region Populate Diagnostics Data
+ private void PopulateFramesThreadMethod()
+ {
+ while (!ApplicationManager.IsShuttingDown)
+ {
+ var frame = _framesQueue.BlockDequeue();
+ PopulateDiagnosticsData(frame);
+ }
+ }
+
/// <summary>
/// Populates the diagnostics data to the proper elements.
/// </summary>
@@ -2308,7 +2323,12 @@ namespace Tango.MachineStudio.Technician.ViewModels
public override void OnApplicationReady()
{
-
+ if (_populateFramesThread == null)
+ {
+ _populateFramesThread = new Thread(PopulateFramesThreadMethod);
+ _populateFramesThread.IsBackground = true;
+ _populateFramesThread.Start();
+ }
}
#endregion
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
index 883d3f893..b87f14b89 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml.cs
@@ -30,7 +30,7 @@ namespace Tango.PPC.UI.Views
{
public static LayoutView Instance { get; private set; }
private LayoutViewVM _vm;
- private DispatcherTimer _timer;
+ private System.Timers.Timer _timer;
public LayoutView()
{
@@ -39,9 +39,9 @@ namespace Tango.PPC.UI.Views
Loaded += (_, __) => _vm = DataContext as LayoutViewVM;
techPressElement.RegisterForPreviewMouseOrTouchDown(OnMouseOrTouchDown);
techPressElement.RegisterForPreviewMouseOrTouchUp(OnMouseOrTouchUp);
- _timer = new DispatcherTimer();
- _timer.Interval = TimeSpan.FromSeconds(10);
- _timer.Tick += _timer_Tick;
+ _timer = new System.Timers.Timer();
+ _timer.Interval = TimeSpan.FromSeconds(10).TotalMilliseconds;
+ _timer.Elapsed += _timer_Elapsed;
this.PreviewMouseUp += LayoutView_PreviewMouseUp;
}
@@ -51,10 +51,14 @@ namespace Tango.PPC.UI.Views
_vm.ApplicationManager.ResetScreenLockTimer();
}
- private void _timer_Tick(object sender, EventArgs e)
+ private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
_timer.Stop();
- _vm.ToggleTechnicianMode();
+
+ Dispatcher.BeginInvoke(new Action(() =>
+ {
+ _vm.ToggleTechnicianMode();
+ }));
}
private void OnMouseOrTouchDown(object sender, MouseOrTouchEventArgs e)
diff --git a/Software/Visual_Studio/Tango.CSV/CsvFile.cs b/Software/Visual_Studio/Tango.CSV/CsvFile.cs
index f925c0017..9b1d23bb3 100644
--- a/Software/Visual_Studio/Tango.CSV/CsvFile.cs
+++ b/Software/Visual_Studio/Tango.CSV/CsvFile.cs
@@ -73,6 +73,18 @@ namespace Tango.CSV
}
/// <summary>
+ /// Gets the columns.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="csvSource">The CSV source.</param>
+ /// <returns></returns>
+ public static IEnumerable<string> GetColumns<T>(CsvSource csvSource) where T : new()
+ {
+ var csvFileReader = new CsvFileReader<T>(csvSource);
+ return csvFileReader.Columns;
+ }
+
+ /// <summary>
/// Gets the field separator.
/// </summary>
/// <value>
@@ -94,7 +106,7 @@ namespace Tango.CSV
/// <value>
/// The columns.
/// </value>
- public IEnumerable<String> Columns { get; private set; }
+ public IEnumerable<String> Columns { get; protected set; }
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
diff --git a/Software/Visual_Studio/Tango.CSV/CsvFileReader.cs b/Software/Visual_Studio/Tango.CSV/CsvFileReader.cs
index ec5b07630..79f716aab 100644
--- a/Software/Visual_Studio/Tango.CSV/CsvFileReader.cs
+++ b/Software/Visual_Studio/Tango.CSV/CsvFileReader.cs
@@ -35,6 +35,8 @@ namespace Tango.CSV
private readonly char textQualifier;
private readonly StringBuilder parseFieldResult = new StringBuilder();
+
+
/// <summary>
/// Initializes a new instance of the <see cref="CsvFileReader{T}"/> class.
/// </summary>
@@ -420,6 +422,7 @@ namespace Tango.CSV
break;
}
this.columns = readColumns.ToArray();
+ Columns = this.columns;
}
/// <summary>
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs
new file mode 100644
index 000000000..54431968f
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs
@@ -0,0 +1,74 @@
+using OxyPlot;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.DispenserAnalyzer.UI.Analysis
+{
+ public class AnalyzerResultChartData : ExtendedObject
+ {
+ public ObservableCollection<DataPoint> Points { get; set; }
+
+ public string Title { get; set; }
+
+ private int _step;
+ public int XStep
+ {
+ get { return _step; }
+ set { _step = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _fromXAxis;
+ public double FromXAxis
+ {
+ get { return _fromXAxis; }
+ set { _fromXAxis = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _toXAxis;
+ public double ToXAxis
+ {
+ get { return _toXAxis; }
+ set { _toXAxis = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _fromYAxis;
+ public double FromYAxis
+ {
+ get { return _fromYAxis; }
+ set { _fromYAxis = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _toYAxis;
+ public double ToYAxis
+ {
+ get { return _toYAxis; }
+ set { _toYAxis = value; RaisePropertyChangedAuto(); }
+ }
+
+ public void UpdateData()
+ {
+ _toYAxis = Points.Max(x => x.Y) + 2;
+ _fromYAxis = Points.Min(x => x.Y) - 1;
+ _toXAxis = Points.Max(x => x.X);
+ _fromXAxis = Points.Min(x => x.X);
+
+ RaisePropertyChanged("Title");
+ RaisePropertyChanged("Points");
+ }
+
+ public AnalyzerResultChartData()
+ {
+ Points = new ObservableCollection<DataPoint>();
+ _fromYAxis = 0;
+ _fromXAxis = 0;
+ _toYAxis = 1;
+ _toXAxis = 1;
+ XStep = 1;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs
index 0bebb4f11..0dbf9a83e 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalysisService.cs
@@ -4,24 +4,37 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using Tango.CSV;
+using Tango.DispenserAnalyzer.UI.Models;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.IO;
namespace Tango.DispenserAnalyzer.UI.Analysis
{
public class AnalysisService
{
- public static IAnalyzer GetAnalyzer(String fileName)
+ public static dynamic GetAnalyzer(String fileName)
{
- var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IAnalyzer).IsAssignableFrom(x)).ToList();
- // var words = fileName.Split().Select(x => x.Trim(' '));
- var analyzerType = analyzerTypes.FirstOrDefault(x => fileName.IndexOf(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) >= 0);
- return (analyzerType != null) ? Activator.CreateInstance(analyzerType) as IAnalyzer : null;
+ string filename = Path.GetFileNameWithoutExtension(fileName);
+
+ var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IBaseAnalyzer).IsAssignableFrom(x)).ToList();
+ var analyzerType = analyzerTypes.FirstOrDefault(x => filename.StartsWith(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) );
+ if(analyzerType == null)
+ {//in case name of test is not first word
+ analyzerType = analyzerTypes.FirstOrDefault(x => filename.IndexOf(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) >= 0);
+ }
+
+ return (analyzerType != null) ? Activator.CreateInstance(analyzerType) : null;
}
public static string GetTestName(String fileName)
{
- var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IAnalyzer).IsAssignableFrom(x)).ToList();
- var analyzerType = analyzerTypes.SingleOrDefault(x => fileName.Contains(x.GetCustomAttribute<AnalyzerAttribute>().Name));
+ var analyzerTypes = typeof(AnalysisService).Assembly.GetTypes().Where(x => typeof(IBaseAnalyzer).IsAssignableFrom(x)).ToList();
+ var analyzerType = analyzerTypes.FirstOrDefault(x => fileName.IndexOf(x.GetCustomAttribute<AnalyzerAttribute>().Name, StringComparison.OrdinalIgnoreCase) >= 0);
+
return analyzerType.GetCustomAttribute<AnalyzerAttribute>().Name;
}
}
+
}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs
index d3d217409..bc82d2215 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyzerResultBase.cs
@@ -15,7 +15,7 @@ namespace Tango.DispenserAnalyzer.UI.Analysis
public class AnalyzerResultBase : ExtendedObject, IAnalyzerResult
{
public AnalyzerResultValue Result { get; set; }
- public List<AnalysisPlotValue> PlotValues { get; set; }
+ // public List<AnalysisPlotValue> PlotValues { get; set; }
//public ObservableCollection<DataPoint> Points { get; set; }
public List<AnalyzerResultProperty> Properties
@@ -53,17 +53,22 @@ namespace Tango.DispenserAnalyzer.UI.Analysis
}
public bool IsShowPlotResult { get; set; }
- public AnalyzerResultPlotData RangeToCountChart { get; set; }
- public AnalyzerResultPlotData RangeToTimeChart { get; set; }
+ public bool IsShowLineChartResult { get; set; }
+ public AnalyzerResultChartData RangeToCountChart { get; set; }
+ public AnalyzerResultChartData RangeToTimeChart { get; set; }
+ public AnalyzerResultChartData LineChart { get; set; }
public bool BackgroundMode { get; set; }
+
public AnalyzerResultBase()
{
- PlotValues = new List<AnalysisPlotValue>();
+ //PlotValues = new List<AnalysisPlotValue>();
Result = AnalyzerResultValue.Undetermined;
IsShowPlotResult = false;
- RangeToCountChart = new AnalyzerResultPlotData();
- RangeToTimeChart = new AnalyzerResultPlotData();
+ IsShowLineChartResult = false;
+ RangeToCountChart = new AnalyzerResultChartData();
+ RangeToTimeChart = new AnalyzerResultChartData();
+ LineChart = new AnalyzerResultChartData();
BackgroundMode = false;
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs
new file mode 100644
index 000000000..8bb519425
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/DispenserReader.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.CSV;
+using Tango.DispenserAnalyzer.UI.Models;
+using OxyPlot.Annotations;
+using System.Windows.Media;
+using System.Diagnostics;
+
+namespace Tango.DispenserAnalyzer.UI.Analysis
+{
+ public class DispenserReader: IReader<DispenserSample>
+ {
+ public List<DispenserSample> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations)
+ {
+ List<DispenserCsvRow> data = CsvFile.Read<DispenserCsvRow>(new CsvSource(filePath)).ToList();
+ List<DispenserSample> samples = new List<DispenserSample>();
+ int index = 0;
+ int last_labelIndex = 0;
+ foreach (var item in data)
+ {
+ double pressure = 0;
+ if (item.Label == "Label")
+ {
+ item.Pressure = "0";
+ item.Command = "Label";
+ if (last_labelIndex == 0 || last_labelIndex < (index + 5))
+ {
+ last_labelIndex = index;
+
+ OxyPlot.Wpf.LineAnnotation _line = new OxyPlot.Wpf.LineAnnotation()
+ {
+ StrokeThickness = 1,
+ Color = Color.FromRgb(255, 5, 5),
+ Type = LineAnnotationType.Vertical,
+ Text = index.ToString(),
+ X = index,
+ };
+ annotations.Add(_line);
+
+ }
+ }
+ if (double.TryParse(item.Pressure, out pressure) || !String.IsNullOrWhiteSpace(item.Command))
+ {
+ samples.Add(new DispenserSample()
+ {
+ Pressure = pressure,
+ Command = String.IsNullOrWhiteSpace(item.Command) ? null : item.Command,
+ Index = index
+ });
+ index++;
+ }
+ }
+ return samples;
+ }
+
+ public List<string> GetTitles(String filePath)
+ {
+ string xAxistitle = "Time[msec]";
+ string yAxistitle = "Pressure [mbar]";
+ return new List<string>() { xAxistitle, yAxistitle };
+ }
+
+ public bool PrintResultsToPDFFile()
+ {
+ return true ;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs
index 6d522da82..fd3b3c267 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzer.cs
@@ -7,9 +7,24 @@ using Tango.DispenserAnalyzer.UI.Models;
namespace Tango.DispenserAnalyzer.UI.Analysis
{
+ [Analyzer("BaseInterface")]
+ public interface IBaseAnalyzer
+ {
+
+ }
[Analyzer("INTERFACE")]
- public interface IAnalyzer
+ public interface IAnalyzer<T>: IBaseAnalyzer
+ {
+ IReader<T> Reader { get; set; }
+ Task<List<IAnalyzerResult>> Process(List<T> csvRows, bool backgroundMode);
+ void GetPoints(List<T> samples, IList<OxyPlot.DataPoint> points);
+ }
+ [Analyzer("DISPENSERINTERFACE")]
+ public interface IDispenserDispenserAnalyser : IAnalyzer<DispenserSample>
+ {
+ }
+ [Analyzer("PROCESSINTERFACE")]
+ public interface IProcessAnalyzer : IAnalyzer<ProcessSample>
{
- Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode);
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs
index 60f7fcb36..5203828e5 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs
@@ -5,62 +5,17 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Tango.Core;
namespace Tango.DispenserAnalyzer.UI.Analysis
{
- public class AnalyzerResultPlotData: ExtendedObject
- {
- public ObservableCollection<DataPoint> Points { get; set; }
-
- public string Title { get; set; }
-
- private int _step;
- public int XStep
- {
- get { return _step; }
- set { _step = value; RaisePropertyChangedAuto(); }
- }
-
- private double _from;
- public double From
- {
- get { return _from; }
- set { _from = value; RaisePropertyChangedAuto(); }
- }
-
- private double _to;
- public double To
- {
- get { return _to; }
- set { _to = value; RaisePropertyChangedAuto(); }
- }
-
- public void UpdateData()
- {
- _to = Points.Max(x => x.Y) + 2;
- _from = Points.Min(x => x.Y)-1;
- RaisePropertyChanged("Title");
- RaisePropertyChanged("Points");
- }
-
- public AnalyzerResultPlotData()
- {
- Points = new ObservableCollection<DataPoint>();
- _from = 0;
- _to = 1;
- XStep = 1;
- }
-
- }
public interface IAnalyzerResult
{
AnalyzerResultValue Result { get; set; }
bool BackgroundMode { get; set; }
- List<AnalysisPlotValue> PlotValues { get; set; }
-
- AnalyzerResultPlotData RangeToCountChart { get; set; }
- AnalyzerResultPlotData RangeToTimeChart { get; set; }
+ //List<AnalysisPlotValue> PlotValues { get; set; }
+
+ //AnalyzerResultChartData RangeToCountChart { get; set; }
+ //AnalyzerResultChartData RangeToTimeChart { get; set; }
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs
new file mode 100644
index 000000000..35c7f8f76
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IReader.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DispenserAnalyzer.UI.Analysis
+{
+ public interface IReader<T>
+ {
+ List<T> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations);
+
+ List<string> GetTitles(String filePath);
+
+ bool PrintResultsToPDFFile();
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs
new file mode 100644
index 000000000..b2e6f0388
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/ProcessReader.cs
@@ -0,0 +1,116 @@
+using OxyPlot;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.CSV;
+using Tango.DispenserAnalyzer.UI.Models;
+using OxyPlot.Annotations;
+using System.Windows.Media;
+
+
+namespace Tango.DispenserAnalyzer.UI.Analysis
+{
+ public class ProcessReader: IReader<ProcessSample>
+ {
+ public List<ProcessSample> ReadScvFile(String filePath, List<OxyPlot.Wpf.LineAnnotation> annotations)
+ {
+ List<ProcessSample> samples = new List<ProcessSample>();
+ try
+ {
+ List<ProcessCsvRow> data = CsvFile.Read<ProcessCsvRow>(new CsvSource(filePath)).ToList();
+
+ double index = 0;
+ double delta = 0;
+ if (data.Count > 2)
+ {
+ DateTime time1;
+ DateTime time2;
+ if (DateTime.TryParse(data[0].Time, out time1) && DateTime.TryParse(data[1].Time, out time2))
+ {
+ int m1 = time1.Millisecond;
+ int m2 = time2.Millisecond;
+ delta = (time2 - time1).Milliseconds / 100;
+ }
+ }
+ delta = Settings.GetValueByName(AnalyzerSettingsEnum.TimeInterval);
+ if(delta == 0)
+ return samples;
+
+ int endPoint = (int)(Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation) / delta);
+ foreach (var item in data)
+ {
+ double dValue = 0;
+
+ if (double.TryParse(item.Value, out dValue))
+ {
+ DateTime time;
+ DateTime.TryParse(item.Time, out time);
+ int mil = time.Millisecond;
+ samples.Add(new ProcessSample()
+ {
+ Time = time,
+ Value = dValue,
+ TimeIntervalSec = index,
+ });
+ index += delta;
+ }
+ }
+ OxyPlot.Wpf.LineAnnotation _line1 = new OxyPlot.Wpf.LineAnnotation()
+ {
+ StrokeThickness = 1,
+ Color = Color.FromRgb(255, 5, 5),
+ Type = LineAnnotationType.Vertical,
+ Text = index.ToString(),
+ X = Settings.GetValueByName(AnalyzerSettingsEnum.StartCalculation)
+ };
+ annotations.Add(_line1);
+ OxyPlot.Wpf.LineAnnotation _line2 = new OxyPlot.Wpf.LineAnnotation()
+ {
+ StrokeThickness = 1,
+ Color = Color.FromRgb(255, 5, 5),
+ Type = LineAnnotationType.Vertical,
+ Text = index.ToString(),
+ X = Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation)
+ };
+ annotations.Add(_line2);
+
+
+ return samples;
+ }
+ catch (Exception ex)
+ {
+ Debug.Write("Exception in ProcessReader ReadScvFile" + ex.Message);
+ return samples;
+ }
+ }
+
+ public List<string> GetScvColumns(String filePath)
+ {
+ try
+ {
+ return CsvFile.GetColumns<ProcessCsvRow>(new CsvSource(filePath)).ToList();
+ }
+ catch (Exception ex)
+ {
+ Debug.Write("Exception in ProcessReader ReadScvFile" + ex.Message);
+ return null;
+ }
+ }
+
+ public List<string> GetTitles(String filePath)
+ {
+ List<string> columns = GetScvColumns(filePath);
+ string xAxistitle = "Time [sec]";
+ string yAxistitle = columns!= null && columns.Count > 1 ? columns[1] : "Values";
+ return new List<string>() { xAxistitle, yAxistitle };
+ }
+
+ public bool PrintResultsToPDFFile()
+ {
+ return false;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/DynamicSealingAnalyzer.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/DynamicSealingAnalyzer.cs
index 8acd1651c..d440f42c3 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/DynamicSealingAnalyzer.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/DynamicSealingAnalyzer.cs
@@ -10,8 +10,19 @@ using Tango.DispenserAnalyzer.UI.Models;
namespace Tango.DispenserAnalyzer.UI.Analyzers
{
[Analyzer("dynamic")]
- public class DynamicSealingAnalzyer : IAnalyzer
+ public class DynamicSealingAnalzyer : IDispenserDispenserAnalyser
{
+ private IReader<DispenserSample> _reader;
+ public IReader<DispenserSample> Reader
+ {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+ public DynamicSealingAnalzyer()
+ {
+ Reader = new DispenserReader();
+ }
+
public Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode)
{
return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
@@ -61,6 +72,16 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
return results;
});
}
+
+ public void GetPoints(List<DispenserSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ if (x.Pressure != 0.0)
+ { points.Add(new OxyPlot.DataPoint(x.Index, x.Pressure)); }
+ });
+ }
+
public class DynamicSealingAnalyzerResult : AnalyzerResultBase
{
[Description("Dynamic sealing result")]
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs
index 492fb3e6a..81c578e5c 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs
@@ -19,15 +19,28 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
{
[Analyzer("flow")]
- public class FlowAnalyser : IAnalyzer
+ public class FlowAnalyser : IDispenserDispenserAnalyser
{
+ private IReader<DispenserSample> _reader;
+ public IReader<DispenserSample> Reader
+ {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+
+
+ public FlowAnalyser()
+ {
+ Reader = new DispenserReader();
+ }
+
public Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode)
{
return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
{
List<IAnalyzerResult> results = new List<IAnalyzerResult>();
List<DispenserSample> commands = csvRows.Where(x => x.Command != null && x.Command.ToLower().Contains("label")).ToList<DispenserSample>();
- var pairs = commands.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index / 2).Select(x => x.Select(v => v.Value).ToList()).ToList();
+ var pairs = commands.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index/2 ).Select(x => x.Select(v => v.Value).ToList()).ToList();
MovingAverageFilter filter = new MovingAverageFilter();
int flowtestNumber = 0;
for (int index = 0; index < pairs.Count(); index++)
@@ -101,6 +114,16 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
return results;
});
}
+
+ public void GetPoints(List<DispenserSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ if (x.Pressure != 0.0)
+ { points.Add(new OxyPlot.DataPoint(x.Index, x.Pressure)); }
+ });
+ }
+
public class FlowAverageAnalyzerResult : AnalyzerResultBase
{
[Description("Average Value")]
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PressureBuildUpAnalyser.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PressureBuildUpAnalyser.cs
index 79b643294..9288eb2ad 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PressureBuildUpAnalyser.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PressureBuildUpAnalyser.cs
@@ -9,8 +9,19 @@ using Tango.DispenserAnalyzer.UI.Models;
namespace Tango.DispenserAnalyzer.UI.Analyzers
{
[Analyzer("pressure build up")]
- public class PressureBuildUpAnalyser : IAnalyzer
+ public class PressureBuildUpAnalyser : IDispenserDispenserAnalyser
{
+ private IReader<DispenserSample> _reader;
+ public IReader<DispenserSample> Reader
+ {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+
+ public PressureBuildUpAnalyser()
+ {
+ Reader = new DispenserReader();
+ }
public Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode)
{
return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
@@ -36,6 +47,15 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
return results;
});
}
+
+ public void GetPoints(List<DispenserSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ if (x.Pressure != 0.0)
+ { points.Add(new OxyPlot.DataPoint(x.Index, x.Pressure)); }
+ });
+ }
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PrimingAnalyzer.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PrimingAnalyzer.cs
index cfd4a7b55..315c384d6 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PrimingAnalyzer.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/PrimingAnalyzer.cs
@@ -11,8 +11,19 @@ using Tango.DispenserAnalyzer.UI.Models;
namespace Tango.DispenserAnalyzer.UI.Analyzers
{
[Analyzer("priming")]
- public class PrimingAnalyzer : IAnalyzer
+ public class PrimingAnalyzer : IDispenserDispenserAnalyser
{
+ private IReader<DispenserSample> _reader;
+ public IReader<DispenserSample> Reader
+ {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+
+ public PrimingAnalyzer()
+ {
+ Reader = new DispenserReader();
+ }
public Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode)
{
return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
@@ -35,6 +46,15 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
return results;
});
}
+
+ public void GetPoints(List<DispenserSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ if (x.Pressure != 0.0)
+ { points.Add(new OxyPlot.DataPoint(x.Index, x.Pressure)); }
+ });
+ }
}
public class PrimingAnalyzerResult : AnalyzerResultBase
{
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/ProcessAnalyser.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/ProcessAnalyser.cs
new file mode 100644
index 000000000..65fe9c85d
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/ProcessAnalyser.cs
@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.CSV;
+using Tango.DispenserAnalyzer.UI.Analysis;
+using Tango.DispenserAnalyzer.UI.Models;
+
+namespace Tango.DispenserAnalyzer.UI.Analyzers
+{
+ [Analyzer("process")]
+ public class ProcessAnalyser : IProcessAnalyzer
+ {
+ private IReader<ProcessSample> _reader;
+ public IReader<ProcessSample> Reader {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+
+ public ProcessAnalyser()
+ {
+ Reader = new ProcessReader();
+ }
+
+ public Task<List<IAnalyzerResult>> Process(List<ProcessSample> csvRows, bool backgroundMode)
+ {
+ return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
+ {
+ List<IAnalyzerResult> results = new List<IAnalyzerResult>();
+ ProcessAnalyzerResult result = new ProcessAnalyzerResult();
+ result.BackgroundMode = backgroundMode;
+ double delta = Settings.GetValueByName(AnalyzerSettingsEnum.TimeInterval);
+ int startPoint = delta == 0? 0 : (int)(Settings.GetValueByName(AnalyzerSettingsEnum.StartCalculation) / delta);
+ int endPoint = delta == 0 ? (csvRows.Count -1) : (int)(Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation) / delta);
+ List<ProcessSample> rangeValues = csvRows.Skip(startPoint).Take(endPoint).ToList();
+
+ result.MinValue = rangeValues.Min(x => x.Value);
+ result.MaxValue = rangeValues.Max(x => x.Value);
+ result.AverageValue = rangeValues.Average(x => x.Value);
+ result.StandardDeviation = ProcessAnalyser.StdDev(rangeValues.Select(x => x.Value));
+
+ result.Result = AnalyzerResultValue.Passed;
+
+ //Move Average data
+ List<Task> tasks = new List<Task>();
+ int calc_count = (int)csvRows.Count() / 4;
+ int start_index = 0;
+ while (start_index < csvRows.Count())
+ {
+ int calc_amount = (start_index + calc_count) >= (csvRows.Count() - 4) ? csvRows.Count() - start_index : calc_count;
+ var source_filter = csvRows.Skip(start_index).Take(calc_amount).ToList();
+ tasks.Add(Task.Run(() =>
+ {
+ ProcessAnalyser.Filtering(source_filter);
+ }));
+ start_index += calc_amount;
+ }
+ Task.WaitAll(tasks.ToArray());
+
+ result.CreateMovingAvgGraph(csvRows);
+ results.Add(result);
+ return results;
+ });
+ }
+
+ public static double StdDev(IEnumerable<double> values)
+ {
+ double avg = values.Average();
+ double sum = values.Sum(v => (v - avg) * (v - avg));
+ double denominator = values.Count() - 1;
+ return denominator > 0.0 ? Math.Sqrt(sum / denominator) : -1;
+ }
+ public static void Filtering(List<ProcessSample> source)
+ {
+ int periodAverage = (int)Settings.GetValueByName(AnalyzerSettingsEnum.MovingAvg);
+ int count = (source.Count < periodAverage) ? source.Count : source.Count - periodAverage;
+ for (int i = 0; i < count; i++)
+ {
+ source[i].Value = source.Skip(i).Take(periodAverage).Average(x => x.Value);
+ }
+ }
+
+ public void GetPoints(List<ProcessSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ points.Add(new OxyPlot.DataPoint(x.TimeIntervalSec, x.Value));
+ });
+ }
+
+ }
+
+ public class ProcessAnalyzerResult : AnalyzerResultBase
+ {
+ [Description("Selected Area")]
+ public string Header { get; set; }
+
+ [Description("Average Value")]
+ public double AverageValue { get; set; }
+ [Description("Max value")]
+ public double MaxValue { get; set; }
+ [Description("Min value")]
+ public double MinValue { get; set; }
+ [Description("Standard deviation value")]
+ public double StandardDeviation { get; set; }
+
+
+ public ProcessAnalyzerResult()
+ {
+ double from = Settings.GetValueByName(AnalyzerSettingsEnum.StartCalculation);
+ double to = Settings.GetValueByName(AnalyzerSettingsEnum.EndCalculation);
+ Header = $"from {from} to {to} seconds";
+ AverageValue = MaxValue = MinValue = 0.0;
+ Result = AnalyzerResultValue.Undetermined;
+ IsShowLineChartResult = true;
+ }
+
+ public void CreateMovingAvgGraph(List<ProcessSample> avgValues)
+ {
+ if (!BackgroundMode)
+ {
+ var points = LineChart.Points;
+ points.Clear();
+ avgValues.ForEach(x =>
+ {
+ points.Add(new OxyPlot.DataPoint(x.TimeIntervalSec, x.Value));
+ });
+
+ LineChart.Title = $"Moving Average Values";
+ LineChart.UpdateData();
+ }
+ }
+
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/SealingAnalyzer.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/SealingAnalyzer.cs
index e1fe232c3..841101b10 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/SealingAnalyzer.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/SealingAnalyzer.cs
@@ -10,8 +10,19 @@ using Tango.DispenserAnalyzer.UI.Models;
namespace Tango.DispenserAnalyzer.UI.Analyzers
{
[Analyzer("sealtest")]
- public class SealingAnalyzer : IAnalyzer
+ public class SealingAnalyzer : IDispenserDispenserAnalyser
{
+ private IReader<DispenserSample> _reader;
+ public IReader<DispenserSample> Reader
+ {
+ get { return _reader; }
+ set { _reader = value; }
+ }
+
+ public SealingAnalyzer()
+ {
+ Reader = new DispenserReader();
+ }
public Task<List<IAnalyzerResult>> Process(List<DispenserSample> csvRows, bool backgroundMode)
{
return Task.Factory.StartNew<List<IAnalyzerResult>>(() =>
@@ -38,6 +49,15 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers
return results;
});
}
+
+ public void GetPoints(List<DispenserSample> samples, IList<OxyPlot.DataPoint> points)
+ {
+ samples.ForEach(x =>
+ {
+ if (x.Pressure != 0.0)
+ { points.Add(new OxyPlot.DataPoint(x.Index, x.Pressure)); }
+ });
+ }
}
public class SealingAnalyzerResult : AnalyzerResultBase
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml
index e56ae6639..595d74e3d 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml
@@ -48,33 +48,34 @@
</Grid>
<Grid Grid.Row="2">
<Border BorderBrush="Silver" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10">
- <Expander Header="{Binding TestName}" IsExpanded="True">
- <!--<lvc:CartesianChart LegendLocation="Bottom" DisableAnimations="True" DataTooltip="{x:Null}" Hoverable="False" >
- <lvc:CartesianChart.Series>
- <lvc:LineSeries Values="{Binding Values}" PointGeometry="{x:Null}" Title="{Binding TestName}"/>
- </lvc:CartesianChart.Series>
- <lvc:CartesianChart.AxisX>
- <lvc:Axis Title="TIME" Foreground="Silver" Labels="{Binding Labels}">
- <lvc:Axis.Separator>
- <lvc:Separator Stroke="#A5A5A5" Step="{Binding XStep}"/>
- </lvc:Axis.Separator>
- </lvc:Axis>
- </lvc:CartesianChart.AxisX>
- <lvc:CartesianChart.AxisY>
- <lvc:Axis Title="PRESSURE" LabelFormatter="{Binding YFormatter}" MinValue="{Binding From, Mode=TwoWay}" MaxValue="{Binding To, Mode=TwoWay}" Foreground="Silver" FontSize="16" >
- <lvc:Axis.Separator>
- <lvc:Separator Stroke="#B0B0B0" />
- </lvc:Axis.Separator>
- </lvc:Axis>
- </lvc:CartesianChart.AxisY>
- </lvc:CartesianChart>-->
- <oxy:Plot Title="{Binding TestName}" x:Name="PressurePlot" Height="300">
+ <Expander IsExpanded="True">
+ <Expander.Header>
+ <Grid >
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*" />
+ <ColumnDefinition Width="auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock Padding="0" Text="{Binding TestName}" Margin="10,0,0,0" VerticalAlignment="Center" FontWeight="DemiBold"/>
+ <materialDesign:PackIcon Grid.Column="1" Kind="Information" Width="24" Height="24" VerticalAlignment="Center" Foreground="#03A9F4" Background="Transparent">
+ <materialDesign:PackIcon.ToolTip>
+ <TextBlock>
+ <Run Text="Panning: CTRL + RIGHT CLICK and select area;"></Run>
+ <LineBreak/>
+ <Run Text="Zooming: MOUSE WHEEL on Axis Area;"></Run>
+ <LineBreak/>
+ <Run Text="Reset all : CTRL + DOUBLE RIGHT CLICK;"></Run>
+ </TextBlock>
+ </materialDesign:PackIcon.ToolTip>
+ </materialDesign:PackIcon>
+ </Grid>
+ </Expander.Header>
+ <oxy:Plot Title="{Binding TestName}" x:Name="PressurePlot" Height="300">
<oxy:Plot.Series >
<oxy:LineSeries ItemsSource="{Binding Points}" Color="#73B6EC" MarkerType="None"/>
</oxy:Plot.Series>
<oxy:Plot.Axes>
- <oxy:LinearAxis Position="Bottom" Title = "Time [msec]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True"/>
- <oxy:LinearAxis Position="Left" Title = "Pressure [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding From}" Maximum="{Binding To}"/>
+ <oxy:LinearAxis Position="Bottom" Title = "{Binding TitleAxisBottom}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True"/>
+ <oxy:LinearAxis Position="Left" Title = "{Binding TitleAxisLeft}" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding From}" Maximum="{Binding To}"/>
</oxy:Plot.Axes>
</oxy:Plot>
</Expander>
@@ -130,7 +131,27 @@
</oxy:Plot.Series>
<oxy:Plot.Axes>
<oxy:LinearAxis Position="Bottom" Title = "Location" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True"/>
- <oxy:LinearAxis Position="Left" Title = "Max-min \ range [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding RangeToTimeChart.From}" Maximum="{Binding RangeToTimeChart.To}"/>
+ <oxy:LinearAxis Position="Left" Title = "Max-min \ range [mbar]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" Minimum="{Binding RangeToTimeChart.FromYAxis}" Maximum="{Binding RangeToTimeChart.ToYAxis}"/>
+ </oxy:Plot.Axes>
+ </oxy:Plot>
+ </StackPanel>
+ </Border>
+ <Border x:Name="ChartBorder" BorderBrush="Silver" Padding="2" BorderThickness="1" CornerRadius="5" Margin="10" Visibility="{Binding IsShowLineChartResult, Converter={StaticResource BooleanToVisibilityConverter}}" MinHeight="300">
+ <StackPanel Orientation="Vertical" x:Name="ChartStackPanel">
+ <!--<StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center">MinDisplayValue</TextBlock>
+ <TextBox VerticalAlignment="Center" Margin="10 0 30 0" x:Name="MinFilter" Text="{Binding LineChart.FromXAxis, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Delay=10}" FontWeight="DemiBold" FontSize="14" Foreground="Blue"></TextBox>
+ <TextBlock VerticalAlignment="Center" >MaxDisplayValue</TextBlock>
+ <TextBox Margin="10 0 10 0" x:Name="MaxFilter" Text="{Binding LineChart.ToXAxis,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=10}" FontWeight="DemiBold" FontSize="14" Foreground="Blue"></TextBox>
+ </StackPanel>-->
+ <oxy:Plot x:Name="ChartProcess" Title="{Binding LineChart.Title}" LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" MinWidth="220" MinHeight="300">
+ <oxy:Plot.Series >
+ <oxy:LineSeries ItemsSource="{Binding LineChart.Points}" Color="#73B6EC" MarkerType="None"/>
+ </oxy:Plot.Series>
+
+ <oxy:Plot.Axes>
+ <oxy:LinearAxis Position="Bottom" Title = "Time [msec]" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" Minimum="{Binding LineChart.FromXAxis}" Maximum="{Binding LineChart.ToXAxis}"/>
+ <oxy:LinearAxis Position="Left" Title = "Value" MajorGridlineStyle="Solid" MinorGridlineStyle="Dot" IsZoomEnabled="True" />
</oxy:Plot.Axes>
</oxy:Plot>
</StackPanel>
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml.cs
index d328ea8a5..e7d263a1c 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml.cs
@@ -43,6 +43,10 @@ namespace Tango.DispenserAnalyzer.UI
for (int index = 0; index < filePathArr.Length; index++)
{
await _vm.GenerateInBackground(filePathArr[index]);
+ if(index < filePathArr.Length)
+ {
+ await Task.Delay(500);
+ }
}
}
await Task.Delay(500);
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/DispenserSample.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/DispenserSample.cs
index d1d37955d..899aaa600 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/DispenserSample.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/DispenserSample.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Tango.DispenserAnalyzer.UI.Models
{
- public class DispenserSample
+ public class DispenserSample: ISample
{
public double Pressure { get; set; }
public String Command { get; set; }
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ISample.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ISample.cs
new file mode 100644
index 000000000..ea374a846
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ISample.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DispenserAnalyzer.UI.Models
+{
+ public interface ISample
+ {
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessCsvRow.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessCsvRow.cs
new file mode 100644
index 000000000..33e85d5b5
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessCsvRow.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.CSV;
+
+namespace Tango.DispenserAnalyzer.UI.Models
+{
+ public class ProcessCsvRow
+ {
+ [CsvOrder(0)]
+ public String Time { get; set; }
+ [CsvOrder(1)]
+ public String Value { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessSample.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessSample.cs
new file mode 100644
index 000000000..3f02ea35d
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/ProcessSample.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.DispenserAnalyzer.UI.Models
+{
+ public class ProcessSample : ISample
+ {
+ public double TimeIntervalSec { get; set; }
+ public DateTime Time { get; set; }
+ public double Value { get; set; }
+
+ public ProcessSample()
+ {
+ Value = 0.0;
+ }
+
+ public override string ToString()
+ {
+ return $"{TimeIntervalSec}, {Value}";
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Settings.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Settings.cs
index 9a1f10aed..b8084b2d3 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Settings.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Settings.cs
@@ -9,7 +9,8 @@ namespace Tango.DispenserAnalyzer.UI
{
public enum AnalyzerSettingsEnum
{
- //Undetermined
+ [Description("Print Results to PDF file")]
+ PrintResultsToPDF,
[Description("PBU Pass fail")]
PBUPassFail,
[Description("PBU Pass fail")]
@@ -28,6 +29,15 @@ namespace Tango.DispenserAnalyzer.UI
MaxError,
[Description("Take off 'Max-min' values(out of highest results)")]
TakeOffMaxMin,
+ [Description("Time gap between data point [sec]")]
+ TimeInterval,
+ [Description("Time point to start calculation [sec]")]
+ StartCalculation,
+ [Description("Time point to end calculation [sec]")]
+ EndCalculation,
+ [Description("How many points to use for moving average")]
+ MovingAvg
+
}
@@ -39,7 +49,6 @@ namespace Tango.DispenserAnalyzer.UI
static Settings()
{
DefaultValues = new Dictionary<AnalyzerSettingsEnum, double>();
-
DefaultValues[AnalyzerSettingsEnum.PBUPassFail] = 4.5;
DefaultValues[AnalyzerSettingsEnum.FlowPBUPassFail] = 4.5;
DefaultValues[AnalyzerSettingsEnum.ExcludeAnalysis] = 1800;
@@ -49,17 +58,13 @@ namespace Tango.DispenserAnalyzer.UI
DefaultValues[AnalyzerSettingsEnum.MaxMinIntervals] = 300;
DefaultValues[AnalyzerSettingsEnum.MaxError] = 1.5;
DefaultValues[AnalyzerSettingsEnum.TakeOffMaxMin] = 3;
+ DefaultValues[AnalyzerSettingsEnum.TimeInterval] = 0.1;
+ DefaultValues[AnalyzerSettingsEnum.StartCalculation] = 600;
+ DefaultValues[AnalyzerSettingsEnum.EndCalculation] = 900;
+ DefaultValues[AnalyzerSettingsEnum.MovingAvg] = 50;
- CurrentValues = new Dictionary<AnalyzerSettingsEnum, double>();
- CurrentValues[AnalyzerSettingsEnum.PBUPassFail] = 4.5;
- CurrentValues[AnalyzerSettingsEnum.FlowPBUPassFail] = 4.5;
- CurrentValues[AnalyzerSettingsEnum.ExcludeAnalysis] = 1800;
- CurrentValues[AnalyzerSettingsEnum.AvgMinValue] = 1400;
- CurrentValues[AnalyzerSettingsEnum.AvgMaxValue] = 1850;
- CurrentValues[AnalyzerSettingsEnum.MaxMinRange] = 500;
- CurrentValues[AnalyzerSettingsEnum.MaxMinIntervals] = 300;
- CurrentValues[AnalyzerSettingsEnum.MaxError] = 1.5;
- CurrentValues[AnalyzerSettingsEnum.TakeOffMaxMin] = 3;
+ CurrentValues = new Dictionary<AnalyzerSettingsEnum, double>(DefaultValues);
+
}
public static double GetValueByName(AnalyzerSettingsEnum name)
{
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj
index b7db85ef8..5a261fb85 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj
@@ -15,7 +15,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
- <PublishUrl>P:\Users - Public\Ori\Dispenser Analyzer\</PublishUrl>
+ <PublishUrl>P:\Dispenser Analyzer Installer\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
@@ -29,8 +29,8 @@
<ProductName>Dispenser Analyser</ProductName>
<PublisherName>Twine</PublisherName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
- <ApplicationRevision>4</ApplicationRevision>
- <ApplicationVersion>2.1.1.%2a</ApplicationVersion>
+ <ApplicationRevision>2</ApplicationRevision>
+ <ApplicationVersion>3.1.1.%2a</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@@ -126,17 +126,22 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Analysis\AnalyserResultChartData.cs" />
<Compile Include="Analysis\AnalysisPlotValue.cs" />
<Compile Include="Analysis\AnalyzerResultProperty.cs" />
<Compile Include="Analysis\AnalyzerResultBase.cs" />
<Compile Include="Analysis\AnalyzerResultValue.cs" />
<Compile Include="Analysis\AnalysisService.cs" />
+ <Compile Include="Analysis\DispenserReader.cs" />
<Compile Include="Analysis\IAnalyzerResult.cs" />
<Compile Include="Analysis\IAnalyzer.cs" />
+ <Compile Include="Analysis\IReader.cs" />
+ <Compile Include="Analysis\ProcessReader.cs" />
<Compile Include="Analyzers\DynamicSealingAnalyzer.cs" />
<Compile Include="Analyzers\FlowAnalyser.cs" />
<Compile Include="Analyzers\PressureBuildUpAnalyser.cs" />
<Compile Include="Analyzers\PrimingAnalyzer.cs" />
+ <Compile Include="Analyzers\ProcessAnalyser.cs" />
<Compile Include="Analyzers\ReliabilityTestAnalyser.cs" />
<Compile Include="Analyzers\SealingAnalyzer.cs" />
<Compile Include="Analysis\AnalyzerAttribute.cs" />
@@ -144,6 +149,9 @@
<Compile Include="Models\DispenserCsvRow.cs" />
<Compile Include="Models\DispenserSample.cs" />
<Compile Include="Models\DispenserSampleCommand.cs" />
+ <Compile Include="Models\ISample.cs" />
+ <Compile Include="Models\ProcessCsvRow.cs" />
+ <Compile Include="Models\ProcessSample.cs" />
<Compile Include="Models\SettingsModel.cs" />
<Compile Include="Settings.cs" />
<Compile Include="ViewModels\MainWindowVM.cs" />
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml
index 2bfa2bba1..d8d4594b8 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml
@@ -6,7 +6,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:Tango.DispenserAnalyzer.UI.View"
mc:Ignorable="d"
- Title="Settings" Height="630" Width="800" FontSize="22" ResizeMode="NoResize" WindowStyle="ToolWindow" Closing="Window_Closing">
+ Title="Settings" Height="690" Width="800" FontSize="22" ResizeMode="NoResize" WindowStyle="ToolWindow" Closing="Window_Closing">
<Window.Resources>
<Style TargetType="{x:Type TextBlock}" x:Key="WrapText">
<Setter Property="TextWrapping" Value="Wrap"/>
@@ -18,7 +18,7 @@
<Setter Property="Padding" Value="0 0 0 0"></Setter>
<Setter Property="Margin" Value="8 0 0 0"></Setter>
<Setter Property="FontWeight" Value="SemiBold"/>
- <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="FontSize" Value="14"/>
</Style>
@@ -64,138 +64,149 @@
</Style.Triggers>
</Style>
- <Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
+ <Style x:Key="PropertyDataGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="BorderBrush" Value="#FF688CAF"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
</Style>
- <DataGrid x:Key="PropertyDataGrid" x:Shared="False" HorizontalAlignment="Left" VerticalScrollBarVisibility ="Auto" SelectionUnit="FullRow" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False"
- ItemsSource="{Binding .}" GridLinesVisibility="None" SelectionMode="Single" AlternatingRowBackground="#F6F6F6" FontSize="12" >
- <DataGrid.Columns>
- <DataGridTextColumn Header="Property Name" Binding="{Binding PropertyName}" Width="150" ElementStyle="{StaticResource WrapText}"/>
- <DataGridTemplateColumn Header="Property Value" Width="150">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
- <TextBox Text="{Binding PropertyValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Width="50" VerticalAlignment="Top">
- <TextBox.Style>
- <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
- <Setter Property="Visibility" Value="Visible"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsRangeVisible}" Value="true">
- <Setter Property="Visibility" Value="Collapsed"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TextBox.Style>
- </TextBox>
- <DockPanel HorizontalAlignment="Stretch" Width="150">
- <DockPanel.Style>
- <Style TargetType="{x:Type DockPanel}">
- <Setter Property="Visibility" Value="Collapsed"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsRangeVisible}" Value="true">
- <Setter Property="Visibility" Value="Visible"/>
- </DataTrigger>
- </Style.Triggers>
+ <Style x:Key="ItemsControlStyle1" TargetType="{x:Type ItemsControl}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ItemsControl}">
+ <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
+ <ScrollViewer VerticalScrollBarVisibility="Auto">
+ <ScrollViewer.Resources>
+ <Style TargetType="ScrollBar">
+ <Setter Property="Width" Value="10"/>
+ <Setter Property="MinWidth" Value="10" />
</Style>
- </DockPanel.Style>
- <TextBox DockPanel.Dock="Left" Name="MinRangeValue" Width="50" Text="{Binding MinRangeValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>
- <TextBox DockPanel.Dock="Right" Name="MaxRangeValue" Width="50" Text="{Binding MaxRangeValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>
- </DockPanel>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTextColumn Header="Default Value" Binding="{Binding DefaultValueDisplay}" Width="150" ElementStyle="{StaticResource WrapText}" />
- <DataGridTemplateColumn Header="" Width="1*">
- <DataGridTemplateColumn.CellStyle>
- <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
- <Setter Property="VerticalAlignment" Value="Center"/>
- <Setter Property="HorizontalAlignment" Value="Stretch"/>
- <Setter Property="Margin" Value="0 0 0 0"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type DataGridCell}">
- <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="Background" Value="Transparent"></Setter>
- <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </DataGridTemplateColumn.CellStyle>
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
- <Button Width="80" Padding="2" Height="26" FontSize="12" Margin="0 8" Command="{Binding SetDefaultCommand}">Set Default</Button>
- </Grid>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
-
+ </ScrollViewer.Resources>
+ <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
+ </ScrollViewer>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
- <RowDefinition Height="Auto"/>
+ <RowDefinition Height="80"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
-
+
</Grid.ColumnDefinitions>
- <Grid Grid.Row="0">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid Grid.Row="0" VerticalAlignment="Top">
- <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="36">
- <Border.Effect>
- <DropShadowEffect/>
- </Border.Effect>
- </Border>
- <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="34" Background="#C4EEFC">
- <TextBlock FontSize="22" Padding="2">Pressure build up test</TextBlock>
- </Border>
- </Grid>
- <ContentControl x:Name="PBUTestControl" Grid.Row="1" Content="{StaticResource PropertyDataGrid}" DataContext="{Binding Path=PBUTestSettings}" Margin="20 0 20 0"></ContentControl>
- </Grid>
- </Grid>
- <Grid Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Stretch">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid Grid.Row="0" VerticalAlignment="Top">
- <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="36">
- <Border.Effect>
- <DropShadowEffect/>
- </Border.Effect>
- </Border>
- <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="34" Background="#C4EEFC">
- <TextBlock FontSize="22" Padding="2">Flow test</TextBlock>
- </Border>
- </Grid>
- <ContentControl x:Name="FlowTestControl" Grid.Row="1" Content="{StaticResource PropertyDataGrid}" DataContext="{Binding Path=FlowTestSettings}" Margin="20 0 20 0"></ContentControl>
- </Grid>
+ <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <ItemsControl ItemsSource="{Binding Settings}" Height="Auto" Style="{StaticResource ItemsControlStyle1}" MinHeight="20" Margin="0 0 20 20">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel VerticalAlignment="Center" Orientation="Vertical" IsItemsHost="True"></StackPanel>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Border BorderThickness="1" BorderBrush="#4D4B4B4B" Margin="10" CornerRadius="6">
+ <Grid Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+ <Grid Grid.Row="0" VerticalAlignment="Top">
+ <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="36">
+ <Border.Effect>
+ <DropShadowEffect/>
+ </Border.Effect>
+ </Border>
+ <Border Margin="20 20 20 0" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="34" Background="#C4EEFC">
+ <TextBlock FontSize="22" Padding="2" Text="{Binding Name}"/>
+ </Border>
+ </Grid>
+ <DataGrid Grid.Row="1" Style="{StaticResource PropertyDataGrid}" ItemsSource="{Binding Settings}" Margin="20 20 20 0" GridLinesVisibility="None" SelectionMode="Single" AlternatingRowBackground="#F6F6F6" FontSize="12" HorizontalAlignment="Left" SelectionUnit="FullRow" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False">
+ <DataGrid.Columns>
+ <DataGridTextColumn Header="Property Name" Binding="{Binding PropertyName}" Width="250" ElementStyle="{StaticResource WrapText}"/>
+ <DataGridTemplateColumn Header="Property Value" Width="150">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <TextBox Text="{Binding PropertyValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Width="50" VerticalAlignment="Top">
+ <TextBox.Style>
+ <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
+ <Setter Property="Visibility" Value="Visible"/>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsRangeVisible}" Value="true">
+ <Setter Property="Visibility" Value="Collapsed"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBox.Style>
+ </TextBox>
+ <DockPanel HorizontalAlignment="Stretch" Width="150">
+ <DockPanel.Style>
+ <Style TargetType="{x:Type DockPanel}">
+ <Setter Property="Visibility" Value="Collapsed"/>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsRangeVisible}" Value="true">
+ <Setter Property="Visibility" Value="Visible"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </DockPanel.Style>
+ <TextBox DockPanel.Dock="Left" Name="MinRangeValue" Width="50" Text="{Binding MinRangeValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>
+ <TextBox DockPanel.Dock="Right" Name="MaxRangeValue" Width="50" Text="{Binding MaxRangeValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"/>
+ </DockPanel>
+ </StackPanel>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTextColumn Header="Default Value" Binding="{Binding DefaultValueDisplay}" Width="150" ElementStyle="{StaticResource WrapText}" />
+ <DataGridTemplateColumn Header="" Width="Auto">
+ <DataGridTemplateColumn.CellStyle>
+ <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ <Setter Property="VerticalAlignment" Value="Center"/>
+ <Setter Property="HorizontalAlignment" Value="Stretch"/>
+ <Setter Property="Margin" Value="0 0 0 0"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type DataGridCell}">
+ <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </DataGridTemplateColumn.CellStyle>
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
+ <Button Width="80" Padding="2" Height="26" FontSize="12" Margin="0 8" Command="{Binding SetDefaultCommand}">Set Default</Button>
+ </Grid>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</Grid>
- <Grid Grid.Row="2" >
+ <Grid Grid.Row="1" >
<Button Width="80" HorizontalAlignment="Right" Margin="20" Click="SaveButton_Click" IsDefault="True">Save</Button>
</Grid>
</Grid>
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs
index 38f8dee81..48d426d23 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs
@@ -126,7 +126,24 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels
}
}
-
+ private string _titleAxisBottom;
+
+ public string TitleAxisBottom
+ {
+ get { return _titleAxisBottom; }
+ set { _titleAxisBottom = value; RaisePropertyChangedAuto(); }
+ }
+
+ private string _titleAxisLeft;
+
+ public string TitleAxisLeft
+ {
+ get { return _titleAxisLeft; }
+ set { _titleAxisLeft = value; RaisePropertyChangedAuto(); }
+ }
+
+
+
private bool _isRunning;
/// <summary>
/// Gets or sets a value indicating whether this instance is running.
@@ -162,7 +179,8 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels
XStep = 1;
AnalyzerResults = new ObservableCollection<IAnalyzerResult>();
_isRunning = false;
-
+ TitleAxisBottom = "";
+ TitleAxisLeft = "";
this.Points = new List<DataPoint>();
}
@@ -251,69 +269,38 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels
return;
ResetSettings();
- IAnalyzer analyzer = AnalysisService.GetAnalyzer(OpenFilePath);
+ var analyzer = AnalysisService.GetAnalyzer(OpenFilePath);
if (analyzer == null)
return;
IsRunning = true;
- AnalyzerAttribute attribute = (AnalyzerAttribute)analyzer.GetType().GetCustomAttributes(typeof(AnalyzerAttribute), true).FirstOrDefault();
-
- TestName = attribute.Name;
- List<DispenserCsvRow> data = CsvFile.Read<DispenserCsvRow>(new CsvSource(OpenFilePath)).ToList();
- List<DispenserSample> samples = new List<DispenserSample>();
-
- To = 0;
- From = 0;
- int index = 0;
- int last_labelIndex = 0;
-
-
- foreach (var item in data)
+ AnalyzerAttribute[] attr = analyzer.GetType().GetCustomAttributes(typeof(AnalyzerAttribute), true);
+ if (attr != null && attr.Count() > 0)
{
- double pressure = 0;
- if(item.Label == "Label")
- {
- item.Pressure = "0";
- item.Command = "Label";
- if (last_labelIndex == 0 || last_labelIndex < (index + 5))
- {
- last_labelIndex = index;
-
- OxyPlot.Wpf.LineAnnotation _line = new OxyPlot.Wpf.LineAnnotation()
- {
- StrokeThickness = 1,
- Color = Color.FromRgb(255, 5, 5),
- Type = LineAnnotationType.Vertical,
- Text = index.ToString(),
- X = index,
- };
- PlotControl.Annotations.Add(_line);
-
- }
- }
- if (double.TryParse(item.Pressure, out pressure) || !String.IsNullOrWhiteSpace(item.Command))
- {
- samples.Add(new DispenserSample()
- {
- Pressure = pressure,
- Command = String.IsNullOrWhiteSpace(item.Command) ? null : item.Command,
- Index = index
- });
- index++;
- }
+ TestName = attr[0].Name;
+ }
+ List<OxyPlot.Wpf.LineAnnotation> annotations = new List<OxyPlot.Wpf.LineAnnotation>();
+ var samples = analyzer.Reader.ReadScvFile(OpenFilePath, annotations);
+ analyzer.GetPoints(samples, Points);
+ if (Points.Count == 0)
+ {
+ IsRunning = false;
+ return;
}
+ annotations.ForEach(x => PlotControl.Annotations.Add(x));
+ To = 0;
+ From = 0;
+
List<IAnalyzerResult> res = await analyzer.Process(samples, false);
AnalyzerResults = new ObservableCollection<IAnalyzerResult>(res);
- samples.ForEach(x =>
- {
- if (x.Pressure != 0.0)
- { Points.Add(new DataPoint(x.Index, x.Pressure)); }
- });
_to = Points.Max(x => x.Y);
_from = TestName.Contains("sealtest") ? Points.FirstOrDefault(x => x.X == 0).Y : Points.Min(x => x.Y);
+ List<string> titles = analyzer.Reader.GetTitles(OpenFilePath);
+ TitleAxisBottom = titles[0];
+ TitleAxisLeft = titles[1];
- data.Clear();
+ // data.Clear();
_to += 100;
RaisePropertyChanged("To");
if (_from != 0)
@@ -324,8 +311,10 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels
IsRunning = false;
PlotControl.InvalidatePlot(true);
- await PrintToXpsFile();
-
+ if(analyzer.Reader.PrintResultsToPDFFile())
+ {
+ await PrintToXpsFile();
+ }
}
/// <summary>
@@ -338,44 +327,24 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels
if (false == File.Exists(OpenFilePath) || IsFileLocked(OpenFilePath))
return;
- IAnalyzer analyzer = AnalysisService.GetAnalyzer(OpenFilePath);
+ var analyzer = AnalysisService.GetAnalyzer(OpenFilePath);
if (analyzer == null)
return;
-
- AnalyzerAttribute attribute = (AnalyzerAttribute)analyzer.GetType().GetCustomAttributes(typeof(AnalyzerAttribute), true).FirstOrDefault();
-
- TestName = attribute.Name;
- List<DispenserCsvRow> data = CsvFile.Read<DispenserCsvRow>(new CsvSource(OpenFilePath)).ToList();
- List<DispenserSample> samples = new List<DispenserSample>();
-
- int index = 0;
- int last_labelIndex = 0;
+ AnalyzerAttribute[] attr = analyzer.GetType().GetCustomAttributes(typeof(AnalyzerAttribute), true);
+ if (attr != null && attr.Count() > 0)
+ {
+ TestName = attr[0].Name;
+ }
- foreach (var item in data)
+ List<OxyPlot.Wpf.LineAnnotation> annotations = new List<OxyPlot.Wpf.LineAnnotation>();
+ var samples = analyzer.Reader.ReadScvFile(OpenFilePath, annotations);
+ analyzer.GetPoints(samples, Points);
+ if (Points.Count == 0)
{
- double pressure = 0;
- if (item.Label == "Label")
- {
- item.Pressure = "0";
- item.Command = "Label";
- if (last_labelIndex == 0 || last_labelIndex < (index + 5))
- {
- last_labelIndex = index;
- }
- }
- if (double.TryParse(item.Pressure, out pressure) || !String.IsNullOrWhiteSpace(item.Command))
- {
- samples.Add(new DispenserSample()
- {
- Pressure = pressure,
- Command = String.IsNullOrWhiteSpace(item.Command) ? null : item.Command,
- Index = index
- });
- index++;
- }
+ return;
}
-
+
List<IAnalyzerResult> res = await analyzer.Process(samples, true);
AnalyzerResults = new ObservableCollection<IAnalyzerResult>(res);
diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs
index d5c54ab08..0f2b5a457 100644
--- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs
@@ -9,79 +9,124 @@ using Tango.SharedUI;
namespace Tango.DispenserAnalyzer.UI.ViewModels
{
- public class SettingsVM : ViewModel, IDisposable
+ public class SettingVM: ViewModel
{
- private ObservableCollection<SettingsModel> _PBUSettings;
+ private string _name;
- public ObservableCollection<SettingsModel> PBUTestSettings
+ public string Name
{
- get { return _PBUSettings; }
- set { _PBUSettings = value; RaisePropertyChangedAuto(); }
+ get { return _name; }
+ set { _name = value; }
}
- private ObservableCollection<SettingsModel> _flowTestSettings;
+ private ObservableCollection<SettingsModel> _settings;
+
+ public ObservableCollection<SettingsModel> Settings
+ {
+ get { return _settings; }
+ set { _settings = value; RaisePropertyChangedAuto(); }
+ }
- public ObservableCollection<SettingsModel> FlowTestSettings
+ public SettingVM(string name)
{
- get { return _flowTestSettings; }
- set { _flowTestSettings = value; RaisePropertyChangedAuto(); }
+ _settings = new ObservableCollection<SettingsModel>();
+ Name = name;
}
- private Dictionary<AnalyzerSettingsEnum, double> changedValues;
+ public void AddSettings(List<SettingsModel> settings)
+ {
+ settings.ForEach(x => Settings.Add(x));
+ }
+
+
+ }
+ public class SettingsVM : ViewModel, IDisposable
+ {
+ public Dictionary<AnalyzerSettingsEnum, double> ChangedValues { get; set; }
+
+ private ObservableCollection<SettingVM> _settings;
+ public ObservableCollection<SettingVM> Settings
+ {
+ get { return _settings; }
+ set { _settings = value; RaisePropertyChangedAuto(); }
+ }
+
public SettingsVM()
{
- _PBUSettings = new ObservableCollection<SettingsModel>();
+ _settings = new ObservableCollection<SettingVM>();
+ ChangedValues = new Dictionary<AnalyzerSettingsEnum, double>();
InitPBUTestSettings();
- _flowTestSettings = new ObservableCollection<SettingsModel>();
- changedValues = new Dictionary<AnalyzerSettingsEnum, double>();
+ InitProcessSettings();
InitFlowTestSettings();
+
}
private void InitPBUTestSettings()
{
- var setting = new SettingsModel(AnalyzerSettingsEnum.PBUPassFail, "4.5 sec");
- setting.SettingValueEvent += new EventHandler(OnSettingValueChanged);
- _PBUSettings.Add(setting);
+ SettingVM model = new SettingVM("Pressure build up");
+ List<SettingsModel> list = new List<SettingsModel>();
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.PBUPassFail, "4.5 sec"));
+ model.AddSettings(list);
+ list.ForEach(x => x.SettingValueEvent += new EventHandler(OnSettingValueChanged));
+ Settings.Add(model);
}
private void InitFlowTestSettings()
{
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.FlowPBUPassFail, "4.5 sec"));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.ExcludeAnalysis, "1800 reads"));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.AvgMinValue, "1400-1850 [mbar]", true));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.MaxMinRange, "500 reads"));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.MaxMinIntervals, "300 reads"));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.MaxError, "1.5%"));
- _flowTestSettings.Add(new SettingsModel(AnalyzerSettingsEnum.TakeOffMaxMin, "3"));
-
- _flowTestSettings.ToList().ForEach(x => x.SettingValueEvent += new EventHandler(OnSettingValueChanged));
+ SettingVM model = new SettingVM("Flow test");
+ List<SettingsModel> list = new List<SettingsModel>();
+
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.FlowPBUPassFail, "4.5 sec"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.ExcludeAnalysis, "1800 reads"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.AvgMinValue, "1400-1850 [mbar]", true));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.MaxMinRange, "500 reads"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.MaxMinIntervals, "300 reads"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.MaxError, "1.5%"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.TakeOffMaxMin, "3"));
+ list.ForEach(x => x.SettingValueEvent += new EventHandler(OnSettingValueChanged));
+ model.AddSettings(list);
+ Settings.Add(model);
+ }
+
+ private void InitProcessSettings()
+ {
+ SettingVM model = new SettingVM("Process");
+ List<SettingsModel> list = new List<SettingsModel>();
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.TimeInterval, "0.1 sec"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.StartCalculation, "600 sec"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.EndCalculation, "900 sec"));
+ list.Add(new SettingsModel(AnalyzerSettingsEnum.MovingAvg, "50 points"));
+ list.ForEach(x => x.SettingValueEvent += new EventHandler(OnSettingValueChanged));
+ model.AddSettings(list);
+ Settings.Add(model);
}
private void OnSettingValueChanged(object sender, EventArgs e)
{
- if(sender is SettingsModel)
+ if (sender is SettingsModel)
{
SettingsModel settingModel = sender as SettingsModel;
- if(settingModel.IsRangeVisible)
+ if (settingModel.IsRangeVisible)
{
- changedValues[AnalyzerSettingsEnum.AvgMinValue] = settingModel.MinRangeValue;
- changedValues[AnalyzerSettingsEnum.AvgMaxValue] = settingModel.MaxRangeValue;
+ ChangedValues[AnalyzerSettingsEnum.AvgMinValue] = settingModel.MinRangeValue;
+ ChangedValues[AnalyzerSettingsEnum.AvgMaxValue] = settingModel.MaxRangeValue;
}
else
- changedValues[settingModel._enumName] = settingModel.PropertyValue;
+ ChangedValues[settingModel._enumName] = settingModel.PropertyValue;
}
}
-
+
public Dictionary<AnalyzerSettingsEnum, double> GetChanges()
{
- return changedValues;
+ return ChangedValues;
}
-
+
public void Dispose()
{
- _PBUSettings.ToList().ForEach(x => x.SettingValueEvent -= OnSettingValueChanged);
- _flowTestSettings.ToList().ForEach(x => x.SettingValueEvent -= OnSettingValueChanged);
+ Settings.ToList().ForEach(x => {
+ x.Settings.ToList().ForEach(k => k.SettingValueEvent -= OnSettingValueChanged);
+ });
}
}
}