Skip to content

Commit

Permalink
corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jul 3, 2024
1 parent 2ce1c21 commit f0f25f4
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ The operators addition `+`, subtraction `-`, multiplication `*`, and division `/
Expressions are the method used to get is dynamic data, provided from jobs, during execution of profiles. For example, the following:

```
pio1::stirring::target_rpm
pio1:stirring:target_rpm >= 500
```

will fetch the `target_rpm` from `pio1`'s `stirring` job _at the time the action is to be executed_. To use this in an example:
will fetch the `target_rpm` from `pio1`'s `stirring` job _at the time the action is to be executed_, compare it to `500`, and return true or false. To use this in an example:

```yaml
stirring:
...
- type: update
hours_elapsed: 6.0
if: pio1::stirring::target_rpm >= 500
if: pio1:stirring:target_rpm >= 500
options:
target_rpm: 400

Expand All @@ -76,7 +76,7 @@ You can also compare against strings. For example, to stop a job if the temperat
...
- type: stop
hours_elapsed: 6.0
if: pio1::temperature_control::automation_name == thermostat
if: pio1:temperature_control:automation_name == thermostat


```
Expand All @@ -90,7 +90,7 @@ Some published settings have are actually nested json blobs, but we need either
...
- type: update
hours_elapsed: 6.0
if: pio1::temperature_control::temperature.temperature <= 30
if: pio1:temperature_control:temperature.temperature <= 30
options:
target_temperature: 32
```
Expand Down Expand Up @@ -181,6 +181,15 @@ common:
target_rpm: ${{ ::stirring:target_rpm + 10 * ::od_reading:od1.od }}
```
### Built-in functions in expressions
There's also some built-in functions you can use in expressions:
- `random()` produces a random number between 0 and 1.
- `unit()` returns the unit the expression is evaluated for.
- `job_name()` returns the job name the expression is evaluated for.
- `experiment()` returns the experiment the expression is evaluated for.

### The `when` action

The `when` action is used to trigger an actions(s) _the first time_ the condition is satisfied. For example, you could start a chemostat when the OD rises above a threshold, or turn off heating when the temperature exceed some threshold, or log a message when some condition is met.
Expand Down

0 comments on commit f0f25f4

Please sign in to comment.