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.

  1. 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

  1. Object cp2 = Model.find("ControlPoint4");
  2. Object newCP = duniform( 0, 1 ) == 1 ? cp1 : cp2;
  3. Object taskEx = Model.find("TaskExecuter1");
  4. AGV agv = AGV( taskEx );
  5. function_s(newCP,"addConnection",-1,taskEx);
  6. taskEx.location = newCP.location;
  7. return agv.currentCP ;
  8. 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.