Distance Calculation and diagramming

Moderator: Moderators

Distance Calculation and diagramming

Postby Ketrey » Tue Oct 30, 2018 7:07 am

Hi,
I`m simulating a vehicle and want to display the distance, i?ve already driven.

The calculation of the distance driven is:

Driven distance (Gefahrene Strecke)= (v/3,6) * (t1-t0) + s0
distance_driven.PNG


v: speed of 50 km/h
t1: value of simtime so i can calculate with the simulation time
t0: equals t1 with a dealay of 1sec to get a timewindow for my calculation
s0: equals Driven distance (Gefahrere Strecke)


If i plot this value i get a diagramm taht is way to fast then i actually expect.
I expect that i need for 100m -> 7,2sec, but it is alot faster.

See diagramm below for the result.

result.PNG





Does anyone know what is going on here?


I`m running with a Simulation Speed of 95


Thanks










I think i have a problem with the animation speed / simulation time.
You do not have the required permissions to view the files attached to this post.
Ketrey
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:1
Joined: Wed Oct 10, 2018 6:57 am

Re: Distance Calculation and diagramming

Postby zilvinas.strolia@nomagic.com » Wed Oct 31, 2018 8:57 am

Dear Ketrey,

Try to simulate your SoI without animation and define your simulation time and clock.

To do this you will need to create simulation configuration element. You will find documentation of how this can be done in the link below:
https://docs.nomagic.com/display/CST185 ... I+modeling

Best Regards,
No Magic Customer Support
zilvinas.strolia@nomagic.com
Forum Beginner
Forum Beginner
 
Posts: 35
Posts Rating:3
Joined: Fri Dec 04, 2015 2:18 am

Re: Distance Calculation and diagramming

Postby james.e.hopper@leidos.com » Wed Oct 31, 2018 10:32 am

Do you have an issue with units in time? On your plot you have labeled 5 milliseconds as 5 seconds?
james.e.hopper@leidos.com
Forum Beginner
Forum Beginner
 
Posts: 26
Posts Rating:1
Joined: Thu Apr 13, 2017 11:02 am

Re: Distance Calculation and diagramming

Postby Ketrey » Sun Nov 04, 2018 11:45 pm

Hi,

@zilvinas.strolia: Thank you, i will try it :)


@james.e.hopper: No ist actually 70.000 ms = 70sec, so i think that is okay.

Thank you


Kind regards
Ketrey
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:1
Joined: Wed Oct 10, 2018 6:57 am

Re: Distance Calculation and diagramming

Postby Ketrey » Mon Nov 05, 2018 1:50 am

Hi,

I tried to Setup the Time/Clock in different ways but it won`t work. I even watched your Webinar about Timing and Duration and still can`t figure out what im doing wrong. I think it worked to set up the clock via a Simulation Configuration, but the "diagram time" won`t work (See Picture below)
TimeSetup.PNG



Any ideas what I`m doing wrong?


Thank you
You do not have the required permissions to view the files attached to this post.
Ketrey
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:1
Joined: Wed Oct 10, 2018 6:57 am

Re: Distance Calculation and diagramming

Postby james.e.hopper@leidos.com » Mon Nov 05, 2018 9:11 am

it looks like you set the timestep to 1, what units did you choose. to do the simulation, i would suggest using milliseconds and stepping like 30 milliseconds. animation speed is just where the bar that you choose the display speed is set initially. I find it easier to debug when I set that to 100%.

Also you driving distance equation looks a bit different to me. i use

v = v0 + a*(t-t0)
x = x0 + v0*(t-t0) + 0.5*a*(t-t0)^2

remember to convert your time from milliseconds to seconds when you use it in these equations.

best jim
james.e.hopper@leidos.com
Forum Beginner
Forum Beginner
 
Posts: 26
Posts Rating:1
Joined: Thu Apr 13, 2017 11:02 am

Re: Distance Calculation and diagramming

Postby Ketrey » Tue Nov 06, 2018 12:09 am

Thank you for your advice, i will check that.

I think my formula for the distance is ok because at first, i just want to calculate it with constant speed -> no acceleration -> we use the same equations.


Thank you very much
Ketrey
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:1
Joined: Wed Oct 10, 2018 6:57 am

Re: Distance Calculation and diagramming

Postby james.e.hopper@leidos.com » Tue Nov 06, 2018 12:55 am

The one difference with acceleration = 0 is that you have the change in position by step to be divided by 3.6? what is that term from. would seem to slow the vehicle down from what it should be. Also, do check that you are using t and t0 in seconds and not milliseconds or the change in velocity with time will be very wrong.
james.e.hopper@leidos.com
Forum Beginner
Forum Beginner
 
Posts: 26
Posts Rating:1
Joined: Thu Apr 13, 2017 11:02 am

Re: Distance Calculation and diagramming

Postby Ketrey » Tue Nov 06, 2018 1:06 am

The Speed is in the Unit km/h.
To transfer km/h to m/s you just jave to divide (km/h) by 3.6

km m * 1000
___ = ___
h s * 60*60


my time t1 and t0 is directly depending on simtime because im using this to calculate everything. It seems that simtime is set in seconds, so this should be ok as well.


I think my calculation is ok, the only thing is that it is not displayed like i calculated it.


I will continue to try different Things :)

Thank you
Ketrey
Forum Newbie
Forum Newbie
 
Posts: 22
Posts Rating:1
Joined: Wed Oct 10, 2018 6:57 am

Re: Distance Calculation and diagramming

Postby james.e.hopper@leidos.com » Tue Nov 06, 2018 8:17 am

For what its worth, I am doing something similar though my car can have constant acceleration that steps from zero to a fixed value, then back to zero when the car reaches cruising speed and it and the plots look fine. I see your units are in seconds for time, and the step size is 1 second. That will work fine for constant velocity but will be really blocky on the plot for any acceleration if you add that. If you can post your model to this forum thread than folks can perhaps be more help. From what you have posted so far it's hard to see that you have done anything wrong.
james.e.hopper@leidos.com
Forum Beginner
Forum Beginner
 
Posts: 26
Posts Rating:1
Joined: Thu Apr 13, 2017 11:02 am

Next

Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests