diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-06 07:56:31 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-08-06 07:56:31 +0300 |
| commit | 5818548b366bb5a31ab04e8960bd37f739242592 (patch) | |
| tree | fbaa0de1ef53177c46e1e7336436052d97918020 /Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | |
| parent | 40afcf1c6591abacfa1466dd4d865296bf687aa4 (diff) | |
| download | Tango-5818548b366bb5a31ab04e8960bd37f739242592.tar.gz Tango-5818548b366bb5a31ab04e8960bd37f739242592.zip | |
real time improvement, screw speed recalculated
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 794559d57..486f8384f 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -168,7 +168,7 @@ numOfSteps = InternalWinderCfg.startoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) { uint32_t NumberOfSteps = InternalWinderCfg.segmentoffsetpulses*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].microstep; - float screw_speed = 0; + float screw_horizontal_speed = 0; float RotationsPerSecond; if (Counter) @@ -178,14 +178,15 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) NumberOfSteps -= (Counter/InternalWinderCfg.spoolbackingrate); REPORT_MSG(ScrewNumberOfSteps, "Head Backing"); ScrewNumberOfSteps--; - screw_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; + screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / 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 / (InternalWinderCfg.diameter * PI); RotationsPerSecond = CurrentControlledSpeed[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. - ScrewSpeed = screw_speed*RotationsPerSecond; + ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); + CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; } if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 1)) @@ -258,7 +259,7 @@ uint32_t WinderPresegmentReady(uint32_t deviceID, uint32_t ReadValue) uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId) { //JobTicket* JobTicket = JobDetails; - float screw_speed = 0; + float screw_horizontal_speed = 0; float RotationsPerSecond; if (dyeingspeed == 0) @@ -275,15 +276,16 @@ uint32_t Winder_Presegment(void *JobDetails, 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_speed = InternalWinderCfg.segmentoffsetpulses / InternalWinderCfg.NumberOfRotationPerPassage; + screw_horizontal_speed = InternalWinderCfg.segmentoffsetpulses / 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 / (InternalWinderCfg.diameter * PI); RotationsPerSecond = CurrentControlledSpeed[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. - ScrewSpeed = screw_speed*RotationsPerSecond; + ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewSpeed); - //screw_speed = InternalWinderCfg.milimetersperrotation + CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; + //screw_horizontal_speed = InternalWinderCfg.milimetersperrotation // * 2. determine optimal micro-step setting // * 3. calculate cart travel length from winding parameters // * 4. start move of travel length @@ -292,7 +294,7 @@ uint32_t Winder_Presegment(void *JobDetails, uint32_t SegmentId) MotorMove (HARDWARE_MOTOR_TYPE__MOTO_SCREW,ScrewCurrentDirection,ScrewNumberOfSteps); //process: set point 0, set max speed, move to the specified length, return back. ScrewControlId = AddControlCallback(ScrewDirectionChange, eOneMillisecond,MotorControlGetnBusyState,(IfTypeMotors*0x100+HARDWARE_MOTOR_TYPE__MOTO_SCREW), HARDWARE_MOTOR_TYPE__MOTO_SCREW, 0); - // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_speed,WinderPresegmentReady); + // MotorSetSpeedWithCallback (HARDWARE_MOTOR_TYPE__MOTO_SCREW, screw_horizontal_speed,WinderPresegmentReady); //in a callback: calculate backing rate for top and bottom, update point 0, update passing length, call the appropriate move to 0 / move; } |
