Showing results 1 to 3 of 3

Thread: Creating variables in Scada addin.

  1. #1
    Join Date
    30.10.2019
    Posts
    6

    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
    28.02.2013
    Posts
    200

    Default Re: Creating variables in Scada addin.

    Hi Isimas3,

    the ChannelType is an enumeration that identifies different driver object types: https://onlinehelp.copadata.com/help/810/addin/html/Variable-ChannelType.htm

    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.

    Regards,
    Felix

  3. #3
    Join Date
    23.11.2016
    Posts
    10

    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  

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 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
  •