I´ve been trying for while creating a new S7Plus connection DP and then setting each DPE from i have seen on the online help and the PARA, copying the values to set from an already working connection.
Here is and example of the code i have been using on a click event in a button
[spoiler]
Code: Select all
main(mapping event)
{
string conn_name = "TEST_CONN";
dpCreate(conn_name, "_S7PlusConnection",1);
dpSet("System1:"+conn_name+".Config.Address","192.168.104.95"); //IP Address Plc
dpSet("System1:"+conn_name+".Config.AccessPoint","S7ONLINE");
dpSet("System1:"+conn_name+".Config.PLCType",1);
//dpSet("System1:"+conn_name+".Config.Password",);
dpSet("System1:"+conn_name+".Config.LegitimationLevel",-1);
dpSet("System1:"+conn_name+".Config.ConnType",0);
dpSet("System1:"+conn_name+".Config.KeepAliveTimeout",20);
dpSet("System1:"+conn_name+".Config.ReconnectTimeout",20);
dpSet("System1:"+conn_name+".Config.EstablishmentMode",0);
dpSet("System1:"+conn_name+".Config.SetInvalidBit",0);
dpSet("System1:"+conn_name+".Config.TimeSyncMode",0);
dpSet("System1:"+conn_name+".Config.Timezone",0);
dpSet("System1:"+conn_name+".Config.TimeSyncInterval",86400);
dpSet("System1:"+conn_name+".Config.UseUTC",1);
dpSet("System1:"+conn_name+".Config.AcquireValuesOnConnect",1);
dpSet("System1:"+conn_name+".Config.EnableStatistics",1);
dpSet("System1:"+conn_name+".Config.ReadOpState",1);
dpSet("System1:"+conn_name+".Config.StationName","TIA_Project|My_Station_Name");
dpSet("System1:"+conn_name+".Config.DrvNumber",2);
dpSet("System1:"+conn_name+".Config.CheckConn",0);
//dpSet("System1:"+conn_name+".Config.ReduConnection.Address",);
dpSet("System1:"+conn_name+".Config.ReduConnection.AccessPoint","S7ONLINE");
dpSet("System1:"+conn_name+".Config.ReduConnection.SwitchCondition",3);
//dpSet("System1:"+conn_name+".Config.ReduConnection.SwitchTaG",);
dpSet("System1:"+conn_name+".Command.Enable",0);
dpSet("System1:"+conn_name+".Command.GQ",0);
dpSet("System1:"+conn_name+".Command.IGQ",0);
dpSet("System1:"+conn_name+".Command.DoSwitchover",0);
dpSet("System1:"+conn_name+".Browse.GetBranch","RequestPlcType", "TIA_Project", "1");
dpSet("System1:"+conn_name+".Browse.NodePaths","My_Station_Name|272|192.168.104.95");
//dpSet("System1:"+conn_name+".Browse.NodeComments",);
dpSet("System1:"+conn_name+".Browse.SystemTypes","Station");
//dpSet("System1:"+conn_name+".Browse.ValueTypes",);
dpSet("System1:"+conn_name+".Browse.ItemLengths",-1);
dpSet("System1:"+conn_name+".Browse.RequestId","RequestPlcType");
}I did the dpset() sepparately just to test. The commented ones are empty DPE's so im not sure if i need to set those.
The result is that the connection is created however it cant detect the PLC type. The log viewer returns:
WCCOAui (1), 2017.08.09 09:22:53.868, CTRL, INFO, 0, , Detecting PLC type...
WCCOAui (1), 2017.08.09 09:23:03.743, CTRL, WARNING, 0, , Unable to autmatically detect PLC type
WCCOAui (1), 2017.08.09 09:23:05.868, CTRL, INFO, 0, , Reading S7DOS access points...
WCCOAui (1), 2017.08.09 09:23:26.272, CTRL, WARNING, 0, , Unable to read S7DOS access points
It does 9 attemps for each, auto and Access points. I saw that the value of System1:TEST_CONN.State.DrvType is SIM:1 instead of S7Plus:2 which is the value in working connection made from panels.
My first question is, can i actually do something like creating a connection like im trying to.
If the answer is yes, where is my mistake (or at least the more important one
Just ask me for the information i could miss.
Thank you so much for your time.