ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 04-05-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default train carriages

Hello

Is it possible to connect an engine with a few carriages, so that i get the required length of the train. I tried making one engine a bit long, but that doesnt look good, just seeing a rectangular block moving. I would like to get the snake flow, across bends, so that the engine, followed by a few carriages meets the required length and also moves like how a train is supposed to move.......

Thanks......
  #2  
Old 04-06-2011
mark.gormley mark.gormley is offline
Flexsim User
 
Join Date: Oct 2008
Posts: 58
Downloads: 12
Uploads: 0
Thanks: 32
Thanked 63 Times in 29 Posts
Rep Power: 181
mark.gormley has a spectacular aura aboutmark.gormley has a spectacular aura about
Default Rail API

Hi,

Have you looked at the Rail API?

It may help you out:

http://www.flexsim.com/community/for...do=file&id=127
  #3  
Old 04-10-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default Hi

Hi

I haven't dealt with Libraries before, so could you advise me what i have to do in regards to this. I did download the file, i copied all the 4 files into my Flexsim Library folder and i tried opening the sample model, but i dont have anything working.
Please help !!
  #4  
Old 04-11-2011
mark.gormley mark.gormley is offline
Flexsim User
 
Join Date: Oct 2008
Posts: 58
Downloads: 12
Uploads: 0
Thanks: 32
Thanked 63 Times in 29 Posts
Rep Power: 181
mark.gormley has a spectacular aura aboutmark.gormley has a spectacular aura about
Default

Hi,

Make sure you have the files in the right place from the unzip.

RailAPISample should be at:

\Flexsim5\libraries\ RailAPISample.fsm

And the rest of the files at:

\Flexsim5\libraries\RailAPI

If you then open a blank Flexsim model and open the library by going to the library icon grid (if this is not open you can open it from View > Modelling Utilities >Library Icon Grid) and pressing the open libraries button (second from the left at the top).

Browse to the RailAPI.fsl and press open.

Then open the Flexsim model using File > Open Model.

You should see a 3D window and a script file.

If you execute the script file the trains should move.
The Following 2 Users Say Thank You to mark.gormley For This Useful Post:
Nischith Kashyap (04-11-2011)
  #5  
Old 04-14-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

Hello

We are working on a model, which has trains of different lengths, moving to different stations ( using a task sequence to mention the different x,y values of each station. We got the Rail API working, and the sample model works too, but what we need is just a train ( Transporter or a basic TE ), with a few carriages behind it ( Again maybe Transporters or Basic TE) representing the train length, move from one station (x1,y1) to another station (x2,y2).

I did have a look at the script in the sample file, and that was good work, but we actually dont need our trains to couple up, and decouple carriages.

We did try editing the script, but we were not able to get the trains move like how we wanted them.

Could some one please help.

Thanks....
  #6  
Old 04-15-2011
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

If you don't tell us what you did, we can't tell you what you did wrong!.

So please post your model (or in this case maybe just the script) and tell what you want it to do. Then somebody might be able to tell you what you have done wrong. Now it stays a guessing game
  #7  
Old 04-17-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default

We have attached the code below. what we have done is just changed the code which was in the script file in the Rail API Example. What we need is the dispatcher (Train ) to move all its carriages from a station1 ( X1, Y1 ) to another station2 ( X2, Y2 ) and so on, like a task sequence....

The code we have written for the train is ...

resetmodel(1);
maintenance(10, 0);
double edge1dist = getrailedgedist(1);
double carlength = 1.1;// Is this the value for the total train length (1.1mts)??
treenode carsdisp = node("/Cars", model());
int nrcars = nrop(carsdisp);
treenodearray cars = makearray(nrcars);
double trainlength = nrcars*carlength;
int i;
treenode sequence = createrailsequence();
for(i = 1; i <= nrcars; i++)
{
cars[i] = outobject(carsdisp, i);
addrailtraveler(sequence, cars[i], (nrcars-i)*carlength);
}

// We want to move the train from station 1 ( X1, Y1) to station 2 (X2, Y2) //and a few more stations after
//that in a task sequence
treenode path = createrailpath(1, 0, 4, trainlength + 2);
treenode move = addrailmove(sequence, path, 1,1,1, trainlength, 0, 0);


startrailsequence(sequence);
go();


this is the code we have written for the train to move in a task sequence.


treenode newtasksequence = createemptytasksequence(node("/Transporter13",model()),0,0);

for(int i=1; i<= gettablerows("TimeTable1"); i++)
{
inserttask(newtasksequence,TASKTYPE_TRAVELTOLOC,NU LL, NULL, gettablenum("TimeTable1",i,1),gettablenum("TimeTab le1",i,2),0,gettablenum("TimeTale1",i,3));
inserttask(newtasksequence,TASKTYPE_DELAY,NULL,NUL L,30,STATE_BUSY);
}
dispatchtasksequence(newtasksequence);

Please if some one could help us out with this ...
thanks...
  #8  
Old 04-22-2011
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

If you don't need to decouple/recouple, then you can just chop off most of the code at the end, as follows:
Code:
 
resetmodel(1);
maintenance(10, 0);// set spline tension to 0
double edge1dist = getrailedgedist(1);
double carlength = 1.1;
treenode carsdisp = node("/Cars", model());
int nrcars = nrop(carsdisp);
treenodearray cars = makearray(nrcars);
double trainlength = nrcars*carlength;
int i;
treenode sequence = createrailsequence();
for(i = 1; i <= nrcars; i++)
{
cars[i] = outobject(carsdisp, i);
addrailtraveler(sequence, cars[i], (nrcars-i)*carlength);
}
// move the train from edge 1 to edge 4
treenode path = createrailpath(1, 0, 4, trainlength + 15);
treenode move = addrailmove(sequence, path, 1,1,1, trainlength, 0, 0);
 
startrailsequence(sequence);
go();
The only way that you will get articulated motion is by using the Rail API. The Rail API is a completely separate implementation from task sequences. You can use task executers as cars/engines in trains that are moved using the Rail API, but it won't work to give them travel tasks while moving them using the Rail API, because you're simply giving them two conflicting methods of movement, i.e. the Rail API tries to move them based on the rail paths, while travel tasks move them through some different method. The best way to encapsulate a Rail API movement within the task sequence mechanism is to give the task executer a utilize task while you are doing the rail movement, essentially causing the task executer to wait while the rail move is performed on him, then use the Rail API messaging mechanism to send a message to the task executer to release himself once the move is finished using freeoperators().
The Following 4 Users Say Thank You to Anthony Johnson For This Useful Post:
Steven Hamoen (04-23-2011)
  #9  
Old 08-10-2011
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default Rail API can support TrafficControl object

hi Anthony Johnson ,can you do something to make that Rail API can support TrafficControl object.



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.