Running a scenario with the zendir-py

Install Python 3.11 or later and run the following terminal/console command:

pip install zendir

Create a new python script (example.py) and copy the example below with your access token:

# import the 'zendir' module
import zendir
 
ACCESS_TOKEN = "XXX" # <= YOUR ACCESS TOKEN GOES HERE
 
# define your simulation scenario
async def scenario_1(simulation: zendir.Simulation):
 
    # initialize your scenario here...
    await simulation.add_object("Spacecraft")
 
    # propagate your simulation forward...
    for _ in range(10):
        await simulation.tick()
        elapsed_seconds = await simulation.get_time()
        print(f"- simulation at {elapsed_seconds:.1f} elapsed seconds")
 
# run your scenario with your access token
client = zendir.Client(token = ACCESS_TOKEN)
zendir.runner.run_simulation(client, scenario_1)

After running your new python script (example.py), you should see the following python output:

- simulation at 0.1 elapsed seconds
- simulation at 0.2 elapsed seconds
- simulation at 0.3 elapsed seconds
- simulation at 0.4 elapsed seconds
- simulation at 0.5 elapsed seconds
- simulation at 0.6 elapsed seconds
- simulation at 0.7 elapsed seconds
- simulation at 0.8 elapsed seconds
- simulation at 0.9 elapsed seconds
- simulation at 1.0 elapsed seconds

What’s Next?

Something Else?

Quick Start Guidance Modes Linking Components Power Systems