Examples and templates
Choose a complete task by goal. All bundled inputs are synthetic and can be checked by hand. For real logs, confirm units, validity periods, direction, synchronization, and business thresholds again.
Actual results and explanations provides commands, output tables, arithmetic, and downloads for the runnable YAML, JSON and batch configurations in the current catalog. Select a configuration here, then look it up by filename there. Two base configurations and shared definitions are building blocks, not standalone analysis success cases.
Common results: Energy and averages, Events and windows, Invalid and stale data, Actual intervals / Fixed intervals, and State mappings.
Choose the parallel execution mode first
Basic single-source ASC/BLF configurations explicitly set execution.process_count: 4, allowing up to four workers to process files from one recording. The number of files caps the actual worker count. Omitting this field still defaults to one. After selecting a configuration, identify the file relationship below before replacing paths, DBC and business conditions.
| Input relationship | Where to set the count | Complete example and result |
|---|---|---|
| Continuous ASC/BLF parts from one recording | Analysis-root execution.process_count; state continues across files |
Two parts: 38 J; sustained condition across parts: 0.06777777777777777 kWh over 61–122 s |
| Files from one recording with overlapping time ranges | Same count, plus explicit sources[].file_merge: time_order |
Time merge: 38 J; required records within each file must be ordered |
| Same-frame per-message accumulation | Analysis-root execution.process_count |
Continuous high-performance integrator: 1200 J; use chronaxis fast run |
| Independent experiments | Batch-root process_count; each child analysis uses one |
Independent batch: separate task results; use chronaxis batch run |
| CSV, memory, or a joint analysis of multiple sources | Use one within the analysis; independent tasks may run through an outer batch | CAN and CSV joint task: 26 J |
Single-file examples retain the same limit so paths can later select multiple files. One file is not split among workers, so a limit of four does not mean four workers actually run. See continuous-file multiprocessing and batch tasks.
Complete teaching tasks
| Task | Inputs and complete configuration | Guide and result |
|---|---|---|
| Measure variation in bench power and P95 across loads | Configuration, ASC, DBC | P95 is 18 W for five readings and 19.5 W for two individual load means. Commands and arithmetic |
| ASC/BLF energy and averages | quickstart.asc, DBC, analysis.yaml | Quick start: 38 J, 6 W, and 38/6 W. |
| Event → window → energy | activity.asc, activity.yaml | Activity tutorial: 50 J in the event and 70 J in the window; selecting from confirmation gives 30 J / 70 J. |
| Shared source and derived definitions | analysis-imports.yaml, definitions.yaml, quickstart.asc and teaching.dbc | Shared definitions: 38 J, 6 W, 38/6 W, and 76 J from doubled power. |
| Stream rows in Python | api_example.py | Runs the neighboring analysis.yaml by default; accepts your own configuration and a reusable --output directory. |
| Rolling mean from actual timestamps | Temporal transforms | Minimal example: 18 A at 0.2 s; DBC-weighted example is separate. |
| Custom Python function/statistic/transform | Custom analysis operators | Peak: 80 A. |
| Lookup and interpolation | Lookup reference | Table-based conversion with declared units. |
| Result aggregation | Aggregation guide | Combine named event/window results with an explicit operation. |
| High-performance integrator | Same-frame per-message accumulation | Single file: 800 J; continuous session: 1200 J; independent batch total: 1200 J, verified separately. |
Grouped bindings and DBC grids
These focused examples include complete inputs, configuration, and actual outputs, listed separately from the result index above.
| Task | Materials and guide | Result to check |
|---|---|---|
| Bind several signals in one message | Configuration, ASC, DBC; Signals | Maximum voltage 42 V, edge at 0.1 s. |
| Export two grids from DBC periods | Configuration, ASC, DBC; Signal exports, CAN exports | Four signal rows, five CAN frames. |
Minimal and extended configurations by feature
Each file below is a complete analysis configuration, with inputs supplied under data. Minimal examples demonstrate one goal; extensions add the stated choice. The linked guides explain the values and references.
Use prepare_can_examples.py to create BLF and mixed-format counterparts in a new directory. Commands and the output layout are in Quick start.
Generate templates with inputs
Installed Chronaxis generates templates, primarily ASC/BLF with DBC and small synthetic logs for the task. CSV scenes retain their appropriate tables. The target directory must not exist. Default annotated style includes comments; --style minimal generates the same configuration with less explanatory text.
Both styles omit default fields that serve no purpose in the example. Ordinary examples omit session/entity, a uniquely inferable source reference, and default scopes/policies. They retain an explicit process limit as an execution choice, distinguishing session workers from batch workers as above. Extensions add their particular choice, such as a nondefault policy, conversion, or resource limit.
Comments explain what each parent groups and what each child controls. Read sources/signals first, then rules/windows/calculations. Listing imports before their uses and derived expressions before references helps reading; the parser permits other root-key orders too.
chronaxis config init --list
chronaxis config init fault-window --output fault-demo
chronaxis validate fault-demo/plan.yaml
chronaxis run fault-demo/plan.yaml --output fault-result| Scene | Purpose | Entry file | Result to check |
|---|---|---|---|
can-blf |
CAN BLF and DBC | plan.yaml | Raw codes 1/3/1 decode through 2x+1 to 3/7/3 V, each held 1 s: 13 V·s. The fourth frame is unrelated. |
can-asc |
CAN ASC and DBC | plan.yaml | The same 1/3/1 → 3/7/3 V and 13 V·s; fourth frame unrelated. |
signal-csv |
Integral and two averages from signal CSV | plan.yaml | 2/4/8/10 W for 1/2/1/2 s: 38 J; sample mean 6 W; time-weighted mean 38/6 W. |
charge-session |
Charging with explicit roles, units, and direction | plan.yaml | Activity [0s,2s): 400 V × 10 A × 2 s = 8000 J, output 8000/3600 Wh; 10 A × 2 s = 20 A·s, output 20/3600 Ah. |
fault-window |
Fault edge and surrounding window | plan.yaml | Alarm rises at 2 s. With 1 s before and 2 s after, the segment is [1s,4s). |
command-response |
Pairing and timeout | plan.yaml | Request at 1 s receives response at 2 s: 1 s delay. Request at 4 s reaches its 2 s wait limit at 6 s without a response. |
threshold |
Entry and exit thresholds | plan.yaml | 85°C enters at 0 s, 77°C retains alarm, 75°C exits at 9 s: 9 s duration. The 80/75°C thresholds are synthetic choices. |
stability |
Hysteresis and debounce | plan.yaml | Hysteresis [1s,4s), mean 247/3°C; 1 s entry/exit debounce [2s,4s), mean 81°C. |
raw-can-csv |
Explicit raw CAN CSV layout | plan.yaml | Codes 1/3/1 decode to 3/7/3 V for 1 s each: 13 V·s. Fourth frame unrelated. |
signal-export |
Signal export with an independent interpolation grid | plan.yaml | Analysis remains 38 J. Original samples and 500 ms grid are separate; 12 grid points from 0 to 5.5 s, starting 2/3/4 W. |
can-export |
Original CAN frames | plan.yaml | Analysis 13 V·s; original frames within the range retain order, without resampling. |
batch |
Two independent jobs | batch.yaml | Both read the same synthetic input independently and complete with 38 J each; they are not slices of one session. |
Run ordinary templates with chronaxis run DIRECTORY/plan.yaml --output OUTPUT_DIRECTORY; use chronaxis batch run DIRECTORY/batch.yaml --output OUTPUT_DIRECTORY for batch. CAN dependencies are part of the ordinary package installation. Exports do not require a device label; add a nonblank custom label only when needed, as described in Outputs.
Download and run complete cases
The configurations and data files below are included in the offline manual. Run from the examples directory and reuse analysis output directories with timestamped filenames. Inputs are synthetic and do not establish thresholds for real equipment.
Combine CAN voltage with CSV current
can-joint-analysis.yaml reads joint.asc, joint.dbc, and joint-current.csv. Both sources declare synthetic_clock as their shared origin; that declaration does not synchronize clocks automatically. Voltage is 3, 7, and 3 V at 0, 1, and 2 seconds, with current fixed at 2 A. Over [0,3), power is 6, 14, and 6 W for one second each, giving 26 J.
chronaxis run can-joint-analysis.yaml --output joint-resultStart/end activity and timeout
start-end.yaml uses start-end.asc and the teaching DBC. begin>0 starts, done>0 ends, with at most 5 seconds. The teaching event CSV contains [0,2), [4,9), and [11,14); the second is 超时结束 (ended by timeout). cycle_mean(1) is 10, 52, and 110. For the second, (40×2 + 60×3)/5 = 52. Time columns are seconds. For a new run, read the timestamped event CSV path from outputs in that run's manifest.
chronaxis run start-end.yaml --output cycle-resultContributions and skipped CAN messages
message-energy.yaml reads power.blf and power.dbc. Two same-time 4000 W messages each multiply by explicit 0.1 s, totaling 800 J. A third target message lacks required data and contributes a missing_input row; an unrelated ID is not an attempt. Use this run’s manifest to locate the contribution table and inspect its three rows, not nonexistent attempt counters in the summary. This example explicitly chooses legacy decoding to demonstrate incomplete messages; it does not recommend relaxed checking for your data.
chronaxis run message-energy.yaml --output message-resultA 250 ms signal grid and 500 ms CAN grid
dual-grid.yaml uses the same joint.asc and joint.dbc, exporting voltage and reconstructed CAN frames. The analysis alias is voltage; the DBC field is Voltage. They are not interchangeable. The synthetic example records its origin with metadata.device_label: home; with your own data, omit it or provide your nonblank device label. See Outputs.
chronaxis run dual-grid.yaml --output grid-resultvoltage_area remains 13 V·s. The signal grid has 12 positions from 0 to 2.75 s, beginning 3, 4, 5, 6, 7 V. The CAN grid requests six positions from 0 to 2.5 s and generates five frames from 0 to 2 s. The excluded 3-second endpoint cannot support interpolation, so the last three signal points are missing/missing_right, and the CAN manifest has skipped_grid_points=1.
Grids do not change the analysis integral. CAN encoding follows DBC quantization: 5 V can be represented exactly, while 4 V lies halfway between raw codes and uses nearest_even-v1. Find both exports through the index named by this run’s manifest at exports.index_file rather than assuming directory numbers.
Building blocks that are not standalone tasks
teaching-base.yaml and electrical-base.yaml define only sources and signals. Add the chapter's rules or calculations before running. They load as plans but are not independent analysis examples. shared/definitions.yaml is for imports and is not run alone.
Automated example checks
run_example.py checks YAML/JSON, both backends, and CLI. imports_example.py checks shared definitions and standalone resolved configurations. readability_examples.py checks expressions, batches, and partial-result semantics. advanced_examples.py, with --output NEW_DIRECTORY, checks the four complete cases above. These are verification tools; ordinary users can start by running the tutorial commands directly.