question

Patrick Zweekhorst avatar image
0 Likes"
Patrick Zweekhorst asked Phil BoBo commented

How to set originCP (reset CP) of AGV?

Hi,

I have a model where there are two possible areas the AGV can work in. I have connected the AGV to a CP in area 1, but now I want to change this in the OnReset trigger of my model to a CP in area 2. This CP is the originCP of the AGV, but you can only read this value and not set it. Using agv.currentCP = newCp or reassigncp does not work in the OnResetTrigger. I have also tried to use the contextdragconnection command in the OnResetTrigger, but this gives a pop up (where I need to select Traveler).

How can I change the start location for the AGV? The code line below does work, but does not look so nice to use.

Model.find("AGVNetwork>variables/agvs/TaskExecuter1/resetPoint").value = newCP;

You can see my attempts in the OnResetTrigger in the example model:]

agv-reassigncp.fsm

Thanks in advance,

Patrick

FlexSim 18.2.2
agvreassigncpcurerntcp
agv-reassigncp.fsm (27.1 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
gilbert jerald avatar image
3 Likes"
gilbert jerald answered Phil BoBo commented

@ Patrick Zweekhorst

Hi,

As per your condition, I have done a small change in your model. I have attached it for your reference.

Solution :Instead of using contextdragconnection concept you can use function_s(newCP,"addConnection",-1,taskEx)

controlpoint-reassign-support.fsm

Thanks

Object cp2 = Model.find("ControlPoint4");
Object newCP = duniform( 0, 1 ) == 1 ? cp1 : cp2;
Object taskEx = Model.find("TaskExecuter1");
AGV agv = AGV( taskEx );
function_s(newCP,"addConnection",-1,taskEx);
taskEx.location = newCP.location;
return agv.currentCP ;
return newCP;

· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Patrick Zweekhorst avatar image Patrick Zweekhorst commented ·

Hi @gilbert Jerald,

Thanks for your answer. That also seems to work. It would however be nice to be able to use the AGV properties to do this and avoid using function_s commands or the solution I did with the path.

Patrick

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Patrick Zweekhorst commented ·

Both contextdragconnection() and function_s(cp, "addConnection", -1) are valid ways to programmatically connect a task executer to the AGV Network at a particular control point.

The dot syntax methods and properties are purposefully narrow in their scope to common functions used during a model run. We purposefully have not added dot-syntax for auto-build functions such as this.

The AGV objects purposefully have nice eventfunctions that can be used to auto-build AGV models. These functions are accessed with function_s() and are designed to be used by the UI and for programmatically creating and/or editing models.

Also, you should probably do this before the reset trigger of the object you are changing. For example, do it in the OnModelReset trigger that fires before it starts executing individual objects' reset triggers.

Finally, originCP is the CP at which an AGV started their last travel task; it is not the CP they are connected to at the beginning.

1 Like 1 ·
Patrick Zweekhorst avatar image Patrick Zweekhorst Phil BoBo ♦♦ commented ·

Hi @phil.bobo,

Thanks for the explanation. I already placed the login in de OnModelReset. I will use the function_s solution as the contextdragconnection gives the unwanted pop up.

Is there some more documentation for the function_s commands? Like what the parameters are and what they do? They can be used in a lot of situations, as this one and others where I already used them.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.