/** * Parameter panel - input fields for simulation configuration. */ import { useSimulationStore } from '../../store/simulationStore'; export default function ParameterPanel() { const { config, updateConfig, addServer, removeServer, updateServer, isRunning, } = useSimulationStore(); if (!config) { return (
Aucune configuration chargée
); } const handleArrivalRateChange = (e: React.ChangeEvent) => { updateConfig({ arrival_rate: parseFloat(e.target.value) || 0 }); }; const handleCoordinatorServiceRateChange = (e: React.ChangeEvent) => { updateConfig({ coordinator_service_rate: parseFloat(e.target.value) || 0 }); }; const handleExitProbabilityChange = (e: React.ChangeEvent) => { updateConfig({ coordinator_exit_probability: parseFloat(e.target.value) || 0 }); }; const handleServerServiceRateChange = (serverId: string, value: string) => { updateServer(serverId, { service_rate: parseFloat(value) || 0 }); }; const handleServerRoutingProbChange = (serverId: string, value: string) => { updateServer(serverId, { routing_probability: parseFloat(value) || 0 }); }; // Calculate total routing probability const totalRoutingProb = config.coordinator_exit_probability + config.servers.reduce((sum, s) => sum + s.routing_probability, 0); const isProbabilityValid = Math.abs(totalRoutingProb - 1.0) < 0.001; return (

Paramètres du réseau

{/* External arrival rate */}

Requêtes par unité de temps

{/* Coordinator parameters */}

Coordinateur

{/* Servers */}

Serveurs

{config.servers.map((server, index) => (
Serveur {index + 1} {config.servers.length > 1 && ( )}
handleServerServiceRateChange(server.id, e.target.value) } disabled={isRunning} className="block w-full px-2 py-1 border border-gray-300 rounded text-sm disabled:bg-gray-100" />
handleServerRoutingProbChange(server.id, e.target.value) } disabled={isRunning} className="block w-full px-2 py-1 border border-gray-300 rounded text-sm disabled:bg-gray-100" />
))}
{/* Probability validation */}
Conservation des probabilités {isProbabilityValid ? '✓' : '✗'}
p + Σq = {totalRoutingProb.toFixed(3)} {isProbabilityValid ? ' = 1.0' : ' ≠ 1.0'}
); }