Page 1 of 2 1 2 LastLast
Showing results 1 to 10 of 11

Thread: Ip-Change(S7TCP32) with VSTA

  1. #1
    Join Date
    06.02.2013
    Posts
    14

    Default Ip-Change(S7TCP32) with VSTA

    Hello All,

    is it possible to change the ip-address from a S7TCP32-driver via VSTA-Editor?

    I guess i just donīt get the right property.
    i tried something like:

    myZenWorkspace.ActiveDocument.Drivers().Item("S7TCP32").get_DynProperties("IP").ToSting();

    i know, iīll get instead of set the ip with that command.

    Greetings

    Sven

  2. #2
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Ip-Change(S7TCP32) with VSTA

    the ip address of the plc within the s7 tcp driver is held in the driver configuration file.
    so you would have to edit the file itself.

    regards,
    herbert


  3. #3
    Join Date
    06.02.2013
    Posts
    14

    Default Re: Ip-Change(S7TCP32) with VSTA

    Hey herbert,

    thanks for your reply.

    iīve found the config file, but it seems the path to the file isnīt always the same, or is it?

    iīll create a wizard and it should bring the same result on every pc.

    Greetings

    Sven

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Ip-Change(S7TCP32) with VSTA

    iīll create a wizard and it should bring the same result on every pc.
    -> hmmm... this i don't understand

    can you please tell what exactly you want to do?
    is it in the editor or runtime? is it only 1 project which runs on several pc? or.. ??


  5. #5
    Join Date
    06.02.2013
    Posts
    14

    Default Re: Ip-Change(S7TCP32) with VSTA

    íīll create a Wizard for Zenon 7.10. This Wizard should create about 300 variables (in the editor) and link them with S7 cariables.Itīs a stand alone Projekt

    The User, who starts the wizard, shut have the chance to change the ip address with my wizard, by writing it into an maskedtextbox.

    i hope that explanation would help.

    Greetings

    Sven

  6. #6
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    879

    Default Re: Ip-Change(S7TCP32) with VSTA

    thx for the reply... i got it now

    so yes, the only way to change the ip address of the plc at the s7tcp32 driver is do to this via its driver configuration file.

    As you can see the driver configuration file has the formating like a *.ini file.
    In the web you can find many examples how to read/write *.ini files (i.e. via WinAPI function "GetPrivateProfileString" / "WritePrivateProfileString")

    So you have to head for the section called [FETCH_HW0] - this is the first connection within the driver - and then you read/write the parameter called "FREMDE_IP".

    Hope this helps....

    regards,
    herbert

    ps: this thread also may help a bit: http://www.copadata.com/forums/showthread.php?t=884


  7. #7
    Join Date
    06.02.2013
    Posts
    14

    Default Re: Ip-Change(S7TCP32) with VSTA

    Hello herberto,

    thanks for your reply,

    It shouldnīt be a problem to change the config file.

    My problem is, to get the path, where the config file is saved.

    after i entered the folder:
    "C:\ProgramData\COPA-DATA\SQL2012\ there are a few folders with a 32digit hexadecimal combination.

    The specific "S7 TCP-IP" Folder has a different name, on every computer.

    if there where a property like...

    IZenWorkspace.ActiveDocument.Drivers().Item("s7 TCP-IP Treiber").get_DynProperties("Path" or "ConfigPath")

    ..it wouldnīt be a hard to solve the problem.

    i hope uīve got a hint for me, where i can find the path to the config file.

    Greetings

    Sven

  8. #8

    Default Re: Ip-Change(S7TCP32) with VSTA

    Hi Sven,

    Please see an example below that builds the path from fixed strings/paths and dynamic strings (project ID, driver identifcation)

            public int getS7tcpID()
            {
                int i;
                // for all the drivers in the project
                for (i = 0; i < this.ActiveDocument.Drivers().Count; i++)
                {
                    // if the driver name starts with S7TCP return the ID of the first S7TCP driver in the project
                    if (this.ActiveDocument.Drivers().Item(i).Name.StartsWith("S7TCP"))
                    {
                        return i;
                    }
                }
                //if no S7TCP driver is found, return 999
                i = 999;
                return i;
            }
    
            public void MacroDrvConfigFile()
            {
                int drvID = getS7tcpID();
                //if a S7TCP driver was found
                if (drvID != 999)
                {
                    // build the string from the dynamic project path (project ID) + fixed string for path + driver identifcation + .txt
                    this.Application.DebugPrint(this.ActiveDocument.Path + "zenon\\custom\\drivers\\S7TCP32_" + this.ActiveDocument.Drivers().Item(drvID).Identification + ".txt",zenOn.tpDebugPrintStyle.tpMsg);     
                }
                else
                {
                    this.Application.DebugPrint("S7TCP driver not found",zenOn.tpDebugPrintStyle.tpErr);
                }
    
            }

  9. #9
    Join Date
    06.02.2013
    Posts
    14

    Default Re: Ip-Change(S7TCP32) with VSTA

    Helllo markclemens,

    thanks for your reply.
    i just tried your code snippet, and it works!
    iīll get the path for the config file. Now i can read/write it.

    Thanks!

    Greetings

    Sven

  10. #10
    Join Date
    08.11.2016
    Posts
    5

    Default Re: Ip-Change(S7TCP32) with VSTA

    Hi,

    I'm also trying to read the configuration file from a driver with C#. The solution you have posted works for all these drivers which their configuration file name is set as default.
    My problem is that I have some S7 TCP-IP drivers which have another configuration file name (f.e: myS7ConfFile1.txt). In this driver, it's possible to set your own configuration file (Configuration --> s7-TCP --> Configuration file).

    As s.jonigk suggested, do you know if it's possible to read this path from a dynamic property?

    The specific "S7 TCP-IP" Folder has a different name, on every computer.

    if there where a property like...

    IZenWorkspace.ActiveDocument.Drivers().Item("s7 TCP-IP Treiber").get_DynProperties("Path" or "ConfigPath")
    Thank you in advance

Similar Threads

  1. Detect Language Change
    By yavaskoray in forum VSTA
    Replies: 4
    Last Post: 6th August 2013, 13:02
  2. flashing when value change
    By focus in forum zenon Supervisor
    Replies: 3
    Last Post: 23rd January 2012, 00:11
  3. how to change driver in runtime
    By victoria in forum VBA
    Replies: 4
    Last Post: 11th October 2011, 23:32
  4. Change the Ip Address in Zenon 5.5
    By sikenga in forum zenon Network
    Replies: 1
    Last Post: 9th June 2009, 13:09
  5. Replies: 0
    Last Post: 21st August 2007, 08:15

Posting Rules

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