Show solved calibration factors in the properties panel.
Some checks failed
CI / check (push) Has been cancelled

Surface free actuators like z_dp after solve in Results and Calibration tabs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-19 16:55:29 +02:00
parent 7ae7ebfc09
commit 7250b9fe4d

View File

@@ -37,7 +37,8 @@ import {
type ControlObjectiveConfig, type ControlObjectiveConfig,
type EntropykNodeData, type EntropykNodeData,
} from "@/lib/configBuilder"; } from "@/lib/configBuilder";
import { buildComponentInspector } from "@/lib/componentInspector"; import { buildComponentInspector, getSolvedVariablesForComponent } from "@/lib/componentInspector";
import type { SolvedVariable } from "@/lib/api";
import { ComponentIcon } from "@/components/canvas/ComponentIcon"; import { ComponentIcon } from "@/components/canvas/ComponentIcon";
import ComponentDocPanel from "@/components/panels/ComponentDocPanel"; import ComponentDocPanel from "@/components/panels/ComponentDocPanel";
import { modelBannerForType } from "@/lib/componentDocMap"; import { modelBannerForType } from "@/lib/componentDocMap";
@@ -135,6 +136,13 @@ export default function PropertiesPanel() {
); );
}, [node, nodes, edges, result]); }, [node, nodes, edges, result]);
// Solver-computed unknowns owned by this component (free actuators +
// calibration factors). Empty until a solve produces them.
const solvedVars = useMemo<SolvedVariable[]>(
() => (node ? getSolvedVariablesForComponent(result, node.data.name) : []),
[node, result],
);
// After a successful solve, jump to Results when selecting a part (Dymola-like). // After a successful solve, jump to Results when selecting a part (Dymola-like).
useEffect(() => { useEffect(() => {
if (!node) return; if (!node) return;
@@ -301,7 +309,11 @@ export default function PropertiesPanel() {
)} )}
{!isRegLoop && panelMode === "results" && ( {!isRegLoop && panelMode === "results" && (
<ModelicaResultsView inspector={inspector} hasResult={!!result} /> <ModelicaResultsView
inspector={inspector}
hasResult={!!result}
solvedVariables={solvedVars}
/>
)} )}
{(isRegLoop || panelMode === "parameters") && ( {(isRegLoop || panelMode === "parameters") && (
@@ -529,7 +541,7 @@ export default function PropertiesPanel() {
)} )}
{activeTab === "Calibration" && ( {activeTab === "Calibration" && (
<div className="space-y-1 border-t border-[var(--line)] bg-[var(--chrome-2)] px-2.5 py-1.5 text-[10px] leading-snug text-[var(--ink-dim)]"> <div className="space-y-1.5 border-t border-[var(--line)] bg-[var(--chrome-2)] px-2.5 py-1.5 text-[10px] leading-snug text-[var(--ink-dim)]">
<p> <p>
<strong>Comment calibrer :</strong> coche Fixed sur la cible (SST/SDT), décoche <strong>Comment calibrer :</strong> coche Fixed sur la cible (SST/SDT), décoche
Fixed sur le facteur (Z_UA). Z_UA vaut <strong>1</strong> par défaut (pas de Fixed sur le facteur (Z_UA). Z_UA vaut <strong>1</strong> par défaut (pas de
@@ -538,6 +550,9 @@ export default function PropertiesPanel() {
<p className="text-[var(--ink-faint)]"> <p className="text-[var(--ink-faint)]">
Tu nas pas besoin du nœud « Regulation loop » pour ça. Tu nas pas besoin du nœud « Regulation loop » pour ça.
</p> </p>
{solvedVars.length > 0 && (
<SolvedVariablesBlock items={solvedVars} title="Facteurs résolus" />
)}
</div> </div>
)} )}
@@ -847,9 +862,11 @@ function controllerSelectOptions(
function ModelicaResultsView({ function ModelicaResultsView({
inspector, inspector,
hasResult, hasResult,
solvedVariables,
}: { }: {
inspector: ReturnType<typeof buildComponentInspector> | null; inspector: ReturnType<typeof buildComponentInspector> | null;
hasResult: boolean; hasResult: boolean;
solvedVariables: SolvedVariable[];
}) { }) {
if (!hasResult || !inspector) { if (!hasResult || !inspector) {
return ( return (
@@ -911,6 +928,10 @@ function ModelicaResultsView({
)} )}
</div> </div>
{solvedVariables.length > 0 && (
<SolvedVariablesBlock items={solvedVariables} title="Variables résolues" />
)}
<div className="overflow-hidden rounded-md border border-[var(--line)]"> <div className="overflow-hidden rounded-md border border-[var(--line)]">
<div className="border-b border-[var(--line)] bg-[var(--chrome-2)] px-2 py-1 text-[9px] font-semibold uppercase tracking-wide text-[var(--ink-faint)]"> <div className="border-b border-[var(--line)] bg-[var(--chrome-2)] px-2 py-1 text-[9px] font-semibold uppercase tracking-wide text-[var(--ink-faint)]">
Ports / variables Ports / variables