diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-17 15:34:28 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-17 15:34:28 +0300 |
| commit | ca2d16fcff8b8776acee40ad6ee287e8293e8299 (patch) | |
| tree | 3558323392bb6fbe8130df9f56e217002a0616bc /Software/Embedded_SW/Embedded/Modules | |
| parent | 4b389560cf068961d2f09c91106f46e35bb8cb40 (diff) | |
| parent | c4cc44a16a7da32d8bcf23928aa396b035bc1ad2 (diff) | |
| download | Tango-ca2d16fcff8b8776acee40ad6ee287e8293e8299.tar.gz Tango-ca2d16fcff8b8776acee40ad6ee287e8293e8299.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
5 files changed, 83 insertions, 61 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c index 93048681d..75ed06b05 100644 --- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c @@ -218,7 +218,7 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->heatertype = HeaterType; HeaterState->has_setpoint = true; HeaterState->setpoint = HeaterCmd[HeaterId].targettemperatue/100; - // HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse; + //HeaterState->setpoint = DCTimeSliceAllocation[HeaterId]*100/NumberOFSlicesInUse; HeaterState->has_currentvalue = true; HeaterState->currentvalue = temp/100;//MillisecGetTemperatures(HeaterId2PT100Id[HeaterId])/100; HeaterState->has_isactive = true; @@ -227,11 +227,16 @@ void LoadHeaterState(HeaterType HeaterType,HeaterState *HeaterState) HeaterState->isrampingup = 1-HeaterReady[HeaterId]; HeaterState->has_isinsetpoint = true; HeaterState->isinsetpoint = HeaterReady[HeaterId]; - /*if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerAirTemperature) + if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain) { HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain].outputproportionalpowerlimit; //HeaterState->isrampingup = InitialHeating; - }*/ + } + if (HeaterId == HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary) + { + HeaterState->setpoint = HeaterControl[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary].outputproportionalpowerlimit; + //HeaterState->isrampingup = InitialHeating; + } return; } uint32_t HeatersSingleHeaterEnd(HardwarePidControlType HeaterId) @@ -667,10 +672,10 @@ uint32_t HeaterMaxTempCBFunction(uint32_t IfIndex, uint32_t readValue) LOG_ERROR (MaxreadValue/100, "Heater Over the max temperature, turned off"); } DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); - HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain] = true; + HeaterMaxTempFlag[index] = true; //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain,0); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); - HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true; + //HeaterMaxTempFlag[HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary] = true; //HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary,0); return OK; } @@ -842,17 +847,18 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) return OK; } // if (readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100)) - if (readValue < (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)) + if (readValue < (/*HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000*/HeaterCmd[index].targettemperatue-1000)) { ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); ActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterMain); return OK; } - if ((readValue > (HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000))&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target + if ((readValue > (HeaterCmd[index].targettemperatue-1000)/*(HeaterCmd[index].targettemperatue * AcHeatersLoweroperationLimit/1000)*/)&&(readValue < (HeaterCmd[index].targettemperatue * AcHeatersUpperoperationLimit/1000)))//read value within 0.5 percent from target { ////////////////// //InitialHeating = false; + Report("AC PID Activating",__FILE__,__LINE__,readValue,RpWarning,(HeaterCmd[index].targettemperatue-1000), 0); DeActivateHeater(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary); HeaterRecalculateSharedHeatersParams(HARDWARE_PID_CONTROL_TYPE__DryerHeaterSecondary, 0); HeatersControlStart(); @@ -891,15 +897,30 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) } else //PID active { - if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) { - 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); + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 0; + HeaterPIDConfig[index].m_integral = 0; + } + else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100))) + { + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 10000; + HeaterPIDConfig[index].m_integral = 0; } else { - HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, - &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + { + 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); + } + else + { + HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + } } // len = usnprintf(ACheatstr, 254, "ACD Id, Temp , Integral, Output{ %d, %d ,%d, %d} ",index,(int)HeaterPIDConfig[index].m_mesuredParam ,(int)HeaterPIDConfig[index].m_integral,(int)HeaterPIDConfig[index].m_calculatedError); // Report(logmsg[index],__FILE__,__LINE__,index,RpWarning,index, Counter[index]); @@ -1015,15 +1036,31 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue) { //check only for the proportional band limits HeaterPIDConfig[index].m_mesuredParam = readValue; - if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + if ((readValue > ((HeaterCmd[index].targettemperatue * (100+HeaterControl[index].outputproportionalband))/100))) { - 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); + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 0; + HeaterPIDConfig[index].m_integral = 0; + } + else if ((readValue < ((HeaterCmd[index].targettemperatue * (100-HeaterControl[index].outputproportionalband))/100))) + { + //disable PID outside band + HeaterPIDConfig[index].m_calculatedError = 10000; + HeaterPIDConfig[index].m_integral = 0; } else { - HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, - &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + if (HeaterPIDConfig[index].m_params.IntegralErrorMultiplier == 0) + { + 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); + } + else + { + HeaterPIDConfig[index].m_calculatedError = AdvancedPIDAlgorithmCalculation(HeaterPIDConfig[index].m_SetParam , HeaterPIDConfig[index].m_mesuredParam, + &HeaterPIDConfig[index].m_params, &HeaterPIDConfig[index].m_preError, &HeaterPIDConfig[index].m_integral); + } + } // error[index][Counter[index]] = HeaterPIDConfig[index].m_preError; // integral[index][Counter[index]] = HeaterPIDConfig[index].m_integral; diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c index e2f2013c9..4867587d9 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_HW_Version.c @@ -22,41 +22,7 @@ #include "driverlib/rom.h" -char Read_HW_Version(unsigned char *Brd_ID, unsigned char *Assy_ID) -{ - //TODO Move in GPIO Initialisation - - // ----------- Set HW Version GPIO as Input ----------- - //MAP_GPIOPinTypeGPIOInput(GPIO_PORTS_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1); - //MAP_GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_7); - //MAP_GPIOPinTypeGPIOInput(GPIO_PORTP_BASE, GPIO_PIN_3 | GPIO_PIN_5); - - //Set HW Version GPIO to Pull down - GPIOPadConfigSet(GPIO_PORTS_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD ); - GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_7, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD ); - GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_3 | GPIO_PIN_5, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPD ); - // ------------------------------------------------------ - if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_3) == GPIO_PIN_3) - *Brd_ID |= 0x08; - if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_2) == GPIO_PIN_2) - *Brd_ID |= 0x04; - if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_5) == GPIO_PIN_5) - *Brd_ID |= 0x02; - if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_4) == GPIO_PIN_4) - *Brd_ID |= 0x01; - - if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_3) == GPIO_PIN_3) - *Assy_ID |= 0x08; - if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_5) == GPIO_PIN_5) - *Assy_ID |= 0x04; - if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_1) == GPIO_PIN_1) - *Assy_ID |= 0x02; - if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7) == GPIO_PIN_7) - *Assy_ID |= 0x01; - - return PASSED; -} void Stub_HWVersionRequest(MessageContainer* requestContainer) { diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c index 636889127..7995b1a42 100644 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c +++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.c @@ -21,7 +21,7 @@ #include "drivers/SPI/SPI_Comm.h" #include "driverlib/ssi.h" - +/* unsigned long Run_Value = 136902 ; unsigned long Pos_Value; unsigned long Mov_Value ; @@ -43,6 +43,28 @@ unsigned long TestUint32_4; unsigned long TestUint32_5; unsigned long TestUint32_6; + */ + extern unsigned long Run_Value ; + extern unsigned long Mov_Value ; + extern unsigned long Pos_Value; + extern bool Direction ; + extern unsigned long Time_2_Change_Direction ; + extern bool Display_Tx_ON_LCD; + extern bool Display_Rx_on_LCD; + extern unsigned long Init_MicroStep ; + extern unsigned long Init_Acc; + extern unsigned long Init_Dec; + extern bool TestBool_1; + extern bool TestBool_2; + extern bool TestBool_3; + extern bool TestBool_4; + extern bool TestBool_5; + extern unsigned long TestUint32_1; + extern unsigned long TestUint32_2; + extern unsigned long TestUint32_3; + extern unsigned long TestUint32_4; + extern unsigned long TestUint32_5; + extern unsigned long TestUint32_6; void Stub_L6470DriverRequest(MessageContainer* requestContainer) { diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h deleted file mode 100644 index 0b4702861..000000000 --- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_L6470.h +++ /dev/null @@ -1,3 +0,0 @@ -void Stub_L6470DriverRequest(MessageContainer* requestContainer); - -void temp_init_spi2(); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 0b19d835a..70f32ce6d 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -111,12 +111,12 @@ uint32_t Winder_Prepare(void) }*/ if (FPGA_Read_limit_Switches(GPI_LS_SCREW_RIGHT)==LIMIT) { - REPORT_MSG(LIMIT, "Winder_Prepare at limit"); + //REPORT_MSG(LIMIT, "Winder_Prepare at limit"); Winder_PrepareStage2(0,0); } else { - REPORT_MSG(ScrewSpeed, "Winder_Prepare"); + //REPORT_MSG(ScrewSpeed, "Winder_Prepare"); Winder_ScrewHoming = true; //REPORT_MSG(MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, "Winder_Prepare move to limit"); status = MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_SCREW,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize, ScrewSpeed, GPI_LS_SCREW_RIGHT, Winder_PrepareStage2,2000); @@ -322,7 +322,9 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) // * calculate // * 1. calculate speed according to JobTicket->processparameters->dyeingspeed // * calculation input: traverse length in milimeters/pulses, number of rotations per traverse ==> length of traverse per rotation. - screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; + ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; + ScrewNumberOfSteps -= 100; + screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage; // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. //RotationsPerSecond = dyeingspeed / (MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulleyradius * PI); RotationsPerSecond = OriginalMotorSpd_2PPS[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; @@ -343,10 +345,8 @@ uint32_t Winder_Presegment(void *SegmentDetails, uint32_t SegmentId) // * 3. calculate cart travel length from winding parameters // * 4. start move of travel length // * 5. register motor nBusy callback. this callback will flip between move(traverse length, hardstop) and goto(0), with handline og the coneshape and adjusting maxspeed - ScrewNumberOfSteps = InternalWinderCfg.segmentoffsetpulses;//*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; - ScrewNumberOfSteps -= 100; temp = SYS_CLK_FREQ; - temp *= InternalWinderCfg.segmentoffsetpulses; + temp *= ScrewNumberOfSteps; temp /= ScrewSpeed; ScrewRunningTime = temp;//(SYS_CLK_FREQ*InternalWinderCfg.segmentoffsetpulses)/ScrewSpeed; REPORT_MSG(ScrewNumberOfSteps,"Winder pre segment - ScrewNumberOfSteps"); |
