cancel
Showing results for 
Search instead for 
Did you mean: 

Monitoring the xdim variable.

Experimenter
Experimenter

I have two vehicles on different ways. One is faster and it will overtake the slower one.

If one vehicle passes the other one, a method should start.

How can I do this? I wanted to monitor the xdim variable, but this isn't possible.

Do i have to calculate this event on my own?  Like 3m/s*x=1m/s*x+10m solve for x

 

2 REPLIES

Re: Monitoring the xdim variable.

Valued Contributor
Valued Contributor

Hi Kintscher

 

The xpos variable is unwatchable value. You can try to use “ self.methcall(t) ” monitoring the xpos variable every t seconds. This is not the best way, but it can solve this problem approximately.

 

Best regards!

 

Tao Yifei

Betreff: Monitoring the xdim variable.

Hello Kintscher,

 

I think if anything you want to observe the "xPos" Attribute, as the xDim-Attribute refers to the loading-positions of the vehicle, not its position. However, xPos is also not observable.

 

With the cyclic methcall you can get an approximate solution (you can set the check-cycle to 0.0001sec, so it should be detailed enough), but note that

1) the xPos is measured in pixels, which also limits how exactly you can find the time you're interested in

2) if you check for fahrzeug.xPos > fahrzeug1.xPos then the vehicle will already be next to the other vehicle (unless you change the booking-points, as well)!

 

Another way would be to let both vehicles drive on the same track, create a collision-control ("Auffahr-Steuerung) in the faster vehicle and insert a "debug;". Then you could change your init-method like this:

is
do
	-- slower vehicle starts 10 meters before the faster one
	.BEs.fahrzeug.erzeugen(Einzelstation);
	.BEs.fahrzeug1.erzeugen(Weg,10);
end;

Now the debugger will open at the exact time when the faster vehicle would start to overtake the slower one.

 

Regards,

Alex

 

 

 

 

 

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!