Practical use case: Volume sensor (PoC)
- Ivaylo Fiziev
- 2 days ago
- 1 min read

This should be a device that detects a substance within a specified volume of space. Usually used in security systems this kind of sensor is also known as a volumetric motion detector. It detects changes in the volume it covers by filling it with energy patterns and recognizing disturbances in the patterns caused by any moving object. In our case it works by simply looking for interference between the geometry of volume itself and the geometry of any part appearance.
As you might imagine the interference is checked by a SCL function. A simple function call defines the behavior. Change the function and you get another behavior. In this case the call is really simple. You put the script on a resource that has some geometric entities. Then you specify which one to use using the VOLUME argument. Optionally you can provide the name of the part that should be detected using the PART argument:
FUNCTION_BLOCK "MAIN"
VERSION:1.0
VAR_OUTPUT
out : BOOL;
END_VAR
BEGIN
#out := DETECT_PART_APPEARANCE_VOLUMATIC(VOLUME:='box1');
END_FUNCTION_BLOCK
How it works? We just get the bounding boxes of both geometries (part and volume) and detect intersections between them. If an intersection is detected the function returns true. Otherwise false.
It handles pretty well with simple parts. You can try it with an early 2606 version. It sits behind the same feature toggle as the RFID sensor (SCL_RFID_SENSOR). Unlike the RFID sensor it works on the actual geometries, not on self frames, which is a real benefit.
Au revoir




Comments