forked from epics_driver_modules/motorBase
Merge pull request #203 from epics-modules/add_accs_field_with_accu_control
Add ACCS field with ACCU control
This commit is contained in:
+28
-2
@@ -272,6 +272,13 @@ below.
|
||||
<td><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#Fields_motion">ACCU</a></td>
|
||||
<td>R/W</td>
|
||||
<td>Acceleration used</td>
|
||||
<td>RECCHOICE</td>
|
||||
<td>(0:"Use ACCL", 1:"Use ACCS")</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#Fields_status">ADEL</a></td>
|
||||
<td>R/W</td>
|
||||
@@ -1718,11 +1725,30 @@ below.
|
||||
motor motion.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">The motor record expects the hardware to produce a trapezoidal
|
||||
<td>ACCS</td>
|
||||
<td>R/W</td>
|
||||
<td>Acceleration (EGU/s^2)</td>
|
||||
<td>DOUBLE</td>
|
||||
<td>Valid range; 0 <= ACCS</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ACCU</td>
|
||||
<td>R/W</td>
|
||||
<td>Acceleration used</td>
|
||||
<td>RECCHOICE</td>
|
||||
<td>(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" </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
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. </td>
|
||||
<p>Note that the ACCS field can be use to specify the acceleration in EGU/s^2.</p>
|
||||
<p>Velocity and acceleration are related by the following equation: <br>
|
||||
VELO - VBAS = ACCL * ACCS </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JVEL</td>
|
||||
|
||||
@@ -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)>> $@
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user