// Numbas version: finer_feedback_settings {"name": "Contact Mechanics", "metadata": {"description": "
Simple Hertz contact without friction.
", "licence": "Creative Commons Attribution 4.0 International"}, "duration": 0, "percentPass": "50", "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Contact Mechanics", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", ""], "variable_overrides": [[], [], []], "questions": [{"name": "Twin-disc test w/ units", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,A gold ball on a steel table - effect of its own weight.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "The size of the contact and the pressure between the contacting surfaces depends on:
\n
Materials: A single material property - the Elastic Contact Modulus ($E^*$) - combines the elastic properties of both contacting surfaces into an equivalent stiffness:
\n\\[{1 \\over E^*} = {1 - \\nu_1^2 \\over E_1} + {1 - \\nu_2^2 \\over E_2}\\]
\nwhere $E_1$ and $E_2$ are the Young's elastic moduli of the two materials, and $\\nu_1$ and $\\nu_2$ are the corresponding Poisson's ratios.
\nGeometry: The two simplest forms of contact between curved surfaces are:
\nIn either case, an equivalent radius $R$ can be defined. If both surfaces are convex, e.g., two balls touching, then:
\n\\[{1 \\over R} = {1 \\over R_1} + {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of Surface 1 and $R_2$ is the radius of Surface 2. If, however, one surface is concave, e.g., a ball in a cup, then:
\n\\[{1 \\over R} = {1 \\over R_1} - {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of (convex) Surface 1 and $R_2$ is the radius of (concave) Surface 2. (The 'cup' radius must be larger than the 'ball' radius.)
\nApplied Load: This is a little tricky because the same notation, $P$, is used to mean different things:
\n2D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({P E^* \\over \\pi R}\\right)^{1 \\over 2}\\]
\n\\[a = \\left({4 P R \\over \\pi E^*}\\right)^{1 \\over 2}\\]
\n3D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({6 P {E^*}^2 \\over \\pi^3 R^2}\\right)^{1 \\over 3}\\]
\n\\[a = \\left({3 P R \\over 4 E^*}\\right)^{1 \\over 3}\\]
", "advice": "${1 \\over R} = {1 \\over R_1} + {1 \\over R_2} = {1 \\over \\var{diawheel} \\div 2} + {1 \\over \\var{diarail} \\div 2}$ [units: mm$^{-1}$]
\nwhich can be rearranged to give $R = \\var{siground(R*1000,3)}$mm.
\n${1 \\over E^*} = {1 - \\nu_1^2 \\over E_1} + {1 - \\nu_2^2 \\over E_2} ={1 - 0.3^2 \\over 209 \\times 10^9} + {1 - 0.3^2 \\over 209 \\times 10^9}$
\nwhich can be rearranged to give $E^* = \\var{siground(ECM,3)}$GPa.
\n$p_0 = \\left({P E^* \\over \\pi R}\\right)^{1 \\over 2} =\\left({ \\left( \\var{load} \\times 10^3 \\div \\var{width} \\times 10^{-3} \\right) \\times \\var{siground(ECM,3)} \\times 10^9 \\over \\pi \\times \\var{siground(R*1000,3)} \\times 10^{-3}} \\right)^{1 \\over 2} = \\var{siground(p0,3)}$MPa.
\n$a = \\left({4 P R \\over \\pi E^*}\\right)^{1 \\over 2} = \\left({4 \\times\\left( \\var{load} \\times 10^3 \\div \\var{width} \\times 10^{-3} \\right) \\times \\var{siground(R*1000,3)} \\times 10^{-3} \\over \\pi \\times \\var{siground(ECM,3)} \\times 10^9}\\right)^{1 \\over 2} = \\var{siground(scw,3)}$mm.
\narea = $2 \\times \\var{siground(scw,3)}$mm $\\times \\var{width}$mm $= \\var{siground(area,3)}$mm$^2$.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"scw": {"name": "scw", "group": "Ungrouped variables", "definition": "(4 * P * R / (pi * ECM * 10^9))^(1/2) * 1000", "description": "Semi-contact width. [Units: mm]
", "templateType": "anything", "can_override": false}, "p0": {"name": "p0", "group": "Ungrouped variables", "definition": "(P * ECM*10^9 / (pi * R))^(1/2) / 10^6", "description": "Peak contact pressure. [Units: MPa]
", "templateType": "anything", "can_override": false}, "load": {"name": "load", "group": "Ungrouped variables", "definition": "random(4..7#0.5)", "description": "Applied load. [Units: kN]
", "templateType": "anything", "can_override": false}, "diarail": {"name": "diarail", "group": "Ungrouped variables", "definition": "random(40..47#0.1)", "description": "Rail disc diameter. [Units: mm]
", "templateType": "anything", "can_override": false}, "ECM": {"name": "ECM", "group": "Ungrouped variables", "definition": "1/((1-0.3^2)/209+(1-0.3^2)/209)", "description": "Elastic Contact Modulus. [Units: GPa]
", "templateType": "anything", "can_override": false}, "width": {"name": "width", "group": "Ungrouped variables", "definition": "random(5..10)", "description": "Track width. [Units: mm]
", "templateType": "anything", "can_override": false}, "area": {"name": "area", "group": "Ungrouped variables", "definition": "2*scw*width", "description": "Contact area. [Units: mm$^2$]
", "templateType": "anything", "can_override": false}, "P": {"name": "P", "group": "Ungrouped variables", "definition": "(load*1000)/(width/1000)", "description": "Load per unit length. [Units: N/m]
", "templateType": "anything", "can_override": false}, "R": {"name": "R", "group": "Ungrouped variables", "definition": "1/(2000/diawheel+2000/diarail)", "description": "Equivalent radius. [Units: m]
", "templateType": "anything", "can_override": false}, "diawheel": {"name": "diawheel", "group": "Ungrouped variables", "definition": "random(40..47#0.1)", "description": "Wheel disc diameter. [Units: mm]
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diawheel", "diarail", "R", "ECM", "width", "load", "P", "p0", "scw", "area"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Contact Mechanics", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Reference values:
\nIn a twin-disc test, a 'wheel' disc (machined from a steel train wheel) with diameter $\\var{diawheel}$ mm runs against a 'rail' disc (machined from a steel railway rail) with diameter $\\var{diarail}$ mm.
\nThe disc surfaces are cylindrical with the axes aligned. The width of the surfaces is $\\var{width}$ mm.
\nThe applied load is $\\var{load}$ kN.
\nCalculate:
\nImportant: Remember to state units (if any) with your answer(s).
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Eq Radius", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(R,\"m\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "ECM", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(ECM*1000000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "peak pressure", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(p0*1000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "scw", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(scw/1000,\"m\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "area", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(area/1000000,\"m^2\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Ball on table w/ units", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,A gold ball on a steel table - effect of its own weight.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "The size of the contact and the pressure between the contacting surfaces depends on:
\n
Materials: A single material property - the Elastic Contact Modulus ($E^*$) - combines the elastic properties of both contacting surfaces into an equivalent stiffness:
\n\\[{1 \\over E^*} = {1 - \\nu_1^2 \\over E_1} + {1 - \\nu_2^2 \\over E_2}\\]
\nwhere $E_1$ and $E_2$ are the Young's elastic moduli of the two materials, and $\\nu_1$ and $\\nu_2$ are the corresponding Poisson's ratios.
\nGeometry: The two simplest forms of contact between curved surfaces are:
\nIn either case, an equivalent radius $R$ can be defined. If both surfaces are convex, e.g., two balls touching, then:
\n\\[{1 \\over R} = {1 \\over R_1} + {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of Surface 1 and $R_2$ is the radius of Surface 2. If, however, one surface is concave, e.g., a ball in a cup, then:
\n\\[{1 \\over R} = {1 \\over R_1} - {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of (convex) Surface 1 and $R_2$ is the radius of (concave) Surface 2. (The 'cup' radius must be larger than the 'ball' radius.)
\nApplied Load: This is a little tricky because the same notation, $P$, is used to mean different things:
\n2D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({P E^* \\over \\pi R}\\right)^{1 \\over 2}\\]
\n\\[a = \\left({4 P R \\over \\pi E^*}\\right)^{1 \\over 2}\\]
\n3D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({6 P {E^*}^2 \\over \\pi^3 R^2}\\right)^{1 \\over 3}\\]
\n\\[a = \\left({3 P R \\over 4 E^*}\\right)^{1 \\over 3}\\]
", "advice": "weight $= \\rho g \\times {4 \\over 3} \\pi r^3 = 19320 \\times 9.81 \\times {4 \\over 3} \\times \\pi \\times \\left( {\\var{diameter} \\times 10^{-2} \\over 2} \\right)^3 = \\var{siground(weight,3)}$N.
\n${1 \\over E^*} = {1 - 0.4^2 \\over 79 \\times 10^9} + {1 - 0.3^2 \\over 209 \\times 10^9}$
\nwhich can be rearranged to give $E^* = \\var{siground(ECM,3)}$GPa.
\n$p_0 = \\left({6 P {E^*}^2 \\over \\pi^3 R^2}\\right)^{1 \\over 3} = \\left({6 \\times \\var{siground(weight,3)} \\times \\left( \\var{siground(ECM,3)} \\times 10^9 \\right)^2 \\over \\pi^3 \\left( \\var{diameter} \\times 10^{-2} \\div 2 \\right)^2}\\right)^{1 \\over 3} = \\var{siground(p0,3)}$MPa.
\n$a = \\left({3 P R \\over 4 E^*}\\right)^{1 \\over 3} = \\left({3 \\times \\var{siground(weight,3)} \\times \\var{diameter} \\times 10^{-2} \\div 2 \\over 4 \\times \\var{siground(ECM,3)} \\times 10^9} \\right)^{1 \\over 3} = \\var{siground(scw,3)}$mm.
\narea $= \\pi a^2 = \\pi \\left( \\var{siground(scw,3)} \\times 10^{-3} \\right)^2 = \\var{siground(area,3)}$mm$^2$.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"weight": {"name": "weight", "group": "Ungrouped variables", "definition": "volume*19320*9.81", "description": "Weight of gold ball. [Units: N]
", "templateType": "anything", "can_override": false}, "ECM": {"name": "ECM", "group": "Ungrouped variables", "definition": "1/((1-0.4^2)/79+(1-0.3^2)/209)", "description": "Elastic Contact Modulus. [Units: GPa]
", "templateType": "anything", "can_override": false}, "area": {"name": "area", "group": "Ungrouped variables", "definition": "pi*scw^2", "description": "Contact area. [Units: mm$^2$]
", "templateType": "anything", "can_override": false}, "p0": {"name": "p0", "group": "Ungrouped variables", "definition": "(6 * weight * (ECM*10^9)^2 / (pi^3 * R^2))^(1/3) / 10^6", "description": "Peak contact pressure. [Units: MPa]
", "templateType": "anything", "can_override": false}, "scw": {"name": "scw", "group": "Ungrouped variables", "definition": "(3 * weight * R / (4 * ECM * 10^9))^(1/3) * 1000", "description": "Semi-contact width. [Units: mm]
", "templateType": "anything", "can_override": false}, "diameter": {"name": "diameter", "group": "Ungrouped variables", "definition": "random(6..40)", "description": "Diameter of gold ball. [Units: cm]
", "templateType": "anything", "can_override": false}, "volume": {"name": "volume", "group": "Ungrouped variables", "definition": "pi*R^3*4/3", "description": "Volume of gold ball. [Units: m3]
", "templateType": "anything", "can_override": false}, "R": {"name": "R", "group": "Ungrouped variables", "definition": "diameter/200", "description": "Radius of gold ball. [Units: m]
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diameter", "R", "volume", "weight", "ECM", "p0", "scw", "area"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Contact Mechanics", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Reference values:
\nA gold sphere of diameter $\\var{diameter}$ cm sits on a flat steel table.
\nCalculate:
\nImportant: Remember to state units (if any) with your answer(s).
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "weight", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(weight,\"N\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "ECM", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(ECM*1000000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "peak pressure", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(p0*1000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "scw", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(scw/1000,\"m\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "area", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(area/1000000,\"m^2\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Ball joint w/ units", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,Hertz contact calculation for ball joint.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "The size of the contact and the pressure between the contacting surfaces depends on:
\n
Materials: A single material property - the Elastic Contact Modulus ($E^*$) - combines the elastic properties of both contacting surfaces into an equivalent stiffness:
\n\\[{1 \\over E^*} = {1 - \\nu_1^2 \\over E_1} + {1 - \\nu_2^2 \\over E_2}\\]
\nwhere $E_1$ and $E_2$ are the Young's elastic moduli of the two materials, and $\\nu_1$ and $\\nu_2$ are the corresponding Poisson's ratios.
\nGeometry: The two simplest forms of contact between curved surfaces are:
\nIn either case, an equivalent radius $R$ can be defined. If both surfaces are convex, e.g., two balls touching, then:
\n\\[{1 \\over R} = {1 \\over R_1} + {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of Surface 1 and $R_2$ is the radius of Surface 2. If, however, one surface is concave, e.g., a ball in a cup, then:
\n\\[{1 \\over R} = {1 \\over R_1} - {1 \\over R_2}\\]
\nwhere $R_1$ is the radius of (convex) Surface 1 and $R_2$ is the radius of (concave) Surface 2. (The 'cup' radius must be larger than the 'ball' radius.)
\nApplied Load: This is a little tricky because the same notation, $P$, is used to mean different things:
\n2D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({P E^* \\over \\pi R}\\right)^{1 \\over 2}\\]
\n\\[a = \\left({4 P R \\over \\pi E^*}\\right)^{1 \\over 2}\\]
\n3D Contact: The peak contact pressure, $p_0$, and semi-contact width, $a$, are given by:
\n\\[p_0 = \\left({6 P {E^*}^2 \\over \\pi^3 R^2}\\right)^{1 \\over 3}\\]
\n\\[a = \\left({3 P R \\over 4 E^*}\\right)^{1 \\over 3}\\]
", "advice": "Reference values:
\nA ball joint has a steel ball of diameter $\\var{diaball}$ mm in a HDPE cup of diameter $\\var{diacup}$ mm. The maximum applied load is $\\var{load}$ N.
\nCalculate:
\n${1 \\over R} = {1 \\over R_1} - {1 \\over R_2} = {1 \\over \\var{diaball} \\div 2} - {1 \\over \\var{diacup} \\div 2}$ [units: mm$^{-1}$]
\nwhich can be rearranged to give $R = \\var{siground(R*1000,3)}$mm.
\n${1 \\over E^*} = {1 - \\nu_1^2 \\over E_1} + {1 - \\nu_2^2 \\over E_2} = {1 - 0.45^2 \\over 1 \\times 10^9} + {1 - 0.3^2 \\over 209 \\times 10^9}$
\nwhich can be rearranged to give $E^* = \\var{siground(ECM,3)}$GPa.
\n$p_0 = \\left({6 P {E^*}^2 \\over \\pi^3 R^2}\\right)^{1 \\over 3} = \\left({6 \\times \\var{load} \\times \\left( \\var{siground(ECM,3)} \\times 10^9 \\right)^2 \\over \\pi^3 \\left( \\var{siground(R*1000,3)} \\times 10^{-3} \\right)^2}\\right)^{1 \\over 3} = \\var{siground(p0,3)}$MPa.
\n$a = \\left({3 P R \\over 4 E^*}\\right)^{1 \\over 3} = \\left({3 \\times \\var{load} \\times \\var{siground(R*1000,3)} \\times 10^{-3} \\over 4 \\times \\var{siground(ECM,3)} \\times 10^9} \\right)^{1 \\over 3} = \\var{siground(scw,3)}$mm.
\narea $= \\pi a^2 = \\pi \\left( \\var{siground(scw,3)} \\times 10^{-3} \\right)^2 = \\var{siground(area,3)}$mm$^2$.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"load": {"name": "load", "group": "Ungrouped variables", "definition": "random(200..1200)", "description": "Applied load. [Units: N]
", "templateType": "anything", "can_override": false}, "ECM": {"name": "ECM", "group": "Ungrouped variables", "definition": "1/((1-0.45^2)/1+(1-0.3^2)/209)", "description": "Elastic Contact Modulus. [Units: GPa]
", "templateType": "anything", "can_override": false}, "p0": {"name": "p0", "group": "Ungrouped variables", "definition": "(6 * load * (ECM*10^9)^2 / (pi^3 * R^2))^(1/3) / 10^6", "description": "Peak contact pressure. [Units: MPa]
", "templateType": "anything", "can_override": false}, "diaball": {"name": "diaball", "group": "Ungrouped variables", "definition": "random(20..30)", "description": "Diameter of ball. [Units: mm]
", "templateType": "anything", "can_override": false}, "diacup": {"name": "diacup", "group": "Ungrouped variables", "definition": "diaball+random(1..4)", "description": "Diameter of cup. [Units: mm]
", "templateType": "anything", "can_override": false}, "area": {"name": "area", "group": "Ungrouped variables", "definition": "pi*scw^2", "description": "Contact area. [Units: mm$^2$]
", "templateType": "anything", "can_override": false}, "R": {"name": "R", "group": "Ungrouped variables", "definition": "1/(2000/diaball-2000/diacup)", "description": "Equivalent radius. [Units: m]
", "templateType": "anything", "can_override": false}, "scw": {"name": "scw", "group": "Ungrouped variables", "definition": "(3 * load * R / (4 * ECM * 10^9))^(1/3) * 1000", "description": "Semi-contact width. [Units: mm]
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diaball", "diacup", "R", "ECM", "load", "p0", "scw", "area"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Contact Mechanics", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Reference values:
\nA ball joint has a steel ball of diameter $\\var{diaball}$ mm in a HDPE cup of diameter $\\var{diacup}$ mm. The maximum applied load is $\\var{load}$ N.
\nCalculate:
\nImportant: Remember to state units (if any) with your answer(s).
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Eq Radius", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(R,\"m\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "ECM", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(ECM*1000000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "peak pressure", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(p0*1000000,\"Pa\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "scw", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(scw/1000,\"m\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "area", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "quantity(area/1000000,\"m^2\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showresultspage": "oncompletion"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": true, "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview", "allowrevealanswer": true, "intro": "", "end_message": "", "results_options": {"printquestions": true, "printadvice": true}, "feedbackmessages": [], "reviewshowexpectedanswer": true, "showanswerstate": true, "reviewshowfeedback": true, "showactualmark": true, "showtotalmark": true, "reviewshowscore": true, "reviewshowadvice": true}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Francis Franklin", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1887/"}], "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,