diff --git a/src/BadDay.Core/PainBox.cs b/src/BadDay.Core/PainBox.cs
index c624472..1ff9959 100644
--- a/src/BadDay.Core/PainBox.cs
+++ b/src/BadDay.Core/PainBox.cs
@@ -25,8 +25,28 @@ public sealed class PainBox
/// The first tick the box is off; when it is never disabled.
public long DisableTick { get; private set; }
- /// The intensity the ramp scales: the parameters' BoxIntensity until a caller sets it.
- public double Level { get; set; }
+ /// The largest intensity the box takes: ten times the strongest the models use, small enough that no product with the ramp and noise can overflow.
+ public const double MaxLevel = 10.0;
+
+ private double _level;
+
+ ///
+ /// The intensity the ramp scales: the parameters' BoxIntensity until a caller sets it. The one rule for every
+ /// writer, the constructor included: finite, not negative, at most ; anything else throws
+ /// and leaves the level as it was.
+ ///
+ public double Level
+ {
+ get => _level;
+ set
+ {
+ if (!double.IsFinite(value) || value < 0.0 || value > MaxLevel)
+ {
+ throw new ArgumentOutOfRangeException(nameof(value), value, $"The box intensity is finite, from 0 to {MaxLevel}.");
+ }
+ _level = value;
+ }
+ }
/// Switches the box off from ; an earlier switch-off stands.
public void SwitchOff(long tick) => DisableTick = Math.Min(DisableTick, tick);
diff --git a/src/BadDay.Core/PainBoxSession.cs b/src/BadDay.Core/PainBoxSession.cs
index 25f0cde..ce0ab64 100644
--- a/src/BadDay.Core/PainBoxSession.cs
+++ b/src/BadDay.Core/PainBoxSession.cs
@@ -62,12 +62,8 @@ public sealed class PainBoxSession
/// True from the tick the deliberate withdrawal begins.
public bool Withdrew { get; private set; }
- /// Sets the box intensity the ramp scales; it takes effect on the next . Refuses a non-finite or negative level.
- public void SetIntensity(double level)
- {
- if (!double.IsFinite(level) || level < 0.0) throw new ArgumentOutOfRangeException(nameof(level), level, "The box intensity is finite and not negative.");
- _box.Level = level;
- }
+ /// Sets the box intensity the ramp scales; it takes effect on the next . owns the range and refuses a level outside it.
+ public void SetIntensity(double level) => _box.Level = level;
/// Switches the box off from the next tick; the check then ends the run if the will still holds.
public void SwitchOff() => _box.SwitchOff(TickIndex);