0
Answered

Device Mapping in ABB

Bo Adam 2 years ago updated 2 years ago 14

Hello,

I am working on connecting ABB robotstudio to game4automation, and I have a question about the device mapping. I have device mappings that go to +-120, How can I make this in robotstudio? I can only see it go up to 9 and then it becomes 1,1, 1,2 etc, does this count as 11,12 etc? 

Another question, Do I have to create empties in robotstudio for every missing device map? I saw the page but didnt understand why you had to create that much empties.

Answer

Answer

Please try do do this. I am not able to test because currently I have not an ABB Robotstudio with your configuration. Hope it works.

Add Byte to Origin Data Type 

and replace Line 167 following in ABBRobotStudioInterface by this:

if (signal.OriginDataType.ToUpper() != "BYTE")
{
if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))
{
if (lastbit)
posmemory = posmemory + 1;
bit = 0;
shm.bit = 0;
lastbit = false;
signal.Comment = $"MD{posmemory}";
accessor.Write(posheader, (byte) 10);
shm.type = SIGNALTYPE.INT;
posmemory = posmemory + 4;
}
}
else
{ if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))
{
if (lastbit)
posmemory = posmemory + 1;
bit = 0;
shm.bit = 0;
lastbit = false;
signal.Comment = $"M{posmemory}";
accessor.Write(posheader, (byte) 8);
shm.type = SIGNALTYPE.BYTE;
posmemory = posmemory + 1;
}
}
Answered

We are not deep experts in ABB  robotsudio and did on our side only a small test project. On the G4A Side all I can say is that you need to enter empty signals so that the structure is without emtpy bits and bytes. Some information about the configuration (Simit is using the same interface) can be found in this video:

https://search.abb.com/library/Download.aspx?DocumentID=9AKK107492A4208&LanguageCode=en&DocumentPartId=&Action=Launch

I have a new question. When creating the list as described, I have a group input which is the size of one byte. How can I get this in unity? I see that there is a signaltype.byte in the switch statement in ABBRobotStudioInterface.css but I cannot see where it writes the signaltype. I've tried filling "BYTE" in the "origin data type" field, but no luck so far.

Hm, thanks for the response but I cant find what to do with high device mapping numbers, I see ABB using 0-8 in their tutorial as well.

Can you provide us your ABB RobotStudio project or a simplified example and we will check?

I fixed the problems I had with the mapping, but I have one problem left. In Game4Automation you can set it on PLC output int,bool or float, but I need a Byte (so in ABB robotstudio one group input has 8 bits instead of the 32 of the INT). I've looked in the code and found some traces of the BYTE and WORD option, but I cannot find them in the scripts.

I Hope this table clarifies what i need.

InputMapping in robotstudioMapping in Game4automation
A0M0.0
B1M0.1
C2M0.2
D3M0.3
E4M0.4
F5M0.5
G6M0.6
H7M0.7
J8-15M1.0
K16M2.0

Thanks, will check this later today.

In G4A bytes are also transferred to ints. So if you have on the ABB-Robotstudio SHM Side a Byte it should be on G4A-Side an PLCInputInt or PLCOutputInt.

IF i use PLCInputInt (or output int) K (on my table) will be on M5.0 because the int is specified as 32 bits, instead of the 8 bits that a byte is long. This results into a memory mismatch

I hope you have time to check this, i've been trying to fix it for a day and it doesnt work yet. It's all i need to test my system.

Answer

Please try do do this. I am not able to test because currently I have not an ABB Robotstudio with your configuration. Hope it works.

Add Byte to Origin Data Type 

and replace Line 167 following in ABBRobotStudioInterface by this:

if (signal.OriginDataType.ToUpper() != "BYTE")
{
if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))
{
if (lastbit)
posmemory = posmemory + 1;
bit = 0;
shm.bit = 0;
lastbit = false;
signal.Comment = $"MD{posmemory}";
accessor.Write(posheader, (byte) 10);
shm.type = SIGNALTYPE.INT;
posmemory = posmemory + 4;
}
}
else
{ if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))
{
if (lastbit)
posmemory = posmemory + 1;
bit = 0;
shm.bit = 0;
lastbit = false;
signal.Comment = $"M{posmemory}";
accessor.Write(posheader, (byte) 8);
shm.type = SIGNALTYPE.BYTE;
posmemory = posmemory + 1;
}
}

Thank yo so much! This worked!

+1

Perfect - and sorry for the missing Byte stuff - we will integrate it into next relase. If you have something to share in public of the things you are doing (a video, linkedin post or something like this) this would be very welcome.

No problem! I will ask the company to make a video/post once everything is finished. It's good promotion for us as well! 

We are trying to get the Word option to work as well, we have changed the code to the following: 

Only thing we are not sure about is the line with accessor.Write(posheader, (byte) 10). 

Is this correct or should we change it?

Sorry for the formatting, couldn't find the code button.

if (signal.OriginDataType.ToUpper() == "BYTE")

{

if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))

{

if (lastbit)

posmemory = posmemory + 1;

bit = 0;

shm.bit = 0;

lastbit = false;

signal.Comment = $"M{posmemory}";

accessor.Write(posheader, (byte) 8);

shm.type = SIGNALTYPE.BYTE;

posmemory = posmemory + 1;

}

}

else if (signal.OriginDataType.ToUpper() == "WORD")

{

if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))

{

if (lastbit)

posmemory = posmemory + 1;

bit = 0;

shm.bit = 0;

lastbit = false;

signal.Comment = $"M{posmemory}";

accessor.Write(posheader, (byte) 10);

shm.type = SIGNALTYPE.WORD;

posmemory = posmemory + 2;

}

}

else

{ if (signal.GetType() == typeof(PLCInputInt) || signal.GetType() == typeof(PLCOutputInt))

{

if (lastbit)

posmemory = posmemory + 1;

bit = 0;

shm.bit = 0;

lastbit = false;

signal.Comment = $"M{posmemory}";

accessor.Write(posheader, (byte) 10);

shm.type = SIGNALTYPE.INT;

posmemory = posmemory + 4;

}

}