Save priphery address parameters C# function

Find and share HowTos to various installations / configurations!
8 posts • Page 1 of 1
AliBou
Posts:25
Joined: Wed Mar 28, 2018 3:57 pm

Save priphery address parameters C# function

Post by AliBou »

Hi,
Is there a C# function to save priphery address parameters ??

Thank you by advance
Best regards

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Save priphery address parameters C# function

Post by leoknipp »

Can you please describe in detail what "save" means?
You can do an ASCII export to save the _address information in a text file.

Best Regards
Leopold Knipp
Senior Support Specialist

AliBou
Posts:25
Joined: Wed Mar 28, 2018 3:57 pm

Re: Save priphery address parameters C# function

Post by AliBou »

Hi,
we try to insert pirephery address using C# manager
all these parameters are written successfuly but we have to go in the para and click apply button to save these parameters
our need is function like "paPutGlobalDpc" in para library

thank you by advance
best regards.

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Save priphery address parameters C# function

Post by leoknipp »

If you want to configure a _address config for a DPE you have to configure the _distrib config first if the driver number is unequal to 1.
Then you can configure it and set the attribute _address.._active as the last step.
Setting is possible with dpSet() commands or the equal function to a dpSet() in a C++/C# API manager.

Best Regards
Leopold Knipp
Senior Support Specialist

AliBou
Posts:25
Joined: Wed Mar 28, 2018 3:57 pm

Re: Save priphery address parameters C# function

Post by AliBou »

thank you for your reponse
that's wahat i've done
// String Address configuration
String addType = dpName+ sRootPrefix + ":_address.._type";
String addRef = dpName + sRootPrefix + ":_address.._reference";
String SubInx = dpName + sRootPrefix + ":_address.._subindex";
String addMode = dpName + sRootPrefix + ":_address.._mode";
String dataType = dpName + sRootPrefix + ":_address.._datatype";
String drvIdent = dpName + sRootPrefix + ":_address.._drv_ident";
String AddActv = dpName + sRootPrefix + ":_address.._active";
String direction = dpName + sRootPrefix + ":_address.._direction";
String distDriver = dpName + sRootPrefix + ":_distrib.._driver";
String distType = dpName + sRootPrefix + ":_distrib.._type";
String pollGrp = dpName + sRootPrefix + ":_address.._poll_group";
String driverConnexion = dpName + sRootPrefix + ":_address.._connection";

//DpIdentifiants
var iPollIdf = processModel.GetDpIdentifierByDpPath("_"+Subscription);
var iConnIdf = processModel.GetDpIdentifierByDpPath("_"+ConnectionName);

if (processModel.IsDpPathExisting(dpName) )
{
this instruction dosn't works:
**********************************************************************************
//var distribDriver = new Tuple<string, OaVariant>(distDriver, Convert.ToChar(DriverNumber));
//await valueProcess.SetDpValueAsync(distribDriver);
************************************************************************************

Tuple<String, OaVariant>[] dpCFG ={
new Tuple<string, OaVariant>( distType, 56),
new Tuple<string, OaVariant>( distDriver, Convert.ToChar(DriverNumber)),
new Tuple<string, OaVariant>( addType, 16),
new Tuple< string, OaVariant>( addRef, addressRef),
new Tuple<string, OaVariant>( direction, Convert.ToChar(Direction)),
new Tuple<string, OaVariant>( addMode, Convert.ToChar(2)),
new Tuple< string, OaVariant>( dataType, TConvertHelper.S7PTypeToIntger(type)),
new Tuple<string, OaVariant>( pollGrp,iPollIdf),
new Tuple<string, OaVariant>( drvIdent, "S7PLUS"),
new Tuple<string, OaVariant>( AddActv, false),
new Tuple< string, OaVariant>( driverConnexion, iConnIdf)
};

TraceObj.WriteInfo("+++++++++++++++Insertion Nouvelle Config+++++++++++++++");
await valueProcess.SetDpValueAsync(dpCFG);
TraceObj.WriteInfo("+++++++++++++++Activation Nouvelle Config+++++++++++++++");

var activeAddress = new Tuple<string, OaVariant>(AddActv, true);
await valueProcess.SetDpValueAsync(activeAddress);

AliBou
Posts:25
Joined: Wed Mar 28, 2018 3:57 pm

Re: Save priphery address parameters C# function

Post by AliBou »

Hi
when we try to set only _distrib config within driver nmuber it doesn't work ??

string distDriver = dpName + sRootPrefix + ":_distrib.._driver";
var distribDriver = new Tuple<string, OaVariant>(distDriver, Convert.ToChar(DriverNumber))
await valueProcess.SetDpValueAsync(distribDriver);

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Save priphery address parameters C# function

Post by leoknipp »

I do not understand your last answer.
For the _distrib config the attributes _type and _driver need to be set.
Setting _type is necessary to create the config if it does not exist.

Best Regards
Leopold Knipp
Senior Support Specialist

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: Save priphery address parameters C# function

Post by gschijndel »

AliBou wrote: ↑ Tue Feb 12, 2019 3:43 pm string distDriver = dpName + sRootPrefix + ":_distrib.._driver";
var distribDriver = new Tuple<string, OaVariant>(distDriver, Convert.ToChar(DriverNumber))
await valueProcess.SetDpValueAsync(distribDriver);
Try it without conversion to character, since the value should be the driver number (not a character of the driver number).

8 posts • Page 1 of 1