diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-16 10:19:53 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-16 10:19:53 +0300 |
| commit | 8e9c53625339326ef5477c4a9222ffbbf01b5d50 (patch) | |
| tree | 6804cec142e5ccff7b326d8b6a5a1de5abd1ae4b /Software/Embedded_SW/Embedded/Modules | |
| parent | e2bbf9ddb31303fab08ca10bd37cb7f469534b14 (diff) | |
| parent | 3ded2e3910c6829c51a87711d7d82a1993596944 (diff) | |
| download | Tango-8e9c53625339326ef5477c4a9222ffbbf01b5d50.tar.gz Tango-8e9c53625339326ef5477c4a9222ffbbf01b5d50.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
7 files changed, 47 insertions, 59 deletions
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/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/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 ebdb126ac..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; @@ -348,7 +347,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 +390,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; diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 59bd8a1b2..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]; @@ -461,7 +473,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) @@ -510,11 +521,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/100)); } @@ -587,14 +607,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; @@ -610,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_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 b9a1f4e27..bbe537263 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 <PMR/Diagnostics/EventType.pb-c.h> #include <utils/ustdlib.h> @@ -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; @@ -462,36 +461,19 @@ 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) + /*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); } |
