diff --git a/docs/motorRecord.html b/docs/motorRecord.html
index 0bd14e2b..dd4d9367 100644
--- a/docs/motorRecord.html
+++ b/docs/motorRecord.html
@@ -272,6 +272,13 @@ below.
|
+
+ | ACCU |
+ R/W |
+ Acceleration used |
+ RECCHOICE |
+ (0:"Use ACCL", 1:"Use ACCS") |
+
| ADEL |
R/W |
@@ -1718,11 +1725,30 @@ below.
motor motion.
- | The motor record expects the hardware to produce a trapezoidal
+ | ACCS |
+ R/W |
+ Acceleration (EGU/s^2) |
+ DOUBLE |
+ Valid range; 0 <= ACCS |
+
+
+ | ACCU |
+ R/W |
+ Acceleration used |
+ RECCHOICE |
+ (0:"Use ACCL", 1:"Use ACCS") This field determines whether the ACCL or ACCS field
+ is used in the calculation of the acceleration that is sent to device support. The field
+ that is not used changes with VELO. The default value is "Use ACCL" |
+
+
+ |
+ The motor record expects the hardware to produce a trapezoidal
speed profile. That is, the motor speed is expected to increase linearly with
time from the base speed, VBAS, to the full speed, VELO, in ACCL seconds. At the
end of a motion, the speed is expected to decrease similarly to VBAS.
- Note that the ACCS field can be use to specify the acceleration in EGU/s^2. |
+ Note that the ACCS field can be use to specify the acceleration in EGU/s^2.
+ Velocity and acceleration are related by the following equation:
+ VELO - VBAS = ACCL * ACCS
| JVEL |
diff --git a/modules/Makefile b/modules/Makefile
index 5c3054ac..13b5cdc5 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -85,6 +85,10 @@ ifdef LUA
$(ECHO) Creating $@, LUA = $(LUA)
@echo LUA = $(LUA)>> $@
endif
+ifdef AUTOSAVE
+ $(ECHO) Creating $@, AUTOSAVE = $(AUTOSAVE)
+ @echo AUTOSAVE = $(AUTOSAVE)>> $@
+endif
ifdef MODBUS
$(ECHO) Creating $@, MODBUS = $(MODBUS)
@echo MODBUS = $(MODBUS)>> $@
diff --git a/motorApp/Db/asyn_motor.db b/motorApp/Db/asyn_motor.db
index e7089228..fefe379f 100644
--- a/motorApp/Db/asyn_motor.db
+++ b/motorApp/Db/asyn_motor.db
@@ -10,6 +10,7 @@ record(motor, "$(P)$(M)") {
field(VELO, "$(VELO)")
field(VBAS, "$(VBAS)")
field(ACCL, "$(ACCL)")
+ field(ACCU, "$(ACCU=0)")
field(BDST, "$(BDST)")
field(BVEL, "$(BVEL)")
field(BACC, "$(BACC)")
diff --git a/motorApp/Db/asyn_motor_model2.db b/motorApp/Db/asyn_motor_model2.db
index 7cd664f4..3fa391a5 100644
--- a/motorApp/Db/asyn_motor_model2.db
+++ b/motorApp/Db/asyn_motor_model2.db
@@ -10,6 +10,7 @@ record(motor, "$(P)$(M)") {
field(VELO, "$(VELO)")
field(VBAS, "$(VBAS)")
field(ACCL, "$(ACCL)")
+ field(ACCU, "$(ACCU=0)")
field(BDST, "$(BDST)")
field(BVEL, "$(BVEL)")
field(BACC, "$(BACC)")
diff --git a/motorApp/Db/basic_asyn_motor.db b/motorApp/Db/basic_asyn_motor.db
index a1859804..b678741b 100644
--- a/motorApp/Db/basic_asyn_motor.db
+++ b/motorApp/Db/basic_asyn_motor.db
@@ -6,6 +6,7 @@ record(motor,"$(P)$(M)")
field(VELO,"$(VELO)")
field(VBAS,"$(VBAS)")
field(ACCL,"$(ACCL)")
+ field(ACCU,"$(ACCU=0)")
field(BDST,"$(BDST)")
field(BVEL,"$(BVEL)")
field(BACC,"$(BACC)")
diff --git a/motorApp/Db/basic_asyn_motor_model2.db b/motorApp/Db/basic_asyn_motor_model2.db
index 84dba5ce..84e7c1fe 100644
--- a/motorApp/Db/basic_asyn_motor_model2.db
+++ b/motorApp/Db/basic_asyn_motor_model2.db
@@ -6,6 +6,7 @@ record(motor,"$(P)$(M)")
field(VELO,"$(VELO)")
field(VBAS,"$(VBAS)")
field(ACCL,"$(ACCL)")
+ field(ACCU,"$(ACCU=0)")
field(BDST,"$(BDST)")
field(BVEL,"$(BVEL)")
field(BACC,"$(BACC)")
diff --git a/motorApp/Db/basic_motor.db b/motorApp/Db/basic_motor.db
index 98e55ec9..87c70bea 100644
--- a/motorApp/Db/basic_motor.db
+++ b/motorApp/Db/basic_motor.db
@@ -6,6 +6,7 @@ grecord(motor,"$(P)$(M)")
field(VELO,"$(VELO)")
field(VBAS,"$(VBAS)")
field(ACCL,"$(ACCL)")
+ field(ACCU,"$(ACCU=0)")
field(BDST,"$(BDST)")
field(BVEL,"$(BVEL)")
field(BACC,"$(BACC)")
diff --git a/motorApp/Db/basic_motor_settings.req b/motorApp/Db/basic_motor_settings.req
index 5e3eb551..9072214a 100644
--- a/motorApp/Db/basic_motor_settings.req
+++ b/motorApp/Db/basic_motor_settings.req
@@ -11,6 +11,7 @@ $(P)$(M).RRES
$(P)$(M).VBAS
$(P)$(M).VELO
$(P)$(M).ACCL
+$(P)$(M).ACCU
$(P)$(M).BDST
$(P)$(M).BVEL
$(P)$(M).BACC
diff --git a/motorApp/Db/motor.db b/motorApp/Db/motor.db
index 3b6c0e5d..7b5b4712 100644
--- a/motorApp/Db/motor.db
+++ b/motorApp/Db/motor.db
@@ -10,6 +10,7 @@ record(motor, "$(P)$(M)") {
field(VELO, "$(VELO)")
field(VBAS, "$(VBAS)")
field(ACCL, "$(ACCL)")
+ field(ACCU, "$(ACCU=0)")
field(BDST, "$(BDST)")
field(BVEL, "$(BVEL)")
field(BACC, "$(BACC)")
diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc
index 88e1ff87..a6b9e053 100644
--- a/motorApp/MotorSrc/motorRecord.cc
+++ b/motorApp/MotorSrc/motorRecord.cc
@@ -486,7 +486,7 @@ static double accEGUfromVelo(motorRecord *pmr, double veloEGU)
double vmax = fabs(veloEGU);
double acc;
/* ACCL or ACCS */
- if (pmr->accu == motorACCSused_Accs)
+ if (pmr->accu == motorACCU_Accs)
acc = pmr->accs;
else if (vmax > vmin)
acc = (vmax - vmin) / pmr->accl;
@@ -498,14 +498,9 @@ static double accEGUfromVelo(motorRecord *pmr, double veloEGU)
static void updateACCLfromACCS(motorRecord *pmr)
{
- if (pmr->accu != motorACCSused_Accs)
- {
- pmr->accu = motorACCSused_Accs;
- db_post_events(pmr, &pmr->accu, DBE_VAL_LOG);
- }
if (pmr->accs > 0.0)
{
- double temp_dbl = pmr->velo / pmr->accs;
+ double temp_dbl = (pmr->velo > pmr->vbas) ? (pmr->velo - pmr->vbas) / pmr->accs : pmr->velo / pmr->accs;
if (pmr->accl != temp_dbl)
{
pmr->accl = temp_dbl;
@@ -517,12 +512,7 @@ static void updateACCLfromACCS(motorRecord *pmr)
static void updateACCSfromACCL(motorRecord *pmr)
{
double temp_dbl;
- if (pmr->accu != motorACCSused_Accl)
- {
- pmr->accu = motorACCSused_Accl;
- db_post_events(pmr, &pmr->accu, DBE_VAL_LOG);
- }
- temp_dbl = pmr->velo / pmr->accl;
+ temp_dbl = (pmr->velo > pmr->vbas) ? (pmr->velo - pmr->vbas) / pmr->accl : pmr->velo / pmr->accl;
if (pmr->accs != temp_dbl)
{
pmr->accs = temp_dbl;
@@ -532,11 +522,11 @@ static void updateACCSfromACCL(motorRecord *pmr)
static void updateACCL_ACCSfromVELO(motorRecord *pmr)
{
- if (pmr->accu == motorACCSused_Accs)
+ if (pmr->accu == motorACCU_Accs)
{
if (pmr->accs > 0.0)
{
- double temp_dbl = pmr->velo / pmr->accs;
+ double temp_dbl = (pmr->velo > pmr->vbas) ? (pmr->velo - pmr->vbas) / pmr->accs : pmr->velo / pmr->accs;
if (pmr->accl != temp_dbl)
{
pmr->accl = temp_dbl;
@@ -546,7 +536,7 @@ static void updateACCL_ACCSfromVELO(motorRecord *pmr)
}
else
{
- double temp_dbl = pmr->velo / pmr->accl;
+ double temp_dbl = (pmr->velo > pmr->vbas) ? (pmr->velo - pmr->vbas) / pmr->accl : pmr->velo / pmr->accl;
if (pmr->accs != temp_dbl)
{
pmr->accs = temp_dbl;
@@ -2639,6 +2629,7 @@ static long special(DBADDR *paddr, int after)
pmr->sbas = temp_dbl;
db_post_events(pmr, &pmr->sbas, DBE_VAL_LOG);
}
+ updateACCL_ACCSfromVELO(pmr);
break;
/* new sbas: make vbas agree */
@@ -2654,6 +2645,7 @@ static long special(DBADDR *paddr, int after)
pmr->vbas = temp_dbl;
db_post_events(pmr, &pmr->vbas, DBE_VAL_LOG);
}
+ updateACCL_ACCSfromVELO(pmr);
break;
/* new vmax: make smax agree */
@@ -2744,7 +2736,11 @@ static long special(DBADDR *paddr, int after)
/* new accs */
case motorRecordACCS:
- db_post_events(pmr, &pmr->accs, DBE_VAL_LOG);
+ if (pmr->accs <= 0.0)
+ {
+ updateACCSfromACCL(pmr);
+ }
+ //db_post_events(pmr, &pmr->accs, DBE_VAL_LOG);
updateACCLfromACCS(pmr);
break;
@@ -4027,20 +4023,22 @@ static void check_speed_and_resolution(motorRecord * pmr)
db_post_events(pmr, &pmr->sbak, DBE_VAL_LOG);
db_post_events(pmr, &pmr->bvel, DBE_VAL_LOG);
- if (pmr->accs && !pmr->accl)
+ /* ACCS (EGU/sec^2) <--> ACCL (sec) */
+ if (pmr->accs > 0.0)
{
- /* ACCL == 0.0, ACCS is != 0.0 -> Use ACCS
- This is a (possible) new way to configure a database.
- Existing Db files will have ACCS == 0.0 and this
- is backwards compatible and behaves as before */
updateACCLfromACCS(pmr);
}
- /* Sanity check on acceleration time. */
- if (pmr->accl == 0.0)
+ else
{
- pmr->accl = 0.1;
- db_post_events(pmr, &pmr->accl, DBE_VAL_LOG);
+ /* Sanity check on acceleration time. */
+ if (pmr->accl == 0.0)
+ {
+ pmr->accl = 0.1;
+ db_post_events(pmr, &pmr->accl, DBE_VAL_LOG);
+ }
+ updateACCSfromACCL(pmr);
}
+ /* Sanity check on backlash acceleration time. */
if (pmr->bacc == 0.0)
{
pmr->bacc = 0.1;
@@ -4060,11 +4058,6 @@ static void check_speed_and_resolution(motorRecord * pmr)
pmr->hvel = pmr->vbas;
else
range_check(pmr, &pmr->hvel, pmr->vbas, pmr->vmax);
- /* Make sure that ACCS/ACCU are initialized */
- if (pmr->accu == motorACCSused_Undef)
- {
- updateACCSfromACCL(pmr);
- }
}
/*
diff --git a/motorApp/MotorSrc/motorRecord.dbd b/motorApp/MotorSrc/motorRecord.dbd
index 3447c74e..be7c549d 100644
--- a/motorApp/MotorSrc/motorRecord.dbd
+++ b/motorApp/MotorSrc/motorRecord.dbd
@@ -68,18 +68,15 @@ menu(motorRMOD) {
choice(motorRMOD_G,"Geometric")
choice(motorRMOD_I,"In-Position")
}
-
menu(motorRSTM) {
choice(motorRSTM_Never, "Never")
choice(motorRSTM_Always, "Always")
choice(motorRSTM_NearZero, "NearZero")
choice(motorRSTM_Conditional, "Conditional")
}
-
-menu(motorACCSused) {
- choice(motorACCSused_Undef,"Undef")
- choice(motorACCSused_Accl, "Accl")
- choice(motorACCSused_Accs, "Accs")
+menu(motorACCU) {
+ choice(motorACCU_Accl, "Use ACCL")
+ choice(motorACCU_Accs, "Use ACCS")
}
include "menuOmsl.dbd"
@@ -195,9 +192,10 @@ recordtype(motor) {
interest(1)
}
field(ACCU,DBF_MENU) {
- prompt("ACCS used")
- special(SPC_NOMOD)
- menu(motorACCSused)
+ prompt("Acceleration used")
+ special(SPC_MOD)
+ menu(motorACCU)
+ initial("0")
}
field(BDST,DBF_DOUBLE) {
prompt("BL Distance (EGU)")