Skip to content

MBP-247: Position Recovery Improvements #17

Open
aslanliafichev wants to merge 25 commits intomasterfrom
aslanl/position-recovery-improvements
Open

MBP-247: Position Recovery Improvements #17
aslanliafichev wants to merge 25 commits intomasterfrom
aslanl/position-recovery-improvements

Conversation

@aslanliafichev
Copy link
Copy Markdown
Collaborator

  1. Check that position, encoder position bias are saved after a power failure.
  2. Check that we timestamp the power failure and startup of the CPU.
  3. At startup check that axises are calibrated and initliazed correctly.

//0 'DontRestore'
//1 'RestoreWithoutHome' -restores the position using a set position fb and does not set the home bit in the axis struct.
//1 'RestoreWithoutHome' - Restores the position using a set position fb and does not set the home bit in the axis struct.
//2 ''RestoreWithHome' - Restores the position using a set position fb and does set the home bit in the axis struct.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the extra apostrophe before ''RestoreWithHome'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

afbSetPosition[iAxes].Execute := FALSE;
eStartUp := eExecuteRestore;
RETURN;
END_IF
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the identation after the line 278, as the following 2 IF statements have different identations, but they should use the same one

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

<Implementation>
<ST><![CDATA[fbSystemTime(timeLoDW => timeAsFileTime.dwLowDateTime, timeHiDW => timeAsFileTime.dwHighDateTime);
timeAsDT := FILETIME_TO_DT(timeAsFileTime);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fbSystemTime uses the function block GETSYSTEMTIME, probably would be better to use the newer function F_GetSystemTime(), as it is stated on Infosys Beckhoff

This function block is replaced by the newer function F_GetSystemTime(), which only needs one return value, not two.

You also probably dont need the extra variable, and it will be a oneliner so you dont even need the SYSTEM_TIME action either.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

Make the timestamping a one-liner, instead of an action.
MC_SetPosition is replaced by MC_Home, thus it sets the home position
to actual position and the calibration flag.
Changed solution to loop using the iCurrentAxis index, and
incrementing if position restore was properly executed or if axis was
not initialized properly or if axis was not homed before power failure.
Changed encoder reference to be constants, for better
readability.
Always restore position despite an axis not being initilized or
homed during shutdown.
For incremental encoders the moving status of the axis cannot
be determined before a power failure, therefore the position
of the axis is sampled every 5 seconds with a difference
limit of 0.001 mm. These values can be changed.
Cleanup of the execution logic for restore position
action.
@aslanliafichev
Copy link
Copy Markdown
Collaborator Author

Please review the latest changes to the position recovery improvements. Overall the following changes have been made:

  • As discovered the status of the axis before power failure cannot be confirmed (goes to error stop) which is important to confirm if moving or standstill before power failure for incremental encoders. Furthermore whilst moving before a power failure there is always some positional difference between the sampled position before shutdown and the actual one at startup. Therefore the position of the axis is sampled every 5 seconds this can be changed with a positional difference limit of 0.001 can also be changed. This is only important for incremental encoders.

  • Furthermore status variables has been added to be saved as persistent variables.

  • Also E_RestorePosition still includes the options to RestoreWithHome, which is relevant for incremental encoders, I still believe that this option should be included, as there are cases where the position of an incremental encoder can be recovered accurately ( for exampled disabled or standstill for more than 5 seconds), eRestorePositionBias has also been included as this is the default value for absolute encoders.

Change to correct naming for TON-timers and time.
MBP-247: Adjust execution logic to match E_RestorePosition changes.
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.

2 participants