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

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

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

Post 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

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

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

Post 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

Post Reply