Exam Summary Notes • University of Groningen • IEM
Compiled from the 2022, 2023 and 2024 PMS exam papers and solutions. Covers: flowcharts, MATLAB
functions & conventions, MRP, simulation, loops, data handling, validation.
# Topic Key Content
1 Flowcharts Building blocks, for-loops, nested loops, decision diamonds
2 MATLAB Functions Header, inputs/outputs, coding conventions, examples
3 MRP Algorithm Netting, lot-for-lot, backward scheduling, BOM explosion
4 Simulation Time step formula, Euler integration, car-on-slope
5 Loops For vs while — when to use each
6 Data & Matrices xlsread, csvread, indexing, writetable, splitting by year
7 Validation Hand-calculation method, edge cases
8 Quick Reference Key MATLAB commands cheat sheet
1. Flowcharts
Flowcharts visually describe an algorithm before writing code. PMS uses the building blocks from Smith's
Engineering Computations with MATLAB, Ch. 4.
1.1 Standard Building Blocks
Shape Name When to use
Rounded rectangle / Oval Start / End (Terminal) First and last block of every flowchart
Rectangle Process / Assignment Calculations, variable assignments
Parallelogram Input / Output Reading data or displaying results
Diamond Decision if / elseif / else conditions
Hexagon (or rect) Loop header for / while loop boundaries
Arrow Flow line Connect blocks in execution order
1.2 Common Patterns
• For-loop: hexagon header → process block → back-arrow to hexagon. Include 'Done' exit arrow.
• Nested loops: outer loop wraps inner loop; inner loop completes fully before outer increments.
• If-else: diamond with True/False branches that merge back to main flow below.
• Function call: rectangle showing the exact MATLAB call with input/output variables named.
Exam tip: Always mark Start/End with ovals. Use 'Done' labels on loop exits. Show explicit variable initialisation
in the first block. –0.5 pt per wrong building block, wrong arrow, or missing index.
1.3 Matrix traversal (2024 exam Q1A) — row-neighbour averages
Programming, Modelling & Simulation — page 1
, Compute B from A (n×m): bi,j = (ai−1,j + ai,j + ai+1,j)/3 (middle); b1,j = (a1,j + a2,j)/2 (first row); bn,j = (an−1,j + an,j)/2
(last row).
MATLAB — relateBtoA
function [B] = relateBtoA(A)
% Input: A — n x m matrix
% Output: B — n x m matrix (row-neighbour averages)
for row = 1:length(A) % length() = number of rows
for col = 1:width(A) % width() = number of columns
if row == 1
B(row,col) = (A(row,col) + A(row+1,col)) / 2;
elseif row == length(A)
B(row,col) = (A(row-1,col) + A(row,col)) / 2;
else
B(row,col) = (A(row-1,col) + A(row,col) + A(row+1,col)) / 3;
end
end
end
end
2. MATLAB Functions — Coding Conventions
Every function must follow the PMS coding conventions. Missing any of these loses marks even if the logic is
correct.
Function template — required structure
function [output1, output2] = functionName(input1, input2)
% Description: one-line explanation of what this function does
% Input: input1 — description and units
% input2 — description and units
% Output: output1 — description
% output2 — description
output1 = ...;
output2 = ...;
end
Convention Requirement Points lost
Function header Correct syntax: function [out] = name(in) 1 pt
Description comment What the function does (first comment line) 0.5 pt
Input descriptions Comment each input with name and meaning 0.5 pt
Output descriptions Comment each output with name and meaning 0.5 pt
No hard-coded values Never write specific data values inside a function 1 pt
Indentation Indent loop/if bodies consistently 0.5 pt
2.1 Example: fill_water_tank (2023 exam Q1.1)
fill_water_tank — full solution
function [tank_volume, refill_count] = fill_water_tank(length, width, height, x)
% Calculates tank volume and number of watering-can refills needed.
Programming, Modelling & Simulation — page 2