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

Typically: "How do I... ", "How can I... " questions
Post Reply
jianye
Posts: 17
Joined: 16 Oct 2019, 13:58

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

Post by jianye » 13 Nov 2019, 20:43

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

coppelia
Site Admin
Posts: 7441
Joined: 14 Dec 2012, 00:25

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

Post by coppelia » 14 Nov 2019, 09:53

Hello Jian,

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

Cheers

Post Reply