Size of a GVL file in bytes

ontdk
2020-06-24
2020-06-29
  • ontdk

    ontdk - 2020-06-24

    Hello everybody.

    I have a novice question regarding the actual size of the GVL files in my project?

    I have a GVL file containing different types of variables and structs, that I would like to transfer to another device. Can I see how many bytes of data the file contains, without counting the number of variables and calculating the total file size manually?

    Is the a menu or compiler logfile somewhere, or can I eventually see it when I'm online on the device?

    I'm currently using CODESYS V3.5 SP14, Patch 2.

    Best regards
    Ole

     
  • quirzo

    quirzo - 2020-06-29

    One way to get the size is to use SIZEOF() operator. But you have to do it for each GVL variable.

    //GVL_Test
    VAR_GLOBAL
        First : STRING;
        Second : INT;
        Third : ST_Struct;
    END_VAR
    

    Then in code somewhere:

    VAR
        GvlSize : UDINT;
    END_VAR
    GvlSize := 0;
    
    GvlSize := GvlSize + SIZEOF(GVL_Test.First);
    GvlSize := GvlSize + SIZEOF(GVL_Test.Second);
    GvlSize := GvlSize + SIZEOF(GVL_Test.Third);
    
    //Now GvlSize is the size as bytes
    
     
  • ontdk

    ontdk - 2020-06-29

    Thank you Quirzo. That will do the job.

    But I think it would be a nice feature if 3S were adding some kind of functionality to show the size of GVL/NVL files in Codesys.

     

Log in to post a comment.