Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fofb_shaper_filt: implement module. #27

Merged
merged 10 commits into from
May 17, 2024
Merged

fofb_shaper_filt: implement module. #27

merged 10 commits into from
May 17, 2024

Conversation

ericonr
Copy link
Member

@ericonr ericonr commented Sep 22, 2023

No description provided.

@ericonr
Copy link
Member Author

ericonr commented Oct 9, 2023

@augustofg and @guilhermerc , please let me know when we know for sure what hardware configuration (which acq cores and channels) we are going with!

@ericonr ericonr force-pushed the shaper-filt branch 2 times, most recently from ce88290 to 96686a7 Compare March 25, 2024 19:45
Omit parameter names instead of marking as maybe unused.

The nElements parameter in readEnum is left, because the max number of
enum elements should be used in a future version, for better error
checking.
This way, the corrector names don't have to be duplicated in every
relevant module's req file.
@ericonr

This comment was marked as outdated.

@ericonr

This comment was marked as outdated.

@ericonr ericonr force-pushed the shaper-filt branch 2 times, most recently from b9c0dfb to 301efdf Compare May 16, 2024 20:11
This was only noticed due to an intermittent slowdown in the iocInit
call in stTIM.cmd.

This happened because asynEnumSyncIO.c's readOp() [1], called from
devAsynInt32.c's initBi(), loops *nIn times calling the asynPrint macro.
Uninitialized nIn could and did take arbitrary, sometimes large, values;
a perf report even showed most of the iocInit time was spent in the
getTraceMask() call of asynPrint. However, since tracing wasn't enabled
at that level for the port, it never tried to print anything, and didn't
trigger a segfault by accessing out-of-bounds memory.

[1] https://github.com/epics-modules/asyn/blob/R4-44/asyn/interfaces/asynEnumSyncIO.c#L155
With the removal of the DCC core, there is a big change to the available
channels.
The filter defined in fofb_shaper_filt has representation limits for its
coefficients, so an external multiplier gain might be necessary to
actually implement it in hardware. To avoid requiring an additional gain
in the hardware and the resultant resource consumption, it was decided
to use the FOFB accumulator gain implemented in hardware as the
combination of FOFBAccGain and FOFBAccFilterGain.

It is simpler to define the PV for it in fofb_processing, since it has
to be combined with the FOFBAccGain for the FOFBAccHwGain that's applied
to the hardware.

The output for FOFBAccHwGain is a -RB because it shouldn't be written
to, and is the configuration we tried to write to hardware. The input is
a -Mon because its sole purpose is getting a feedback as to what's
actually in hardware.

In order to provide feedback on the applied gain's precision, the
readback for the separate gains uses the gain that was actually applied
to hardware divided by the other gain's setpoint.

The slightly complex CALC definition for the gain readbacks is necessary
for two reasons: the readback will be different from the setpoint if the
resulting HwGain is outside of the hardware's representable range (this
can also be verified with FOFBAccHwGain-Mon's value); and one of the
gains being set to 0 shouldn't cause the readbacks to be NaN.
@ericonr ericonr merged commit 149d040 into master May 17, 2024
1 check passed
@ericonr ericonr deleted the shaper-filt branch May 17, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant