# How to define IOConnection is smartcomponent?

**URL:** https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727
**Category:** RobotStudio
**Created:** [March 11, 2019, 9:57am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727 "2019-03-11T09:57:33Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 11, 2019, 9:57am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/1 "2019-03-11T09:57:33Z")

</div>

Hello,

I need create a smartcomponent with “system name” and “system function” as input property. The smart component can make the IOConnection inside itself with the input system name. I wonder if it’s possible to do this? Is any one have experience with this?

Thanks  
Br/Wind

---

<div class="post-metadata">

### Author: ![DenisFR](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@DenisFR](https://tech-community.robotics.abb.com/u/DenisFR)
#### Post date: [March 12, 2019, 4:22pm UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/2 "2019-03-12T16:22:08Z")

</div>

Hello,  
You can have a look at:  
[ABB.Robotics.Controllers.IOSystemDomain](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/31028a71-0def-063a-362d-3db5bbdf69e9.htm).Signal  
[http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/b4e2dc2a-0f59-633c-d903-ad06d0f09602.htm](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/b4e2dc2a-0f59-633c-d903-ad06d0f09602.htm)

Never used it.

---

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 13, 2019, 8:23am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/3 "2019-03-13T08:23:50Z")

</div>

Hi DenisFR,

I saw there are class “IOConnection” in robotstuido SDK,

```auto
public IOConnection(
	ProjectObject sourceObject,
	string sourceSignal,
	ProjectObject targetObject,
	string targetSignal
)

I don't know how to define sourceObject. Do you have some experience?

Thanks a lot

```

---

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 13, 2019, 8:23am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/4 "2019-03-13T08:23:50Z")

</div>

Hi ,

I have add a function to create connection of signals between two objects. As the following example, the signal will be connected from a.dotest1 to b.ditest1. But I have tested the code, it’s not work. I have check the code have been executed. What’s the reason the signal can’t be connected with each other.

public void ConnectIO(SmartComponent component)  
{  
ProjectObject a = (ProjectObject)component.Properties[“ObjectA”].Value;  
ProjectObject b = (ProjectObject)component.Properties[“ObjectB”].Value;

IOConnection IOConn1 = new IOConnection(a, “dotest1”, b, “ditest1”);  
IOConn1.Update();

}

Thanks  
Br/Wind

---

<div class="post-metadata">

### Author: ![DenisFR](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@DenisFR](https://tech-community.robotics.abb.com/u/DenisFR)
#### Post date: [March 13, 2019, 10:49am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/5 "2019-03-13T10:49:31Z")

</div>

Hello,  
I don’t understand what you want to do.  
I thought you want your component can get Robot Controller IO status.

In you last example, you use this [Constructor](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotStudio/html/cda5115c-27ac-e81f-4eed-352f3b12b38f.htm).  
In remarks, you can found that line:  
The object should be either a [IHasIOSignals](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotStudio/html/cbda171b-a26e-bd74-4197-4bc1862b37c1.htm) or an [RsIrc5Controller](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotStudio/html/605a5b0b-64d6-6a4c-f5ca-61fe678ecb63.htm).  
[SmartComponent](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotStudio/html/a80fa180-48d3-28ce-1fab-8d0539112ac1.htm) is IHasIOSignals.

In [Update](http://developercenter.robotstudio.com/blobproxy/devcenter/RobotStudio/html/c39e7e2b-2854-6428-ee60-687a510c1278.htm)() method, you get this remark too:  
There is normally no need to call this method since the connection is updated automatically whenever the source signal changes.

---

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 13, 2019, 11:10am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/6 "2019-03-13T11:10:40Z")

</div>

Hi Denis,

We have simulation station with many robot controllers. Their have many communication between them. Normally we manually map the connection with station logic “IO Connection” page. The robot IO signals is standard. To make simulation easier, I want make a smart component to do this job. You just need define the system name and the smart component can map the connection automatically. I have tried with and without Update() method, both doesn’t work. I don’t know what’s the problem actually.

Thanks  
Br/Wind

---

<div class="post-metadata">

### Author: ![DenisFR](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@DenisFR](https://tech-community.robotics.abb.com/u/DenisFR)
#### Post date: [March 13, 2019, 11:31am UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/7 "2019-03-13T11:31:46Z")

</div>

So, can you test to add these lines?

```auto
            Station station = component.ContainingProject as Station;
            station.IOSignals.Add(IOConn1);

```

PS: you should rename IOConn1 to ioConn1 to respect case naming.

Variable start with lower and Class with upper.

---

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 13, 2019, 12:20pm UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/8 "2019-03-13T12:20:49Z")

</div>

Hi Denis,

public void ConnectIO(SmartComponent component)  
{  
ProjectObject a = (ProjectObject)component.Properties[“ObjectA”].Value;  
ProjectObject b = (ProjectObject)component.Properties[“ObjectB”].Value;

IOConnection ioConn1 = new IOConnection(a, “dotest1”, b, “ditest1”);  
Station station = component.ContainingProject as Station;  
station.Connections.Add(ioConn1);  
station.Connections.Clear();

}  
Thanks your support, now the connection auto map is OK. I also test the connections.Clear(), but found the clear can’t clear the connection. Any mistake I made?

Thanks  
Br/Wind

---

<div class="post-metadata">

### Author: ![DenisFR](https://avatars.discourse-cdn.com/v4/letter/d/dc4da7/32.png) [@DenisFR](https://tech-community.robotics.abb.com/u/DenisFR)
#### Post date: [March 13, 2019, 5:08pm UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/9 "2019-03-13T17:08:30Z")

</div>

Hello,  
I don’t know why Clear doesn’t work. You may send an issue.  
Did you test by using Remove(each item) ?

---

<div class="post-metadata">

### Author: ![wind](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wind](https://tech-community.robotics.abb.com/u/wind)
#### Post date: [March 14, 2019, 1:18pm UTC](https://tech-community.robotics.abb.com/t/how-to-define-ioconnection-is-smartcomponent/8727/10 "2019-03-14T13:18:10Z")

</div>

Hi Denis,

Remove is OK. But there have other small problem with remove also. Thanks for your great help.

Br/Wind
