Page 1 of 1

How to use sim.getSimulationTime() and sim.getSimulationTimeStep()

Posted: 13 Nov 2019, 20:43
by jianye
hello,

i implement the following code:

Code: Select all

time_1 = sim.getSimulationTime()
step_time = sim.getSimulationTimeStep()
jp=time_1/step_time
and i get the problem: attempt to perform arithmetic on global 'time_1' (a nil value)

i want to know what is the problem`?

Thank you !

Jian

Re: How to use sim.getSimulationTime() and sim.getSimulationTimeStep()

Posted: 14 Nov 2019, 09:53
by coppelia
Hello Jian,

this code works fine here... just after calling sim.getSimulationTime(), print the time_1 variable to see what it contains.

Cheers