DotNetSiemensPLCToolBoxLibrary Hardwareconfig lesen

Senator42

Level-1
Beiträge
927
Reaktionspunkte
80
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo PLCToolBox spezies,

(VB 2010 Express)
ich hätte gerne von einem S7-projekt herausgefunden auf welche IP-Adresse, MPI-Nr, Rack etc. die CPU konfiguriert ist.
Aus der *.s7p - nicht online !

Mittels dieser Aufrufe gelingt es mir aber nicht:

bei
PLCConnectionConfiguration.LoadConfigFromFile(fn)
gibt es einen fehler: "Fehler im XML-Dokument (0,0)."

offensichtlich mach ich das völlig falsch.

Code:
Imports DotNetSiemensPLCToolBoxLibrary.Communication
... und andere

Dim xConnCfg As New PLCConnectionConfiguration

fn = "C:\EW\TestPrj.s7p"

xConnCfg = PLCConnectionConfiguration.LoadConfigFromFile(fn)
....
? Err.Description 
"Fehler im XML-Dokument (0,0)."
Symbole und Datenbausteine kann ich lesen :
Code:
Dim x4 As Projectfiles.Step7ProjectV5
x4 = Projectfiles.Projects.LoadProject(fn, False)
... weiterer code - der gut funktioniert
 
Jo, du machst das völlig falsch!

Es gibt aber auch kein richtig, da Ich dies nicht implementiert habe!
Ich habe mich mit der HW Config so gut wie gar nicht befasst, wie diese in den DBF Files im S7 Projekt gespeichert ist. Wenn du dich damit befassen willst, und mir dann Infos zukommen lässt baue Ich das gerne in die Lib ein.

PLCConnectionConfiguration.LoadConfigFromFile(fn) dient einfach nur dazu um ein PLCConnectionConfiguration Objekt welches man in einer Datei abgelegt hatte wieder zu laden.

Mfg
 
Zuviel Werbung?
-> Hier kostenlos registrieren
PLCConnectionConfiguration.LoadConfigFromFile(fn) dient einfach nur dazu um ein PLCConnectionConfiguration Objekt welches man in einer Datei abgelegt hatte wieder zu laden.
aha, was ist das, ein:
PLCConnectionConfiguration Objekt ?
wie kann ich es erzeugen?

die DBF scannen, mal sehn.

gruss
 
aha, was ist das, ein:
PLCConnectionConfiguration Objekt ?
wie kann ich es erzeugen?

So macht man's ja normal:
Code:
            Configuration.ShowConfiguration("SimpleCSharpDemonstrationConnection", true);
            myConn = new PLCConnection("SimpleCSharpDemonstrationConnection");
dann wird die Config auf dem Rechner abgelegt.

Wenn man nun aber z.B. eine eigene Visu programmieren will, kann es ja sein, das man die Verbindungskonfig nicht auf dem Rechner sondern in seinem Projekt speichern will, und das geht dann so:

Code:
            //Erzeugen und Speichern:
            PLCConnectionConfiguration myConf = new PLCConnectionConfiguration("MyConf", LibNodaveConnectionConfigurationType.ObjectSavedConfiguration);
            Configuration.ShowConfiguration(myConf);
            myConf.SaveConfigToFile("aa.connconf");

            //Laden:
            PLCConnectionConfiguration myConf = PLCConnectionConfiguration.LoadConfigFromFile("aa.connconf");
oder man Serialisiert sich das PLCConnectionConfiguration direkt dahin wo man es will!

Mfg
 
PLCConnectionConfiguration - PalTrans.s7p

Hallo Jochen,
hab jetzt am Config-lesen weitergemacht.
ich finde jetzt den Zusammenhang von meinem S7p zu deinem Beispiel nicht.

hier mein VB Test:
Code:
        Dim i As Integer
        Dim myPrj As Projectfiles.Step7ProjectV5

        ' hier ist mein S7-Projekt
        myPrj = Projectfiles.Projects.LoadProject([COLOR=Blue]"C:\EW\ProjektPalTransA_I\PalTrans.s7p"[/COLOR], False)
        i = myPrj.CPFolders.Count ' --> liefert 2
        i = myPrj.CPUFolders.Count ' --> liefert 1

       [COLOR=Blue] ' wie stellt man jetzut die VERBINDUNG von meinem S7-Projekt zu  MyConf   her ?
        ' was hier herauskommt hat momentan nichts mit meinem S7-Projekt zu tun  :-(([/COLOR]
        Dim myConf As New PLCConnectionConfiguration

        myConf = New PLCConnectionConfiguration("MyConf", LibNodaveConnectionConfigurationType.ObjectSavedConfiguration)

        'Erzeugen und Speichern:
        Configuration.ShowConfiguration(myConf)
        myConf.SaveConfigToFile("[COLOR=Blue]c:\ew\aa.connconf[/COLOR]")

        'Laden:
        myConf = PLCConnectionConfiguration.LoadConfigFromFile("c:\ew\aa.connconf")
aa.connconf wird zwar erzeugt, aber ohne inhalt von meinem
"C:\EW\ProjektPalTransA_I\PalTrans.s7p"

:-((
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo Jochen,
hab jetzt am Config-lesen weitergemacht.
ich finde jetzt den Zusammenhang von meinem S7p zu deinem Beispiel nicht.

hier mein VB Test:
Code:
        Dim i As Integer
        Dim myPrj As Projectfiles.Step7ProjectV5

        ' hier ist mein S7-Projekt
        myPrj = Projectfiles.Projects.LoadProject([COLOR=Blue]"C:\EW\ProjektPalTransA_I\PalTrans.s7p"[/COLOR], False)
        i = myPrj.CPFolders.Count ' --> liefert 2
        i = myPrj.CPUFolders.Count ' --> liefert 1

       [COLOR=Blue] ' wie stellt man jetzut die VERBINDUNG von meinem S7-Projekt zu  MyConf   her ?
        ' was hier herauskommt hat momentan nichts mit meinem S7-Projekt zu tun  :-(([/COLOR]
        Dim myConf As New PLCConnectionConfiguration

        myConf = New PLCConnectionConfiguration("MyConf", LibNodaveConnectionConfigurationType.ObjectSavedConfiguration)

        'Erzeugen und Speichern:
        Configuration.ShowConfiguration(myConf)
        myConf.SaveConfigToFile("[COLOR=Blue]c:\ew\aa.connconf[/COLOR]")

        'Laden:
        myConf = PLCConnectionConfiguration.LoadConfigFromFile("c:\ew\aa.connconf")
aa.connconf wird zwar erzeugt, aber ohne inhalt von meinem
"C:\EW\ProjektPalTransA_I\PalTrans.s7p"

:-((

Die ConnectionConfiguration hat auch nichts mit deinem Projekt zu tun!

Das auslesen von Verbindungsdaten, etc aus einem Step7 Projekt ist nicht implementiert!!!
 
Zurück
Oben