File size: 2,340 Bytes
02d27c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
 "cells": [
  {"cell_type": "markdown", "metadata": {}, "source": [
    "# KODEX demo — predict in milliseconds, with calibrated uncertainty and a trust gate\n",
    "The Kronos Family of Codes. One contract: `predict(x) -> (y, uncertainty, in_domain)`.\n",
    "Nothing here is published; representative-fidelity CGYRO (μ=400)."]},
  {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [
    "import kronos_ml as K\n",
    "print(K.__version__, '·', len(K.SURROGATES), 'codes')\n",
    "K.fleet(phase=1)"]},
  {"cell_type": "markdown", "metadata": {}, "source": [
    "## KYRO — CGYRO turbulence transport in ~0.3 ms"]},
  {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [
    "p = K.run('KYRO', [3.5, 1.6])   # a/L_T, shear\n",
    "print(f'Q_i = {p.y:.0f} ± {p.uncertainty:.0f}  (in_domain={p.in_domain})')\n",
    "p.as_tagged('CGYRO (nonlinear gyrokinetic)')   # provenance travels with the value"]},
  {"cell_type": "markdown", "metadata": {}, "source": [
    "## KGATE — the model-free trust boundary"]},
  {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [
    "g = K.get('KGATE')\n",
    "safe, ok = g.clamp([2.0, 0.3, 9.0, 5.0, 0.9, 60.0])   # over-limit command\n",
    "print('projected onto envelope:', safe.round(2), '· in_domain=', g.in_domain([2.0,0.3,9.0,5.0,0.9,60.0]))"]},
  {"cell_type": "markdown", "metadata": {}, "source": [
    "## KHALO — calibrated uncertainty, and a benchmark"]},
  {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [
    "import json\n",
    "print(json.dumps(K.get('KYRO').benchmark(), default=str, indent=1))"]},
  {"cell_type": "markdown", "metadata": {}, "source": [
    "## KECON — generic techno-economics (financial firewall: your inputs only)"]},
  {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [
    "K.run('KECON', {'capex':5e9,'opex_per_yr':1e8,'annual_generation_MWh':3e6,\n",
    "                'discount_rate':0.07,'lifetime_yr':30}).y   # $/MWh, no Kronos numbers"]}
 ],
 "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"},
  "language_info": {"name": "python", "version": "3.11"}},
 "nbformat": 4, "nbformat_minor": 5
}