Cancel
Showing results for 
Search instead for 
Did you mean: 

Add a signal in Simulation Panel

Experimenter
Experimenter

Hi

 

 I want to add all robots program number in  Simulation Panel through the api.

 Is this possible?

 

Regards

8 REPLIES 8

Re: Add a signal in Simulation Panel

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

 

Can you give more details? Do you want to create new signals?

 

 

Re: Add a signal in Simulation Panel

Experimenter
Experimenter

I created these singnals, know how to add by Click the add button.

now I want to add these in the Simulation Panel through the api .

 

Is this possible?

 

pic.jpg

Re: Add a signal in Simulation Panel

Siemens Phenom Siemens Phenom
Siemens Phenom

No, there is no such API. In the Simulation Panel, you can create a .spss file configuration that contains a list of signals and load it each time you need it.

Re: Add a signal in Simulation Panel

Pioneer
Pioneer

Hy,

 

in this spss file is for example this line:

 

<Item name="_StartRobots" id="E9A47116-798A-43BA-B886-DD3BEAEA1556" isForcedState="1" forceStrValue="1" strValue="0"/>

 

Is it possible to get this ID string from signal with API?

 

TxPlcProgram plcProgram = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram;
TxTypeFilter signalfilter = new TxTypeFilter(typeof(ITxPlcSignal));
TxObjectList signals = plcProgram.GetSignals(signalfilter);


string id = signals[0].Id;

 

I tried this and is not the right one.

 

 

Re: Add a signal in Simulation Panel

Genius
Genius

Hi, @Tomaz_K !

 

this is obviously the so called external ID. You can obtain it from the ProcessModelId.ExternalId of any object, that implements ITxPlanningObject or ITxProcessModelObject interface.

Best Regards
Witalij.
 
 

Re: Add a signal in Simulation Panel

Pioneer
Pioneer

Hi Witalij,

 

the Problem is that ITxPlcSignal does not contain this. Is there any other possibility to obtain this ID?

Re: Add a signal in Simulation Panel

Valued Contributor
Valued Contributor

You may not be able to add signals to a simulation panel directly through the api, but you can programmatically create an spss file with the proper xml format and then load it into the simulation panel.  You do not need the external id, you can create it with only the signal names and leave the "id" attribute out of the "Item" elements entirely.  It will load into the simulation panel and then when you save it through the simulation panel, the id's will be added.

 

This will work at least as of version 13.1, I have not tried this in earlier versions.

 

 

Re: Add a signal in Simulation Panel

Pioneer
Pioneer

Thats it! Thank you. I tested with 13.1 and 14.1 and is working.