Closed SevenMag closed 10 years ago
I'm found number Rack and Slot for CP and CPU (3xx and 4xx) in file HOBJECT1.DBF column SUBSTATN is number rack, column MODULN is slot. checked in more S7 projects with H-system. You can add to LibNoDaveConnectionLibrary ?
Have you also find out where the IP is stored?
I am looking for. But it's not easy.
Ich bin für. Aber es ist nicht einfach.
Ich glaube die sind eher im Ordner CONN... also nicht bei der Hardware! Aber sicher bin Ich da nicht...
I've also tried again. I used Winmerge, and compared two projects after changeing a IP, but I had no success
Ich glaube die sind eher im Ordner CONN... also nicht bei der Hardware!
No. IP address is in file \S7Netze\S7NONFGX.tab as hex to string. exsample: ip = 192.168.2.200; string = "C0A802C8"; file S7NONFGX.tab has this string, but many times. Where is the offset for each CPFolder I have not found.
The Byte before the IP Adress String is the Length of the String.
The Byte before the IP Adress String is the Length of the String.
Pascal? This file also has mask and MAC-address. When save hardware without changing the file changes.
Pascal? what do you mean?
Pascal has string as: first byte is length, the rest up to 255 bytes is text. it simply washed. I have a few ideas on this file, I will try
I'm disassembled file S7NONFGX.DLL, but that does not found.
What do you mean?
File S7NONFGX.DLL is the only file that has a string of "S7Netze", then it reads the file "\S7Netze\S7NONFGX.tab", but in this file I could not find how to read this structure with IP, mask and MAC.
here is also little bit info:
so einfach? bravo!
I found for the CP: IP address, MAC, mask and router, but only for simple CP. For 6GK7443-1EX20-0XE0 ( which has 2 Ethernet ) compliance can not find.
I'm a little confused. made changes in two pull Requests.
I will modifie your changes a little bit, because for Example a CPU or PG can have more than one Network Interface...
Good. CP 6GK7443-1EX20-0XE0 has two network interface, but not fill this code.
I need the code of "IndexOfByteArray"
ups. sorry. something like this:
public int IndexOfByteArray(byte[] array, byte[] pattern, int offset, int maxLen)
{
int success = 0;
int length = array.Length;
for (int i = offset; i < length; i++)
{
if (array[i] == pattern[success])
success++;
else if ( success > 0 )
{
ii--;
success = 0;
}
if (pattern.Length == success)
return i - pattern.Length + 1;
if ( --maxLen == 0 ) return -1;
}
return -1;
}
more:
if (cp.IP != ip)
always is TRUE. need change to
if (cp.IP.ToString() != ip.ToString() )
in my test project every cp is added twice (lean 340) so i looked in the hrelatio file and se, i have two entrys for every cp. but i will overwoek it, i also see in the hobject dbf in this folder also the ports seem to be in that file... i will look to repair it, maybe today, or tomorrow....
Today I downloaded the new version, in my project, he showed the CPFolder.Count = 0, I removed the condition "if (x.TobjTyp == 1314972)", the CP appeared, but without Network. Corrected as I sent yesterday, appeared Network. Add "pull Requests" with my changes?
I can send the project on which I am trying to
why is your network info missing? i changed nothing on your reading code!
i mean nothing functional!
in "//Get The CP Folders" i'm add code:
int sobjid;
foreach (DataRow row in dbfTbl.Rows)
{
if (!(bool)row["DELETED_FLAG"] || _showDeleted)
{
if ((int)row["RELID"] == 64)
{
sobjid = (int)row["SOBJID"];
var cp = CPFolders.FirstOrDefault(x => x.ID == sobjid);
if (cp != null)
cp.TobjId = (int)row["TOBJID"];
}
}
}
you do not have this
Yes!!!!!! I found a match for the CP with 2 network interfaces.
With your Code, and remove my x.TobjId = Convert.ToInt32(row["TOBJID"]); I get not CP Folder!
I look for it at the weekend...
Maybe you can send me also your Project...
I sent a test project and 2 file with the new changes for reading in the Multi-Interface CP Please send me your project, I'll see why we read differently IP
I sent the file Step7ProjectV5.cs it has 3 lines:
byte[] bbb = new byte[1960];
Array.Copy(completeBuffer, position, bbb, 0, 1960);
File.WriteAllBytes(@"d:\Temp\Temp\" + number + ".txt", bbb);
they help to find small changes, but in the release are not needed.
hello received a project Test2. looked. Very strange situation, in my project was simple. If you look in the reverse order, then: S7NONFGX.tab file has 5 structures beginning with 0x03, 0x52, 0x14, 0x00, ie 5 addresses. these structures number: 3.4, 6, 7, 8. file \s7wb53ax\HRELATI1.DBF with row["RELID"] == 64 only 4 addresses: 4, 6, 7, 8; file \s7hssiox\HRELATI1.DBF(for multi-Interface) with row ["RELID"] == 64 has address 3. but how to compare the values of CP and it is hard to find. and more: project Test2 has 8 CP, may be 3 CP is profibus.
I hope these thoughts as they will help. Ich hoffe, dass diese Gedanken, wie sie helfen
I now checked my code for 30 different projects, always determine the correct IP address. For project Test2 I had an idea how to compare, but to test this idea a little project.
Which code you use for reading the IP address?? I get the cpufolder but the property NetworkInterfaces is always null. Should I run some code before to parse the addresses?
Yes SvenMag, can you create a Git Pull Request, with the changes yu have to the current Master Branch? I've now reverted my changes to reading from the hrelatio.dbf. I will add your Code that works for your Projects, still I've no time at the moment to look into this.
I'm change my project (https://github.com/SevenMag/DotNetSiemensPLCToolBoxLibrary) for read IP. now read IP for CPU with ethernet, for CP with 2 Ethernet and another CP. Please testing.
I send you a Project wich does not work. There are read now 4 CP's (it only has two), in my Tree in the Toolbox, only the two are shon, but the other two get the IPs. I think we have two combine this two CP entrys in any way! And the IP of the CPU is also not read!
I'm add to CPFolder one more CPFolder as SubModul, see it. CPU in project Test2 (sent me an e-mail) I read IP normal. maybe it's the other project?
may be a little to alter the reading of the DB-files. In each folder, you first need to read HOBJECT1.DBF and then HRELATI1.DBF. UNITID in HRELATI1 is ID in the HOBJECT1.DBF
When HW Config shows two CP, but raed 4 this is may be because the 2 Ethernet CP and 2 CP Profibus. We must unite and do 2 NetworkInterfaces for each CP
Can I send you a Example Project? (I thought I did, but I don't find your EMail adress, i replied to github...)
Yes. send to berlyakov.ev@npoa.mmk.ru
I have not received anything.
We have found for the networkInterface: IP, MAC, Router, Name; I have found a property useIP, useISO, useROUTER; There are many options, I found 32. But I think others do not want, or something you want?
I send it to you now...
If there are more options you read out, feel free to create Properties and fill them...
wie Sie die IP-Adresse der PLC von Hardware lesen?