# World Zone Tutorial

**URL:** <https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060>\
**Category:** RobotStudio\
**Tags:** rapid-code, robotstudio, rapid, worldzones, world-zone\
**Created:** [March 16, 2016, 2:26pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060 "2016-03-16T14:26:50Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 2:26pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/1 "2016-03-16T14:26:50Z")

</div>

Hello All,

I am fairly new to RobotStudio and RAPID programming. I am trying to set up a cube World Zone, and I am getting several syntax errors. I have read the Technical Reference Manual and looked at the functions, etc. They weren’t really of much help. So my question is, is there any sort of World Zone tutorial out there or is there some place I can get lots of examples for World Zone code?

Thanks in advance for any help!  
SM

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 3:03pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/2 "2016-03-16T15:03:27Z")

</div>

Maybe a little more info in the attached manual.  
[3HAC18152-1\_revF\_en.pdf](https://tech-community.robotics.abb.com/uploads/short-url/mpo0bCPl5wghB4nl9RZ3hzrvcGM.pdf) (371 KB)

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 3:44pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/3 "2016-03-16T15:44:19Z")

</div>

Soup,

Thank you for your post. Although it was helpful, it still didn’t really answer my question. Perhaps the attached screenshot will help clarify my question a little more:

 ![image.jpg](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/2X/f/f875f1f34e433b26afd8cc189d862897a1e0965d.jpeg)  
Both syntax errors are saying “Wrong number of arguments.” Any ideas on how to correct my syntax? Am I placing that snippet of code in the wrong place or something?

Essentially I am trying to create a “box” defined at **corner1:=[28.50, -14.25, 0.00]** and **corner2:=[17.00, 28.50, 58.80]**. I want the robot to stop everything when it comes into contact with that “box.”

Also attached is the text file for my code snippet.

Any examples or help is greatly appreciated!  
SM

 ![image.jpg](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/2X/f/f875f1f34e433b26afd8cc189d862897a1e0965d.jpeg)  
[WorldZone.txt](https://tech-community.robotics.abb.com/uploads/short-url/9EYfZqKxGtOYDrMSUS3Ijps4h4E.txt) (1.51 KB)

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 4:05pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/4 "2016-03-16T16:05:22Z")

</div>

Looks good. The only thing I see is that “object” is defined as temporary and then “\Stat” is used in the limit supervision instruction. Probably both need to be one or the other – but not sure if that’s what is causing your error.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 4:09pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/5 "2016-03-16T16:09:04Z")

</div>

I changed them both to the same for “temp” and “stat” and that still did not fix the problem. I did find out that line 15 (“WZBoxDef…”) is the line that is causing the error.

Any other suggestions or examples of World Zone code?

Thanks,  
SM

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 4:26pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/6 "2016-03-16T16:26:58Z")

</div>

It looks good – not seeing anything.

Things to try:

1. Press the “Format” button in the Rapid editor and see if any garbage characters are hiding somewhere.
2. Save the module out, attach it here, and I’ll try to run it.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 4:45pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/7 "2016-03-16T16:45:24Z")

</div>

Ok attached is the text file. The module method isn’t really working, but the text file should be sufficient?  
Thanks,  
SM

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 4:54pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/8 "2016-03-16T16:54:48Z")

</div>

Has a “-” after ENDMODULE – looks good otherwise.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 5:00pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/9 "2016-03-16T17:00:43Z")

</div>

That was an accidental on my part when I was pasting it to notepad. The program in RS doesn’t have that “-”.

Were you getting “Wrong number of arguments” errors in the “WZBoxDef” or “WZLimSup” lines?

Could my PC not hooked up to the real controller have anything to do with it? Like my RS doesn’t actually have WZ on it, but the real controller does. Is that unusual? Or is there an addin for RS that has WZ?

Also, what version of RS are you using? I am using 6.01.01.  
Thanks,  
Stephen

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 5:08pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/10 "2016-03-16T17:08:56Z")

</div>

Nothing – applied and got “No errors.”

If the controller doesn’t have the World Zone option it should error saying it doesn’t have that option – virtual or real controller.

I’m using a virtual controller with RW 5.15.8.

All this is very odd – I’d Apply changes, close and restart RobotStudio. If still have an issue – restart the PC. If still have an issue – throw the computer out the window.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 5:12pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/11 "2016-03-16T17:12:42Z")

</div>

So I am looking at the output window, and it says “The instruction WZBoxDef requires option World.” I think this may be the problem. Is there somewhere that I can download WZ to the virtual controller? Or is this something that has to be purchased when purchasing RS?

Thanks,  
Stephen

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 5:24pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/12 "2016-03-16T17:24:32Z")

</div>

No purchase necessary – the virtual controller keystring has World Zones as an available option – the World Zone box must be checked. Sounds like it was not checked when your virtual controller was created. After the fact, I don’t think you can easily add the option to your virtual controller without remaking the system.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 16, 2016, 6:02pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/13 "2016-03-16T18:02:43Z")

</div>

Ok. Thanks for all the help. I just hooked my PC up to the real controller (which has WZ on it) and I no longer received syntax errors.

However, I want the robot to stop everything when it enters the WZ “cube” defined above. Is my program not written for that case? I am still trying to understand what all the commands are for… What would I need to change in my program above to have the robot stop when it enters the WZ “cube?”

Thanks for all the help,  
SM

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 16, 2016, 7:01pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/14 "2016-03-16T19:01:14Z")

</div>

The procedure is good but now you need to call it at a POWER\_ON event. Look-up “Event Routine” in the manual to learn about it, add the POWER\_ON event in the controller under Configuration \> Controller \> Event Routine in RobotStudio, cycle the power on the controller, and it should work. And every edit to the zone requires that you cycle power for it to take.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 17, 2016, 8:57pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/15 "2016-03-17T20:57:31Z")

</div>

So I created a POWER\_ON Event, but I am not really sure how to implement it in my code in order to get the WZ to work?  
Thanks  
SM

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [March 18, 2016, 2:24pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/16 "2016-03-18T14:24:06Z")

</div>

You choose the procedure you’d like to call in the POWER\_ON event parameters and as the controller is powering on that procedure is called in the background – in this case the procedure is defining the World Zones. If you think the event is not running the procedure, try pulsing an output (something you can see – light, alarm, solenoid, etc.) in that procedure to confirm to yourself the event is working before digging into possible issues with the World Zone definitions.

---

<div class="post-metadata">

**Author:** ![SteveMob](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/stevemob/32/1600_2.png) [@SteveMob](https://tech-community.robotics.abb.com/u/SteveMob)\
**Post date:** [March 18, 2016, 7:12pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/17 "2016-03-18T19:12:02Z")

</div>

Can you show me an example of this? I am having trouble creating inputs/outputs as I am new to this sort of thing.  
Thanks,  
SM

---

<div class="post-metadata">

**Author:** ![graemepaulin](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@graemepaulin](https://tech-community.robotics.abb.com/u/graemepaulin)\
**Post date:** [March 20, 2016, 6:56pm UTC](https://tech-community.robotics.abb.com/t/world-zone-tutorial/7060/18 "2016-03-20T18:56:12Z")

</div>

![image.jpg](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/1X/9256154c159174052bd489f0b73cfab9c5f580e4.jpeg)

In RobotStudio go to Controller tab-\> configuration-\>I/O system-\>right click signal-\>new signal-\> then fill in the name and type of signal (as shown above )

For RW6.xx this is all you need to create a virtual signal.

You can then set this signal high (1) in your power on routine to check it is running).

 ![image.jpg](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/1X/9256154c159174052bd489f0b73cfab9c5f580e4.jpeg)
