# Process Flow - Simulated Tribology Laboratory

Generated by make_process_flow.py (task 02) from out/config/lab_config.yaml.
Standalone diagram sources: ./diagrams/D1..D6.mermaid.

## D1 - Coupon Assembly

Substrate preparation, adhesion layer, and gradient Pt-Au sputter deposition.

```mermaid
flowchart LR
    A([Ti-6Al-4V Base 10x10x3 mm]) --> B[Cleaning]
    B --> B1([Rinsed in deionized water])
    B1 --> B2([Sonicated in cleaning solution])
    B --> C[Smearing Adhesive]
    C --> C1([Cr adhesive coating])
    C --> D[Vapor Deposition System<br/>Kurt J. Lesker PVD 200]
    D --> D1([PtAu sputter coating, gradient])
    D --> E([Test Coupon])
```

## D2 - Characterization and Batch Assembly

Per-coupon simulation and thickness characterization, then assembly into wafers (x49 coupons) and batches (x3 wafers), deposited per the parameter table below.

```mermaid
flowchart LR
    TC([Test Coupon]) --> S[SIMTRA simulation<br/>composition / atom energies]
    S --> OP[Optical profilometry<br/>film thickness 0.3-1.1 um]
    OP --> TW[Assemble Test Wafer<br/>x49 coupons]
    TW --> TB[Assemble Test Batch<br/>x3 wafers]
    TB --> B721[B721<br/>Pt 150 W / Au 50 W]
    TB --> B722[B722<br/>Pt 100 W / Au 100 W]
    TB --> B723[B723<br/>Pt 150 W / Au 50 W]
    TB --> B724[B724<br/>Pt 50 W / Au 150 W]
```

Deposition matrix:

| Batch | Pt:Au gun tilt | Pt power W | Au power W | Pt discharge V | Au discharge V |
|---|---|---|---|---|---|
| B721 | 20:0 deg | 150 | 50 | 432 | 311 |
| B722 | 20:20 deg | 100 | 100 | 399 | 352 |
| B723 | 20:20 deg | 150 | 50 | 430 | 311 |
| B724 | 0:20 deg | 50 | 150 | 376 | 340 |

## D3 - Testing Tree

The four characterization/testing paths every coupon can take.

```mermaid
flowchart TD
    TC([Test Coupon]) --> F[Friction<br/>RAPID 6-probe tribometer]
    F --> FA([Lab Air -> COF dataset mu_normal])
    F --> FN([Dry N2 -> COF dataset mu_dry_nit])
    TC --> NI[Nanoindentation<br/>Bruker TI980]
    NI --> NIR([Hardness, reduced modulus<br/>25 indents per coupon])
    TC --> AF[AFM]
    AF --> AFR([Topography -> Ra / Rq])
    TC --> XR[micro-XRF<br/>Bruker M4 Tornado]
    XR --> XRR([Pt/Au wt% map, 20x20 grid])
```

## D4 - Tribometer Session Sequence

Operator workflow for one RAPID tribometer session, from test request to teardown.

```mermaid
sequenceDiagram
    actor Op as Operator
    participant Prep as Sample Prep
    participant Plan as Excel Test Plan
    participant SW as Control Software
    participant TR as RAPID Tribometer

    Op->>Prep: Request test
    Op->>Prep: Get samples
    Op->>Prep: Load samples onto plates
    Op->>Prep: Load ball holders (3 counterfaces per holder)
    Op->>Plan: Create test plan<br/>(Sample Plate, Plate Location, Sample ID, Save Location,<br/>Folder Name, X/Y/Z Offset, Load, Iterations)
    Op->>TR: Transfer plates to tribometer
    Op->>TR: Set up platter
    Op->>SW: Activate software
    Op->>SW: Load plan
    SW->>TR: Activate tribometer
    TR-->>SW: Run reciprocating tests (execution loop, see D5)
    Op->>SW: Software stop
    SW-->>Op: Save avg files
    Op->>TR: Remove plates and platters
    Op->>SW: Close software
    Op->>TR: Pull equipment out
```

## D5 - Execution Loop

Nested iteration executed by the tribometer within one run.

```mermaid
flowchart TD
    L[Load all counterfaces] --> P{5 plates}
    P -->|for each plate| PR{6 probes in parallel}
    PR -->|for each probe| C{4 coupons on coupon square}
    C -->|for each coupon| T[Draw track]
    T --> RC[Rotate counterface - fresh ball per track]
    RC -->|3 tracks per coupon| T
    T --> DONE([120 coupons x 3 tracks = 360 tracks per run])
```

## D6 - Data Hierarchy

Entity containment and per-entity measurement datasets (ERD-style).

```mermaid
erDiagram
    DEPOSITION_RUN ||--|| SIMTRA_PROFILE : produces
    DEPOSITION_RUN ||--|| BATCH : creates
    BATCH ||--|{ WAFER : contains
    WAFER ||--|{ COUPON : contains
    COUPON ||--|| XRF_MAP : has
    COUPON ||--|| NANOINDENTATION : has
    COUPON ||--|| AFM : has
    COUPON ||--|| PROFILOMETRY : has
    COUPON ||--o{ TRACK : "friction coupons only"
    TRACK ||--|{ CYCLE : has
    TRACK ||--|{ LOOP_POINT : has
    TRACK ||--|| WEAR : has
```
