Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page Examples of scripts with Macros and Time zones  Example of a script with Core Next page


Formats

Format of events procedure for the PTZ device object:

OnEvent("TELEMETRY","_id_","_event_")

Operator format to describe actions with the PTZ devices:

DoReact("TELEMETRY","_id_","_command_" [,"_parameters_"]);

Format of events procedure for the Keyboard object:

OnEvent("TELEMETRY_EXT","_id_","_event_")

Operator format to describe actions with the Keyboard:

DoReact("TELEMETRY_EXT","_id_","_command_" [,"_parameters_"]);

The format of events procedure for the Control device object:

OnEvent("JOYSTICK","_id_","_event_")

Examples

Examples of using reactions of the PTZ device object:

  1. Set autofocus when camera 1 is armed.

    OnEvent("CAM","1","ARM")
    {
        DoReact("TELEMETRY","1", "AUTOFOCUS_ON");
    }
  2. Rotate camera to the position specified in the first preset with the relay enabled.

    OnEvent("GRELE","1","ON")
    {
        telemetry_id= GetObjectParam("CAM","1","parent_id");
        DoReact("TELEMETRY","telemetry_id","SETUP","GO_preset<1>");
    }
  3. Record the patrol route for Camera 1 corresponding to the PTZ device 1.1. The route consists of two points, such that to go from point 1 to point 2, you need to rotate the camera to the left at speed of 6 for two seconds. Patrolling must be performed at speed of 10. The time at each point of the route is 25 seconds. It is supposed that when the program is started, the camera is set to the position corresponding to the first point of the route.

    OnEvent("MACRO","1","RUN")
    {
        DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<1>,tel_prior<1>,dwell<25>,speed<10>,flush_tour<0>");
        Wait(2);
        DoReact("TELEMETRY","1.1","LEFT","speed<6>,tel_prior<1>");
        Wait(2);
        DoReact("TELEMETRY","1.1","STOP","speed<6>,tel_prior<1>");
        Wait(2);
        DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<2>,tel_prior<1>,dwell<25>,speed<10>,flush_tour<1>");
    }
    
  4. There are two cameras with PTZ devices. Every 15 minutes you need to rotate cameras to preset 1 and take a screenshot. File name is current time.
    OnTime(W,D,X,Y,H,M, "01")
    {
        if(strequal(M,"0"))
        {
            name=H+"_"+M+"_"+S+".jpg";
            //Camera 1 PTZ device 1.1
            name1="Camera1 "+name;
            DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
            //Camera 2 PTZ device 1.2
            name="Camera2 "+name;
            DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
        }
     
        if(strequal(M,"15"))
        {
            name=H+"_"+M+"_"+S+".jpg";
            //Camera 1 PTZ device 1.1
            name1="Camera1 "+name;
            DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
            //Camera 2 PTZ device 1.2
            name="Camera2 "+name;
            DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
        }
     
        if(strequal(M,"30"))
        {
            name=H+"_"+M+"_"+S+".jpg";
            //Camera 1 PTZ device 1.1
            name1="Camera1 "+name;
            DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
            //Camera 2 PTZ device 1.2
            name="Camera2 "+name;
            DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
        }
     
        if(strequal(M,"45"))
        {
            name=H+"_"+M+"_"+S+".jpg";
            //Camera 1 PTZ device 1.1
            name1="Camera1 "+name;
            DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
            //Camera 2 PTZ device 1.2
            name="Camera2 "+name;
            DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
            DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
        }
    }
  5. Patrol multiple FOVs using the PTZ camera presets, with the possibility of activating the motion detection on certain areas.
    Camera 1: five detection areas, five presets. These two parameters are set by the n variable. Macro 1 starts the algorithm. Macro 2 stops the algorithm. Flag is an internal variable.
    When the algorithm starts, the camera sets into preset 1 and arms detection area 1. There is a delay of 200 milliseconds between these commands, so that the camera has time to set into the preset. Then after five seconds, area 1 is disarmed, and the cycle starts again, but with area 2 and preset 2. And so on until all n areas and presets are run through. After that, the algorithm starts again from 1. The algorithm stops if the flag variable is reset (using macro 2).
    OnEvent("MACRO","1","RUN")
    {
        flag=1;
        n=5;
        [
         for(i=1;flag;i=str(i+1))
         {
             DoReact("TELEMETRY","1.1","GO_PRESET","preset<"+i+">,tel_prior<3>");
             Sleep(200);
             DoReact("CAM_ZONE","1"+i,"ARM");
             Wait(5);
             DoReact("CAM_ZONE","1"+i,"DISARM");
             if(strequal(i,n)) {i=0;}
        }
        ]
    }
     
    OnEvent("MACRO","2","RUN")
    {
        flag=0;
    }

Example of using events and reactions of the Keyboard object:

Turn on the light and arm camera 2 after pressing the key 15 on the AXIS T8312 keyboard.

OnEvent ("TELEMETRY_EXT","1","KEY_PRESSED")
{
    if (strequal(param0, "15")){
        DoReact("TELEMETRY_EXT","1","RELE_ON","rele<15>");
        DoReact("CAM","2","ARM");
    }
}


  • No labels