aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2018-05-29 09:58:17 +0300
committerAvi Levkovich <avi@twine-s.com>2018-05-29 09:58:17 +0300
commit7c7d112ea07018f0781522ba21fb799fc0870ed3 (patch)
tree6ac30b334fa6cfc037739aaf059999c9a9384e08 /Software/Embedded_SW/Embedded/Modules
parentc22e4713c31b1579a79ac7af2240941d96f766fa (diff)
parentf5d8eb49fa9f6a73a6d7a9ad72870bb5fcdcf3ea (diff)
downloadTango-7c7d112ea07018f0781522ba21fb799fc0870ed3.tar.gz
Tango-7c7d112ea07018f0781522ba21fb799fc0870ed3.zip
merge confilct heater.c
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c3
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c21
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c9
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c36
7 files changed, 47 insertions, 27 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
index e73f16a10..eaf5de995 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c
@@ -327,6 +327,8 @@ uint32_t HWConfigurationFunc(MessageContainer* requestContainer)
return ERROR;
}
HardwareConfiguration *request = UploadRequest->hardwareconfiguration;
+
+ PrintingHWConfiguration(request);
if (request->n_winders == 1)
status += InternalWinderConfigMessage(request->winders);
status += MotorsInit();
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
index d8cac97a5..bb38161c7 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
@@ -48,7 +48,7 @@ typedef enum {
/******************** GLOBAL PARAMETERS ********************************************/
HeaterPIDControlConfig HeaterControl[MAX_HEATERS_NUM] = {0};
HeaterControlConfig_t HeaterPIDConfig[MAX_HEATERS_NUM] = {0};
-uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {ANALOG_DRYER_TEMP1,ANALOG_DRYER_TEMP2,ANALOG_DRYER_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP5,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,ANALOG_MIXCHIP_TEMP};
+uint32_t HeaterId2PT100Id[MAX_HEATERS_NUM] = {ANALOG_DRYER_TEMP1,ANALOG_DRYER_TEMP2,ANALOG_DRYER_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP1,TEMP_SENSE_ANALOG_DYEINGH_TEMP2,TEMP_SENSE_ANALOG_DYEINGH_TEMP3,TEMP_SENSE_ANALOG_DYEINGH_TEMP4,ANALOG_MIXCHIP_TEMP};
bool AcHeaterConfigured[MAX_AC_HEATERS] = {0};
bool FastHeating = 1;
@@ -158,7 +158,6 @@ void HeatingTestSendResonse(uint32_t status, bool last,bool heater1Active,bool h
MessageContainer responseContainer;
uint8_t* container_buffer;
// uint8_t container_buffer[50];
-
if (stubToken[0] == 0)
return;
StubHeatingTestPollResponse response = STUB_HEATING_TEST_POLL_RESPONSE__INIT;
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
index b7a13e91b..d3224e9b3 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_print.c
@@ -51,6 +51,7 @@ uint32_t Heater_timerBase = TIMER2_BASE; //Timer handle
uint32_t OutputProportionalCycleTime = 0; //A/C Heaters Cycle time in milliseconds - one for all heaters
char TimeSliceAllocation[MAX_TIMESLICES] = {0xFF};
int DCTimeSliceAllocation[MAX_HEATERS_NUM] = {0};
+bool HeatersReadey[MAX_HEATERS_NUM] = {true};
bool InitialHeatingState = true;
bool TimerActivated = false;
@@ -86,7 +87,7 @@ void HeatersControlStop(void)
TimerActivated = false;
HeatersRestart = false;
}
-
+#warning there is a need to separate the AC and DC heaters preparation!
void HeatersControlStart(void)
{
Report("HeatersControlStart ", __FILE__,__LINE__,0, RpMessage, 0, 0);
@@ -107,7 +108,7 @@ void HeatersStartControlTimer (void)
Report("HeatersStartControlTimer ", __FILE__,__LINE__,0, RpMessage, 0, 0);
return;
}
-
+bool HeaterReducedPowerStarted = false;
/**************************************************************************************
* HeaterCommandRequestMessage
* called by: Communication from host
@@ -117,6 +118,12 @@ uint32_t HeaterCommandRequestMessage(int HeaterId, bool OnOff, int Temperature)
{
//uint32_t status = NOT_SUPPORTED;
//MessageContainer responseContainer;
+ if (HeaterReducedPowerStarted == false)
+ {
+ HeaterReducedPowerStarted = true;
+ AddControlCallback( HeaterBalanceLoadControlCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
+ }
+
if (HeaterId< MAX_HEATERS_NUM)
{
if (HeaterControl[HeaterId].id != HeaterId) // heater configuration missing
@@ -187,7 +194,7 @@ uint32_t PrepareHeater(int HeaterId, uint32_t SetTemperatue)
HeaterPIDConfig[HeaterId].m_isReady = true;
HeaterPIDConfig[HeaterId].m_mesuredParam = 0;
HeaterPIDConfig[HeaterId].m_preError = 0;
- HeaterPIDConfig[HeaterId].m_SetParam = SetTemperatue;//need to update SetParams on presegment stage
+ HeaterPIDConfig[HeaterId].m_SetParam = SetTemperatue*100;//need to update SetParams on presegment stage
if (HeaterId > HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //DC Heaters
ControlIdtoHeaterId [HeaterId] = AddControlCallback( DCHeaterControlCBFunction, eHundredMillisecond,TemperatureSensorRead,(IfTypeHeaters*0x100+HeaterId),HeaterId2PT100Id[HeaterId],0);
else if (HeaterId < HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2) //AC Heaters
@@ -228,10 +235,10 @@ uint32_t HeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
static uint32_t Temperature[2] = {0};
if (index<2)
Temperature[index] = readValue;
- HeatingTestSendResonse(0, false,GetHeaterState(HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w),GetHeaterState(HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1),
+ /*HeatingTestSendResonse(0, false,GetHeaterState(HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w),GetHeaterState(HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1),
Temperature[0],Temperature[1],
HeaterPIDConfig[HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w].m_calculatedError, HeaterPIDConfig[HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1].m_calculatedError,"Standard");
-
+*/
// check if the read value is within the proportional band
if (InitialHeating)
{
@@ -324,9 +331,9 @@ uint32_t DCHeaterControlCBFunction(uint32_t IfIndex, uint32_t readValue)
Temperature[0],Temperature[1],
HeaterPIDConfig[HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w].m_calculatedError, HeaterPIDConfig[HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1].m_calculatedError,"Standard");
*/
- HeatingTestSendResonse(0, false,GetHeaterState(index),0,
+ /*HeatingTestSendResonse(0, false,GetHeaterState(index),0,
readValue,0,
- HeaterPIDConfig[index].m_calculatedError, 0,"Standard");
+ HeaterPIDConfig[index].m_calculatedError, 0,"Standard");*/
// check if the read value is within the proportional band
if (InitialHeating[index])
{
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
index e690b72b4..2c3910140 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS.h
@@ -3,7 +3,7 @@
#include "PMR/common/MessageContainer.pb-c.h"
#include "PMR/Hardware/HardwareDispenser.pb-c.h"
#include "drivers/motors/motor.h"
-#define MAX_SYSTEM_DISPENSERS 8
+#include "ids_ex.h"
extern uint32_t DispenserIdToMotorId[MAX_SYSTEM_DISPENSERS];
uint32_t DispenserConfigMessage(HardwareDispenser * request);
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
index 12a0372d0..feb38000f 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_ex.h
@@ -9,6 +9,7 @@
#define MODULES_IDS_IDS_EX_H_
#include "PMR/Hardware/HardwarePIDControl.pb-c.h"
+#define MAX_SYSTEM_DISPENSERS 8
uint32_t IDSPrepareState(void *JobDetails);
uint32_t IDSPreSegmentState(void *JobDetails, int SegmentId);
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c
index 52aef460f..e24c4b0c2 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Heater.c
@@ -21,6 +21,10 @@
#include "Stub_Status.h"
#include "Drivers/Heater/Heater.h"
+#include "../control/control.h"
+#include "Drivers/Heater/TemperatureSensor.h"
+
+bool StubHeaterReducedPowerStarted = false;
void Stub_HeaterRequest(MessageContainer* requestContainer)
{
@@ -39,6 +43,11 @@ void Stub_HeaterRequest(MessageContainer* requestContainer)
writeFloat(request->heatergroupid);
writeString(", ");
writeFloat(request->heatergroupon);
+ if (StubHeaterReducedPowerStarted == false)
+ {
+ StubHeaterReducedPowerStarted = true;
+ AddControlCallback( HeaterBalanceLoadControlCBFunction, eHundredMillisecond,TemperatureSensorRead,0,0,0);
+ }
if (request->heatergroupon )
status = ActivateHeater(request->heatergroupid);
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index c036f4913..1e2203abb 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -21,6 +21,9 @@
#include "drivers/Danser_SSI/ssi_comm.h"
#include "drivers/Heater/TemperatureSensor.h"
#include "drivers/Heater/Heater.h"
+#include "drivers/Motors/Motor.h"
+#include "modules/heaters/heaters.h"
+
////////////////////////////////State machine operation////////////////////////////////////
//the state machine operation is used to operate in runtime correct profile flow execution
//by recieved esign flow of the user from the UI
@@ -186,6 +189,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//read value is the dancer angle
int i,index=MAX_THREAD_MOTORS_NUM;
int DancerId;
+ static int pooler_counter = 0;
int32_t TranslatedReadValue, avreageSampleValue = 0;
double NormalizedError;
if (IfIndex>>8 != IfTypeThread)
@@ -238,6 +242,15 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
MotorSetSpeed(ThreadMotorIdToMotorId[index], calculated_speed, MotorsCfg[ThreadMotorIdToMotorId[index]].microstep);
}
}
+ if (index == POOLER_MOTOR)
+ {
+ pooler_counter++;
+ if (pooler_counter>=1000)
+ {
+ HeatingTestSendResonse(0, false,true,true, MotorDriverRequest[22].Speed,MotorDriverRequest[18].Speed,MotorDriverRequest[15].Speed,MotorDriverRequest[3].Speed, "MotorSpeed");
+ pooler_counter = 0;
+ }
+ }
return OK;
}
@@ -245,13 +258,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//********************************************************************************************************************
//********************************************************************************************************************
-/*#ifdef DEBUG_TEST_FUNCTIONS
-uint32_t Debug_Get_Dancer_Read(uint32_t DancerId, uint32_t Parameter1, uint32_t Parameter2)
-{
-
- return (rand() % (103 + 1 + 103) - 103);
-}
-#endif*/
uint32_t ThreadInitialTestStub(HardwareMotor * request)
{
@@ -276,7 +282,7 @@ bool InitialProcess = false;
MotorControlConfig[Motor_i].m_params.Kd = MotorsControl[Pid_Id].derivativetime;
MotorControlConfig[Motor_i].m_params.Kp = MotorsControl[Pid_Id].proportionalgain;
MotorControlConfig[Motor_i].m_params.Ki = MotorsControl[Pid_Id].integraltime;
- MotorControlConfig[Motor_i].m_params.epsilon = 0.01;
+ MotorControlConfig[Motor_i].m_params.epsilon = 0.1;
MotorControlConfig[Motor_i].m_params.dt = 50;
MotorControlConfig[Motor_i].m_calculatedError = 0;
MotorControlConfig[Motor_i].m_integral = 0;
@@ -287,13 +293,14 @@ bool InitialProcess = false;
MotorControlConfig[Motor_i].m_SetParam = 0;//need to update SetParams on presegment stage
MotorSetDirection((TimerMotors_t)HW_Motor_Id,MotorsCfg[HW_Motor_Id].directionthreadwize);
- #ifdef DEBUG_TEST_FUNCTIONS
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
ControlIdtoMotorId[Motor_i] = AddControlCallback(ThreadLengthCBFunction, eHundredMillisecond,MotorGetPositionFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[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
ControlIdtoMotorId[Motor_i] = AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
- if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled
+ if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled
+ ControlIdtoMotorId[Motor_i] = AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
+ if (Motor_i == WINDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled
ControlIdtoMotorId[Motor_i] = AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
/*if (HW_Motor_Id == HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled
//AddControlCallback(ThreadSpeedControlCBFunction, eOneMillisecond,MotorGetSpeed,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],0);
@@ -301,15 +308,12 @@ bool InitialProcess = false;
AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,ThreadMotorIdToDancerId[Motor_i],Motor_i);
else if ((HW_Motor_Id == HARDWARE_MOTOR_TYPE__MOTO_WINDER)||(HW_Motor_Id == HARDWARE_MOTOR_TYPE__MOTO_LDRIVING)||(HW_Motor_Id == HARDWARE_MOTOR_TYPE__MOTO_RDRIVING))
AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);*/
- #else
if (Motor_i == HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will not be controlled
continue;
//AddControlCallback(ThreadSpeedControlCBFunction, eOneMillisecond,MotorGetSpeed,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i);
- else if ((Motor_i == HARDWARE_MOTOR_TYPE__MOTO_WINDER)||(Motor_i == HARDWARE_MOTOR_TYPE__MOTO_LDRIVING)||(Motor_i == HARDWARE_MOTOR_TYPE__MOTO_RDRIVING))
- AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
- #endif
+// else if ((Motor_i == HARDWARE_MOTOR_TYPE__MOTO_WINDER)||(Motor_i == HARDWARE_MOTOR_TYPE__MOTO_LDRIVING)||(Motor_i == HARDWARE_MOTOR_TYPE__MOTO_RDRIVING))
+// AddControlCallback(ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
}
- Winder_Prepare();
PrepareReady(Module_Thread,ModuleDone);
//set 3 dancers to the profile positions
InitialProcess = true;
@@ -325,8 +329,6 @@ uint32_t ThreadPreSegmentState(void *JobDetails)
int process_speed = JobTicket->processparameters->dyeingspeed;
- process_speed = 50; //debug
-
for (Motor_i = 0;Motor_i <= WINDER_MOTOR;Motor_i++)
{
HW_Motor_Id = ThreadMotorIdToMotorId[Motor_i];