aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-06 07:56:31 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-06 07:56:31 +0300
commit5818548b366bb5a31ab04e8960bd37f739242592 (patch)
treefbaa0de1ef53177c46e1e7336436052d97918020 /Software/Embedded_SW/Embedded/Modules/Thread
parent40afcf1c6591abacfa1466dd4d865296bf687aa4 (diff)
downloadTango-5818548b366bb5a31ab04e8960bd37f739242592.tar.gz
Tango-5818548b366bb5a31ab04e8960bd37f739242592.zip
real time improvement, screw speed recalculated
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c10
3 files changed, 18 insertions, 11 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;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
index 7405a91d9..79c2bf843 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
@@ -25,6 +25,7 @@ extern double TotalProcessedLength;
uint32_t InternalWindingConfigMessage(JobSpool* request);
+uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId);
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 8d1ea20fa..d56ff34cf 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -127,8 +127,8 @@ void ThreadUpdateProcessLength (double length, void *Funcptr)
ProcessedLengthFuncPtr = (ProcessedLengthFunc)Funcptr;
initialpos = 0xFFFF;
}
-double MotorSentData[102] = {0};
-uint32_t PosDif[102] = {0};
+double MotorSentData[100] = {0};
+uint32_t PosDif[100] = {0};
int MotorDataIndex = 0;
@@ -181,7 +181,7 @@ uint32_t ThreadLengthCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//PosDif[MotorDataIndex] = positionDiff;
MotorSentData[MotorDataIndex] = length;
MotorDataIndex+=1;
- if (MotorDataIndex >= 97) MotorDataIndex = 0;
+ if (MotorDataIndex == 99) MotorDataIndex = 0;
static int pooler_counter = 0;
pooler_counter++;
TotalProcessedLength+= (length/100);
@@ -415,6 +415,10 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
}
//********************************************************************************************************************
+uint32_t ThreadGetMotorSpeed(threadMotorsEnum MotorId)
+{
+ return CurrentControlledSpeed[MotorId];
+}
//********************************************************************************************************************
uint32_t ThreadInitialTestStub(HardwareMotor * request)