Showing results 1 to 5 of 5

Thread: Creating variables in Scada addin.

  1. #1
    Join Date

    Default Creating variables in Scada addin.

    Hi, I've been trying to create an intern variable using Scada addin
    I'm VariableCollection Create method like this:

    IVariableCollection myVariables = context.VariableCollection;

    IDataType myDatatype = context.DataTypeCollection["BOOL"]; // type of a variable I want to create

    IDriver myDriver = context.DriverCollection[6]; // index of a driver in which I want to create a variable

    myVariables.Create(bit_name, myDriver, ChannelType....., myDatatype);

    so far I was able to figure out everything except What is a ChannelType and which one to use when creating internal variable.

    Thanks in advance!

  2. #2
    Join Date

    Default Re: Creating variables in Scada addin.

    Hi Isimas3,

    the ChannelType is an enumeration that identifies different driver object types:

    For internal driver it is enum item 33 which is SystemDriverVariable.

    So calling

    myVariables.Create(bit_name, myDriver, ChannelType.SystemDriverVariable , myDatatype);

    should bring you to the goal.


  3. #3
    Join Date

    Default Re: Creating variables in Scada addin.

    Hello Isimas3, 

    Actually, the tpChannelType is an enumeration for all the different specific variable types that are supported by the driver protocol.
    This means that not all enumeration values are available in the variable creation dialog for specific driver variables, however in the programming environment all these types are available.

    An overview of all the enumeration values of the channel types is available in the zenon help:

    ObjectModel Add-In --> Variable --> DataType 

    For your example with the internal driver please use the following call:

    myVariables.Create("VariableName", myDriver, ChannelType.SystemDriverVariable, myDataType);
    As I mentioned above the channeltype strongly depends on the driver protocol. Due to the fact that the create-method is needed for variable creation in general, all ChannelTypes are available. But be careful because it might lead to an error if you for example want to create a variable with a ChannelType that is not supported by the driver protocol. For further information look in the specific driver help chapter.

    Attached Thumbnails Attached Thumbnails forumScreeni.png  

  4. #4
    Join Date

    Default Re: Creating variables in Scada addin.

    Hello, all.

    How to create variable for MODRTU32 driver? Coil or Holding register for Driver object type?

    When i set ChannelType.DriverVariable, variable created but Driver object type is : Communication details

    Last edited by milosh : 25th May 2020 at 21:32

  5. #5
    Join Date
    Salzburg, AT

    Default Re: Creating variables in Scada addin.

    According the documentation of the MODRTU32 driver the 'Driver object type' = "Coil" is the Channel Type = 65 (in Add-In docu it has no predefined member in tpKanaltypes constants), "Holding register" is 8 (in Add-In has member name PlcMarker).

    The 'Driver object type' = 35 (Add-In member name DriverVariable) in current zenon versions means "Communication details", but in old zenon versions was called "driver variable".

    disclaimer: i have no clue about C#, i'm just able to RTFM ;-)

Similar Threads

  1. Using the Scada.Addin.Contracts API For XML Imports
    By Kyle in forum Add-In Framework
    Replies: 1
    Last Post: 15th May 2019, 07:35
  2. help with creating variables zenon 6.51
    By martinrelayer in forum zenon Service Engine Supervisor
    Replies: 1
    Last Post: 2nd March 2018, 18:51
  3. Assembly "Scada.AddIn.Contracts"
    By Ruebezaehler in forum Add-In Framework
    Replies: 7
    Last Post: 31st August 2017, 08:36
  4. Replies: 6
    Last Post: 17th November 2011, 00:05
  5. Replies: 0
    Last Post: 5th January 2009, 15:13

Posting Rules

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