3D-Printing : TCP Speed setpoint for extruder via Analogoutput

I'd like to use the TCPSpeed3DP as speed setpoint Anaolg Out for an extruder.

Therefor I added a module and programmed a dedicated procedure. Rapid OK, but errors/issues when starting the program: 



    !Scale actual TCP speed (from PrintL command attribute) and link to Local_IO Analogout 1

    PERS Num aoTCP_Mult:=1000;

    PERS Num aoTCP_Div:=1000;

    VAR Num aoTCP_Scaled;

    PROC Extruder_SpeedSetpoint() 

        !aoTCP_Scaled:=aoTCP_3DP*aoTCP_Mult/aoTCP_Div; ! Scale TCP speed

        !Local_IO_1_AO1:= aoTCP_Scaled; !Push to analog out 1

        Local_IO_1_AO1:=aoTCP_3DP;!Push to analog out 1




Any comment on what is wrong or a better way to link and scale the TCPspeed to an Analogoutput is very much appreciated.