Simulations💡
from threedi_api_client.openapi.models.simulation import Simulation
Read💡
List simulation resources that have been created for all organisations you are a member of.
GET /simulations/
from threedi_api_client.api import ThreediApi
from threedi_api_client.versions import V3Api
with ThreediApi() as api_client:
api_client: V3Api
api_client.simulations_list()
Ordering options
Fields that can be used to order the results
- created [default]: Time of creation, newest first.
- name: name of the simulation resource
- id: numerical identifier
see ordering for general ordering options.
Create💡
Create a simulation resource.
POST /simulations/
Important
There are two options to specify the desired duration for the
simulation, either by using the end_datetime
or the duration
parameter.
Parameter | type | Description |
---|---|---|
name | string | Name of the simulation. |
threedimodel | string | The model schema to use for the simulation by referring to the id of the threedimodel resource. |
organisation | string | uuid of the organisation for which the simulation is run |
start_datetime | string | datetime (in ISO 8601 (UTC) format) for the imulation start, e.g. "YYYY-MM-DDThh:mm:ss" |
end_datetime | string | datetime (in ISO 8601 (UTC) format) for the simulation end, e.g. "YYYY-MM-DDThh:mm:ss" |
duration | int | in seconds, can be used instead of end_datetime |
💡
from datetime import datetime
from threedi_api_client.openapi.models.simulation import Simulation
from threedi_api_client.api import ThreediApi
from threedi_api_client.versions import V3Api
with ThreediApi() as api_client:
api_client: V3Api
organisation_uuid = "<your organisation uuid here>"
threedimodel_id = 111 # use your own threedimodel id here
calculation_duration_hrs = 4
simulation = Simulation(
name="user guide simulation",
threedimodel=threedimodel_id,
organisation=organisation_uuid,
start_datetime=datetime.utcnow(),
duration=calculation_duration_hrs * 3600 # in seconds
)
api_client.simulations_create(simulation)
See the starting your first simulation for a complete code example.