Showing results 1 to 2 of 2

Thread: Shared memory online variables management

  1. #1
    Join Date
    07.10.2009
    Posts
    5

    Default Shared memory online variables management

    Hi,
    I've developed a gateway in C# to manage online variables through shared memory for reading and writing a lot of variables.

    It works with great performance compared the normal online variables in bulk mode expecial it's great in writing speed!

    But I have just one problem the string size in the shared struct you have defined is fixed to 64 byte:
    1. Is it possible to change this number (for string length) through some secret parameter in some secret place like zenon6.ini for example?
    2. If in ZenOn editor I declare a variable whith more character and in runtime from zenOn element I write a long string there's no control when you write in shared memory and you override the next struct in the memory. I think It's best cut the string in the shared to the maximum allowed from the struct.




    This is your struct:

    {
    BYTE bFlags; // Bit0=von zenOn geändert, Bit1=extern
    // geändert
    DWORD dwStatus; // Statuswort bitcodiert (gestört, Hand, etc.)
    DWORD dwTimestamp; // Zeitstempel in s seit 1.1.1970 00:00 GMT
    union
    {
    BYTE bBool; // numerischer Rohwert (0=FALSE, 0xFF=TRUE)
    BYTE bByte; // numerischer Rohwert INT_8 oder UINT_8
    WORD wWord; // numerischer Rohwert INT_16 oder UINT_16
    DWORD dwDWord; // numerischer Rohwert INT_32 oder UINT_32
    float fFloat; // numerischer Rohwert IEEE single
    double dDouble; // numerischer Rohwert IEEE double
    double dNumerical; // numerischer Wert normiert
    char csString[64]; // alphanumerischer Wert
    } Value;
    };


    Thanks
    Matteo

  2. #2
    martins Gast

    Default Re: Shared memory online variables management

    Quote Originally Posted by matteo.fabbri View Post
    Hi,
    I've developed a gateway in C# to manage online variables through shared memory for reading and writing a lot of variables.

    It works with great performance compared the normal online variables in bulk mode expecial it's great in writing speed!

    But I have just one problem the string size in the shared struct you have defined is fixed to 64 byte:
    1. Is it possible to change this number (for string length) through some secret parameter in some secret place like zenon6.ini for example?
    2. If in ZenOn editor I declare a variable whith more character and in runtime from zenOn element I write a long string there's no control when you write in shared memory and you override the next struct in the memory. I think It's best cut the string in the shared to the maximum allowed from the struct.
    hi,

    to the first question: no, the definition of the struct is done hardcoded in the zenon source code.
    to your second point: best solution will be to check this by the length of the string. As the struct always has this size and as you are operating in the memory itself, there is no check like you know it from the .NET Framework - that is the downside of the data exchange over shared memory you have to handle that yourself.

    best regards,
    Martin

Similar Threads

  1. straton-zenon shared variable
    By batabaha in forum straton / zenon Logic
    Replies: 1
    Last Post: 13th April 2012, 00:14
  2. InitInstance():Out of memory
    By scotttee in forum zenon Supervisor
    Replies: 3
    Last Post: 4th April 2012, 23:58
  3. Replies: 4
    Last Post: 22nd February 2012, 20:42
  4. Replies: 0
    Last Post: 19th September 2007, 11:06
  5. memory on windows CE
    By sebastiank in forum zenon Operator
    Replies: 0
    Last Post: 19th September 2007, 08:05

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •