Detect movement direction of container elevator arm with contacless sensors generating signal for GPS/Modem
So I want to generate a brief signal &quot;Analog In&quot; 24V for my GPS/Modem ...

I think you want a digital on-off for this, not analog.

... signal ... when the elevator arm moves UP and passes contacless sensor A first, then contactless sensor B. No signal when it moves down past B and then past A. When the arm moves down again past B first and then past A no signal is generated. After going past A downwards process needs to be at original situation again.

Timing diagram.
            &lt;- up ---&gt;   &lt;- down --&gt;               &lt;- up ---&gt; 
               _                  _                 _
Sensor A   ___| |________________| |______ _ _ ____| |______
                   _       _                             _
Sensor B   _______| |_____| |_____________ _ _ _________| |_
               ____               ________ _ _ __________
RLY1       ___|    |_____________|                       |__
                   _                                     _
RLY2/Output ______| |_____________________ _ _ _________| |_




simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. Relay logic.
How it works:

When SW-A is activated RLY1 will pick up and remain on via its own contact after the arm continues past it in the upward direction. This &quot;arms&quot; the circuit for SW-B.
When SW-B is activated RLY2 will pick up and latch on via its own contact.
Power to RLY1 will be immediately cut. D1 should slow down RLY1 dropping out for long enough that RLY2 can be fully energised and latch.
When the arm passes B RLY2 will drop out.
On the way back down RLY2 can't energise again as RLY1 is no longer energised.

Note that RLY1 will energise again and latch on the way back down. This should still be OK  for your requirements as RLY2 won't be pulsed until you go back up to B again.
Other than this I would recommend a micro PLC such as Siemens LOGO!, or equivelant from A-B, Mitsubishi, etc. Inductive proximity switches will be most robust for the sensing.