Recipe Creation

Aqueduct Recipes are written in Python (3.7+). Python's powerful standard library gives you great flexibility in implementing your Recipe's logic and data management, but you must have some familiarity with Python to begin scripting.

There are many excellent introductions and tutorials for Python available, including:

so we won't attempt to provide a full introduction here. Instead, we'll focus on Python in the context of the Aqueduct environment.

Limitations

When using the Aqueduct environment, you have the flexibility to run the Python recipe process on the same host as the core application or on another computer. The communication between the Python process and the Aqueduct application is established through a TCP socket interface.

The Aqueduct library registers the Python process with the Aqueduct application. This registration allows the Aqueduct user interface (UI) to interact with the Python process. The UI can pause and resume the process, as well as send updates of device data to the Python process.

This capability enables seamless integration between the Aqueduct UI and the Python process, allowing for real-time control, monitoring, and data exchange. Whether running the Python process on the same host or a different computer, the Aqueduct environment ensures synchronized communication and efficient coordination between the application and the Python code.

Please note that when running the Python process on a separate computer, appropriate network configuration and access permissions are required to establish the TCP socket connection between the host and the Aqueduct application.

Adding the Recipe Editor and Terminal Widgets

Ok, with those caveats out of the way, let's start writing a Recipe for our Setup. First, let's add the Recipe Editor Widget to our window.

Again, click the plus icon on the vertical Container menu at the right of the screen. This time select:

Add
> Add Widget > Recipe > Editor

You'll see a new Widget appear to the right of the Sandbox Widget. The Editor Widget lets you enter Python code directly in the interface.

While we're rearranging, let's add another Widget - the Output Widget - to our layout. The Recipe Output widget will output any print statements that you execute during your Recipe. Instead of being directed to your local interpreter's standard output, the print output is pushed to the Terminal Widget in the interface. Select:

Add
> Add Widget > Recipe > Output

To keep things neat, let's add another Tab Container to our layout to house the Editor and Terminal. Click the plus icon on the vertical Container menu and select:

Add
> Add Container After

Then, drag the Editor and Terminal Widgets to the new Container by selecting their menu bars and dragging them to the new Tab Container. You can change the layout of a Tab's Containers by selecting the gear icon on the left sidebar menu, then clicking:

Add
> Layout > Columns

This will change the arrangement of the Tab so that the Containers are oriented as vertical columns. In this case, we have two Tab Containers, one housing the Sandbox Widget and one housing the Editor and Terminal Widgets.

You can also change the Layout of a Container by selecting the plus menu, then selecting:

Add
> Row Layout

This will arrange the Widgets within the container as rows spanning the entire width.

Now let's move on to see how we can write code that will control the pump's operation and execute our recipe...