ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
Rail API
I've posted a Rail API library to the downloads section:
http://www.flexsim.com/community/for...do=file&id=127 Check it out! |
The Following 7 Users Say Thank You to Anthony Johnson For This Useful Post: | ||
Vinay Mehendiratta (04-09-2008) |
#3
|
||||
|
||||
Check the following file: railapifunctions.h
You will find the sentence "uncomment the following to be compatible with 4.3" If you do this, it will work in flexsim 4.3 regards, Lolke |
The Following 2 Users Say Thank You to Lolke Koopmans For This Useful Post: | ||
qin tian (04-27-2008) |
#4
|
||||
|
||||
direction of edges are not uniform
Anthony,
I was working with your Rail API (It is great! ) when Flexsim just shut down (like with an infinite loop). I found out that this was because I tried to send a train over a network of edges with different directions. When I used your beta version of the library (where you had to compile), I used to get an error pop-up box telling me: "Could not create path because direction of edges are not uniform." Is it possible to re-introduce the error-message? That would make modelling and certainly debugging easier! Thanks! Lolke |
#5
|
||||
|
||||
Lolke,
I just checked the code, and the logic is the same as the c++ version that I gave you a while back (the error message is still implemented in the code), so from what I can tell, your issue must be something else. I know that the current RailAPI will crash when you compile Flexsim unless you add /DELAYLOAD:RailAPI.dll to Flexsim4\program\config\flexsimexeB.txt. Is that when you're getting the crash? Your question brings up an issue that we've not clearly decided here at Flexsim, and about which I'm undecided myself, namely how do we support the rail API. It's a really cool library, but we haven't set it up to be an income-generator as yet, so we don't know exactly how/if we want to support it, except through projects that we get in the rail industry. We've considered open-sourcing it, but if we do that, we'd want some commitment from others that they will indeed help to improve it (I think there are a lot of improvements that can be made to it), so we can benefit from the open source, and not just the users. Or maybe we set it up through maintenance contracts with customers (since we've already given it away, and since it's still "half-baked" in my opinion, I don't think it's sellable yet, but we can sell support for it). Anyway, what are your thoughts? I think it's a great library, but it's a pretty small niche market, which means that it's not worth it to us right now to just maintain it for free for our customers. |
#6
|
||||
|
||||
Thanks for your answer, Anthony.
I do not compile, so that is not the problem. I am pretty sure the problem is in the direction of the edges. I could reproduce the problem if the direction was not uniform and I solved the problem completely by making sure the direction is always correct (without changing anything else in the model). I really like the library a lot and I am using it in 2 projects right now. You are probably right that it is a small niche market, but we are working a lot with train movements. And from the other thread we saw that there is more interest in this area. I can see that supporting the library is an issue since you gave the library away. I like the idea of open sourcing, but I have to say I didn't change a word of your code. I am using it as it is for the movements of the trains, for allocating the edges and for checking and listening for the allocations. If you want to sell / support it, you have to think who your customers are. I can use it as it is. But I can imagine that someone less experienced with flexsim or using functions, will need more explanation / help or even a training. Our customers will not be interested in buying or using the library, since we build the models for them. When I speak for myself, using the library, I think I can get pretty far without any support. But this is only true if I can see the code. If it is in a dll and I can't see what is happening it is much more difficult to find out. Regards, Lolke |
The Following User Says Thank You to Lolke Koopmans For This Useful Post: | ||
Anthony Johnson (05-07-2008) |
#7
|
||||
|
||||
Lolke,
Thanks for your thoughts. Given your input and my own thoughts on it, I'm leaning toward just leaving the RailAPI "as-is" with no guarantees, no support. Improvements will be made on a per-project basis, when we get projects here at Flexsim. I agree that there has lately been an increase in interest in simulation doing rail operations. We'll see how/if that leads to improvements in the rail API. Thanks, Anthony |
#9
|
|||
|
|||
Quote:
the continuefromrailwait() command is executed independent of the rail sequence" in attach i I try to use continuefromrailwait() but I failed can fromobj be " sequence ".can anyone give some idea???????? |
#10
|
|||
|
|||
i test one day,Finally understand "allocating the edges and for checking and listening for the allocations." but i also do not know how to use continuefromrailwait(node sequence), and can not understand delayrailmoveatswitches(node railmove, num delaytime, num maxspeed, num acc, num dec, num shortdist); i set delaytime smaller,but move slower,i do not know why.there is A few examples, it is so difficult.
I made an example that use "allocating the edges and for checking and listening for the allocations." to Help later learners can anybody help me????? thank you |
The Following User Says Thank You to For This Useful Post: | ||
Hao Zhou (12-17-2010) |
#11
|
|||
|
|||
i think there is something wrong in command
"delayrailmoveatswitches(node railmove, num delaytime, num maxspeed, num acc, num dec, num shortdist)". Description: Searches through the rail moves entire path and changes the move so that the train will stop short of the switch and wait for the delaytime at the switch before resuming on. Example: delayrailmoveatswitches(railmove, 5,1,0,0) can i expain this for "train move along path and stop at switch and wait for the delaytime then resuming on.'' i write code "delayrailmoveatswitches(move, 1.5, 1,2, 3,1.5);" Kinematic data - Last Updated Location: [7.50,0.00,0.00] Rotation: [0.00, 0.00, 0.00] Start Time: 0.00 End Time: 9.35 Last Update Time: 0.04 Initial Location: [7.50,0.00,0.00] Initial Rotation: [0.00, 0.00, 0.00] 2 Kinematics Added Travel [6.50, 0.00, 0.00] totaldist: 6.50 starttime: 0.00 endtime: 5.08 startspeed: 0.00 endspeed: 1.50l acc1: 1.00 acc2: 1.00 peakspeed: 1.50 acc1time: 1.50 peaktime: 3.58 acc2time: 0.00 Travel [5.83, 0.00, 0.00] totaldist: 5.83 starttime: 5.08 endtime: 9.35 startspeed: 1.50 endspeed: 0.00l acc1: -2.00 acc2: -2.00 peakspeed: 1.50 acc1time: 0.00 peaktime: 3.51 acc2time: 0.75 1.5 is speed ,not delaytime,"1,2"are acc and dec , not maxspeed and acc. i test again delayrailmoveatswitches(move, 3, 2, 3,4,5); Kinematic data - Last Updated Location: [0.00,0.00,0.00] Rotation: [0.00, 0.00, 0.00] Start Time: 0.00 End Time: 8.54 Last Update Time: -1.06 Initial Location: [7.50,0.00,0.00] Initial Rotation: [0.00, 0.00, 0.00] 5 Kinematics Added Travel [6.77, 0.00, 0.00] totaldist: 6.77 starttime: 0.00 endtime: 3.01 startspeed: 0.00 endspeed: 3.00l acc1: 2.00 acc2: 2.00 peakspeed: 3.00 acc1time: 1.50 peaktime: 1.51 acc2time: 0.00 Travel [3.22, 0.00, 0.00] totaldist: 3.22 starttime: 3.01 endtime: 4.08 startspeed: 3.00 endspeed: 3.00l acc1: -3.00 acc2: 2.00 peakspeed: 3.00 acc1time: 0.00 peaktime: 1.07 acc2time: 0.00 Travel [7.50, 0.00, 0.00] totaldist: 7.50 starttime: 4.08 endtime: 6.58 startspeed: 3.00 endspeed: 3.00l acc1: -3.00 acc2: 2.00 peakspeed: 3.00 acc1time: -0.00 peaktime: 2.50 acc2time: 0.00 Travel [0.76, 0.00, 0.00] totaldist: 0.76 starttime: 6.58 endtime: 6.83 startspeed: 3.00 endspeed: 3.00l acc1: -3.00 acc2: 2.00 peakspeed: 3.00 acc1time: -0.00 peaktime: 0.25 acc2time: 0.00 Travel [3.61, 0.00, 0.00] totaldist: 3.61 starttime: 6.83 endtime: 8.54 startspeed: 3.00 endspeed: 0.00l acc1: -3.00 acc2: -3.00 peakspeed: 3.00 acc1time: -0.00 peaktime: 0.70 acc2time: 1.00 can some body tell why???????? |
#12
|
||||
|
||||
The continuefromrailwait() command is used in conjunction with the addrailwait() command. If you've added a rail wait operation, then when the train gets to that operation in the sequence, it will just stop its progression in the sequence. Then, calling continuefromrailwait() will signal the rail sequence to finish the wait operation and continue to the next operation. It is very similar to the TASKTYPE_UTILIZE, where the TaskExecuter waits in this task until the modeler calls freeoperators().
For delayrailmoveatswitches(), it looks like we changed the functionality and then forgot to change the documentation. The delaytime parameter no longer exists, so parameter 2 is really maxspeed, parameter 3 is acc, etc. In order to make it more flexible, we moved the definition of the delay time to be defined on each network node's label named "switch_throw_time". Also, the network nodes have additional labels defining which switch configuration is a "turnout" configuration, and if needed, a maximum speed that the train can be traveling over the switch if the switch is in its "turnout" configuration. All of these label values are considered to create a potentially complex set of kinematics when you call delayrailmoveatswitches(). |
The Following User Says Thank You to Anthony Johnson For This Useful Post: | ||
Carsten Seehafer (01-04-2010) |
#14
|
|||
|
|||
addrailmove(node sequence, node railpath, num speed, num acc, num dec, num length, num deallocateid [, num
coupledecoupleoffset]) Description: Adds a rail move operation to a rail sequence. Specify the path that the railmove applies to. Distance is measured from the first node of the edge, where the first node is the node you dragged from when 'A' connecting. Length is the total amount of space that the set of travelers will take up, or the train size. The travelers will travel the total distance of the edge(s) minus the length, meaning the length will be completely inclusive within the distance of the edge(s). Specify viaedge if you want to travel through a particular edge on the way to the destination edge. This command returns a reference to a node representing the rail move operation. For more information, refer to createrailsequence(). If deallocateid is not 0, then as the train clears edges on the network, it will deallocate those edges, based on the given id. Refer to couplerailtraveler for more information on the coupledecoupleoffset parameter. how to "Specify viaedge if you want to travel through a particular edge on the way to the destination edge. " createrailpath(num fromedge, num fromdist, num toedge, num todist, num via_1, num via_2, num via_3) what is mean "num via_1, num via_2, num via_3", do they have relationship with "Specify viaedge if you want to travel through a particular edge on the way to the destination edge. " i try to use "via_1, num via_2, num via_3" but they do not affect. see attach |
#15
|
||||
|
||||
I've updated the Rail API to be compatible with version 5. http://www.flexsim.com/community/for...do=file&id=127
|
The Following 3 Users Say Thank You to Anthony Johnson For This Useful Post: | ||
Tom David (07-01-2010) |
#16
|
|||
|
|||
Quote:
|
#17
|
||||
|
||||
Sorry, yes the via_1, via_2, and via_3 parameters are the same as viaedge. They allow you to define one or multiple edges through which you want the path the traverse.
|
#18
|
|||
|
|||
Quote:
today , i test it again but they do not had no effect . |