Go Back   Flexsim Community Forum > Flexsim Software > Q&A
FAQ Downloads Calendar Search Mark Forums Read vBExperience Register

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default how to use Dijkstra algorithm to conveyor system;

how to use Dijkstra to conveyor system;
in my project,conveying material from one place to another place there are a lot of routes in my conveyor system;
so i want to use Dijkstra to conveyor system;or use usercommands and the first parameter is first conveyor and the second parameter is the last conveyor,the materials can search available
routes and conveying in my conveyor system;
i know we can use itemtype ,label or global table to contol out port ,but it is too troublesome
I do not knows where code control the op travling network node, i think my problem can use some internal code like control "the op travling network node"
and i want to use binary seartch tree to write usercommands
my project is big raw material yard
can you give me some advise?do anyone do this before?
__________________
Chinese Flexsim consultant
Reply With Quote
  #2  
Old 03-08-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Preston, UK
Posts: 211
Thanks: 67
Thanked 343 Times in 130 Posts
Downloads: 20
Uploads: 0
Rep Power: 259
Jason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud of
Default

To use this dynamically to route from 'a' to 'b' you'd need to keep the port sequence on the item or execute it on the sendto of every conveyor, so my approach would be to automatically create a lookup table on each conveyor (as a variable or label) that tells me which port has the shortest route to the item's destination, and then find the port to return in the sendto trigger. The lookup table is like a signpost at a junction.

Pre-populate the lookup table using the Dijkstra algorithm or similar that marks conveyors as 'visited' when recursing through the conveyor port network and returns its own length plus the downstream conveyors returned lengths for the various destinations. When the output conveyor is marked as visited you know not to go down that branch. When receiving the port-destination-distances back, compare with the best so far and update the ports listed in the table to reflect improvements and add new destinations.

Last edited by Jason Lightfoot; 03-08-2010 at 05:32 AM.. Reason: clarification
Reply With Quote
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
Lars-Olof Leven (03-08-2010), LINWEIXU (03-13-2010)
  #3  
Old 03-14-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default

Actual Situation is different,some pathes share some conveys,if conveting some material use one path and use
these sharing conveys, some other pathes can not use these sharing conveys,so if you want use one route,you must reserve
this route,and this route must shortest in available route.
Sorry, I didn't express clearly,

so i want to use usercommands to achieve " the first parameter is first conveyor and the second parameter is the last conveyor,the materials can search available
routes and conveying in my conveyor system" This is the first step
like these:
creatconveylist(treenode firstconvey,treenode endconvey,treenode table,int i,int portnum)
{
int n=0;
int k=0;
n=nrop(firstconvey);
if(n=0) return 0;
if(tonum(firstconvey)==tonum(endconvey))
{
return 1;
}
settablenum(table,1,k,tonum(firstconvey));
settablenum(table,2,k,portnum);
k++;
for(int i=0;i<n;i++)
{
if(content(Outobject(firstconvey,i)==0)
creatconveylist(Outobject(firstconvey,i), endconvey,table,i,portnum)
}
}
but usercommands don't support nested loop
do you have other ideas?
how to use flexsimscript to support nested loop?
__________________
Chinese Flexsim consultant

Last edited by LINWEIXU; 03-14-2010 at 06:16 AM..
Reply With Quote
  #4  
Old 03-14-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default

I don't know how to realize "Pre-populate the lookup table using the Dijkstra algorithm or similar that marks conveyors as 'visited' when recursing through the conveyor port network and returns its own length plus the downstream conveyors returned lengths for the various destinations. When the output conveyor is marked as visited you know not to go down that branch. When receiving the port-destination-distances back, compare with the best so far and update the ports listed in the table to reflect improvements and add new destinations."
can you give me a example or pseudocode?
thank you very much
__________________
Chinese Flexsim consultant

Last edited by LINWEIXU; 03-14-2010 at 09:32 PM..
Reply With Quote
  #5  
Old 03-15-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Preston, UK
Posts: 211
Thanks: 67
Thanked 343 Times in 130 Posts
Downloads: 20
Uploads: 0
Rep Power: 259
Jason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud of
Default

I'll try and put it together one evening this week.
Reply With Quote
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
LINWEIXU (03-15-2010)
  #6  
Old 03-18-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Preston, UK
Posts: 211
Thanks: 67
Thanked 343 Times in 130 Posts
Downloads: 20
Uploads: 0
Rep Power: 259
Jason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud of
Default A* implementation example for network nodes

Here is the shortest path example - only I thought maybe Dijkstra would be a little inefficient for huge networks, so I've implemented the A* algorithm (Dijkstra is a simplification of this without the ability to 'leave early' as I understand it).

The results are stored on the 'Start' network node under a label called routes so as more queries are run the routes build up. You could then check this routes table before you ask to find the route for further efficiency.

There are two user commands - getRoute (the A* algorithm) and writeRoute, which writes the results and opens a table view of the route found. The user only needs to call getRoute and pass it the start and finish objects - it calls writeRoute itslelf.

Changing it to work with conveyors should just be a matter of reading the length of the conveyor instead of the distance node of the connectionsout ( the line where 'newdist' is assigned) - although you'll probably want to revise the estimator too.

I've not fully checked the logic yet so let me know if anyone finds something I've missed. Thanks.
Attached Files
File Type: zip A_star v4.52.zip (69.1 KB, 38 views)

Last edited by Jason Lightfoot; 03-18-2010 at 05:09 PM..
Reply With Quote
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
LINWEIXU (03-18-2010)
  #7  
Old 03-18-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default

here is non-recursive depth first search;I debug a lot of time;Maybe efficiency is not high
thank you very much
Attached Files
File Type: zip shendu.zip (111.0 KB, 20 views)
__________________
Chinese Flexsim consultant
Reply With Quote
  #8  
Old 03-22-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default

can you tell me more how to use "createcoupling",or explain more ,i confused about that
__________________
Chinese Flexsim consultant
Reply With Quote
  #9  
Old 03-22-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Preston, UK
Posts: 211
Thanks: 67
Thanked 343 Times in 130 Posts
Downloads: 20
Uploads: 0
Rep Power: 259
Jason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud ofJason Lightfoot has much to be proud of
Default

Createcoupling creates two nodes with values that point to each other. It's a mechanism used for creating relationships that persist between model saves and compilation (where the memory address changes), and is the basis for connections between objects in the model - eg. ports, members of a timetable, and also stations on network nodes.

For more information see the command help.
Reply With Quote
The Following 3 Users Say Thank You to Jason Lightfoot For This Useful Post:
LINWEIXU (03-22-2010), Phil BoBo (03-22-2010), Tom David (03-22-2010)
  #10  
Old 03-22-2010
LINWEIXU's Avatar
LINWEIXU LINWEIXU is offline
Flexsim User
 
Join Date: Jun 2009
Location: china
Posts: 138
Thanks: 121
Thanked 15 Times in 9 Posts
Downloads: 216
Uploads: 0
Rep Power: 37
LINWEIXU will become famous soon enough
Default

I understand. Thank you very much
__________________
Chinese Flexsim consultant

Last edited by LINWEIXU; 03-22-2010 at 08:59 PM..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between a Conveyor and Basic Conveyor shivrash Q&A 2 07-21-2009 02:09 AM
Can embedding genetic algorithm in Flexsim ? ankus d Q&A 3 05-24-2009 11:06 PM
Can I write to the system console? Steven Hamoen Q&A 2 11-26-2008 03:37 AM
Concept Training System Brandon Peterson User Development 0 11-14-2008 09:02 AM
shortest path algorithm Vinay Mehendiratta Q&A 5 01-25-2008 08:42 AM


All times are GMT -6. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Powered by NuWiki v1.3 RC1 Copyright ©2006-2007, NuHit, LLC
Copyright 1993-2010 Flexsim Software Products, Inc.