Add to Existing Program
4026 XAE Requirements
The PLC libraries require the PackML TwinCAT package installed. To install, open a Powershell or CMD instance and run the command:
1 |
|
Adapting to Existing Vision Projects
You can easily make use of this new service with existing TcVision Projects. There are 4 main components that need to be addressed.
-
Add the SPT Vision Library to the References section of the PLC Project (v3.0.4 or later)
-
Instantiate a new FB_ImageToVideo and TriggerEvent BOOL
1 2 3 4 5 6 7 8 9 10 11 12 13
VAR // ImageToVideo Instance Playback : FB_ImageToVideo := (CameraName := 'Camera1', JsonAttribute := '{CreateVid : 1, CameraName: "Camera1"}', FramesPerSecond := 10, TimeBeforeEvent := T#3S, TimeAfterEvent := T#3S, VideoOutputDirectory := 'C:\TcAlarmVideos', ReductionFactor := 0.25); // Event Trigger Boolean TriggerEvent : BOOL; END_VAR
-
Add the CyclicLogic call to the main body of your POU. This MUST be called cyclically to work.
1
Playback.CyclicLogic();
-
Add the trigger logic somewhere in your program. The TriggerAlarmForVideoCapture method only needs to be called once to start processing.
1 2 3 4
IF TriggerEvent THEN TriggerEvent := FALSE; Playback.TriggerAlarmForVideoCapture(); END_IF
-
Add the AddImage method to your image aquisition loop of your program. This will add an image to the buffer of the Playback block.
1
Playback.AddImage(ipImageIn := ImageIn);