Skip to content

Spend Guard Simulator

Run the Spend Guard Simulator MicroSim Fullscreen

About This MicroSim

A small app can guard its bill three ways. A daily cap counts scans and refuses any past the limit. A spend alert counts dollars and tells a person. A spend circuit breaker counts dollars and stops every paid call until a person resets it. Each guard misses something the others catch.

This MicroSim plays out a day of scans, spread evenly over 24 hours, and draws the money spent as a line. Dashed lines show the alert threshold and the breaker limit. Markers show where each guard acts. The scenarios and thresholds are illustrative.

How to Use

  1. Run scenario A, a normal day, to see 400 scans at $0.25 reach $100 with no guard acting.
  2. For scenarios B, C and D, pick two answers before you run the day: which guard acts first, and which guard stops the spending. The choices are the daily cap, the spend alert, the spend circuit breaker and none.
  3. Press Run the day. When the day ends you see whether each answer was right and why.
  4. Hover over the guard cards on the right to see what each one counts, does and misses. Hover over the chart or a marker to read the time, the scans run and the spend.
  5. After scenario D, press Start exploring. Change the limits, switch guards off, and rerun any scenario. These runs are not scored.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/spend-guard-simulator/main.html"
        height="729px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Learning Objective

The learner will attribute each of three runaway-spend scenarios to the guard that acts first and the guard that stops the spending, choosing among the daily cap, the spend alert, the spend circuit breaker and none.

Prerequisites

Cost per user action, daily cap, spend alert and spend circuit breaker from Chapter 13. Retry from Chapter 9.

Activities

  1. Exploration (3 min): Run scenario A and hover over the guard cards.
  2. Guided Practice (7 min): Answer and run scenarios B, C and D in order. Read the reason after each one.
  3. Assessment (5 min): In free exploration, switch the breaker off in scenario C and predict the day's total before you run it. Then lower the cap and check whether it helps in C or D.

Assessment

Six scored answers, two per scenario, one attempt each. Mastery is 5 of 6 correct on the first attempt. Runs after free exploration begins are not scored.

Things to Notice

  • In the retry storm (C), switching the breaker off takes the day from $301 to $700.
  • Lowering the cap does nothing for C or D, because the scan count in those scenarios is normal.
  • The alert fires in every bad scenario, and it never stops anything by itself.

References

  1. Chapter 13, "Three Guards Against a Runaway Bill" and "A Worked Example: The Retry Storm", in this book.
  2. Chapter 9 of this book, on retries, circuit breakers, and failing open or closed.
  3. p5.js reference, the library this MicroSim is built with.