lab library
Virtual laboratory simulations — edu-04's own worked example
(PendulumSimulation) is the first, not the only one this package is
named for.
Not flutter3d_sim. A lab experiment is domain content built on top
of flutter3d_sim's stepping and recording primitives
(DigestTrace, DataSourceTrace, Demo), the same relationship a genre
package (flutter3d_game_shooter and its siblings) already has with the
engine underneath it — one more phenomenon to simulate is not one more
thing flutter3d_sim itself needs to know how to do. Plain Dart, same
reason flutter3d_sim is: a server replays a lab run through it, in a
container with no Flutter SDK in it.
Classes
- DataSourceTrace
-
What every
edu_data_sourcea run read gave, one fixed step at a time —edu-00§9's "значение из источника... становится вводом для этого шага ленты", written down the same wayInputTapewrites down a controller: dense, one entry per step, so a replay reads the exact value a run saw rather than a value recomputed from a clock that has since moved on. - Demo
- A run, as a file somebody can send: where it started and what they did.
- DigestTrace
- The digest of a running simulation, taken every so many steps.
- Divergence
- Where two runs of the same tape parted company.
- LabClock
- Steps a pendulum by labFixedDt however long the frames are: what a frame brings is added to what is owed, and as many whole steps as that covers are taken.
- LabDivergence
-
The step a student's own recorded parameter first differs from the
assignment's —
doc/lesson-scenarios-plan.md's own wording forls-e-01's acceptance: "преподаватель видит на шкале rp-02, на каком шаге студент выставил длину, отличную от задания". - PendulumDivergence
- PendulumLabRun.divergenceFrom's own answer: where two runs parted, and what each one's own length knob read there.
- PendulumLabRun
-
Runs PendulumSimulation for a fixed number of steps, recording exactly
what
edu-04asks a virtual lab to record — aDigestTracefor verification (rp-01's own mechanism) and aDataSourceTraceof the one parameter a student's panel changes (edu-05's own mechanism, reused rather than reinvented: a lab's length knob and a factory's temperature sensor are both "a value with no controller behind it"). - PendulumSimulation
-
edu-04's own worked example: a gravity pendulum, simple enough that a student changing one number — the length of the string — visibly changes how the run unfolds, and small enough that this file owes nothing toflutter3d_physics's general rigid-body machinery for it.
Constants
- labFixedDt → const double
- The lab's step, s: a sixtieth of a second, the rate every recorded run here is stepped at. A run, a branch and the app on screen all step by this and nothing else, so what a student watches is the run that is recorded and checked — the app through a LabClock.
Functions
-
firstLabDivergence(
DataSourceTrace assignment, DataSourceTrace student, {required String path, double tolerance = 1e-9}) → LabDivergence? -
Compares
assignmentagainststudentstep by step onpathand answers the first step they disagree, or null when the student never touched the parameter the assignment set.