Get started

In order to explore what numerous and numerous as code is all about we have made this getting started guide that takes you through the basic processes to start developing your own numerous systems and content for the numerous platform.

Step 1 [A minimum example]

Open your python editor and install the numerous as code package:

pip install numerous-as-code

Step 2

Copy the below code into a new .py file

Step 3

Run your .py file to run your first numerous system.

What happened here?

You created a repository with the Repository() statement. Repositories are numerous way of organizing your code. Repositories help numerous access your code and helps you staying organized and version control your systems. If you want to understand repositories better there is some documentation on the concept of repositories here.

You created a new system of the type NumerousSystem. Systems is how numerous represents the code you are adding on the platform. The Parameters, Inputs and Outputs are how your system can interact with other systems.

Finally you have run the system you defined as “simulation” which is a simulation of the ConnectedWaterTanks you have build.

Running the system and connect to the cloud:
As you may have noticed from the output of the code in the console numerous-as-code detected that you where running in your local environment with no data stored in the cloud and not utilizing the cloud to execute your code. This is of course great for experimenting with numerous and exploring how to make your code best interact with numerous.

However, in order to take advantage of the cloud platform for exploring the data generated by your code and sharing it with your collaborators you are suggested to connect your code with a numerous platform environment.

Step 4

Change out the repository and the environment in the code to point to the numerous platform and the numerous code repository.
“from numerous_.as_code.repositories.repository import NumerousRepository as Repository
from numerous_platform.numerous_environment import NumerousEnvironment as Environment ”

Step 5
Run the script again. This time when the code starts running you will be asked to sign-up/login to the numerous platform. After you have signed-up and created a new repository the code in the terminal will continue running - now saving your systems in a repository which can be accessed by the platform and actually running the code in the cloud.

From here you can explore the links printed in the terminal. For instance try to go and visit the repository page on the plaform.

from numerous_.as_code.basic_objects import Parameter, Input, Output, connect, Description

from numerous_.as_code.repositories.repository import Repository
from simple_python.python_environment import PythonEnvironment as Environment

with Repository() as repository:
from simple_numerous_engine.system_type_definitions import NumerousSystem, NumerousSimulation

with NumerousSystem("WaterTank") as Tank:
Parameter('initial_fill_level', default=20, unit="%")
Parameter('capacity', default=100, unit="m3")

Input('F', unit="m3/s", description="flow rate into tank")
Output('P', unit="kPa", description="Hydrostatic Pressure")

with NumerousSystem("WaterPipe") as Pipe:
Parameter('resistance', default=100, unit="kPa*s/m3")
Input('P1', unit="kPa", description="Pressure of tank 1")
Input('P2', unit="kPa", description="Pressure of tank 2")
Output('F1', unit="m3/s", description="flow to tank 1")
Output('F2', unit="m3/s", description="flow to tank 2")

with NumerousSystem("ConnectedWaterTanks") as ConnectedWaterTanks:
"System connecting three water tanks together with pipes. The water will equilibrate between the tanks."

tank1 = Tank()
tank2 = Tank()
tank3 = Tank()

pipe12 = Pipe()
pipe23 = Pipe()

# Connect tank1 and 2 to pipe12
connect(pipe12.P1, tank1.P)
connect(pipe12.P2, tank2.P)

connect(pipe12.F1, tank1.F)
connect(pipe12.F2, tank2.F)

# Connect tank2 and 3 to pipe23
connect(pipe23.P1, tank2.P)
connect(pipe23.P2, tank3.P)

connect(pipe23.F1, tank2.F)
connect(pipe23.F2, tank3.F)

with NumerousSimulation('simulation') as Simulation:

if __name__ == '__main__':

with Environment() as environment:

simulation = Simulation()