From 01a5ff7a65859fd650fad207d102095ed68953ec Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 14 Oct 2018 11:52:49 +0300 Subject: thread debug. diagnostics heaters state --- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 4 +- .../Embedded/Modules/Control/MillisecTask.c | 4 +- .../Embedded/Modules/Diagnostics/Diagnostics.c | 39 ++++++--------- .../Embedded/Modules/Heaters/Heaters_print.c | 3 +- .../Embedded/Modules/Thread/Thread_print.c | 57 +++++++++++++++------- 5 files changed, 60 insertions(+), 47 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index c46e49672..15ebfc632 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -116,10 +116,10 @@ AlarmHandlingItem AlarmItem[MAX_SYSTEM_ALARMS]={ {100,LimitSwitchAlarm,LimitSwitchAlarmLow_6,false,true,DEBUG_LOG_CATEGORY__Warning,5,0,0,false,EVENT_TYPE__Dispenser6LowLevel,NULL,"Dispenser6LowLevel"}, {100,LimitSwitchAlarm,LimitSwitchAlarmLow_7,false,true,DEBUG_LOG_CATEGORY__Warning,6,0,0,false,EVENT_TYPE__Dispenser7LowLevel,NULL,"Dispenser7LowLevel"}, {100,LimitSwitchAlarm,LimitSwitchAlarmLow_8,false,true,DEBUG_LOG_CATEGORY__Warning,7,0,0,false,EVENT_TYPE__Dispenser8LowLevel,NULL,"Dispenser8LowLevel"},*/ -{100,TemperatureAlarm,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__GeneralInternalOverTemperature,NULL,"GeneralInternalOverTemperature"}, +{100,TemperatureAlarm,TEMP_SENSE_AN_ENCLOSURETEMP3,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__GeneralInternalOverTemperature,NULL,"GeneralInternalOverTemperature"}, //{100,TemperatureAlarm,TEMP_SENSE_AN_ENCLOSURETEMP1,250,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,0,false,EVENT_TYPE__GeneralInternalOverTemperature,NULL,"GeneralInternalOverTemperature"}, //{100,TemperatureAlarm,TEMP_SENSE_AN_ENCLOSURETEMP2,80,true,DEBUG_LOG_CATEGORY__Error,0xFF,0,0,false,EVENT_TYPE__GeneralInternalOverTemperature,NULL,"GeneralInternalOverTemperature"}, -{100,TemperatureAlarm,TEMP_SENSE_AN_ENCLOSURETEMP3,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__DyeingHead6OverTemperature,NULL,"DyeingHead6OverTemperature"}, +{100,TemperatureAlarm,TEMP_SENSE_ANALOG_MIXCHIP_TEMP,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__DyeingHead6OverTemperature,NULL,"DyeingHead6OverTemperature"}, {100,TemperatureAlarm,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__DyeingHead1OverTemperature,NULL,"DyeingHead1OverTemperature"}, {100,TemperatureAlarm,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__DyeingHead2OverTemperature,NULL,"DyeingHead2OverTemperature"}, {100,TemperatureAlarm,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,300,true,DEBUG_LOG_CATEGORY__Error,0xFF,10,0,false,EVENT_TYPE__DyeingHead3OverTemperature,NULL,"DyeingHead3OverTemperature"}, diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c index 9ce05b485..fa168067f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c +++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c @@ -494,13 +494,13 @@ uint32_t MillisecLoop(uint32_t tick) { Read_MidTank_Pressure_Sensor(Disp_i); } - for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) +/* for (Motor_i = 0;Motor_i < NUM_OF_MOTORS;Motor_i++) { if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_SCREW) continue; // if (isMotorConfigured(Motor_i)) MotorGetStatusFromFPGA(Motor_i); - } + }*/ } //ROM_IntMasterEnable(); diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 1ec32a4ae..67e0cf34b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -55,7 +55,6 @@ uint32_t Diagnostics_TenMiliControlTrigger(uint32_t IfIndex, uint32_t ReadValue) DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT; -DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM]; #define DIAGNOSTICS_LIMIT 10 #define DIAGNOSTICS_DANCER_LIMIT 100 int DiagnosticsIndex = 0; @@ -96,6 +95,8 @@ DoubleArray DiagnosticsDispenserPressure[MAX_SYSTEM_DISPENSERS]; HeaterState **heatersstates; HeaterState HeaterInfo[HEATER_TYPE__MixerHeater+1]; +DigitalInterfaceState **digitalinterfacestates; +DigitalInterfaceState DigitalOutputState[MAX_HEATERS_NUM]; /*double dispenser1motorfrequency[DIAGNOSTICS_LIMIT]; double dispenser2motorfrequency[DIAGNOSTICS_LIMIT]; double dispenser3motorfrequency[DIAGNOSTICS_LIMIT]; @@ -153,6 +154,14 @@ void DiagnosticsInit(void) heater_state__init(&HeaterInfo[i]); heatersstates[i] = &HeaterInfo[i]; } + digitalinterfacestates = (DigitalInterfaceState**)malloc(sizeof(DigitalInterfaceState *)*MAX_HEATERS_NUM); + for (i = 0;ihas_heatertype = true; HeaterState->heatertype = HeaterType; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 05c6c9003..023e0dfc8 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -14,6 +14,7 @@ #include "PMR/Hardware/HardwareDancerType.pb-c.h" #include "PMR/Printing/JobSegment.pb-c.h" #include "PMR/Printing/JobTicket.pb-c.h" +#include "PMR/common/ErrorCode.pb-c.h" #include #include @@ -144,10 +145,10 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) double length = 0.0; char str[150]; int index = MAX_THREAD_MOTORS_NUM; - if (ThreadControlActive == false) - return OK; - if (PrepareState == true) - return OK; + // if (ThreadControlActive == false) + // return OK; + // if (PrepareState == true) + // return OK; if (IfIndex>>8 != IfTypeThread) { LOG_ERROR (IfIndex, "Wrong Interface type"); @@ -310,14 +311,16 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) } return OK; } -double calculatedError[200]; +double calculatedError[1000]; //double eNormalizedError[100]; -int MotorId[200]; -int readValue[200]; +int MotorId[1000]; +int readValue[1000]; //int TranslatedreadValue[100]; -int AveragereadValue[200]; -int calculatedspeed[200]; +int AveragereadValue[1000]; +int calculatedspeed[1000]; +int timestamp[1000]; int controlIndex = 0; +bool keepdata = true; /*int32_t KeepReadValue = 0; void testDancersControl() { @@ -343,6 +346,8 @@ void testDancersControl() ThreadControlActive = false; }*/ bool dancerinvalid = false; +int MotorFailedSample[MAX_THREAD_MOTORS_NUM] = {0,0,0,0,0}; +char Message[60]; uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) { //#define MAX_CONTROL_SAMPLES 6 @@ -375,11 +380,13 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) DancerId = ThreadMotorIdToDancerId[index]; if (ReadValue < 10) { + MotorFailedSample[index]++; REPORT_MSG(ReadValue, "Dancer value read too small."); return OK; } if (ReadValue == 0x3FFF) { + MotorFailedSample[index]++; if (dancerinvalid == false) { dancerinvalid = true; @@ -429,6 +436,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) //Stop Execution if the dancer moves too much if ((abs(avreageSampleValue)> DancerStopActivityLimit[index])&&(JobCounter > eOneSecond)) { + keepdata = false; usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint); //JobAbortedByUser = true; ThreadControlActive = false; @@ -471,18 +479,25 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*/ if (abs(calculated_speed-CurrentControlledSpeed[index])>2) { - calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError; - //double eNormalizedError[100]; - MotorId[controlIndex] = index; - readValue[controlIndex] = ReadValue; - //int TranslatedreadValue[100]; - AveragereadValue[controlIndex] = avreageSampleValue; - calculatedspeed[controlIndex] = calculated_speed; - if (controlIndex++>=199) - controlIndex = 0; + if (keepdata == true) + { + calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError; + //double eNormalizedError[100]; + MotorId[controlIndex] = index; + readValue[controlIndex] = ReadValue; + //int TranslatedreadValue[100]; + AveragereadValue[controlIndex] = avreageSampleValue; + calculatedspeed[controlIndex] = calculated_speed; + timestamp[controlIndex] = HibernateRTCSSGet(); + if (controlIndex++>=999) + controlIndex = 0; + } CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } + else + MotorFailedSample[index]++; + } return OK; @@ -715,11 +730,17 @@ uint32_t ThreadDistanceToSpoolState(void ) return OK; } +char Endstr[150]; //******************************************************************************************************************** uint32_t ThreadEndState(void *JobDetails) { int Motor_i; ThreadControlActive = false; + + usnprintf(Endstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); + SendJobProgress(0.0,0,false, Endstr); + Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); + ThreadUpdateProcessLength (0.0,(void *)NULL); SetOriginMotorSpeed(0); -- cgit v1.3.1 From fb2991bde321e59160a3dd821ecc08db87ac9217 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 15 Oct 2018 07:53:06 +0300 Subject: Remove (temporarily) PID in heaters - for mre research. the code is commented out --- .../Embedded/Modules/Heaters/Heaters_print.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 2acd8c56f..c4dd6150e 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -462,7 +462,6 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { int index=MAX_HEATERS_NUM; - double temperror = 0.0, correction = 0.0; /*char str[100]; uint8_t len = 0;*/ if (IfIndex>>8 != IfTypeHeaters) @@ -511,11 +510,20 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0)) { HeaterPIDConfig[index].m_mesuredParam = readValue; + if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) //below proportional band + { + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, 100); + //REPORT_MSG (readValue,"AC HEATER Over temperature"); + } + else if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)) + { + HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, 0); + //REPORT_MSG (readValue,"AC HEATER Under temperature"); + } //check only for the proportional band limits HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); - //correction = HeaterPIDConfig[index].m_calculatedError; - HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, (int)(HeaterPIDConfig[index].m_calculatedError)); + //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, (int)(HeaterPIDConfig[index].m_calculatedError)); } @@ -588,14 +596,14 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } if(HeaterPIDConfig[index].m_isEnabled && (HeaterPIDConfig[index].m_SetParam != 0)) { - /*if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) //below proportional band + if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) //below proportional band { HeaterRecalculateHeaterParams(index, 100); } else if (readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100)) { HeaterRecalculateHeaterParams(index, 0); - }*/ + } //check only for the proportional band limits HeaterPIDConfig[index].m_mesuredParam = readValue; @@ -611,7 +619,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); //#warning PID is now only proportional (above) - HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError)); + //HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError)); } -- cgit v1.3.1 From 4b1431aafb428328f8a512e546e1e178155fb68f Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Mon, 15 Oct 2018 20:16:03 +0000 Subject: Updated Heaters_init.c --- Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c index ebdb126ac..87a202469 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c @@ -348,7 +348,7 @@ uint32_t HeaterRecalculateSharedHeatersParams(uint32_t deviceId, uint32_t new_ou } // all numbers are rounded down. better to have carefully calculated numbers - HeaterControl[deviceId].outputproportionalpowerlimit = new_outputproportionalpowerlimit/100; + HeaterControl[deviceId].outputproportionalpowerlimit = new_outputproportionalpowerlimit;///100; Heater1000Slices = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit * NumberOFSlicesInUse / 100; Heater200aSlices = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary].outputproportionalpowerlimit * NumberOFSlicesInUse / 100; @@ -391,7 +391,7 @@ uint32_t HeaterRecalculateHeaterParams(uint32_t deviceId, uint32_t new_outputpro HeaterControl[deviceId].outputproportionalpowerlimit = new_outputproportionalpowerlimit; //mark the time slices for heaters operation as empty / Heater1000 / Heater 200 - DCTimeSliceAllocation[deviceId] = (HeaterControl[deviceId].outputproportionalpowerlimit/100 * NumberOFSlicesInUse) / 100; + DCTimeSliceAllocation[deviceId] = (HeaterControl[deviceId].outputproportionalpowerlimit/*/100*/ * NumberOFSlicesInUse) / 100; -- cgit v1.3.1 From 31476e863ec157682861d227ea0e23c7690cb65d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 16 Oct 2018 08:45:20 +0300 Subject: small changes, remove debug data in thread_print --- .../Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c | 2 -- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 13 +++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 67e0cf34b..1ab4f311a 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -520,8 +520,6 @@ void SendDiagnostics(void) } } */ - response.n_digitalinterfacestates = 0; - DiagnosticsLoadDigitalValues(); response.n_digitalinterfacestates = MAX_HEATERS_NUM; response.digitalinterfacestates = digitalinterfacestates; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 023e0dfc8..d2bbad72b 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -14,7 +14,6 @@ #include "PMR/Hardware/HardwareDancerType.pb-c.h" #include "PMR/Printing/JobSegment.pb-c.h" #include "PMR/Printing/JobTicket.pb-c.h" -#include "PMR/common/ErrorCode.pb-c.h" #include #include @@ -311,14 +310,14 @@ uint32_t ThreadControlSpeedReadFunction(uint32_t IfIndex, uint32_t ReadValue) } return OK; } -double calculatedError[1000]; //double eNormalizedError[100]; +//int TranslatedreadValue[100]; +/*double calculatedError[1000]; int MotorId[1000]; int readValue[1000]; -//int TranslatedreadValue[100]; int AveragereadValue[1000]; int calculatedspeed[1000]; -int timestamp[1000]; +int timestamp[1000];*/ int controlIndex = 0; bool keepdata = true; /*int32_t KeepReadValue = 0; @@ -479,19 +478,17 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*/ if (abs(calculated_speed-CurrentControlledSpeed[index])>2) { - if (keepdata == true) + /*if (keepdata == true) { calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError; - //double eNormalizedError[100]; MotorId[controlIndex] = index; readValue[controlIndex] = ReadValue; - //int TranslatedreadValue[100]; AveragereadValue[controlIndex] = avreageSampleValue; calculatedspeed[controlIndex] = calculated_speed; timestamp[controlIndex] = HibernateRTCSSGet(); if (controlIndex++>=999) controlIndex = 0; - } + }*/ CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } -- cgit v1.3.1 From 1d2d783fdbbd6500e9b89f4c628affc190ff2b8d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 16 Oct 2018 09:08:16 +0300 Subject: heaters correction --- Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h | 12 ------------ .../Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c | 1 - .../Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c | 16 ++++++++++++++-- .../Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 15 --------------- 4 files changed, 14 insertions(+), 30 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h index 3b357ce11..f7a2f3079 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h @@ -50,20 +50,8 @@ typedef struct HeaterCommandstruc uint32_t targettemperatue; }HeaterCommand; -typedef struct -{ - bool m_isEnabled; - float m_SetParam; - float m_mesuredParam; - float m_preError; - float m_integral; - float m_calculatedError; - bool m_isReady; - PID_Config_Params m_params; -}HeaterControlConfig_t; extern HeaterPIDControlConfig HeaterControl[MAX_HEATERS_NUM]; -extern HeaterControlConfig_t HeaterPIDConfig[MAX_HEATERS_NUM]; extern HeaterCommand HeaterCmd[MAX_HEATERS_NUM]; extern uint32_t Heater_timerBase; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c index 87a202469..e862107ff 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c @@ -46,7 +46,6 @@ typedef enum { /******************** GLOBAL PARAMETERS ********************************************/ HeaterPIDControlConfig HeaterControl[MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0}; -HeaterControlConfig_t HeaterPIDConfig[MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0}; bool AcHeaterConfigured[MAX_AC_HEATERS] = {0,0,0}; int NumberOFSlicesInUse = 0; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 08a86ac39..3caf91de4 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -41,6 +41,18 @@ typedef struct HeatersControlMessage{ uint32_t tick; uint8_t messageData[20]; }HeatersControlMessageStruc; +typedef struct +{ + bool m_isEnabled; + float m_SetParam; + float m_mesuredParam; + float m_preError; + float m_integral; + float m_calculatedError; + bool m_isReady; + PID_Config_Params m_params; +}HeaterControlConfig_t; +HeaterControlConfig_t HeaterPIDConfig[MAX_HEATERS_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0}; /******************** GLOBAL PARAMETERS ********************************************/ HeaterCommand HeaterCmd[MAX_HEATERS_NUM]; @@ -522,7 +534,7 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) //check only for the proportional band limits HeaterPIDConfig[index].m_calculatedError = PIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); - //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, (int)(HeaterPIDConfig[index].m_calculatedError)); + //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain, (int)(HeaterPIDConfig[index].m_calculatedError/100)); } @@ -618,7 +630,7 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); //#warning PID is now only proportional (above) - //HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError)); + //HeaterRecalculateHeaterParams(index, (int)(HeaterPIDConfig[index].m_calculatedError/100)); } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index d2bbad72b..503ef2c37 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -461,21 +461,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) //KeepNormalizedError = NormalizedError; } calculated_speed = (1-MotorControlConfig[index].m_calculatedError)*OriginalMotorSpd_2PPS[index]; - /*if (index == FEEDER_MOTOR) - { - if (KeepReadValue != TranslatedReadValue) - { - eNormalizedError[controlIndex] = NormalizedError; - calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError; - readValue[controlIndex] = ReadValue; - TranslatedreadValue[controlIndex] = TranslatedReadValue; - AveragereadValue[controlIndex] = avreageSampleValue; - calculatedspeed[controlIndex] = calculated_speed; - controlIndex++; - if (controlIndex >= 99) controlIndex = 0; - KeepReadValue = TranslatedReadValue; - } - }*/ if (abs(calculated_speed-CurrentControlledSpeed[index])>2) { /*if (keepdata == true) -- cgit v1.3.1 From 6ecc58f3c47fbb10250253e14e35a75023dd7998 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 16 Oct 2018 09:37:33 +0300 Subject: job error reporting. validate process parameters --- .../Embedded_SW/Embedded/Modules/General/process.c | 25 +++++++------- .../Embedded/Modules/Thread/Thread_Winder.c | 2 +- .../Embedded/Modules/Thread/Thread_print.c | 5 ++- .../Embedded/StateMachines/Printing/JobSTM.c | 38 +++++++++++++++------- 4 files changed, 43 insertions(+), 27 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/General/process.c b/Software/Embedded_SW/Embedded/Modules/General/process.c index 8fc9434cb..b56162bea 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/process.c +++ b/Software/Embedded_SW/Embedded/Modules/General/process.c @@ -33,6 +33,18 @@ ProcessParameters* ProcessParametersKeep; uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) { uint32_t status = 0; + if (ProcessParams->dryerzone1temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->dryerzone2temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->dryerzone3temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->mixertemp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone1temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone2temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone3temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone4temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone5temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (ProcessParams->headzone6temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; + if (status != 0) + return status; if (ProcessParams) { ProcessParametersKeep = ProcessParams; @@ -127,7 +139,7 @@ uint32_t HandleProcessParameters(ProcessParameters* ProcessParams) headairflow = ProcessParams->headairflow; dryerairflow = ProcessParams->dryerairflow; - return OK;//status; + return status;//status; } void ProcessRequestFunc(MessageContainer* requestContainer) @@ -148,17 +160,6 @@ void ProcessRequestFunc(MessageContainer* requestContainer) REPORT_MSG (ProcessParams->dryerzone1temp,"Process Params Dryer"); - if (ProcessParams->dryerzone1temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->dryerzone2temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->dryerzone3temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->mixertemp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone1temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone2temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone3temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone4temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone5temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (ProcessParams->headzone6temp > MAX_ALLOWED_TEMPERATURE) status = ERROR_CODE__INVALID_PARAMETER; - if (status == 0) status = HandleProcessParameters(ProcessParams); if (status) diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index ccc9623a3..c7dd4f7ae 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -107,7 +107,7 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue) uint32_t status=OK; uint32_t numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; - MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency); + MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,InternalWinderCfg.segmentoffsetpulses); //REPORT_MSG(numOfSteps, "Winder_PrepareStage2"); REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].maxfrequency, "Winder_PrepareStage2"); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 023e0dfc8..7ff72f057 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -14,7 +14,6 @@ #include "PMR/Hardware/HardwareDancerType.pb-c.h" #include "PMR/Printing/JobSegment.pb-c.h" #include "PMR/Printing/JobTicket.pb-c.h" -#include "PMR/common/ErrorCode.pb-c.h" #include #include @@ -479,7 +478,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) }*/ if (abs(calculated_speed-CurrentControlledSpeed[index])>2) { - if (keepdata == true) + /*if (keepdata == true) { calculatedError[controlIndex] = MotorControlConfig[index].m_calculatedError; //double eNormalizedError[100]; @@ -491,7 +490,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) timestamp[controlIndex] = HibernateRTCSSGet(); if (controlIndex++>=999) controlIndex = 0; - } + }*/ CurrentControlledSpeed[index] = calculated_speed; MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed); } diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 0b85fbd87..72eea34d7 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -315,13 +315,17 @@ void JobAbortFunc(MessageContainer* requestContainer) } double previousJobLength; +char ErrorMsg[100]; //******************************************************************************************************************** void JobRequestFunc(MessageContainer* requestContainer) { uint32_t status = NOT_SUPPORTED; MessageContainer responseContainer; uint8_t* container_buffer; + ErrorCode error = ERROR_CODE__NONE; + int len; + len = usnprintf(ErrorMsg, 100, "GJM"); /*if (CurrentJobRequest!= NULL) job_request__free_unpacked(CurrentJobRequest,NULL); @@ -338,6 +342,8 @@ void JobRequestFunc(MessageContainer* requestContainer) { LOG_ERROR (TicketSize, "job ticket message too long"); status = FAILED; + error = ERROR_CODE__BAD_CRC; + len = usnprintf(ErrorMsg, 100, "job ticket message too long"); } else { @@ -347,10 +353,23 @@ void JobRequestFunc(MessageContainer* requestContainer) status = PASSED; if (Ticket->processparameters) - HandleProcessParameters(Ticket->processparameters); + { + if (HandleProcessParameters(Ticket->processparameters)!= OK) + { + status = FAILED; + error = ERROR_CODE__INVALID_PARAMETER; + len = usnprintf(ErrorMsg, 100, "Hardware Parameters Not Set"); + } + } if (Ticket->spool) - InternalWindingConfigMessage(Ticket->spool); - + { + if (InternalWindingConfigMessage(Ticket->spool)!= OK) + { + status = FAILED; + error = ERROR_CODE__INVALID_PARAMETER; + len = usnprintf(ErrorMsg, 100, "spool parameters error"); + } + } // PrepareWaiting[Module_Heaters] = ModuleWaiting; } if (status == PASSED) @@ -365,9 +384,9 @@ void JobRequestFunc(MessageContainer* requestContainer) JobStatus jobStatus = JOB_STATUS__INIT; if (status == PASSED) { - char Msg[13] = "Job Accepted"; + len = usnprintf(ErrorMsg, 100, "Job Accepted"); - jobStatus.message =Msg; + jobStatus.message =ErrorMsg; jobStatus.has_progress = true; jobStatus.progress = 0.0; jobStatus.has_currentsegmentindex = false; @@ -378,10 +397,7 @@ void JobRequestFunc(MessageContainer* requestContainer) } else { - char Msg[25] = "Job message too large"; - - - jobStatus.message = Msg; + jobStatus.message = ErrorMsg; jobStatus.has_progress = true; jobStatus.progress = 0.0; jobStatus.has_currentsegmentindex = false; @@ -389,9 +405,9 @@ void JobRequestFunc(MessageContainer* requestContainer) response.has_canceled = true; response.canceled = true; responseContainer = createContainer(MESSAGE_TYPE__JobResponse, JobToken, true, &response, &job_response__pack, &job_response__get_packed_size); - container_buffer = malloc(message_container__get_packed_size(&responseContainer)); responseContainer.has_error = true; - responseContainer.error = ERROR_CODE__BAD_CRC; + responseContainer.error = error; + container_buffer = malloc(message_container__get_packed_size(&responseContainer)); } if (container_buffer) { -- cgit v1.3.1 From c04ec63bb31d471584c83ce3e013ccd72c968afd Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 17 Oct 2018 09:43:01 +0300 Subject: diagnostic sends calculated error in the tension info - every 10 msec --- .../Embedded/Modules/Diagnostics/Diagnostics.c | 30 ++++++++++++++++++++-- .../Embedded/Modules/Thread/Thread_ex.h | 1 + .../Embedded/Modules/Thread/Thread_print.c | 15 +++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 1ab4f311a..bda086251 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -55,8 +55,8 @@ uint32_t Diagnostics_TenMiliControlTrigger(uint32_t IfIndex, uint32_t ReadValue) DiagnosticsMonitors DiagnosticsMonitor = DIAGNOSTICS_MONITORS__INIT; -#define DIAGNOSTICS_LIMIT 10 -#define DIAGNOSTICS_DANCER_LIMIT 100 +#define DIAGNOSTICS_LIMIT 5 +#define DIAGNOSTICS_DANCER_LIMIT 50 int DiagnosticsIndex = 0; int DiagnosticCollectionLimit = 3; //number of data samples to collect before sending to the host //int DiagnosticLimit = eHundredMillisecond; //frequency of data collection @@ -169,6 +169,8 @@ uint8_t HeaterCounterIndex[MAX_HEATERS_NUM]= {0,0,0,0,0,0,0,0,0,0}; double HeaterTemperature[MAX_HEATERS_NUM][DIAGNOSTICS_LIMIT]; uint8_t DancerCounterIndex[NUM_OF_DANCERS]= {0,0,0}; double DancerValue[NUM_OF_DANCERS][DIAGNOSTICS_DANCER_LIMIT]; +int8_t DancerErrorCounterIndex[NUM_OF_DANCERS]= {0,0,0}; +double DancerErrorValue[NUM_OF_DANCERS][DIAGNOSTICS_DANCER_LIMIT]; uint8_t MotorCounterIndex[MAX_THREAD_MOTORS_NUM]= {0,0,0}; double MotorValue[MAX_THREAD_MOTORS_NUM][DIAGNOSTICS_LIMIT]; uint8_t SpeedCounterIndex= 0; @@ -253,6 +255,19 @@ void DiagnosticLoadDancer(int DancerId, uint16_t value) if (DancerCounterIndex[DancerId]>=DIAGNOSTICS_DANCER_LIMIT ) DancerCounterIndex[DancerId] = 0; } +void DiagnosticLoadDancerError(int DancerId, double value) +{ + if (DancerId >= MAX_HEATERS_NUM) + { + LOG_ERROR(DancerId,"wrong Dancer Id"); + return; + } + DancerErrorValue[DancerId][DancerErrorCounterIndex[DancerId]] = value; + DancerErrorCounterIndex[DancerId]++; + if (DancerErrorCounterIndex[DancerId]>=DIAGNOSTICS_DANCER_LIMIT ) + DancerErrorCounterIndex[DancerId] = 0; + +} void DiagnosticTenMsecCollection(void) { if (DiagnosticsActive == false) @@ -262,6 +277,11 @@ void DiagnosticTenMsecCollection(void) DiagnosticLoadDancer(WINDER_DANCER,Control_Read_Dancer_Position(WINDER_DANCER, 0,0)); DiagnosticLoadDancer(POOLER_DANCER,Control_Read_Dancer_Position(POOLER_DANCER, 0,0)); DiagnosticLoadDancer(FEEDER_DANCER,Control_Read_Dancer_Position(FEEDER_DANCER, 0,0)); + + DiagnosticLoadDancerError(WINDER_DANCER,ThreadGetMotorCalculatedError(WINDER_DANCER)); + DiagnosticLoadDancerError(POOLER_DANCER,ThreadGetMotorCalculatedError(POOLER_DANCER)); + DiagnosticLoadDancerError(FEEDER_DANCER,ThreadGetMotorCalculatedError(FEEDER_DANCER)); + //DiagnosticLoadSpeedSensor(getSensorSpeedData()); } @@ -403,6 +423,12 @@ void SendDiagnostics(void) DiagnosticsMonitor.dancer1angle = DancerValue[0]; DiagnosticsMonitor.dancer2angle = DancerValue[1]; DiagnosticsMonitor.dancer3angle = DancerValue[2]; + DiagnosticsMonitor.n_windertension = DancerErrorCounterIndex[0]; + DiagnosticsMonitor.n_pullertension = DancerErrorCounterIndex[1]; + DiagnosticsMonitor.n_feedertension = DancerErrorCounterIndex[2]; + DiagnosticsMonitor.n_windertension = DancerErrorValue[0]; + DiagnosticsMonitor.pullertension = DancerErrorValue[1]; + DiagnosticsMonitor.feedertension = DancerErrorValue[2]; DiagnosticsMonitor.n_threadspeed = SpeedCounterIndex; DiagnosticsMonitor.threadspeed = SpeedValue; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h index 2961bd105..c5e3edc85 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h @@ -27,6 +27,7 @@ uint32_t InternalWindingConfigMessage(JobSpool* request); uint32_t ThreadConfigBreakSensor(void *request); uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId); +double ThreadGetMotorCalculatedError(int DancerId); uint32_t ThreadPrepareState(void *JobDetails); uint32_t ThreadPreSegmentState(void *JobDetails); uint32_t ThreadSegmentState(void *JobDetails, int SegmentId); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 503ef2c37..0ca0b7159 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -490,6 +490,21 @@ uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId) { return CurrentControlledSpeed[MotorId]; } +//******************************************************************************************************************** +double ThreadGetMotorCalculatedError(int DancerId) +{ + switch (DancerId) + { + case FEEDER_DANCER: + return (double)MotorControlConfig[FEEDER_MOTOR].m_calculatedError; + case POOLER_DANCER: + return (double)MotorControlConfig[POOLER_MOTOR].m_calculatedError; + case WINDER_DANCER: + return (double)MotorControlConfig[WINDER_MOTOR].m_calculatedError; + + } + return 0; +} //******************************************************************************************************************** uint32_t ThreadInitialTestStub(HardwareMotor * request) -- cgit v1.3.1 From 40ae2d14550ff8d9948aac12ba2e8a90c9bad6cb Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 17 Oct 2018 09:59:56 +0300 Subject: fix pooler length calculation + heater PID band to float --- .../Embedded_SW/Embedded/Modules/Heaters/Heaters.h | 2 +- .../Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h index f7a2f3079..d19e4e5dd 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters.h @@ -24,7 +24,7 @@ typedef struct HeaterPIDControlConfigstruc int id; //HardwarePidControlType char name[20]; int32_t outputproportionalpowerlimit; - int32_t outputproportionalband; + float outputproportionalband; int32_t integraltime; int32_t derivativetime; int32_t sensorcorrectionadjustment; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 503ef2c37..dec3b8323 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -137,12 +137,12 @@ void ThreadUpdateProcessLength (double length, void *Funcptr) initialpos = 0xFFFF; Poolerinitialpos = 0xFFFF; } - +char Lenstr[150]; uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) { uint32_t positionDiff = 0; double length = 0.0; - char str[150]; + int index = MAX_THREAD_MOTORS_NUM; // if (ThreadControlActive == false) // return OK; @@ -189,9 +189,9 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) if (PrepareState == true) { //later - add temperatures - TemperatureListString(str); + TemperatureListString(Lenstr); - SendJobProgress(0.0,0,false, str); + SendJobProgress(0.0,0,false, Lenstr); } else { @@ -201,9 +201,9 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) } if (CurrentProcessedLength>=CurrentRequestedLength ) { - usnprintf(str, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); - SendJobProgress(0.0,0,false, str); - Report(str,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); + usnprintf(Lenstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); + SendJobProgress(0.0,0,false, Lenstr); + Report(Lenstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); // segment/intersegment/distance to spool finished if (ProcessedLengthFuncPtr) ProcessedLengthFuncPtr(); @@ -439,7 +439,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue) usnprintf(Message, 60, "Dancer %d limit %d value %d Zero %d",DancerId,DancerStopActivityLimit[index],avreageSampleValue,DancersCfg[DancerId].zeropoint); //JobAbortedByUser = true; ThreadControlActive = false; - JobEndReason = JOB_WINDER_DANCER_FAIL+index; + JobEndReason = JOB_WINDER_DANCER_FAIL+DancerId; SendJobProgress(0.0,0,false, Message); //EndState(CurrentJob,Message ); SegmentReady(Module_Thread,ModuleFail); @@ -561,7 +561,7 @@ uint32_t ThreadEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue) PoolerSpeedControlId = 0xFF; } //SetMotHome(ThreadMotorIdToMotorId[Motor_i]); - LengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); + PoolerLengthCalculationMultiplier = (MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulleyradius*2*PI)/(MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].pulseperround*MotorsCfg[ThreadMotorIdToMotorId[Motor_i]].microstep); PoolerSpeedControlId = AddControlCallback(PoolerThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i); } if (Motor_i == FEEDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled -- cgit v1.3.1 From 24d42fbd0c7a3202039d0c0f014a91b49d2fab3d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 17 Oct 2018 10:04:12 +0300 Subject: fix pooler counter (?) --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 576a2bd5a..28e2ecdf0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -70,10 +70,12 @@ double TotalProcessedLength = 0.0; double LengthCalculationMultiplier; uint32_t PoolerPreviousPosition = 0, PoolerCurrentPosition = 0; -double PoolerCurrentProcessedLength = 0.0; double PoolerTotalProcessedLength = 0.0; double PoolerLengthCalculationMultiplier; +double TempPoolerTotalProcessedLength = 0.0; +double TempTotalProcessedLength = 0.0; + bool PrepareState = false; int CurrentSegmentId = 0; typedef void (* ProcessedLengthFunc)(void); @@ -132,7 +134,6 @@ void ThreadUpdateProcessLength (double length, void *Funcptr) { CurrentRequestedLength = length*100;//Centimetres CurrentProcessedLength = 0; - PoolerCurrentProcessedLength = 0; ProcessedLengthFuncPtr = (ProcessedLengthFunc)Funcptr; initialpos = 0xFFFF; Poolerinitialpos = 0xFFFF; @@ -184,6 +185,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) static int pooler_counter = 0; pooler_counter++; TotalProcessedLength+= (length/100); + TempTotalProcessedLength = TotalProcessedLength; if (pooler_counter%10 == 0) { if (PrepareState == true) @@ -247,7 +249,8 @@ uint32_t PoolerThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue) PoolerPreviousPosition = PoolerCurrentPosition; length = (double)(positionDiff)*PoolerLengthCalculationMultiplier; - PoolerCurrentProcessedLength+=length; + PoolerTotalProcessedLength+= (length/100); + TempPoolerTotalProcessedLength = PoolerTotalProcessedLength; return OK; } -- cgit v1.3.1 From 8d8035d7c7382e9aa74f4a42aa1cd9080a4c2095 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 17 Oct 2018 12:11:53 +0300 Subject: fix diagnostics calculated error --- Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c | 3 ++- Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules') diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index bda086251..44681fb29 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -426,7 +426,7 @@ void SendDiagnostics(void) DiagnosticsMonitor.n_windertension = DancerErrorCounterIndex[0]; DiagnosticsMonitor.n_pullertension = DancerErrorCounterIndex[1]; DiagnosticsMonitor.n_feedertension = DancerErrorCounterIndex[2]; - DiagnosticsMonitor.n_windertension = DancerErrorValue[0]; + DiagnosticsMonitor.windertension = DancerErrorValue[0]; DiagnosticsMonitor.pullertension = DancerErrorValue[1]; DiagnosticsMonitor.feedertension = DancerErrorValue[2]; DiagnosticsMonitor.n_threadspeed = SpeedCounterIndex; @@ -579,6 +579,7 @@ void SendDiagnostics(void) else { LOG_ERROR(Task_self(),"malloc failed"); + DiagnosticsStop(); } free(diagnosticsresponseContainer.data.data); } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index 28e2ecdf0..54309a187 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -737,7 +737,7 @@ char Endstr[150]; int Motor_i; ThreadControlActive = false; - usnprintf(Endstr, 100, "Total processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); + usnprintf(Endstr, 100, "Total _processed length: Feeder: %d Pooler %d",(int)TotalProcessedLength,(int)PoolerTotalProcessedLength); SendJobProgress(0.0,0,false, Endstr); Report(Endstr,__FILE__,__LINE__,(int)TotalProcessedLength,RpWarning,(int)PoolerTotalProcessedLength,0); -- cgit v1.3.1