Skip to content

Latest commit

 

History

History
329 lines (319 loc) · 14.6 KB

json-file-formats.md

File metadata and controls

329 lines (319 loc) · 14.6 KB

JSON File Formats

Breadboard Environment

The following (invalid because of the # comments) JSON contains descriptions of the various environment settings and options.

Within the Breadboard JSON you can use several predefined variables that are generated by the internal model:

  • $E - the current of the circuit
  • $R - the external resistance of the circuit
  • $V1 - the voltage drop desired from $R1
  • $V2 - the voltage drop desired from $R2
  • $V3 - the voltage drop desired from $R3
  • $R1 - the internal resistance of the resistor on the first board
  • $R2 - the internal resistance of the resistor on the second board
  • $R3 - the internal resistance of the resistor on the third board
{
  "name": "Three Resistors - Level 2",                        # this is displayed at the top of the page
  "interface": {
    "enableChatType": true,                                    # if true a dropdown is shown where the user must select the type of message
    "hideZoomDetails": true,                                   # if true the DMM result and resistor bands for other clients are hidden
    "disableForwardNav": true,                                 # if true the forward nav is disabled when run under LARA
    "enableWaitingRoom": true,                                 # if true a waiting room is shown until all users have joined the group
    "enablePersistentWaitingRoom", true,                       # if true and enableWaitingRoom is true then the waiting room is shown again after all users have joined
                                                               # when one or more of the users drop off
    "showTutorial": true,                                      # if true a multi-step tutorial is shown after the circuit is selected
    "tutorialFreePlayDuration": 60                             # if showTutorial is true this is the number of seconds of "free play" after the tutorial, use 0 to disable
    "tutorialFreePlayAboutToTimeoutDuration": 30,              # if showTutorial is true this is the number of seconds left in the play timeout when the countdown starts, use 0 to disable
    "tutorialStepPauseDuration": 2,                            # if showTutorial is true this is the number of seconds of pause between steps, use 0 to disable
    "tutorialAboutToTimeoutDuration": 5,                       # if showTutorial is true this is the number of seconds left in the timeout when the countdown starts, use 0 to disable
    "tutorialTimeoutDuration": 30                              # if showTutorial is true this is the number of seconds before the step times out, use 0 to disable
    "tutorialTimeoutDurationStep1": 10,                        # if showTutorial is true this is the number of seconds before step times 1 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep2": 10,                        # if showTutorial is true this is the number of seconds before step times 2 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep3": 10,                        # if showTutorial is true this is the number of seconds before step times 3 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep4": 10,                        # if showTutorial is true this is the number of seconds before step times 4 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep5": 10,                        # if showTutorial is true this is the number of seconds before step times 5 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep6": 10,                        # if showTutorial is true this is the number of seconds before step times 6 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep7": 10,                        # if showTutorial is true this is the number of seconds before step times 7 out, it overrides the tutorialTimeoutDuration setting
    "tutorialTimeoutDurationStep8": 10                        # if showTutorial is true this is the number of seconds before step times 8 out, it overrides the tutorialTimeoutDuration setting
  },
  "image": "images/three-resistors-circuit.v2.png",           # if present this is displayed at the bottom of the page
  "otherCircuits": {                                          # specifies the image and breadboard locations for the "View All" dialog
    "image": "images/three-resistors-breadboards.v2.png",
    "width": 740,
    "height": 250,
    "breadboards": [
      {"x": 19, "y": 80, "width": 222, "height": 150},
      {"x": 260, "y": 80, "width": 222, "height": 150},
      {"x": 501, "y": 80, "width": 222, "height": 150}
    ]
  },
  "model": {                                                  # name and options of the activity model that generates random values
    "name": "three-resistors",
    "options": {
      "level": 2
    }
  },
  "nextActivity": "OK",                                       # if present sets the button text when moving to a new activity
  "initialChatMessage": "You can find your goal at the top of the screen. Use this area to chat with your teammates.",
  "goals": [                                                  # used by the submit button to determine if the players have met the activity goals
    {
      "Voltage across R1": {
        "measurement": "component_voltage(r1)",
        "value": "$V1",
        "units": "V",
        "tolerance": 0.005
      }
    },
    {
      "Voltage across R2": {
        "measurement": "component_voltage(r2)",
        "value": "$V2",
        "units": "V",
        "tolerance": 0.005
      }
    },
    {
      "Voltage across R3": {
        "measurement": "component_voltage(r3)",
        "value": "$V3",
        "units": "V",
        "tolerance": 0.005
      }
    }
  ],
  "externalComponents": [                         # components not shown on the player's breadboard, used to connect them
    {
      "type": "battery",
      "UID": "source",
      "voltage": "$E",
      "connections": "battery_1,battery_2"
    },
    {
      "type": "resistor",
      "UID": "rX",
      "resistance": "$R",
      "connections": "battery_1,0:off_11",
      "hidden": true
    },
    {
      "type": "wire",
      "connections": "0:off_1,1:off_11",
      "hidden": true
    },
    {
      "type": "wire",
      "connections": "1:off_1,2:off_11",
      "hidden": true
    },
    {
      "type": "wire",
      "connections": "2:off_1,battery_2",
      "hidden": true
    }
  ],
  "logging": {
    "startActivity": {                                     # these are logged at the start of the activity
      "Activity Settings": {
        "parameters": {
          "E": "$E",
          "R0": "$R"
        }
      },
      "Activity Goals": {
        "parameters": {
          "V1": "$V1",
          "V2": "$V2",
          "V3": "$V3"
        }
      }
    },
    "append": {                                            # these are appended to each log message automatically
      "local": {                                           # local measurements
        "components": [
          {"name": "r1", "measurement": "resistance"},
          {"name": "r2", "measurement": "resistance"},
          {"name": "r3", "measurement": "resistance"}
        ]
      },
      "remote": {
        "events": {                                        # remote events
          "sparks": ["DMM measurement"]
        }
      }
    }
  },
  "clients": [                                                                          # a list of players in the activity
    {
      "show_multimeter": true,
      "showComponentEditor": true,
      "notes": "E = $E volts, R0 = $R Ω, your goal is to make your voltage $V1 volts.",  # if present this is displayed at the top of the page
      "circuit": [
        {
          "type": "wire",
          "connections": "off_11,a20",
          "draggable": false
        },
        {
          "type": "resistor",
          "UID": "r1",
          "resistance": "$R1",
          "connections": "c20,c14",
          "label": "R1",
          "draggable": false
        },
        {
          "type": "wire",
          "connections": "a14,off_1",
          "draggable": false
        }
      ]
    },
    {
      "show_multimeter": true,
      "showComponentEditor": true,
      "notes": "E = $E volts, R0 = $R Ω, your goal is to make your voltage $V2 volts.",
      "circuit": [
        {
          "type": "wire",
          "connections": "off_11,a20",
          "draggable": false
        },
        {
          "type": "resistor",
          "UID": "r2",
          "resistance": "$R2",
          "connections": "c20,c14",
          "label": "R2",
          "draggable": false
        },
        {
          "type": "wire",
          "connections": "a14,off_1",
          "draggable": false
        }
      ]
    },
    {
      "show_multimeter": true,
      "showComponentEditor": true,
      "notes": "E = $E volts, R0 = $R Ω, your goal is to make your voltage $V3 volts.",
      "circuit": [
        {
          "type": "wire",
          "connections": "off_11,a20",
          "draggable": false
        },
        {
          "type": "resistor",
          "UID": "r3",
          "resistance": "$R3",
          "connections": "c20,c14",
          "label": "R3",
          "draggable": false
        },
        {
          "type": "wire",
          "connections": "a14,off_1",
          "draggable": false
        }
      ]
    }
  ]
}

PIC Environment

This activity is not currently authorable in JSON.

Logic Gates Environment

{
  "name": "Single XOR",                    # this is displayed at the top of the page
  "notes": "Set bus port E to be A XOR B", # if present this is displayed under the name.  HTML is allowed here.
  "interface": {
    "showPinColors": true,                 # show red/blue pin colors that denote voltage levels
    "showBusColors": true,                 # show red/blue connector colors on bus that denote voltage levels
    "allowAutoWiring": true,               # show button that enables toggling of all wiring of all the boards, if true a "autoWiring" option setting is required below
    "showPinouts": true,                   # show schematic pinouts on hover
    "showBusLabels": true,                 # show labels next to the bus connector holes
    "showProbe": "edit",                   # show probe only in edit mode, other values are "all" and false
    "showInputAutoToggles": true,          # show the increment and decrement controls next to the local board input switches
    "showGlobalIOWires": true,             # shows the wires coming and going to the global input/output on the bus
    "showBreadboardColors": true           # show red/blue colors on breadboard that denote voltage levels
  },
  "busSize": 5,                            # total number of holes in the bus connector
  "busInputSize": 2,                       # number of input holes
  "busInputLabels": ["A", "B"],            # array of labels for bus input
  "busOutputSize": 1,                      # number of output holes
  "busOutputLabels": ["E"],                # array of labels for bus output
  "boards": [                              # array of boards in the activity
    {
      "logicChipDrawer": {
        "chips": {                         # list of chips available on the right hand part of the page
          "7408": {"max": 2},              # the format is "<chipNumber>": {"max": <maximum number of chips>}
          "7404": {"max": 5}
        }
      },
      "localInputSize": 4,                 # number of holes in the local input connector (switches)
      "localOutputSize": 4,                # number of holes in the local output connector (leds)
      "autoWiring": {                      # used to auto wire the boards if the interface/allowAutoWiring option is set
        "chips": {                         # defines the internal name, type and location of the chips on the board
          "not": {
            "type": "7404",
            "x": 150,
            "y": 150
          },
          "and": {
            "type": "7408",
            "x": 425,
            "y": 150
          }
        },
        "wires": [                         # defines wires between chips and inputs and outputs, strings that start with "//" are ignored
                                           # the format is <source name>:<source location>,<dest name>:<dest location>
                                           # if the source is a chip the location is a 1-based pin, if the location is an input or output it is the input/output label defined above
          "bus:1,not:13",   "// create NOT A on not pin 12",
          "bus:2,not:9",    "// create NOT B on not pin 8",
          "not:12,and:13", "// NOT A to and pin 13",
          "bus:2,and:12",   "// B to and pin 12",
          "and:11,bus:3",  "// (NOT A AND B) to bus hole 1",
          "not:8,and:10",  "// NOT B to and pin 10",
          "bus:1,and:9",    "// A to and pin 9",
          "and:8,bus:4",   "// (NOT B AND A) to bus hole 2"
        ]
      }
    },
    {
      "logicChipDrawer": {
        "chips": {
          "7432": {"max": 2}
        }
      },
      "localInputSize": 4,
      "localOutputSize": 4,
      "autoWiring": {
        "chips": {
          "or": {
            "type": "7432",
            "x": 300,
            "y": 150
          }
        },
        "wires": [
          "bus:3,or:13",  "// C = (NOT A AND B) from bus hole 1",
          "bus:4,or:12",  "// D = (NOT B AND A) from bus hole 2",
          "or:11,bus:5", "// (C OR D) to bus hole 1"
        ]
      }
    }
  ],
  "truthTable": [  # used by the submit button to determine if the wiring is correct
                   # each row is a test with the first array being the global inputs and the second the global outputs
                   # both the input and output arrays are set right to left (the least significant bit is rightmost)
                   # the code will cycle through all the combinations, setting the inputs, resolving the board values and then testing the output
                   # NOTE: the first array element can be an array of arrays, in which case the inputs are set in that order and
                   #       then the output is checked.  This is useful to test circuits that switch output between inputs states.
                   #       An example entry for such a truth table would be: [ [[0, 0], [0, 1]], [0] ]
    [[0, 0], [0]],
    [[0, 1], [1]],
    [[1, 0], [1]],
    [[1, 1], [0]]
}