Forecast
The forecast function can be used to query information about the future movement of an axis. An important application of forecast is to determine the time until a position is reached (similar to trigger functionality). Another application is to determine the position and velocity which an axis will have at a given time. In this way, dead times can be compensated when actuators are switched on, for example when an gluing nozzle is switched on. It can also be used to precisely control actuators with dead time, such as controlling the gluing output based on the axis velocity 100 ms in the future
To implement these applications, you can use the SMC_GetTravelTime and SMC_ReadSetValues function blocks after you have configured the forecast duration with SMC_SetForecast.
For an example of usage, see: Forecast for Single-Axis Movements
Movement function blocks with forecast functionality
Function Block | Forecast |
---|---|
| -- |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| -- |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| -- |
| -- |
| ✓ |
| ✓ |
| ✓ |
Enabling the forecast function
The forecast function is disabled by default. This means that SMC_ReadSetValues
returns valid values only for a TimeOffset
between 0 s (start of the current task cycle) and the task interval (end of the current task cycle), and SMC_GetTravelTime
returns a valid time only for positions which are reached in this cycle.
The SMC_SetForecast function block is used to configure the required forecast duration and the SMC_GetForecast function block is used to read.
Notes:
The forecast duration can be changed at any time.
Avoid an unnecessarily long forecast duration because the forecast calculation consumes computing time. Select the smallest value which is sufficient for your application.
If you use master/slave function blocks (such as
MC_CamIn
), then the forecast must be enabled for both the master axis and the slave axis.
Call order
In order for the forecast function to yield the best possible results, it is important to make sure that the master/slave function blocks are called in the correct order. This applies to MC_CamIn
, MC_GearIn
, MC_GearInPos
, MC_Phasing
, SMC_BacklashCompensation
, and SMC_TrackAxis
. The movement function block of the master axis should be called before the master/slave function block.
Even without forecast, the trajectory is better when the call order is correct. When the order is wrong, the slave movement is delayed by one cycle.
For MC_SetOverride
, this function block should also be called before the movement function blocks of the axis. By changing the override, the movement of the axis is changed in the same task cycle. As a result, values which were previously determined based on the forecast lose their validity. They are determined again the next time SMC_GetTravelTime
or SMC_ReadSetValues
is called.
Buffer modes
The forecast function is not limited to a single movement. It also extends to all subsequent movements which are commanded with a blending or buffered buffer mode.
When an aborting movement is executed on an axis, it changes the movement of the axis in this task cycle. As a result, values which were previously determined based on the forecast lose their validity. They are determined again the next time SMC_GetTravelTime
or SMC_ReadSetValues
is called.
Effective forecast / restrictions
Ideally, the effective available forecast duration is equal to the configured forecast duration. However, there are some factors which can lead to the effective forecast being shorter than the configured forecast.
When a master/slave movement is executed, the effective forecast of the slave is the minimum of the effective forecast of the master and the configured forecast of the slave.
For logical axes and encoder axes, the effective forecast is always 0.
If the active movement function block does not support the forecast function, then the effective forecast is also 0.
In all other cases, the effective forecast is the same as the configured forecast.