Changed ACCU from a readback to a control. ACCU can be optionally specified when motor databases are loaded and is autosaved by default.

This commit is contained in:
Kevin Peterson
2023-05-18 15:32:42 -05:00
parent ba769e5285
commit 63bfe5d077
10 changed files with 51 additions and 35 deletions
+28 -2
View File
@@ -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 &lt;= 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")&nbsp; 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"&nbsp;</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.&nbsp;</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 &nbsp;</p></td>
</tr>
<tr>
<td>JVEL</td>
+1
View File
@@ -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)")
+1
View File
@@ -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)")
+1
View File
@@ -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)")
+1
View File
@@ -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)")
+1
View File
@@ -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)")
+1
View File
@@ -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
+1
View File
@@ -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)")
+9 -26
View File
@@ -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;
@@ -3984,14 +3974,6 @@ 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)
{
/* 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)
{
@@ -4017,8 +3999,9 @@ 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)
/* Make sure that ACCS is initialized */
if (pmr->accs == 0.0)
{
updateACCSfromACCL(pmr);
}
+7 -7
View File
@@ -74,10 +74,9 @@ menu(motorRSTM) {
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"
@@ -191,9 +190,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)")