Fixed bug: Wrong scale used before

The correct scale from counts to engeering units is Qxx00.
This commit is contained in:
2025-09-10 11:52:51 +02:00
parent bf3406be1c
commit a70bcc0d75

View File

@@ -135,7 +135,7 @@ asynStatus turboPmacAxis::init() {
double motorAccel = 0.0;
// Conversion factor between engineering units (EU) and encoder counts
double eu_to_counts = 0.0;
double counts_to_eu = 0.0;
// Deadband in counts. Can be a fraction of a count, hence double.
double deadband_counts = 0.0;
@@ -173,11 +173,11 @@ asynStatus turboPmacAxis::init() {
/*
Read out the axis status, the current position, current and maximum speed,
acceleration, the air cushion delay, the scaling factor between counts and
engineering units ([Ixx08] = counts / engineering units) and the deadband
engineering units ([Qxx00] = engineering units / counts) and the deadband
Ixx65.
*/
snprintf(command, sizeof(command),
"P%2.2d00 Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 I%2.2d08 "
"P%2.2d00 Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 "
"I%2.2d65",
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_,
axisNo_);
@@ -195,7 +195,7 @@ asynStatus turboPmacAxis::init() {
}
nvals = sscanf(response, "%d %lf %lf %lf %lf %d %lf %lf", &axStatus,
&motorPos, &motorVmax, &motorVelocity, &motorAccel,
&acoDelay, &eu_to_counts, &deadband_counts);
&acoDelay, &counts_to_eu, &deadband_counts);
// The acoDelay is given in milliseconds -> Convert to seconds, rounded up
setOffsetMovTimeout(std::ceil(acoDelay / 1000.0));
@@ -236,18 +236,18 @@ asynStatus turboPmacAxis::init() {
populate the field SPDP (see record PushSPDB2Field in db/turboPmac.db)
First, the deadband is read out (Ixx65, see Turbo PMAC User Manual, p.
160.). This value then needs to be converted into counts (by dividing it by
160). This value then needs to be converted into counts (by dividing it by
16). After words, the deadband in counts then need to be converted into
engineering units. For this, the scaling factor Ixx08 needs to be applied
(see Turbo PMAC User Manual, p. 268f):
[Ixx08] = counts / engineering units (eu)
deadband_eu = deadband_counts / Ixx08 = Ixx65 / (16 * Ixx08)
engineering units. For this, the scaling factor Qxx10 needs to be applied
(see SINQ_2G_MCU_SW_manual_rev7, p. 17):
[Qxx10] = engineering units (eu) / counts
deadband_eu = Qxx10 * Ixx65 / 16
The values of Ixx08 and Ixx65 are read out during initialization and are
The values of Qxx10 and Ixx65 are read out during initialization and are
assumed to not change during operation.
*/
setAxisParamChecked(this, motorPositionDeadband,
deadband_counts / (16.0 * eu_to_counts));
counts_to_eu * deadband_counts / 16.0);
// Update the parameter library immediately
status = callParamCallbacks();