Electrical & Electronics Engineering Electrical & Electronics Engineering major 100% Free Open Access
Chapter 7 • Theory & Derivations

Unit 7: Data Acquisition Systems (DAQ): Multiplexing, Sample-and-Hold, and Instrumentation Amplifiers

Comprehensive study of Data Acquisition Systems (DAQ): Multiplexing, Sample-and-Hold, and Instrumentation Amplifiers, incorporating analytical formulations, simulation frameworks, and quantitative engineering solutions.

§7.1 Foundational Principles & Curriculum Scope: Data Acquisition Systems (DAQ): Multiplexing, Sample-and-Hold, and Instrumentation Amplifiers

Unit 7 — Automated instruments and measurement software

Conceptual thread: Make automated experiments auditable and safe. Application scenario: A simulated bench instrument controlled through a local command protocol.

Why this topic matters

Automation can repeat a procedure precisely and repeat a mistake at scale. Instrument state, query ordering, timeouts, metadata and error handling must be designed alongside the measurement. These lessons use local simulated commands; no real instrument control or network access is required. The engineering goal is a measurement whose physical interpretation can survive an independent check. The activity is intentionally model-based: any numbers in assignments, datasets or simulator plots are invented for educational purposes. In actual equipment, frequency-dependent calibration, laboratory safety and environmental ratings would require external evidence.

Learning outcomes

By the end of this unit, you should be able to construct the principal measurement relation and explain its limits; reproduce two independent numerical results; identify at least one coherent alternative explanation for an apparent trend; select the data and metadata needed for a reproducible report; and design a measurement assurance check that does not assume the result it intends to confirm. The last outcome is central: a collection of accurate-looking digital values is not itself a valid measurement.

Suggested sequence

Read the first lesson as a model-building exercise, the second as an instrument or method comparison, the third as an error-analysis problem, and the fourth as a verification and decision exercise. Keep an equation notebook with a units check, an uncertainty table and a record of any assumptions you changed. Then solve the [unit assessment](../assessments/unit-07.html), complete the [integrated project](../projects/unit-07.html) and explore the [interactive model](../simulations/model-07.html).

Model interpretation

The simulator for this unit is Acquisition throughput and command overhead. Idealized single instrument with per-command latency and fixed batch overhead; no genuine SCPI transport. It varies only the mathematical quantities visible in its controls; a plotted result does not constitute an equipment qualification or measured sample. For a meaningful parameter study, save the default values, change one input at a time, reproduce a point independently and then look for a counterexample outside the ideal model. The derivative of the curve, not merely its appearance, is often the best clue about sensitivity and where resolution becomes inadequate.

Topics

  • [Lesson 7.1 — SCPI command parsing and instrument state](../lessons/U07-L01-scpi-command-parsing-and-instrument-state.html)
  • [Lesson 7.2 — Timeouts, retries and idempotent acquisition](../lessons/U07-L02-timeouts-retries-and-idempotent-acquisition.html)
  • [Lesson 7.3 — Calibration metadata, provenance and schema design](../lessons/U07-L03-calibration-metadata-provenance-and-schema-design.html)
  • [Lesson 7.4 — Automated test validation and regression checks](../lessons/U07-L04-automated-test-validation-and-regression-checks.html)

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

§7.2 SCPI command parsing and instrument state

7.1 — SCPI command parsing and instrument state

Unit: Automated instruments and measurement software Prerequisites: introductory electronics, calculus, signals and probability. Type of evidence: mathematical and synthetic; no physical hardware was tested. Estimated study time: 75–110 minutes including the calculation and verification challenge.

Engineering question and underlying phenomenon

SCPI is a command-language family used by many instruments, but exact commands, state persistence and transport settings depend on the device. A command that changes range may invalidate the previous calibration selection or trigger status. Queries can return old data if the program assumes instantaneous completion. A robust client treats the instrument as a state machine with a documented initialization and cleanup procedure.

Within this unit, the example application is a simulated bench instrument controlled through a local command protocol. A useful outcome is not merely a number: the reader must be able to decide what electrical or physical quantity is inferred, how the inference depends on a reference, and which alternative mechanisms might reproduce the observation. A calibrated indication is still conditional on the quantity being measured, reference range, environmental state and acquisition protocol. Consider whether the experiment will distinguish the input phenomenon from the measurement chain itself. If not, a second observable or controlled intervention is required.

Governing model

Central relation: Example conceptual sequence: reset or known preset → select function/range → configure trigger → initiate → wait for completion → read → check error queue.

Interpret every mathematical symbol before substitution. Express frequencies in hertz, durations in seconds, temperatures in the convention required by the equation, and angles in degrees or radians as specified. When an inverse operation is needed, verify that it is unique over the operational range. For ratio measurements, verify that the denominator cannot approach zero; for logarithmic levels, identify the reference quantity, detection bandwidth and impedance convention. More reported digits cannot compensate for an undefined physical variable.

Model development

Classify the relation as a direct physical law, an approximation derived under controlled assumptions, or an empirical calibration curve. Write the independent and dependent variables and check the direction of the physical mechanism. In particular, look for a relevant limiting case: no input, very large impedance, long observation, or an ideal reference.

Specific context: An automated measurement is a sequence of instrument-state transitions and evidence artifacts, not a string of commands that happens to run once. Every retry and exception needs a policy before the run begins. Even when the equation is correct, it is valid only under its stated physical model. A good laboratory report differentiates assumptions adopted to make a model solvable, experimentally checked operating limits and parameters that remain completely unknown. The first two can be defended; the third must be stated as an unresolved source of uncertainty rather than assigned an attractive but unjustified small value.

Detailed worked calculation

A simulated DMM accepts :CONF:VOLT:DC 10 and :READ? but will issue an error if READ is requested without a configured function. This is a teaching mock-up, not a promise of syntax for a particular model.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Important departures from the ideal model

Some real instruments buffer output, require newlines or termination characters, and have model-specific command hierarchies. Sending undocumented reset commands can change safety-relevant output states.

It is useful to classify the departures by where they enter. Errors before conversion can distort the physical input; errors in amplification or digitization change the measured indication; timebase and software errors corrupt event ordering; calibration errors convert an otherwise faithful electrical reading to an incorrect physical quantity. The appropriate check differs across these cases. Repeated acquisition on the same unmodified chain can measure repeatability but cannot expose every persistent bias. In practice one should prioritize a small number of physically plausible error sources over a long, unweighted list of hypothetical effects.

Practical verification strategy

Test commands against a simulator and a version-controlled device profile before connecting a physical bench device under supervision. Use a second method or reference only when its systematic errors are sufficiently independent. Record conditions that make the check reproducible: model revision, input data, ranges, reference conditions, clock and sample rate, software version, arithmetic precision and the date of the hypothetical experiment. If equipment were involved, the methods would also need actual safety ratings and personnel authorization. The offline simulations in this book test formulas, not equipment compliance.

Three graded exercises

Exercise A — reproduce and interpret (6 marks). Reconstruct the numerical example from the governing relation Example conceptual sequence: reset or known preset → select function/range → configure trigger → initiate → wait for completion → read → check error queue.. Show the dimensional conversion, leading intermediate values and units. Explain the scope of the result in one sentence, and identify one missing uncertainty term. For full credit, the interpretation must not confuse uncertainty with an operating tolerance or a variation of the physical input.

Exercise B — discriminate between explanations (8 marks). Design the expected response to three faults: unexpected units, timeout, and an error queue that is nonempty after a measurement. Prepare a two-column table comparing the ideal physical prediction with a competing measurement-chain explanation. Name the variable you would change, the response you would record and the expected observation that distinguishes the hypotheses. A plan that changes two variables at once without controlling confounders does not earn full marks.

Exercise C — construct a defensible measurement plan (10 marks). Design a software-only analysis or a supervised low-energy verification compatible with this topic. Identify one reference quantity, two controlled operating points and the raw evidence required for another person to reproduce the result. State at least two ways your inference might fail. Specify how you would report an inconclusive result instead of force-fitting a conformance label.

Answer guide and criteria

For A, the worked example above supplies an independent numeric target and a way to audit the physical units. The model is accepted only over the assumptions used in its derivation; a final displayed number without an explanation of its meaning is incomplete. For B, a correct response evaluates the parameter dependence explicitly rather than saying only that a quantity “goes up” or “goes down.” If an input is multiplied by two, its effect on the output must be recomputed with the actual nonlinear or proportional relation instead of assuming the whole result doubles. For C, full credit requires a check capable of finding the suggested fault, a data provenance note and a decision rule written before inspecting the result. Common-reference correlations, environmental drift and software interpretation need attention when relevant.

Extension: deeper engineering reasoning

Use the supplied example as an internal consistency check, then change the parameter most likely to reveal a violated approximation. Implement the change using the [interactive model for Unit 7](../simulations/model-07.html) if that model includes the relevant variable; otherwise calculate in a spreadsheet. The model is a unit-level demonstration and may not simulate the exact physical relation of this particular lesson. Compare the two predicted cases, discuss at least one omitted effect and specify an independent observation that could reject your preferred physical explanation. Keep all synthetic calculations clearly labeled in any exported report.

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

§7.3 Timeouts, retries and idempotent acquisition

7.2 — Timeouts, retries and idempotent acquisition

Unit: Automated instruments and measurement software Prerequisites: introductory electronics, calculus, signals and probability. Type of evidence: mathematical and synthetic; no physical hardware was tested. Estimated study time: 75–110 minutes including the calculation and verification challenge.

Engineering question and underlying phenomenon

Communication timeouts are ambiguous: the device may have executed the command but the response may be lost. Blindly resending an initiation command can trigger two acquisitions or advance a sequence. Queries, configuration commands and potentially destructive operations have different retry semantics. The acquisition protocol should correlate each requested operation with an identifier and preserve raw communication logs without exposing credentials.

Within this unit, the example application is a simulated bench instrument controlled through a local command protocol. A useful outcome is not merely a number: the reader must be able to decide what electrical or physical quantity is inferred, how the inference depends on a reference, and which alternative mechanisms might reproduce the observation. A calibrated indication is still conditional on the quantity being measured, reference range, environmental state and acquisition protocol. Consider whether the experiment will distinguish the input phenomenon from the measurement chain itself. If not, a second observable or controlled intervention is required.

Governing model

Central relation: Reliability illustration: if independent success probability per attempt is p, chance of success within n tries is 1−(1−p)^n (only for truly independent safe retries).

Interpret every mathematical symbol before substitution. Express frequencies in hertz, durations in seconds, temperatures in the convention required by the equation, and angles in degrees or radians as specified. When an inverse operation is needed, verify that it is unique over the operational range. For ratio measurements, verify that the denominator cannot approach zero; for logarithmic levels, identify the reference quantity, detection bandwidth and impedance convention. More reported digits cannot compensate for an undefined physical variable.

Measurement-chain diagnosis

Draw a signal-chain sketch from the physical input through transduction, cabling, gain, filtering, conversion, timing and calculation. Mark any stage that can change the quantity without changing the physical phenomenon. The measurement-chain sketch is often more useful than listing nominal resolution because it reveals where correction or calibration can be placed.

Specific context: An automated measurement is a sequence of instrument-state transitions and evidence artifacts, not a string of commands that happens to run once. Every retry and exception needs a policy before the run begins. Even when the equation is correct, it is valid only under its stated physical model. A good laboratory report differentiates assumptions adopted to make a model solvable, experimentally checked operating limits and parameters that remain completely unknown. The first two can be defended; the third must be stated as an unresolved source of uncertainty rather than assigned an attractive but unjustified small value.

Detailed worked calculation

For a harmless status query with p=0.9, two independent attempts would succeed with probability 0.99. This does not authorize repeating an action whose side effects may already have occurred.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Important departures from the ideal model

Failure probability is rarely independent during an outage, and retrying can worsen overloaded instruments or networks. Device outputs should never be changed automatically after an uncertain timeout without verified state.

It is useful to classify the departures by where they enter. Errors before conversion can distort the physical input; errors in amplification or digitization change the measured indication; timebase and software errors corrupt event ordering; calibration errors convert an otherwise faithful electrical reading to an incorrect physical quantity. The appropriate check differs across these cases. Repeated acquisition on the same unmodified chain can measure repeatability but cannot expose every persistent bias. In practice one should prioritize a small number of physically plausible error sources over a long, unweighted list of hypothetical effects.

Practical verification strategy

Separate idempotent readback operations from side-effecting actions; implement bounded retry with exponential backoff and a safe stop state. Use a second method or reference only when its systematic errors are sufficiently independent. Record conditions that make the check reproducible: model revision, input data, ranges, reference conditions, clock and sample rate, software version, arithmetic precision and the date of the hypothetical experiment. If equipment were involved, the methods would also need actual safety ratings and personnel authorization. The offline simulations in this book test formulas, not equipment compliance.

Three graded exercises

Exercise A — reproduce and interpret (6 marks). Reconstruct the numerical example from the governing relation Reliability illustration: if independent success probability per attempt is p, chance of success within n tries is 1−(1−p)^n (only for truly independent safe retries).. Show the dimensional conversion, leading intermediate values and units. Explain the scope of the result in one sentence, and identify one missing uncertainty term. For full credit, the interpretation must not confuse uncertainty with an operating tolerance or a variation of the physical input.

Exercise B — discriminate between explanations (8 marks). If attempts are correlated, show why the 0.99 claim can fail, and propose a log field that makes duplicate acquisitions detectable. Prepare a two-column table comparing the ideal physical prediction with a competing measurement-chain explanation. Name the variable you would change, the response you would record and the expected observation that distinguishes the hypotheses. A plan that changes two variables at once without controlling confounders does not earn full marks.

Exercise C — construct a defensible measurement plan (10 marks). Design a software-only analysis or a supervised low-energy verification compatible with this topic. Identify one reference quantity, two controlled operating points and the raw evidence required for another person to reproduce the result. State at least two ways your inference might fail. Specify how you would report an inconclusive result instead of force-fitting a conformance label.

Answer guide and criteria

For A, the worked example above supplies an independent numeric target and a way to audit the physical units. The model is accepted only over the assumptions used in its derivation; a final displayed number without an explanation of its meaning is incomplete. For B, a correct response evaluates the parameter dependence explicitly rather than saying only that a quantity “goes up” or “goes down.” If an input is multiplied by two, its effect on the output must be recomputed with the actual nonlinear or proportional relation instead of assuming the whole result doubles. For C, full credit requires a check capable of finding the suggested fault, a data provenance note and a decision rule written before inspecting the result. Common-reference correlations, environmental drift and software interpretation need attention when relevant.

Extension: deeper engineering reasoning

Contrast two independent fault hypotheses and identify a parameter change that makes their predicted results diverge. Implement the change using the [interactive model for Unit 7](../simulations/model-07.html) if that model includes the relevant variable; otherwise calculate in a spreadsheet. The model is a unit-level demonstration and may not simulate the exact physical relation of this particular lesson. Compare the two predicted cases, discuss at least one omitted effect and specify an independent observation that could reject your preferred physical explanation. Keep all synthetic calculations clearly labeled in any exported report.

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

§7.4 Calibration metadata, provenance and schema design

7.3 — Calibration metadata, provenance and schema design

Unit: Automated instruments and measurement software Prerequisites: introductory electronics, calculus, signals and probability. Type of evidence: mathematical and synthetic; no physical hardware was tested. Estimated study time: 75–110 minutes including the calculation and verification challenge.

Engineering question and underlying phenomenon

A data file can be complete and still lack a defensible link to the measurement system that produced it. Essential metadata include units, sensing channel, timestamp clock source, calibration record identifier, range, revision, environmental conditions and processing versions. Store raw samples immutably; transformations should produce derived datasets with a reproducible lineage. A checksum detects changed bytes but cannot establish that the calibration record was correct.

Within this unit, the example application is a simulated bench instrument controlled through a local command protocol. A useful outcome is not merely a number: the reader must be able to decide what electrical or physical quantity is inferred, how the inference depends on a reference, and which alternative mechanisms might reproduce the observation. A calibrated indication is still conditional on the quantity being measured, reference range, environmental state and acquisition protocol. Consider whether the experiment will distinguish the input phenomenon from the measurement chain itself. If not, a second observable or controlled intervention is required.

Governing model

Central relation: For a linear calibration y=a+bx, uncertainty from a,b,x requires sensitivity coefficients and their covariance.

Interpret every mathematical symbol before substitution. Express frequencies in hertz, durations in seconds, temperatures in the convention required by the equation, and angles in degrees or radians as specified. When an inverse operation is needed, verify that it is unique over the operational range. For ratio measurements, verify that the denominator cannot approach zero; for logarithmic levels, identify the reference quantity, detection bandwidth and impedance convention. More reported digits cannot compensate for an undefined physical variable.

Quantitative uncertainty analysis

Differentiate the output with respect to the key input parameters where possible. Absolute uncertainties are appropriate for an additive voltage offset; relative uncertainties are often convenient for proportional scale errors. Correlated calibration terms must not be treated as independent contributions simply because they appear in different datasheets.

Specific context: An automated measurement is a sequence of instrument-state transitions and evidence artifacts, not a string of commands that happens to run once. Every retry and exception needs a policy before the run begins. Even when the equation is correct, it is valid only under its stated physical model. A good laboratory report differentiates assumptions adopted to make a model solvable, experimentally checked operating limits and parameters that remain completely unknown. The first two can be defended; the third must be stated as an unresolved source of uncertainty rather than assigned an attractive but unjustified small value.

Detailed worked calculation

A sensor record stores raw ADC code 2050, reference 3.3 V and 12-bit ADC resolution. The ideal unipolar estimate is about 2050×3.3/4095≈1.652 V. Without a calibration ID and applied gain/offset it is not yet a traceable physical measurand.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Important departures from the ideal model

The code-to-voltage example assumes endpoint mapping to 4095 and ignores architecture-specific offset and transfer conventions. A timestamp without timezone or clock-domain annotation is ambiguous for distributed data.

It is useful to classify the departures by where they enter. Errors before conversion can distort the physical input; errors in amplification or digitization change the measured indication; timebase and software errors corrupt event ordering; calibration errors convert an otherwise faithful electrical reading to an incorrect physical quantity. The appropriate check differs across these cases. Repeated acquisition on the same unmodified chain can measure repeatability but cannot expose every persistent bias. In practice one should prioritize a small number of physically plausible error sources over a long, unweighted list of hypothetical effects.

Practical verification strategy

Define a JSON schema with required units, calibration version, raw/derived status and quality flags; validate all records prior to plotting. Use a second method or reference only when its systematic errors are sufficiently independent. Record conditions that make the check reproducible: model revision, input data, ranges, reference conditions, clock and sample rate, software version, arithmetic precision and the date of the hypothetical experiment. If equipment were involved, the methods would also need actual safety ratings and personnel authorization. The offline simulations in this book test formulas, not equipment compliance.

Three graded exercises

Exercise A — reproduce and interpret (6 marks). Reconstruct the numerical example from the governing relation For a linear calibration y=a+bx, uncertainty from a,b,x requires sensitivity coefficients and their covariance.. Show the dimensional conversion, leading intermediate values and units. Explain the scope of the result in one sentence, and identify one missing uncertainty term. For full credit, the interpretation must not confuse uncertainty with an operating tolerance or a variation of the physical input.

Exercise B — discriminate between explanations (8 marks). Choose a metadata field to invalidate deliberately and demonstrate how the reader should reject or quarantine the record. Prepare a two-column table comparing the ideal physical prediction with a competing measurement-chain explanation. Name the variable you would change, the response you would record and the expected observation that distinguishes the hypotheses. A plan that changes two variables at once without controlling confounders does not earn full marks.

Exercise C — construct a defensible measurement plan (10 marks). Design a software-only analysis or a supervised low-energy verification compatible with this topic. Identify one reference quantity, two controlled operating points and the raw evidence required for another person to reproduce the result. State at least two ways your inference might fail. Specify how you would report an inconclusive result instead of force-fitting a conformance label.

Answer guide and criteria

For A, the worked example above supplies an independent numeric target and a way to audit the physical units. The model is accepted only over the assumptions used in its derivation; a final displayed number without an explanation of its meaning is incomplete. For B, a correct response evaluates the parameter dependence explicitly rather than saying only that a quantity “goes up” or “goes down.” If an input is multiplied by two, its effect on the output must be recomputed with the actual nonlinear or proportional relation instead of assuming the whole result doubles. For C, full credit requires a check capable of finding the suggested fault, a data provenance note and a decision rule written before inspecting the result. Common-reference correlations, environmental drift and software interpretation need attention when relevant.

Extension: deeper engineering reasoning

Record a small uncertainty table and calculate which source dominates at the numerical operating point. Implement the change using the [interactive model for Unit 7](../simulations/model-07.html) if that model includes the relevant variable; otherwise calculate in a spreadsheet. The model is a unit-level demonstration and may not simulate the exact physical relation of this particular lesson. Compare the two predicted cases, discuss at least one omitted effect and specify an independent observation that could reject your preferred physical explanation. Keep all synthetic calculations clearly labeled in any exported report.

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

§7.5 Automated test validation and regression checks

7.4 — Automated test validation and regression checks

Unit: Automated instruments and measurement software Prerequisites: introductory electronics, calculus, signals and probability. Type of evidence: mathematical and synthetic; no physical hardware was tested. Estimated study time: 75–110 minutes including the calculation and verification challenge.

Engineering question and underlying phenomenon

An automatic test should verify both scientific behavior and software behavior. Unit tests check mathematical functions; integration tests check command ordering and parser behavior; regression data can catch unintended changes. A simulated instrument cannot validate real wiring, range safety or actual calibration. The strongest tests intentionally provoke invalid inputs, out-of-order events, dropped samples and stale state, rather than exercising only one normal run.

Within this unit, the example application is a simulated bench instrument controlled through a local command protocol. A useful outcome is not merely a number: the reader must be able to decide what electrical or physical quantity is inferred, how the inference depends on a reference, and which alternative mechanisms might reproduce the observation. A calibrated indication is still conditional on the quantity being measured, reference range, environmental state and acquisition protocol. Consider whether the experiment will distinguish the input phenomenon from the measurement chain itself. If not, a second observable or controlled intervention is required.

Governing model

Central relation: For a known transfer y=ax+b, a simple residual test is e=|ycomputed−yexpected| with threshold chosen from model precision, not arbitrary display digits.

Interpret every mathematical symbol before substitution. Express frequencies in hertz, durations in seconds, temperatures in the convention required by the equation, and angles in degrees or radians as specified. When an inverse operation is needed, verify that it is unique over the operational range. For ratio measurements, verify that the denominator cannot approach zero; for logarithmic levels, identify the reference quantity, detection bandwidth and impedance convention. More reported digits cannot compensate for an undefined physical variable.

Engineering verification

Translate the mathematical relation into a verification protocol that another engineer could repeat. List setup conditions, retained raw data, reference or second method, validity range and the observation that would falsify the conclusion. A protocol that can only reproduce the expected result has insufficient diagnostic power.

Specific context: An automated measurement is a sequence of instrument-state transitions and evidence artifacts, not a string of commands that happens to run once. Every retry and exception needs a policy before the run begins. Even when the equation is correct, it is valid only under its stated physical model. A good laboratory report differentiates assumptions adopted to make a model solvable, experimentally checked operating limits and parameters that remain completely unknown. The first two can be defended; the third must be stated as an unresolved source of uncertainty rather than assigned an attractive but unjustified small value.

Detailed worked calculation

For the known model y=2x+1 at x=3, expected y=7. A simulation returning 7.0000001 may be within a numerical tolerance of 10^-5; a result of 7.1 fails. The tolerance must be chosen with expected floating-point and physics-model behavior in mind.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Important departures from the ideal model

Passing tests does not establish external accuracy unless independent measured reference cases are included. Snapshots of previous incorrect outputs can preserve bugs just as effectively as correct behavior.

It is useful to classify the departures by where they enter. Errors before conversion can distort the physical input; errors in amplification or digitization change the measured indication; timebase and software errors corrupt event ordering; calibration errors convert an otherwise faithful electrical reading to an incorrect physical quantity. The appropriate check differs across these cases. Repeated acquisition on the same unmodified chain can measure repeatability but cannot expose every persistent bias. In practice one should prioritize a small number of physically plausible error sources over a long, unweighted list of hypothetical effects.

Practical verification strategy

Maintain a test matrix covering mathematical assertions, malformed input, timeouts, state transitions, file integrity and human-readable reports. Use a second method or reference only when its systematic errors are sufficiently independent. Record conditions that make the check reproducible: model revision, input data, ranges, reference conditions, clock and sample rate, software version, arithmetic precision and the date of the hypothetical experiment. If equipment were involved, the methods would also need actual safety ratings and personnel authorization. The offline simulations in this book test formulas, not equipment compliance.

Three graded exercises

Exercise A — reproduce and interpret (6 marks). Reconstruct the numerical example from the governing relation For a known transfer y=ax+b, a simple residual test is e=|ycomputed−yexpected| with threshold chosen from model precision, not arbitrary display digits.. Show the dimensional conversion, leading intermediate values and units. Explain the scope of the result in one sentence, and identify one missing uncertainty term. For full credit, the interpretation must not confuse uncertainty with an operating tolerance or a variation of the physical input.

Exercise B — discriminate between explanations (8 marks). Develop a fault injection that causes a trigger to be missed while the data transfer succeeds; specify how the report records the distinction. Prepare a two-column table comparing the ideal physical prediction with a competing measurement-chain explanation. Name the variable you would change, the response you would record and the expected observation that distinguishes the hypotheses. A plan that changes two variables at once without controlling confounders does not earn full marks.

Exercise C — construct a defensible measurement plan (10 marks). Design a software-only analysis or a supervised low-energy verification compatible with this topic. Identify one reference quantity, two controlled operating points and the raw evidence required for another person to reproduce the result. State at least two ways your inference might fail. Specify how you would report an inconclusive result instead of force-fitting a conformance label.

Answer guide and criteria

For A, the worked example above supplies an independent numeric target and a way to audit the physical units. The model is accepted only over the assumptions used in its derivation; a final displayed number without an explanation of its meaning is incomplete. For B, a correct response evaluates the parameter dependence explicitly rather than saying only that a quantity “goes up” or “goes down.” If an input is multiplied by two, its effect on the output must be recomputed with the actual nonlinear or proportional relation instead of assuming the whole result doubles. For C, full credit requires a check capable of finding the suggested fault, a data provenance note and a decision rule written before inspecting the result. Common-reference correlations, environmental drift and software interpretation need attention when relevant.

Extension: deeper engineering reasoning

Define a pass/inconclusive/fail rule using a predeclared metric and record environmental and software versions. Implement the change using the [interactive model for Unit 7](../simulations/model-07.html) if that model includes the relevant variable; otherwise calculate in a spreadsheet. The model is a unit-level demonstration and may not simulate the exact physical relation of this particular lesson. Compare the two predicted cases, discuss at least one omitted effect and specify an independent observation that could reject your preferred physical explanation. Keep all synthetic calculations clearly labeled in any exported report.

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

§7.6 Engineering Design Project & Numerical Investigation: Data Acquisition Systems (DAQ): Multiplexing, Sample-and-Hold, and Instrumentation Amplifiers

Project 7 — Automated instruments and measurement software: reproducible measurement dossier

Scenario. A simulated bench instrument controlled through a local command protocol. Status: synthetic design exercise with no physical implementation. Deliverable: a 5–8 page engineering dossier plus a numerical notebook or spreadsheet and reproducible model output. This project evaluates reasoning and communication, not ability to claim certification.

Part 1 — measurand and system architecture

Specify the intended measurand, realistic operating range and the decision it supports. Draw a signal chain identifying physical source, sensor or test interface, conditioning, clock, digitization and software. Explain which parts should be independently calibrated. Build two competing explanations for a suspicious result, one physical and one instrumentation-related. The two models must predict different responses to at least one controllable input.

Part 2 — baseline and sensitivity

Open the [interactive model for Unit 7](../simulations/model-07.html) and save its complete default inputs. Export the calculated sweep. Independently reproduce three points using the mathematical relation identified in the model. Vary at least two parameters in separate runs and compare the direction and magnitude of their effects. The response should be represented by a labeled graph and a table; neither may be presented as observed field measurements.

Part 3 — model discrepancy and uncertainty

Introduce one nonideal process grounded in the lessons: Failure probability is rarely independent during an outage, and retrying can worsen overloaded instruments or networks. Device outputs should never be changed automatically after an uncertain timeout without verified state.. State the size and justification of every invented parameter. Compute a first-order sensitivity where possible and distinguish a correction from a standard uncertainty. Identify a common-reference or shared-clock mechanism that could correlate results. Explain why repeated acquisitions on the same setup might fail to uncover this mechanism.

Part 4 — validation against an alternative mechanism

Construct a test that would tell the main model apart from the following limitation: Passing tests does not establish external accuracy unless independent measured reference cases are included. Snapshots of previous incorrect outputs can preserve bugs just as effectively as correct behavior.. Identify the reference observation, intervention, evidence to retain and what result would make the conclusion inconclusive. Specify an acceptance or escalation rule before inspecting results. Compare a plausible success case and a boundary case under that same rule.

Part 5 — audit-quality communication

Present a conclusion with three headings: supported by the synthetic model, unverified in a physical instrument, and next evidence required. Include raw data, equations, units, assumption register, uncertainty budget, exported CSV, software version and short reproducibility instructions. Do not include fabricated calibration certificates, genuine-looking measurement signatures or a suggestion that any component was tested in an accredited laboratory.

Marking rubric

20% physics and sensing-chain architecture; 20% reproducible calculations; 20% error modeling and uncertainty; 20% discrimination between fault hypotheses; 20% accurate reporting and evidence hygiene. A beautiful graph with no independent calculation does not pass. An overly confident conclusion must be revised even when its central arithmetic is correct.

Scope and safety. Every dataset in this book is synthetic. Models are intended for offline learning, and do not authorize connection to energized power apparatus, unsafe test voltages, industrial machinery, RF transmitters, clinical devices, or safety-critical control systems. Consult qualified laboratory personnel, current equipment manuals, local rules and appropriate device ratings before any physical work. No certification or calibration is claimed.

THREE WORKED QUESTIONS

Step-by-Step Electrical Measurements & Instrumentation II Solutions

Three original questions connect calculations, definitions and interpretation. Open each solution to follow the reasoning.

Solved Problem Example 7.1: Problem 7.1: Detailed worked calculation

A simulated DMM accepts :CONF:VOLT:DC 10 and :READ? but will issue an error if READ is requested without a configured function. This is a teaching mock-up, not a promise of syntax for a particular model.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Solved Problem Example 7.2: Problem 7.2: Detailed worked calculation

For a harmless status query with p=0.9, two independent attempts would succeed with probability 0.99. This does not authorize repeating an action whose side effects may already have occurred.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Solved Problem Example 7.3: Problem 7.3: Detailed worked calculation

A sensor record stores raw ADC code 2050, reference 3.3 V and 12-bit ADC resolution. The ideal unipolar estimate is about 2050×3.3/4095≈1.652 V. Without a calibration ID and applied gain/offset it is not yet a traceable physical measurand.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Solved Problem Example 7.4: Problem 7.4: Detailed worked calculation

For the known model y=2x+1 at x=3, expected y=7. A simulation returning 7.0000001 may be within a numerical tolerance of 10^-5; a result of 7.1 fails. The tolerance must be chosen with expected floating-point and physics-model behavior in mind.

Interpretation. This calculation is a model prediction under the stated conditions, not a newly observed experimental result. To audit it, write the substituted numbers next to their units, calculate without premature rounding, and estimate the order of magnitude before accepting the final digits. Distinguish a predicted change caused by a controlled parameter from an apparent change caused by sensor gain, instrument timing, filtering or normalization. If the expected sign of a correction is reversed, review the signal flow and physical reference before changing the equation to match the desired answer.

Checks that should accompany the numerical result

First, change one input while keeping the remaining assumptions fixed and confirm the output moves in the physically expected direction. Second, calculate the result through a different arrangement of the same governing law or a limiting-case approximation. Third, state the span over which the model has been calibrated or independently verified. Fourth, document whether the result is meant to represent an instantaneous value, an RMS estimate, an average over a defined interval or a statistical bound. These distinctions affect what can legitimately be compared with a manufacturer's specification.

Solved Problem Example 7.5: Problem 7.5: Prompt. Define the unknown quantity and the physical equation fir

Prompt. Define the unknown quantity and the physical equation first, then state the numerical or symbolic substitution. Provide the predicted output with its proper unit and a check against a plausible nonideal mechanism. End with one sentence explaining which evidence would be required before treating the output as a real measurement.

Answe...

Answer and grading guidance. Relevant relation: Example conceptual sequence: reset or known preset → select function/range → configure trigger → initiate → wait for completion → read → check error queue.. Use the worked example of [Lesson 7.1](../lessons/U07-L01-scpi-command-parsing-and-instrument-state.html) as a numerical reference and modify only the variable requested. The specific limitation is Some real instruments buffer output, require newlines or termination characters, and have model-specific command hierarchies. Sending undocumented reset commands can change safety-relevant output states.. Award 3 marks for correct mathematics, 2 for units and physical interpretation, 2 for identifying an independent check, and 1 for a defensible uncertainty statement.