question

Visakh Sakulan avatar image
0 Likes"
Visakh Sakulan asked Arun Kr answered

Dispatcher Pass To Function Shows error.

When I take Dispatcher Pass to function 'First Available Unless Preempting then Minimize Custom Value' , It is showing some coding error.

FlexSim 17.0.0
dispatcherfunctions
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

Arun Kr avatar image
0 Likes"
Arun Kr answered

Dear Vishak,

Try the following code in the code edit field. There were some extra open braces at findmatch() function and findmin() function

Needed to be added for fixing in the next release.

treenode tasksequence = param(1);
Object current = ownerobject(c);
/***popup:PassToPreempt*/
/***tag:description*//**First Available Unless Preempting then Minimize Custom Value*/
/** If there are no objects currently available, then queue the tasksequence up using the 
Queue Strategy and wait until someone connected to its output ports becomes available.
If the tasksequence is preempting, then find the best taskexecuter to pass the task sequence to.*/
if (!getpreempt(tasksequence))
	return 0;


treenode te;
int availablePort = 
	findmatch(current.outObjects.length, 
		!objectexists(gettasksequence(te = current.outObjects[count], 0)) &&
		inputopen(te));
if (availablePort)
	return availablePort;


int travelTaskNum = findmatch(content(tasksequence), gettasktype(tasksequence, count) == TASKTYPE_TRAVEL);
treenode travelDest = current;
if (travelTaskNum > 0)
	travelDest = gettaskinvolved(tasksequence, travelTaskNum, 1);


int bestPort = 
	/**Min/Max: *//***tag:value*//**/findmin/**list:findmin~findmax*/(current.outObjects.length,
	/**Priority: *//***tag:expression*//**/distancetotravel(current.outObjects[count], travelDest)/**/,
	count, inputopen(current.outObjects[count]));


return bestPort;

Regards,

Arun KR

5 |100000

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