{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "/parts/api/test/result.schema.json",
 "title": "Joint actuator test result (maglev.test-result/0.1)",
 "type": "object",
 "required": [
  "format",
  "protocol",
  "date",
  "unit",
  "bench",
  "tests"
 ],
 "additionalProperties": false,
 "properties": {
  "format": {
   "const": "maglev.test-result/0.1"
  },
  "protocol": {
   "const": "joint-actuator@0.1"
  },
  "date": {
   "type": "string",
   "format": "date"
  },
  "unit": {
   "type": "object",
   "description": "The actuator under test",
   "required": [
    "description"
   ],
   "properties": {
    "part_id": {
     "type": "string",
     "description": "Catalog id, when it is a listed part (enables the datasheet comparison)"
    },
    "built_from": {
     "type": "array",
     "items": {
      "type": "string"
     },
     "description": "Catalog ids of the parts, for a joint built from parts"
    },
    "description": {
     "type": "string"
    },
    "serial": {
     "type": "string"
    },
    "firmware": {
     "type": "string"
    },
    "bought_from": {
     "type": "string"
    },
    "bought_on": {
     "type": "string",
     "format": "date"
    }
   }
  },
  "bench": {
   "type": "object",
   "required": [
    "torque_sensor"
   ],
   "properties": {
    "kit": {
     "enum": [
      "starter",
      "serious",
      "lab"
     ]
    },
    "torque_sensor": {
     "type": "object",
     "required": [
      "model",
      "range_nm"
     ],
     "properties": {
      "model": {
       "type": "string"
      },
      "part_id": {
       "type": "string"
      },
      "range_nm": {
       "type": "number"
      },
      "accuracy_pct_fs": {
       "type": "number"
      },
      "calibrated_on": {
       "type": "string",
       "format": "date"
      }
     }
    },
    "load": {
     "type": "string"
    },
    "daq": {
     "type": "string"
    },
    "power_supply": {
     "type": "string"
    },
    "ambient_c": {
     "type": "number"
    }
   }
  },
  "lab": {
   "type": "string",
   "description": "Who ran it: a company or lab name. No personal names."
  },
  "tests": {
   "type": "object",
   "additionalProperties": false,
   "minProperties": 1,
   "properties": {
    "electrical": {
     "type": "object",
     "description": "Winding resistance, inductance and back-EMF",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "phase_resistance_ohm": {
         "type": "number",
         "description": "in Ω"
        },
        "phase_inductance_uh": {
         "type": "number",
         "description": "in µH"
        },
        "kv_rpm_per_v": {
         "type": "number",
         "description": "in rpm/V"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "kt": {
     "type": "object",
     "description": "Torque per amp and saturation",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "kt_output_nm_per_a": {
         "type": "number",
         "description": "in N·m/A"
        },
        "peak_torque_nm": {
         "type": "number",
         "description": "in N·m"
        },
        "saturation_current_a": {
         "type": "number",
         "description": "in A"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "stiffness": {
     "type": "object",
     "description": "Backlash, lost motion and torsional stiffness",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "backlash_arcmin": {
         "type": "number",
         "description": "in arcmin"
        },
        "lost_motion_arcmin": {
         "type": "number",
         "description": "in arcmin"
        },
        "stiffness_nm_per_arcmin": {
         "type": "number",
         "description": "in N·m/arcmin"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "friction": {
     "type": "object",
     "description": "Friction, breakaway and backdrive torque",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "breakaway_torque_nm": {
         "type": "number",
         "description": "in N·m"
        },
        "backdrive_torque_nm": {
         "type": "number",
         "description": "in N·m"
        },
        "damping_nm_s_per_rad": {
         "type": "number",
         "description": "in N·m·s/rad"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "ripple": {
     "type": "object",
     "description": "Torque ripple and cogging",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "ripple_pk_pk_nm": {
         "type": "number",
         "description": "in N·m"
        },
        "ripple_std_nm": {
         "type": "number",
         "description": "in N·m"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "efficiency": {
     "type": "object",
     "description": "Torque-speed curve and efficiency map",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "torque_speed_curve": {
         "type": "string",
         "description": "Path or URL of the data file (CSV: speed_rpm, torque_nm, efficiency_pct)"
        },
        "efficiency_map": {
         "type": "string",
         "description": "Path or URL of the data file (CSV: speed_rpm, torque_nm, efficiency_pct)"
        },
        "peak_efficiency_pct": {
         "type": "number",
         "description": "in %"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "thermal": {
     "type": "object",
     "description": "Heating and continuous torque",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "continuous_torque_nm": {
         "type": "number",
         "description": "in N·m"
        },
        "time_to_limit_at_peak_s": {
         "type": "number",
         "description": "in s"
        },
        "thermal_resistance_k_per_w": {
         "type": "number",
         "description": "in K/W"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "bandwidth": {
     "type": "object",
     "description": "Torque bandwidth",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "torque_bandwidth_hz": {
         "type": "number",
         "description": "in Hz"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    },
    "endurance": {
     "type": "object",
     "description": "Endurance on a real duty cycle",
     "additionalProperties": false,
     "properties": {
      "values": {
       "type": "object",
       "additionalProperties": false,
       "properties": {
        "hours_run": {
         "type": "number",
         "description": "hours_run"
        },
        "backlash_change_arcmin": {
         "type": "number",
         "description": "in arcmin"
        },
        "efficiency_change_pct": {
         "type": "number",
         "description": "in %"
        }
       }
      },
      "conditions": {
       "type": "object",
       "description": "Bus voltage, temperature, current limit, speed: whatever was held fixed",
       "additionalProperties": {
        "type": [
         "number",
         "string"
        ]
       }
      },
      "raw": {
       "type": "array",
       "items": {
        "type": "object",
        "required": [
         "file"
        ],
        "properties": {
         "file": {
          "type": "string"
         },
         "sha256": {
          "type": "string"
         },
         "columns": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "sample_hz": {
          "type": "number"
         }
        }
       }
      },
      "notes": {
       "type": "string"
      }
     }
    }
   }
  }
 }
}