Advanced Question Simulation Speed Increment?

AssemblyLanguage

Donator
Donator
Joined
Jun 10, 2012
Messages
112
Reaction score
1
Points
0
I'm looking for a quick (one button) way to speed up a simulation by a smaller factor than 10 ("T" key). Even better would be setting the speed from a scenario.

Perhaps TimerMode in orbiter.cfg would help. What does it do?

Thanks
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,216
Reaction score
1,562
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
No need for that, just press CTRL-F2: that pops up a time acceleration slider where you can select any speed you want (you can type in an exact value as well). :thumbup:
 

AssemblyLanguage

Donator
Donator
Joined
Jun 10, 2012
Messages
112
Reaction score
1
Points
0
No need for that, just press CTRL-F2: that pops up a time acceleration slider where you can select any speed you want (you can type in an exact value as well). :thumbup:

Thanks but I'm running an interactive demo for lots of people and I need a quick start. I have a desktop icon the launches direct to a scenario. It is a little distracting and tedious to change speed the time slider way. I do that now but I would like something more automatic.
 

dgatsoulis

ele2png user
Donator
Joined
Dec 2, 2009
Messages
1,924
Reaction score
340
Points
98
Location
Sparta
A demo as in a pre-recorded playback flight? Or you are flying "live" and during the flight you want to be able to change the time-warp factor by a different scale than the default x10 steps?

If it's a pre-recorded flight (a scenario that you run from the Playbacks folder), you can easily set the time-warp to any factor you want, by editing the Flights\(Name of your scenario)\system.dat file with a text editor (notepad). All you need to do is to insert lines like this:
Code:
0.01 TACC 2
3600 TACC 1
The first number is the time-stamp (simulation time) that an event occurs.
The TACC means set the time acceleration and the last number is the factor that you want to change it to. The example above will set the time-warp to x2 from simtime 0.01 to simtime 3600 (realtime = 1800.01 seconds)

If it's a live flight, you can use a lua script to do the same. If you want the whole flight to run at x2 it's pretty easy.
Code:
t=oapi.get_simtime()
while t < 3600 do
  oapi.set_tacc(2)
  t=oapi.get_simtime()
  proc.skip()
  if t > 3600 then
     oapi.set_tacc(1) 
  end
end
This will set the timewarp to x2 for the first 3600 seconds of the simulation. (Realtime = 1800 seconds) and then go back to x1.

Unfortunately lua doesn't understand keypresses, so if you want to vary the time-warp you'll need to preset some events that will trigger the change. The trigger can be pretty much anything you want. For example:
Code:
v = vessel.get_focusinterface()
t=oapi.get_simtime()
while t < 3600 do
  t=oapi.get_simtime()
  alt = v:get_altitude()
  if alt > 100 and alt < 10000 then
     tacc==2
       else 
         tacc=1
  end    
  oapi.set_tacc(tacc)
  proc.skip()
  if t > 3600 then 
     oapi.set_tacc(1)
  end
end

This will set the timewarp to x2 while the focus vessel is between 100 meters and 10000 meters in altitude and x1 if it's not within that range or the simtime exceeds 3600 seconds . Like I said the trigger -or triggers- can be pretty much anything you want.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,865
Reaction score
2,127
Points
203
Location
between the planets
You could also use the "fixed time increments" debug-function, I guess...
 

blixel

Donator
Donator
Joined
Jun 29, 2010
Messages
647
Reaction score
0
Points
16
I think I understand exactly what this guy wants, because I've wanted it too.

Essentially, I've wanted to be able to use the usual t and r keys to speed up time in +1x increments and -1x decrements. Pressing CTRL+F2 and having a time control box sitting on your screen looks ugly (especially when recording videos), and having to use your mouse to slide a bar back and forth isn't nearly as convenient as simply pressing t and r.

In my case, I have often wanted this when landing on Earth and on Mars. 10x is too much time warp in most cases, and gliding for thousands of kilometers at 1x is too slow. So I've often wished that I could toggle t and r to switch from powers of 10 down to just +1x/-1x.
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
There is an easy way to set a start-up time acceleration for a scenario: by using the often-neglected capabilities of the script interface.

  • create a file <orbiterroot>\script\timeacc.lua, containing the line
    Code:
    oapi.set_tacc(100)
    or whatever speed you want to set
  • In your scenario file, inside the ENVIRONMENT block, add the line
    Code:
    Script timeacc
 

AssemblyLanguage

Donator
Donator
Joined
Jun 10, 2012
Messages
112
Reaction score
1
Points
0
Thanks martins and dgatsoulis for pointing me to lua scripts. I had looked at scripts when I first started working with Orbiter but I had too many other things to learn at the time. With the excellent lua script documentation, I've been able to automate several actions.
 
Top