DiamondLightSource / DiamondLightSource/pmac

PPMAC - Invalid lookahead definition when switching CS Groups

Open
#144 2 comments 0 reactions 0 assignees View on GitHub
bug ppmac
Dominant language
C++
Stars
31
Forks
25
PR merge metrics
No merged PRs in 30d

Description

# Description

The `redefineLookaheads` method currently uses commands that are exclusive to TurboPMAC, making it ineffective for PowerPMAC. This difference can lead to incorrect or non-existent lookahead buffer allocation for coordinate systems, especially when switching between defined CsGroups.

Currently, the method performs the following operations:

`strcpy(cmd, "DELETE ALL TEMPS");
`

This deletes all the temporary buffers: lookahead, gather, rotary and ccbuffer.

`sprintf(cmd, "&%dDEFINE LOOKAHEAD 50,10", cs);
`

This sets:
- A lookahead buffer size of 50
- 10 synchronous assignments

In contrast, PowerPMAC expects:
`strcpy(cmd, "delete all lookaheads");`
`sprintf(cmd, "&%d define lookahead 1024", cs);
`

Key differences between TurboPMAC and PowerPMAC relevant to this issue include:
- PowerPMAC does not require a specific order to define lookahead buffers for each coordinate system, whereas TurboPMAC requires definitions from high-numbered to low-numbered coordinate systems.
- PowerPMAC enforces a minimum lookahead buffer size of 1024.
- PowerPMAC only accepts the define lookahead command for coordinate systems that have at least one assigned motor. While it is technically possible to set Coord[x].LHSize directly, the Power PMAC Software Reference Manual (May 19, 2023, p.853) states:

> “It is not possible to write to it directly in the Script environment.”

As a result, the current implementation is incompatible with PowerPMAC systems and may lead to incorrect or non-existent lookahead buffer allocation, particularly when switching between defined CsGroups or modifying the number of motors in a coordinate system.

# Suggested solution

- Abstract the command string in `pmacHardwareInterface` through a `get` function.
- Define the correct syntax for each hardware in:
- `pmacHardwareTurbo`
- `pmacHardwarePower`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.