diff --git a/models/intersection/queue.mjs b/models/intersection/queue.mjs new file mode 100644 index 0000000..496f82b --- /dev/null +++ b/models/intersection/queue.mjs @@ -0,0 +1,39 @@ +/** @typedef {{ NS: number, EW: number }} Counts */ +/** @typedef {{ horizon_slots: number, initial_queue: Counts, phase_sequence: string[], service: Record }} QueueModel */ + +/** @param {Counts | undefined} counts */ +function validCounts(counts) { + return counts && [counts.NS, counts.EW].every(value => Number.isSafeInteger(value) && value >= 0); +} + +/** @param {QueueModel} model @param {Counts[]} arrivals */ +export function runQueue(model, arrivals) { + if (model.horizon_slots !== model.phase_sequence.length || arrivals.length !== model.horizon_slots) { + throw new Error('Each slot needs a phase and an arrival record.'); + } + if (!validCounts(model.initial_queue)) throw new Error('Invalid initial queue.'); + let queue = { ...model.initial_queue }; + return model.phase_sequence.map((phase, index) => { + const arrival = arrivals[index]; + const capacity = model.service[phase]; + if (!validCounts(arrival) || !validCounts(capacity)) throw new Error(`Invalid arrivals or phase at slot ${index + 1}.`); + const waitingNS = queue.NS + arrival.NS; + const waitingEW = queue.EW + arrival.EW; + const departures = { NS: Math.min(waitingNS, capacity.NS), EW: Math.min(waitingEW, capacity.EW) }; + queue = { NS: waitingNS - departures.NS, EW: waitingEW - departures.EW }; + return { slot: index + 1, phase, arrival, departures, queue }; + }); +} + +/** Move one vehicle, using the one-based slot numbers shown in the chapter. + * @param {Counts[]} arrivals @param {'NS' | 'EW'} group @param {number} from @param {number} to */ +export function moveArrival(arrivals, group, from, to) { + if (!['NS', 'EW'].includes(group) || ![from, to].every(slot => Number.isInteger(slot) && slot >= 1 && slot <= arrivals.length)) { + throw new Error('Choose a vehicle group and two valid slots.'); + } + if (from === to || arrivals[from - 1][group] < 1) throw new Error('Move an existing arrival to a different slot.'); + const edited = arrivals.map(arrival => ({ ...arrival })); + edited[from - 1][group]--; + edited[to - 1][group]++; + return edited; +} diff --git a/models/intersection/queue.test.ts b/models/intersection/queue.test.ts new file mode 100644 index 0000000..f2acec0 --- /dev/null +++ b/models/intersection/queue.test.ts @@ -0,0 +1,39 @@ +import { readFileSync } from 'node:fs'; +import { describe, expect, it } from 'vitest'; +import inputs from '../../project/v3/case-study/model-inputs-v1.json'; +import { moveArrival, runQueue } from './queue.mjs'; + +const trace = readFileSync(new URL('../../project/v3/case-study/trace-v1.csv', import.meta.url), 'utf8') + .trim().split(/\r?\n/).slice(1); +const clustered = inputs.scenarios.find(s => s.id === 'B')!.arrivals; + +describe('fixed-phase intersection experiment', () => { + it('matches every arrival, phase, departure and queue in the independent reference trace', () => { + const calculated = inputs.scenarios.flatMap(scenario => runQueue(inputs, scenario.arrivals) + .map(({ slot, phase, arrival, departures, queue }) => + [scenario.id, slot, phase, arrival.NS, arrival.EW, departures.NS, departures.EW, queue.NS, queue.EW].join(','))); + expect(calculated).toEqual(trace); + }); + + it('moves one NS arrival to the last NS green and preserves the baseline', () => { + const edited = moveArrival(clustered, 'NS', 3, 2); + expect(runQueue(inputs, edited).at(-1)?.queue).toEqual({ NS: 1, EW: 0 }); + expect(runQueue(inputs, clustered).at(-1)?.queue).toEqual({ NS: 2, EW: 0 }); + expect(edited.reduce((n, row) => n + row.NS + row.EW, 0)).toBe(4); + }); + + it('rejects an empty origin, an unchanged slot and slots outside the horizon', () => { + expect(() => moveArrival(clustered, 'EW', 3, 2)).toThrow(); + expect(() => moveArrival(clustered, 'NS', 3, 3)).toThrow(); + expect(() => moveArrival(clustered, 'NS', 3, 9)).toThrow(); + expect(() => moveArrival(clustered, 'NS', 0, 2)).toThrow(); + }); + + it('rejects malformed records before reporting a result', () => { + for (const count of [-1, 0.5]) { + expect(() => runQueue(inputs, [{ NS: count, EW: 0 }, ...clustered.slice(1)])).toThrow(); + } + expect(() => runQueue(inputs, clustered.slice(1))).toThrow(); + expect(() => runQueue({ ...inputs, phase_sequence: ['UNKNOWN', ...inputs.phase_sequence.slice(1)] }, clustered)).toThrow(); + }); +}); diff --git a/project/v3/case-study/MODEL-CHECK.md b/project/v3/case-study/MODEL-CHECK.md index dab58e8..3beb821 100644 --- a/project/v3/case-study/MODEL-CHECK.md +++ b/project/v3/case-study/MODEL-CHECK.md @@ -33,7 +33,7 @@ Both have **four** invented arrivals; the fixed phase schedule never changes. On During preparation, a first JavaScript implementation generated all **16 trace records** from the declared inputs and checked conservation. A second, separately written calculation fetched the saved inputs and CSV through the GitHub connection and independently recomputed **every field in all 16 rows**; it matched exactly. The second check also resolved all eight typed graph edges to twelve existing source objects, confirmed the deliberately missing target is not a real object, rejected negative/fractional arrivals and unknown phase labels, and verified each derived final queue in the data-quality file. -Those are **editorial consistency checks**, not an independent accredited engineering examination, an executed Astro simulation or empirical evidence. The standalone [verify-fixture.mjs](verify-fixture.mjs) preserves a reproducible check for future editors. **It has not been wired into GitHub Actions or the public site**; before promotion, run and record its results in the checked-out repository and review its test coverage. +Those checks established the internal consistency of the teaching fixture. The [Chapter 5 browser exercise](../manuscripts/revised/05-learning-through-models-and-prototypes.md) and the [standalone checker](verify-fixture.mjs) now use the same [queue calculation](../../../models/intersection/queue.mjs). Its [regression tests](../../../models/intersection/queue.test.ts) compare every original row with the stored trace and check the effect of moving one arrival. ### Conservation @@ -51,7 +51,7 @@ Every existing edge has a known source and target ID, a declared relation type, The allowed editorial conclusion is narrow: **with T1's eight-slot rule and invented arrivals, arrival clustering changes the number still queued**. No real intersection, physical indication, safety or AI-agent performance is assessed. -## Explicit missing work / future checks +## Follow-ups recorded in the original review on 16 November 2026 - [ ] Owner/editorial review of object vocabulary, system boundary, source revision, model assumptions and whether two-group signal phase is a useful pedagogical simplification. - [ ] Run `node project/v3/case-study/verify-fixture.mjs` in the repository environment; retain actual stdout and CLI exit code for the record. diff --git a/project/v3/case-study/verify-fixture.mjs b/project/v3/case-study/verify-fixture.mjs index 6362326..39d13b9 100644 --- a/project/v3/case-study/verify-fixture.mjs +++ b/project/v3/case-study/verify-fixture.mjs @@ -5,6 +5,7 @@ import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname, join } from 'node:path'; import assert from 'node:assert/strict'; +import { runQueue } from '../../../models/intersection/queue.mjs'; const root = dirname(fileURLToPath(import.meta.url)); const read = (name) => readFileSync(join(root, name), 'utf8'); @@ -43,21 +44,9 @@ assert.throws(() => validate({ ...input, scenarios: [{ ...input.scenarios[0], ar assert.throws(() => validate({ ...input, scenarios: [{ ...input.scenarios[0], arrivals: input.scenarios[0].arrivals.slice(1) }] })); function run(scenario) { - const queue = { NS: 0, EW: 0 }; - const rows = []; - for (let k = 0; k < input.horizon_slots; k++) { - const arrival = scenario.arrivals[k]; - const phase = input.phase_sequence[k]; - const capacity = input.service[phase]; - queue.NS += arrival.NS; - queue.EW += arrival.EW; - const departNS = Math.min(queue.NS, capacity.NS); - const departEW = Math.min(queue.EW, capacity.EW); - queue.NS -= departNS; - queue.EW -= departEW; - rows.push([scenario.id,k+1,phase,arrival.NS,arrival.EW,departNS,departEW,queue.NS,queue.EW]); - } - return rows; + return runQueue(input, scenario.arrivals).map(({ slot, phase, arrival, departures, queue }) => [ + scenario.id, slot, phase, arrival.NS, arrival.EW, departures.NS, departures.EW, queue.NS, queue.EW, + ]); } const expected = input.scenarios.flatMap(run); const csvLines = read('trace-v1.csv').trimEnd().split(/\r?\n/); diff --git a/project/v3/learning/README.md b/project/v3/learning/README.md new file mode 100644 index 0000000..deb24dc --- /dev/null +++ b/project/v3/learning/README.md @@ -0,0 +1,21 @@ +# Learning activities in V3 manuscripts + +The [V3 chapter route](../../../site/src/pages/learn/v3/%5Bslug%5D.astro) inserts activities into the published Markdown during the build. Each chapter issue owns its questions, their placement and its reading links. + +## Knowledge checks + +Use the stable `id` from the manuscript frontmatter as the filename in `quizzes/`. Each question has an ID, a prompt and distinct choices with feedback for each choice. Set `"correct": true` on one choice. The [Chapter 3 questions](quizzes/eel-v3-ch03-planning.json) show the format. + +Place `` on its own line, with a blank line before and after it, where readers have enough information to reason about the questions. The build checks the question data and the placement marker. Chapter 5 uses `` for the arrival experiment. + +## Cards + +Use a Markdown blockquote with a bold first paragraph containing either `Concept` or `Explore further`. A concept card explains a distinction at the point of need. An optional reading card names what a linked source lets the reader inspect. + +```markdown +> **Explore further** +> +> Inspect the [arrival and service rules](../../case-study/model-inputs-v1.json) used in the comparison. +``` + +Use relative Markdown links from the manuscript. The V3 link processor resolves current chapter links under the Pages base path and other source files in GitHub. Run the repository's preview check to exercise the chapter, quiz and model tests together. diff --git a/project/v3/learning/quizzes/eel-v3-ch01-new-paradigm.json b/project/v3/learning/quizzes/eel-v3-ch01-new-paradigm.json new file mode 100644 index 0000000..21b2204 --- /dev/null +++ b/project/v3/learning/quizzes/eel-v3-ch01-new-paradigm.json @@ -0,0 +1,40 @@ +[ + { + "id": "repeatable-feedback", + "prompt": "Teams discover the same interface mismatch late in integration. Which investment would shorten the next decision cycle?", + "options": [ + { + "text": "Add a second sign-off meeting before integration.", + "feedback": "The team would still discover the mismatch at integration. Identify where the two interface definitions first become comparable." + }, + { + "text": "Check the two versioned interface definitions whenever either changes.", + "feedback": "An early comparison exposes a disagreement while the teams can still change their designs. The reusable check improves the engineering system.", + "correct": true + }, + { + "text": "Build the next product variant before investigating the mismatch.", + "feedback": "A further variant increases the number of configurations the teams must investigate. It does little to locate the existing disagreement." + } + ] + }, + { + "id": "what-a-check-supports", + "prompt": "A model check passes for a proposed design change. Which decision can the team now make?", + "options": [ + { + "text": "Use the result to decide what to integrate or investigate next.", + "feedback": "The check gives timely evidence about the modeled condition. The team can use that evidence to choose its next integration or test step.", + "correct": true + }, + { + "text": "Release the product in every intended operating condition.", + "feedback": "The check covered a particular model and condition. Release also depends on integration and evidence for the intended use." + }, + { + "text": "Count the check as a measured reduction in total development cost.", + "feedback": "A passing check records a technical result. A cost claim needs a measure of the work or rework it actually saved." + } + ] + } +] diff --git a/project/v3/learning/quizzes/eel-v3-ch02-intersection-challenge.json b/project/v3/learning/quizzes/eel-v3-ch02-intersection-challenge.json new file mode 100644 index 0000000..f858893 --- /dev/null +++ b/project/v3/learning/quizzes/eel-v3-ch02-intersection-challenge.json @@ -0,0 +1,40 @@ +[ + { + "id": "first-question", + "prompt": "The city wants better flow and safe crossings. Which question fits the first fixed-phase queue prototype?", + "options": [ + { + "text": "Which crossing time is suitable for all pedestrians?", + "feedback": "The prototype has vehicle arrivals and signal phases. Answering a crossing-time question requires information about pedestrians, geometry and timing." + }, + { + "text": "Which detector should the city purchase?", + "feedback": "Choosing hardware requires sensing and interface needs that the first queue experiment leaves open." + }, + { + "text": "Can different arrival patterns leave different queues under the same phases?", + "feedback": "Arrivals, phases and queues are part of the prototype. Varying arrivals while holding the phases fixed isolates a question it can answer.", + "correct": true + } + ] + }, + { + "id": "intent-and-criteria", + "prompt": "Two groups agree to improve the intersection but give different meanings to “better.” What is the next useful step?", + "options": [ + { + "text": "Identify each group’s intended outcome and choose one uncertainty to investigate.", + "feedback": "A driver’s queue and a pedestrian’s crossing opportunity call for different observations. Naming both helps turn a shared intent into meaningful criteria.", + "correct": true + }, + { + "text": "Make the shortest vehicle queue the acceptance criterion for everyone.", + "feedback": "Queue length describes one outcome for one group. It leaves the crossing concern unanswered." + }, + { + "text": "Choose adaptive control so that everyone can work to one design.", + "feedback": "Selecting a controller settles the proposed mechanism before the team has agreed which outcomes it should improve." + } + ] + } +] diff --git a/project/v3/learning/quizzes/eel-v3-ch03-planning.json b/project/v3/learning/quizzes/eel-v3-ch03-planning.json new file mode 100644 index 0000000..1929f11 --- /dev/null +++ b/project/v3/learning/quizzes/eel-v3-ch03-planning.json @@ -0,0 +1,40 @@ +[ + { + "id": "replan-increment", + "prompt": "Two teams count arrivals on different sides of the same service step. What should change in the next increment?", + "options": [ + { + "text": "Order detectors to get a larger set of arrival records.", + "feedback": "Additional records will still have two interpretations until the event order is agreed." + }, + { + "text": "Agree on event order, record the decision and rerun the comparison.", + "feedback": "The disagreement affects the meaning of the result. A small, reviewable rerun makes the investigation useful again.", + "correct": true + }, + { + "text": "Replace the long-term aim for the intersection.", + "feedback": "The ambiguity concerns an experiment. It provides grounds to revise the increment while the stakeholder aim still guides planning." + } + ] + }, + { + "id": "planning-horizon", + "prompt": "A team wants to keep its direction while learning whether the fixed-phase model is useful. Which entry belongs in its immediate backlog?", + "options": [ + { + "text": "Improve how people move through the intersection.", + "feedback": "That describes a longer-term outcome. A backlog item identifies a concrete piece of work toward it." + }, + { + "text": "Set the full hardware procurement schedule.", + "feedback": "Procurement depends on choices that this investigation is meant to inform." + }, + { + "text": "Write down how each slot treats arrivals and check one trace together.", + "feedback": "The task can be done and reviewed within the next increment. Its result gives the team grounds to keep or revise the plan.", + "correct": true + } + ] + } +] diff --git a/project/v3/learning/quizzes/eel-v3-ch04-engineering-knowledge.json b/project/v3/learning/quizzes/eel-v3-ch04-engineering-knowledge.json new file mode 100644 index 0000000..27a5c1e --- /dev/null +++ b/project/v3/learning/quizzes/eel-v3-ch04-engineering-knowledge.json @@ -0,0 +1,40 @@ +[ + { + "id": "follow-a-relation", + "prompt": "The phase-selection function may change. The source says the queue model represents that function. What should an engineer do with this link?", + "options": [ + { + "text": "Review the model assumptions that depend on phase selection.", + "feedback": "The directed link identifies a concrete model to inspect. The engineer can then establish and record the effect of the proposed change.", + "correct": true + }, + { + "text": "Mark the signal interface as failed.", + "feedback": "The link records what the model represents. A failure claim requires an observed result against a criterion." + }, + { + "text": "Update every diagram independently.", + "feedback": "The views draw on maintained definitions. Checking the shared definition first shows which views actually need updating." + } + ] + }, + { + "id": "unresolved-target", + "prompt": "An assistant suggests an interface ID that is missing from the source graph. How should the engineer record it?", + "options": [ + { + "text": "Connect it to the nearest-looking interface name.", + "feedback": "A similar label provides no evidence of identity. That guessed connection would mislead the next review." + }, + { + "text": "Remove the question because the graph has no edge.", + "feedback": "A missing edge can identify a gap in the recorded information. Other sources may still show an effect." + }, + { + "text": "Keep it as an unresolved review question and check its source.", + "feedback": "The uncertainty stays visible and reviewable. A verified identity can later support a recorded relationship.", + "correct": true + } + ] + } +] diff --git a/project/v3/learning/quizzes/eel-v3-ch05-models-prototypes.json b/project/v3/learning/quizzes/eel-v3-ch05-models-prototypes.json new file mode 100644 index 0000000..da1c6fe --- /dev/null +++ b/project/v3/learning/quizzes/eel-v3-ch05-models-prototypes.json @@ -0,0 +1,40 @@ +[ + { + "id": "bounded-claim", + "prompt": "Two scenarios have the same four arrivals and fixed signal phases, yet finish with different queues. What accounts for the difference?", + "options": [ + { + "text": "The model has selected a better controller for one scenario.", + "feedback": "Both scenarios use the same phase sequence. Look at when each vehicle arrives relative to a green slot." + }, + { + "text": "The timing of arrivals changes which vehicles can depart within the eight slots.", + "feedback": "The rule serves the active green group after arrivals join its queue. An arrival that misses that group’s green can still be waiting at the end.", + "correct": true + }, + { + "text": "The smaller final queue establishes a shorter average wait in city traffic.", + "feedback": "The trace counts vehicles remaining at one horizon. It contains neither a mean waiting-time measure nor observed city traffic." + } + ] + }, + { + "id": "capture-observation", + "prompt": "What should be saved so a colleague can use this experiment in the next investigation?", + "options": [ + { + "text": "The model revision, scenario edit, observation horizon, queue result and next question.", + "feedback": "These details connect the observation to the exact assumptions and inputs that produced it and make the follow-up reproducible.", + "correct": true + }, + { + "text": "Only the smallest queue shown by the experiment.", + "feedback": "A count on its own omits the arrival pattern, model revision and time at which it was taken." + }, + { + "text": "An instruction to use the simulated schedule for the real intersection.", + "feedback": "A source-linked observation supports the next investigation. Choosing an operational schedule requires evidence about the real system." + } + ] + } +] diff --git a/project/v3/manuscripts/revised/01-the-new-engineering-paradigm.md b/project/v3/manuscripts/revised/01-the-new-engineering-paradigm.md index 842153c..33e6945 100644 --- a/project/v3/manuscripts/revised/01-the-new-engineering-paradigm.md +++ b/project/v3/manuscripts/revised/01-the-new-engineering-paradigm.md @@ -11,19 +11,17 @@ teaching_fixture: "Conceptual overview; case begins in Chapter 2" # The New Engineering Paradigm -*Why engineering is changing—and what leaders and teams must change with it.* +*What would help a team turn an engineering question into a sound decision sooner?* -Engineering organizations face a widening gap between how quickly products need to evolve and how slowly many engineering decisions move through fragmented disciplines, documents, tests, approvals and delivery processes. Software and artificial intelligence (AI) offer new capabilities, but neither removes the responsibility to develop safe, useful and trustworthy systems. +When two disciplines discover an interface disagreement during integration, they may have to revisit weeks of design work. A check that exposes the same disagreement as soon as either definition changes gives engineers time to compare options while a change is still affordable. -The opportunity is broader than automating old tasks: **engineer the product and the capability to improve it, together.** This chapter sets out the whole picture. The next chapter introduces a fictional four-way intersection used to explore the practical implications throughout the course. +Building that check improves how the organization engineers its products. Reusing it on the next variant helps the team support more designs and gives new colleagues a way to understand the interface. The investment pays off when it improves a product decision or reduces avoidable rework. ## Expectations are changing -Customers increasingly expect products to gain capabilities, respond to feedback and remain useful after delivery. Competitive pressure raises expectations for shorter development cycles, higher quality, more frequent improvements and faster adaptation to new needs. These pressures affect software-intensive systems, electronics, mechanical products and the services surrounding them. +Competitive pressure can make shorter development cycles, higher quality and frequent improvements valuable. A team that produces changes faster than it can integrate or test them moves work into a queue. A leader can ask where an earlier check would actually change a decision. -They create a demanding combination: **develop faster, release more often where feasible, and increase confidence in what is released**. Faster output alone is not a solution. A team that produces more changes but cannot integrate, test or authorize them has merely moved work into a queue elsewhere. - -Release frequency also differs by product. A web service may deploy repeatedly; embedded software may require controlled integration and qualification; electronics and physical designs involve supplier, manufacturing and test constraints. The objective is not one universal release rhythm. It is to shorten the time between a relevant question, reliable feedback, an informed decision and a useful product improvement. +A web service may deploy repeatedly, embedded software may need controlled integration, and a physical design may depend on suppliers and test equipment. Each team can shorten the path from a question to reliable feedback within its own delivery constraints. ## Software-inspired engineering moves beyond software @@ -55,6 +53,10 @@ The **engineering system** includes people, methods, engineering knowledge, exec The two systems form a feedback relationship. A difficult product question may reveal the need for a new simulation or test fixture. A better engineering capability may make previously expensive options practical to investigate. Improvements to the engineering system should be justified by the product decisions and delivery outcomes they enable. +> **Concept** +> +> Changing a product interface changes what teams must deliver. Adding a repeatable compatibility check changes how teams can investigate that interface on this product and the next. + ## From document-driven handoffs to executable feedback Documents and reviews remain useful; the problem arises when engineering knowledge is disconnected from the models, tests and decisions that give it meaning. @@ -74,12 +76,14 @@ The transformation changes the questions leaders should ask. Beyond measuring ta That means investing selectively in shared engineering information, simulation and test capability, integration practices, multidisciplinary interfaces and the skills to direct and evaluate AI-supported work. It also means allowing exploration where the design is uncertain and making stronger commitments when the evidence supports them. -The goal is neither a tool collection nor automation for its own sake. It is **a better engineering system that can learn faster, build with greater confidence and improve products more continuously**. +A useful investment gives teams an earlier signal about a decision that costs time or money to reverse. Leaders can judge its value by looking at which changes a team caught earlier, how much rework it avoided and where uncertainty still affects delivery. -## From the paradigm to a working example +> **Explore further** +> +> [Choosing an engineering capability when several investments compete](15-choosing-the-next-engineering-capability.md#decide-from-what-is-blocking-the-product) develops this decision later in the course. -The rest of the lab turns this broad argument into concrete engineering choices. We will work with a fictional four-way intersection, starting with uncertain needs rather than an assumed solution. We will follow how planning, engineering knowledge, models, data, specifications, agents, integration, evidence and release decisions build on one another. + -**Chapter 2, Introducing the Engineering Challenge**, defines that shared example and its boundaries. The subsequent chapters develop the practices in progressively greater detail. +## From the paradigm to a working example -**Engineering takeaway:** Market expectations create pressure for speed, release frequency and quality. Software-inspired ways of working provide a foundation, and AI expands the opportunities. The enduring change is to develop the product and the engineering capability that improves it as two connected systems. +A city wants people to move through a busy intersection more easily. Before choosing a controller, its engineers need to decide whose experience to improve and what they can learn first. [Chapter 2 introduces the intersection and its stakeholders](02-introducing-the-engineering-challenge.md). diff --git a/project/v3/manuscripts/revised/02-introducing-the-engineering-challenge.md b/project/v3/manuscripts/revised/02-introducing-the-engineering-challenge.md index 6b3d847..f72cb31 100644 --- a/project/v3/manuscripts/revised/02-introducing-the-engineering-challenge.md +++ b/project/v3/manuscripts/revised/02-introducing-the-engineering-challenge.md @@ -17,11 +17,15 @@ A city wants to improve how people move through a busy four-way intersection. Dr An adaptive controller sounds appealing. New detectors might help. Perhaps the existing signal sequence could be improved. But the city has not yet established which problem is most important, which movements must be protected or what evidence would justify a change. -This is the recurring **fictional engineering challenge** for the lab. It gives us a product question that is easy to picture but rich enough to connect software, electronics, physical systems, operational needs and engineering decisions. Nothing in the teaching case is an observed result from an actual intersection. +We will return to this four-way intersection throughout the course. Here it gives us a first question to investigate before the team selects a controller. -## Start with outcomes, not a favored solution +> **Explore further** +> +> The [intersection case description](../../REFERENCE-INTERSECTION.md#the-shared-engineering-question) explains the city's question. The [case source collection](../../case-study/README.md) contains the assumptions, inputs and observations used later. -The city's broad ambition is to make the intersection serve road users better. That statement is not yet a testable requirement. Different stakeholders may mean different things by *better*. +## Start with engineering intent + +The city's engineering intent is to improve traffic flow while protecting people crossing the road. Different stakeholders experience the intersection differently. Their concerns help the team decide what to observe and which requirements it can define with confidence. | Stakeholder | Example concern | Question that remains open | | --- | --- | --- | @@ -33,7 +37,9 @@ The city's broad ambition is to make the intersection serve road users better. T These concerns cannot be reduced to one queue metric. Optimizing an abstract model without defining crossing safety, interfaces and intended operation could make the wrong problem easier to solve. -The first decision is therefore not which controller to purchase. It is **what the team must understand before it can make that decision**. +> **Concept** +> +> An intent sets a direction, such as improving pedestrian crossings. A requirement needs a criterion that people can check. Agreeing on whose crossing, under which conditions and what to measure gives the team a way to develop that criterion. ## Establish a whole-system boundary @@ -41,7 +47,7 @@ The conceptual product includes the control function, signal indications, releva Our earliest executable model is deliberately smaller. It considers a **simplified fixed-phase signal sequence and invented vehicle arrivals**. It can help us reason about some queue behavior under stated rules. It cannot establish safe crossing times, real traffic performance, controller reliability, hardware timing or compliance with traffic regulations. -Keeping the product boundary and the model boundary separate is essential. The model may answer a narrow engineering question without representing the product well enough to approve a real-world change. +An engineer can use a language model to sketch this small prototype from the signal sequence and the arrival rule, then check the result by tracing one time slot by hand. That makes an early assumption cheap to change while the team learns which details matter. ## The first learning question @@ -51,6 +57,8 @@ That is a suitable initial *learning question*, not a promise of improved traffi We will not solve that question here. Later chapters will introduce the controlled engineering information, executable model and data needed to investigate it properly. + + ## Two kinds of work follow from the same question **On the product side**, the team must define relevant road-user movements, intended behavior, interfaces and acceptable trade-offs. It must distinguish what is known from what is merely proposed. @@ -70,20 +78,6 @@ We will use this same intersection from start to finish, with each chapter addin The storyline is educational rather than a prescribed project sequence. Real teams must consider integration, verification, safety, security and operational needs from the beginning, even though later chapters examine those topics in greater depth. -## What the example will—and will not—prove - -The lab uses synthetic scenarios and a limited teaching model to make engineering reasoning inspectable. A model output or automated check can support a claim about **that model with those inputs**. It does not demonstrate that an actual intersection controller has been built, connected to signals or qualified for operation. - -As the story develops, we will distinguish proposed changes from executed checks, software behavior from physical behavior, and model evidence from operational acceptance. These boundaries are part of the engineering lesson, not obstacles to learning. - -## The next decision - -The city has multiple plausible improvements, but insufficient grounds to choose one. The team needs to decide which uncertainty matters most, what investigation would reduce it, and what it can responsibly commit to next. - -**Chapter 3, Planning Under Uncertainty**, starts there. It asks how to plan meaningful progress without disguising an exploration as a guaranteed product result. - -**Engineering takeaway:** A shared example is useful only when its stakeholders, system boundary and evidence limits remain visible. The four-way intersection gives us one coherent product story—not a preselected solution—to carry through the rest of executable engineering. - ---- +## From the first question to the next experiment -*Reference case:* [Fictional intersection scope](../../REFERENCE-INTERSECTION.md) · [T1 educational sources](../../case-study/README.md). The model and any AI-agent workflows in later chapters are bounded teaching examples, not a physical traffic-control validation. +The team now has an intent, a question about arrival patterns and a small prototype it could build. It must decide what to investigate first and what finding would change that choice. [Chapter 3 develops a plan around that uncertainty](03-planning-under-uncertainty.md). diff --git a/project/v3/manuscripts/revised/03-planning-under-uncertainty.md b/project/v3/manuscripts/revised/03-planning-under-uncertainty.md index 7e838db..11a29f6 100644 --- a/project/v3/manuscripts/revised/03-planning-under-uncertainty.md +++ b/project/v3/manuscripts/revised/03-planning-under-uncertainty.md @@ -11,21 +11,17 @@ teaching_fixture: "T1 — fictional planning decision" # Planning Under Uncertainty -*What should a team promise when it still does not know which solution is appropriate?* +*What should change in the plan when an experiment changes what the team knows?* -The city has asked its engineers to investigate how the four-way intersection could serve road users better. The team can imagine several activities: revise the signal timing, add detectors, study physical movements, or explore adaptive control. +The city wants to improve its intersection. The team has a question about arrivals and an idea for a small prototype. Signal timing, new detectors and adaptive control remain possible directions. Choosing the next investigation lets the team make progress while those choices are open. -All of those may create work. Only some can responsibly be promised as product outcomes today. - -A planning process that converts every idea into a scheduled implementation item would hide an important difference. Some activities are **explorations**, designed to discover whether an assumption holds. Others are **commitments**, whose outcome can be defined and evaluated with sufficient confidence. - -We need to keep moving while making that distinction visible. +A useful first increment produces something colleagues can examine together. Its result can change the next experiment, reveal a dependency or justify a delivery commitment. The plan needs room for each of those outcomes. ## Begin with the next decision, not a backlog The initial purpose is broader than any one solution: improve useful intersection operation without losing sight of competing road-user, physical and operational needs. -Before the team chooses the next investment, imagine a fictional concept review in which there is capacity for **one substantial investigation**. Three options are on the table. +Imagine the team has capacity for **one substantial investigation**. It has three options. | Candidate investigation | What is uncertain? | Smallest useful result | Dependency or stopping condition | |---|---|---|---| @@ -35,7 +31,7 @@ Before the team chooses the next investment, imagine a fictional concept review Option C is not a bad idea. It is simply too early to call it a responsible product commitment in this hypothetical situation. Option A helps define what the system must consider. A bounded part of option B may then test a specific modeling hypothesis. -**The proposed decision:** clarify the conflict boundary and authorize a modest fixed-phase model investigation, while deferring detector procurement and adaptive-control commitments. This is a fictional planning decision, not a measured priority score or a municipal project approval. +The team proposes to clarify the movement conflicts and investigate a small fixed-phase model. It can revisit detector procurement and adaptive control once it knows what those options would need to achieve. ## Vision, initiative, increment and backlog are different things @@ -95,9 +91,15 @@ A failed or inconclusive exploration can be progress when it reveals what is not The plan should therefore track both completed work and **knowledge gained, remaining uncertainties, decision owners and triggers for change**. +Suppose one team counts arriving vehicles just before the signal serves the queue and another counts them just after. Their results can differ even when their input files match. The immediate task is to agree on event order and rerun a small comparison. + +> **Explore further** +> +> The [model input and event-order rule](../../case-study/model-inputs-v1.json) show where the two teams can check which convention applies. + ## Keep a small decision record -A short planning record for our fictional case could state: +The team records its decision while the assumptions are fresh. **Decision:** Use a fixed-phase teaching model as an exploratory reference. **Reason:** It makes one arrival-pattern question inspectable with a limited, understandable source set. @@ -106,18 +108,14 @@ A short planning record for our fictional case could state: **Review trigger:** A changed system boundary, invalid scenario data or findings that make the model unfit for the question. **Decision status:** Provisional, for learning. -This is more useful than recording “simulation task complete” because it explains what the team has actually learned and what it has not authorized. - -## Why the information must become connected - -Once several disciplines are investigating the intersection, assumptions appear in notes, models, interface drafts, diagrams and proposed checks. If two engineers use different versions of those definitions, even well-executed work can produce contradictory conclusions. - -Our next problem is not how to add more backlog items. It is **how to maintain engineering meaning and relationships** so that the selected investigation and later changes can be understood. +> **Concept** +> +> Correcting the order of events changes the next increment and its backlog. If the city decides that pedestrian access is its principal concern, the team has a reason to revisit the initiative itself. -Chapter 4, **Engineering Knowledge as Code**, begins with that need. +The [case source collection](../../case-study/README.md) gives the investigation a common set of definitions to work from. -**Engineering takeaway:** Good planning under uncertainty distinguishes learning from commitment. It chooses the next important question, makes dependencies and stopping rules visible, and invests in engineering capabilities because they improve product decisions. + ---- +## Why the information must become connected -*Related case:* [T1 source and defined information objects](../../case-study/README.md) · [Proposed model/data plan](../../case-study/model-inputs-v1.json). The planning review is fictional and the model is educational. +The two teams have agreed when arrivals enter a queue. Where should they record that decision so that a model, a diagram and a later experiment all refer to the same rule? [Chapter 4 follows an engineering decision into its maintained sources](04-engineering-knowledge-as-code.md). diff --git a/project/v3/manuscripts/revised/04-engineering-knowledge-as-code.md b/project/v3/manuscripts/revised/04-engineering-knowledge-as-code.md index 083105c..37d739f 100644 --- a/project/v3/manuscripts/revised/04-engineering-knowledge-as-code.md +++ b/project/v3/manuscripts/revised/04-engineering-knowledge-as-code.md @@ -15,7 +15,7 @@ teaching_fixture: "T1 — synthetic editorial source" A city wants to explore whether a four-way intersection could operate more effectively. The engineers have an intended outcome, a candidate signal-selection function, a simple interface idea and several unknowns. A proposed adaptive control strategy could change far more than the timing algorithm: it might affect what detector information is available, how signal commands are represented and which properties need checking. -Someone asks: “What would this change affect?” +Systems engineers use model-based systems engineering (MBSE) and modeling languages such as SysML to explore functions, interfaces, behavior and requirements. A change to phase selection gives us a practical question to ask of those sources. What else should the engineer review? A diagram of connected boxes might be a useful starting point. But the answer depends on what each box means, what each line asserts, and whether the information refers to the same revision of the concept. The useful capability is not drawing a network. It is maintaining engineering information that people and tools can inspect, question and revise. @@ -33,7 +33,7 @@ An **engineering information model** gives important concepts stable identities | INT-IF-001 | Proposed controller-side signal command interface | Compatibility with installed electronics | | INT-MOD-001 | Simplified phase-state model | The behavior of a physical traffic signal | -These records are from a [single fictional T1 source set](../../case-study/source-graph-v1.json), not actual city project documents. Their IDs make it possible to show the same object in different views while preserving a link to its meaning and status. +Each entry has a stable ID in the [intersection source records](../../case-study/source-graph-v1.json). Engineers can use the ID to find the same object in different views and check its meaning and status. A **view** is a purposeful representation of those sources. A functional diagram answers what the controller needs to do. An interface view asks which information crosses a system boundary. A requirements view asks which rules constrain behavior. A behavioral model explores change over time. @@ -45,9 +45,15 @@ Consider the candidate phase-selection function. A functional view might show inputs, decisions and commanded states. A structural view might show the controller and a signal-driving interface. A requirement view might show the no-conflicting-permissive rule. A behavior view might point to a phase state machine, which we will investigate in the next chapter. -SysML v2 can express various system-modeling concepts formally and provide useful textual or graphical representations. Whether it is the right format depends on the engineering environment and the problem. A drawing styled to resemble a SysML view is not automatically a valid SysML model; formal claims require checking the actual language and semantics. The [OMG SysML v2 specification](https://www.omg.org/spec/SysML/2.0) is the appropriate reference for those details. +A SysML model can express structure, behavior and requirements. A team can select the parts of that model that answer a particular engineering question and maintain the definitions under version control. -The educational principle here is independent of one tool: **give engineering meaning a maintained source, and derive useful views from it**. The purpose is to make changes and reviews easier to reason about, not to mandate that every engineering discipline store all its work in one database. +> **Concept** +> +> The source gives the phase-selection function its identity. A functional view shows what that function does. A behavioral model can explore how its state changes over time. Each can refer to the same function. + +> **Explore further** +> +> The [OMG SysML v2 specification](https://www.omg.org/spec/SysML/2.0) defines the modeling language and its semantics. ## Relationships need types, direction and a source @@ -60,7 +66,7 @@ Our small teaching graph includes twelve objects and eight typed relationships. | INT-EXP-001 | examines_model | INT-MOD-001 | The defined experiment is intended to examine the teaching model | | INT-TST-001 | check_targets | INT-REQ-001 | A *proposed check* addresses a property; **no passing result is asserted** | -All four relationships have a direction and an asserted source revision. They exist in the **fictional teaching fixture**. “Recorded” means that someone can find the assertion there; it is not evidence that an actual product has implemented or satisfied it. +Each relationship records its direction and source revision. To find what was actually checked, follow the link to the relevant test and look for its execution result. This distinction becomes especially important with automated reasoning. A relationship saying that a test **targets** a requirement is not a result showing that the requirement **passed**. An arrow saying that a model **represents** a function does not tell us whether the model predicts real physical behavior. @@ -90,7 +96,7 @@ A **knowledge graph** is one way to represent objects and their typed relationsh The two ideas are related but not interchangeable. A graph visualization is not the entire digital thread, and a list of traceability links is not automatically sufficient for engineering reasoning. We need object identity, revision, relation meaning, source provenance and a way to distinguish current information from an unselected proposal. -The planned interactive graph for this chapter should use the T1 source set rather than inventing another dataset for the display. Readers should be able to select a function, inspect an edge, reveal an impact candidate, then return to the original state. The [source records](../../case-study/source-graph-v1.json) and a readable relationship table already support that reasoning without requiring the interactive feature. **The browser graph itself has not yet been implemented.** +The [intersection source graph](../../case-study/source-graph-v1.json) records the direction, meaning and revision of each link. Looking up an edge there gives reviewers a way to check a diagram or an assistant's suggestion. ## Greenfield and brownfield need different questions @@ -102,20 +108,14 @@ A stable identifier helps both situations, but it is never a substitute for know ## What agents can use—and what still needs judgment -An AI agent asked to investigate a proposed change could benefit from structured sources and a typed graph. The relevant context can be selected from the source rather than copied into a very large prompt. Natural language may be the entry point to a question; the controlled engineering definitions must persist beyond a conversation. - -That does not grant an agent authority to change a product. Reading a source, proposing an update, executing an authorized check and accepting a design change are different operations. Later chapters examine how an agent works within those boundaries. +Consider a language-model assistant helping an engineer review the proposed change to phase selection. A plausible suggestion is “review the queue model and the signal command interface.” The engineer can check each part against the [maintained relationship records](../../case-study/source-graph-v1.json). -The immediate result is simpler: **a reader can tell what was recorded, why a relationship exists, and where the engineering conclusion still stops**. - -## From connected knowledge to a useful experiment +The model record `INT-MOD-001` has a `represents` link to the phase-selection function `INT-FUN-001`. That gives the engineer a reason to inspect the model. The change record identifies the interface as a possible impact. Establishing what changes there requires a separate investigation. -We now know where a candidate signal-selection function and its model sit within the information. What we do not know is how that model behaves under different conditions. +Before review, the suggestion is a list in a conversation. After review, the engineering note can say “Review the phase-selection assumptions in INT-MOD-001, revision T1, and investigate the controller interface separately.” A colleague can trace both statements back to their sources. -The next chapter, **Learning Through Models and Prototypes**, uses the same identified model, a small fixed phase sequence and explicit arrivals to investigate that question. The record of a relationship becomes the starting point for a **reproducible experiment**, not a substitute for one. + -**Engineering takeaway:** Treat meaningful engineering information as maintained, identifiable sources. Give every important relation a type, direction, status and provenance. Then use the resulting views to find *review questions*—without mistaking a graph for verified system behavior. - ---- +## From connected knowledge to a useful experiment -*Explore the sources:* [T1 teaching graph](../../case-study/source-graph-v1.json) · [Case study overview](../../case-study/README.md). These are synthetic editorial examples, not authoritative traffic system records. +The review has identified a model and the function it represents. How will its queues respond if one arrival moves to a different part of the signal cycle? [Chapter 5 runs that experiment](05-learning-through-models-and-prototypes.md). diff --git a/project/v3/manuscripts/revised/05-learning-through-models-and-prototypes.md b/project/v3/manuscripts/revised/05-learning-through-models-and-prototypes.md index c81755e..b369b7e 100644 --- a/project/v3/manuscripts/revised/05-learning-through-models-and-prototypes.md +++ b/project/v3/manuscripts/revised/05-learning-through-models-and-prototypes.md @@ -39,10 +39,16 @@ The experiment has **eight ordered slots**. A slot is **not a second** and carri In each slot, new vehicles first join the corresponding queue. During an NS-green slot, at most one NS vehicle can depart; during an EW-green slot, at most one EW vehicle can depart. No one departs during amber or all-red. We record both remaining queues **after** that slot's arrivals and departures. +To sketch an executable version, an engineer can give a language-model assistant the phase sequence, the service capacities and one row of arrivals. Consider a draft that serves the queue before adding the vehicles that just arrived. An engineer can check it against the first slot of scenario A by hand. The north–south vehicle arrives on green and should depart in that slot. Putting arrivals first fixes the discrepancy. The full baseline traces then give the team sixteen rows against which to check the implementation. + The model deliberately excludes turning movements, pedestrians, cycling, failures, real signal timing and driver behavior. Those omissions matter for real engineering, but they do not prevent a carefully bounded calculation from teaching a specific relationship. The fixed phases are also important: **the controller does not react to the arrival pattern**. Adaptive signal control remains a proposed future design question, not a hidden feature of this experiment. +> **Concept** +> +> A queue count is taken after arrivals and service in each slot. A vehicle arriving on its group's last green may leave immediately. One arriving a slot later may still be waiting at the observation horizon. + ## Determinism is the starting point T1 is an ordinary **deterministic software calculation**. Given the same rules, initial queues and arrivals, it produces the same trace in the defined execution environment. That is expected behavior, not a breakthrough delivered by AI or a special modeling platform. @@ -64,6 +70,8 @@ The values are invented inputs, not observed traffic counts. Because the total a Before reading the result, predict what you think will happen to the queues at the end of slot eight. Might the same total demand always produce the same remaining count? + + ## Follow the actual queue updates A little arithmetic is enough to inspect the result. In scenario A, one NS vehicle arrives in slot 1 during NS green and departs immediately. A second NS vehicle arrives in slot 3, during amber; it cannot depart in that slot or during the later EW phases. The EW vehicles arrive in slots 2 and 6; both can depart when EW green becomes available. @@ -87,7 +95,7 @@ The same calculation also reports departures: | Departures in the window | 3 | 2 | | Vehicles still queued | **1** | **2** | -The source model is identified as **INT-MOD-001, revision T1**. We have independently recomputed the table from its declared synthetic inputs for editorial consistency. The result is a model calculation, **not** an executed Astro user experience or a real signal-controller experiment. +The two baseline traces identify **INT-MOD-001, revision T1**. In the browser exercise, moving one arrival creates a new scenario for this same model. Compare its rows with the original to find the first slot at which the queues diverge. ## What does that comparison establish? @@ -111,24 +119,28 @@ The **engineering environment** evolves with that decision: clearer model assump ## Design the feedback around the engineering question -For T1, negative or fractional arrival counts, unknown phase labels and missing slots are invalid. A responsible implementation should reject such inputs instead of creating an animation that looks plausible. The existing [editorial model check](../../case-study/MODEL-CHECK.md) examines T1's declared calculations; it does not validate a real controller. +T1 expects a nonnegative integer count for each group in each slot and a known phase. The model rejects an incomplete run or an invalid count before it reports a queue. A bounded development loop could now be: propose a change to the model or input handling, run the calculation, evaluate fixed behavioral and invalid-input checks, inspect a failure, and correct the implementation. If those checks are sufficiently independent of the change being made, an agent could work through several iterations without asking a human to direct every step. That does **not** make all green tests a product approval. If the criteria encode the wrong requirements, or if the model leaves out an important physical interaction, the loop may converge on the wrong answer. Engineers therefore also assess whether the model and tests represent the system question—and use other evidence when they do not. -The eventual browser interaction should derive its traces, tables and charts from a single model definition rather than duplicate calculations in presentation code. The ability to close a rapid feedback loop is the opportunity; rerunning an unchanged deterministic model is only its starting condition. +## Record what the experiment changed -## The data is now the next engineering problem +The maintained source identifies `INT-MOD-001`, revision T1, and the published inputs identify the two baseline scenarios. An observation also needs the particular input change and the point at which the queue was counted. -Chapter 4 supplied the information needed to *identify* what is related. This chapter supplied a bounded calculation with visible assumptions and results. +In a worked LLM-assisted review, the engineer starts with a proposed note, “The new pattern improves traffic.” The engineer checks the trace and records a more precise observation. -The next step is not automatically to choose a controller. It is to decide how the resulting data can be trusted, annotated, compared and reused. What if another file reports a “better” result but provides no model version or units? +> In scenario B, moving one north–south arrival from slot 3 to slot 2 leaves one vehicle queued after slot 8, compared with two in the original B. Model INT-MOD-001, revision T1, fixed phases. -That is the investigation in **Engineering Data: From Measurements to Decisions**. +The colleague maintaining the experiment can reproduce that observation and ask whether the difference persists over a longer horizon. -**Engineering takeaway:** Select models for the question at hand, make the rules and calculations inspectable, and interpret only the claims that the model's scope permits. A good model creates an opportunity to learn—and tells the team what it must investigate elsewhere. +> **Explore further** +> +> Compare the [complete baseline trace](../../case-study/trace-v1.csv) with the [calculation and its assumptions](../../case-study/MODEL-CHECK.md) when reviewing an observation. ---- + + +## The data is now the next engineering problem -*Inspect the case:* [T1 inputs and rules](../../case-study/model-inputs-v1.json) · [Complete computed trace](../../case-study/trace-v1.csv) · [Calculation and limitations](../../case-study/MODEL-CHECK.md). +A colleague sends another queue count. Which model revision, input pattern and observation horizon would make it comparable with the one you recorded? [Chapter 6 follows engineering data from measurements to decisions](06-engineering-data-from-measurements-to-decisions.md). diff --git a/scripts/remark-v3-links.mjs b/scripts/remark-v3-links.mjs index 2ec6d47..0518166 100644 --- a/scripts/remark-v3-links.mjs +++ b/scripts/remark-v3-links.mjs @@ -1,12 +1,27 @@ import path from 'node:path'; import { existsSync } from 'node:fs'; +const cardTypes = new Map([['Concept', 'concept'], ['Explore further', 'reading']]); export default function v3Links() { return (tree, file) => { const name = String(file.path).replaceAll('\\', '/'); const marker = '/project/v3/manuscripts/revised/'; if (!name.includes(marker)) return; const root = name.slice(0, name.indexOf(marker)); + const learningChapter = tree.children.some(node => node.type === 'html' && //.test(node.value)); function visit(node) { + if (learningChapter && node.type === 'table') { + // The reading layout scrolls wide tables horizontally on narrow screens. + node.data ??= {}; + node.data.hProperties = { ...node.data.hProperties, tabIndex: 0 }; + } + if (node.type === 'blockquote') { + const label = node.children[0]?.children; + const title = label?.length === 1 && label[0].type === 'strong' && label[0].children[0]?.value; + const cardType = cardTypes.get(title); + if (cardType) { + node.data = { ...node.data, hName: 'aside', hProperties: { className: ['learning-card', cardType], ariaLabel: title } }; + } + } if ((node.type === 'link' || node.type === 'definition') && !/^(?:[a-z]+:|#|\/)/i.test(node.url)) { const [target, fragment] = node.url.split('#'); const resolved = path.resolve(path.dirname(name), target); diff --git a/site/src/components/CourseOverview.astro b/site/src/components/CourseOverview.astro index ac754cb..2c36d1d 100644 --- a/site/src/components/CourseOverview.astro +++ b/site/src/components/CourseOverview.astro @@ -4,7 +4,7 @@ import { parts } from "../data/v3-course";

The course · Fifteen chapters

Begin with the changing engineering paradigm, then follow one fictional traffic intersection from uncertain intent to an integrated product and the engineering capabilities needed to sustain it.

-

All fifteen chapters are available below following initial author review. The examples are fictional teaching cases; interactive V3 graph and model tools remain in development. Earlier lessons remain available separately.

+

Chapters 1–5 include short knowledge checks. In Chapter 5 you can change a vehicle’s arrival and see how the queue develops. Earlier lessons are available separately.

{parts.map(part =>

{part.title}

    {part.chapters.map(chapter =>
  1. )}
)}