What you learn today
- Your own big project following all the rules
- Test cases
- Documentation
The master project is no new topic, but the proof of the pudding: you build a system the way you learned to build systems this year. The specification is below, the acceptance tests check it. How you solve it is up to you – the sample solution is one way of many.
The specification
| No. | Requirement |
|---|---|
| A1 | every tank fills below 4000 kPa and only stops above 4500 kPa |
| A2 | above 5000 kPa the tank's vent valve opens, its pump stands still |
| A3 | the display “Depot” shows the fill level of the emptier tank in percent of 5000 kPa |
| A4 | “Depot_Status” reports 0 fine, 1 overpressure, 2 fault; “Depot_Puls” counts |
| A5 | if an analyzer is missing: its pump off, valve closed, status 2, flashing light “Depot_Alarm”, display −1 – the other tank keeps working |
The setup
| Device | Prefab | Name |
|---|---|---|
| two pipe analyzers | StructurePipeAnalysizer | “Depot_A”, “Depot_B” |
| two fill pumps | StructureVolumePump | “Depot_A”, “Depot_B” |
| two vent valves | StructureDigitalValve | “Depot_A”, “Depot_B” |
| LED display | StructureConsoleLED5 | “Depot” |
| flashing light | StructureFlashingLight | “Depot_Alarm” |
| two Logic Memories | StructureLogicMemory | “Depot_Status”, “Depot_Puls” |
The naming scheme saves registers: all devices of a tank have the same name, they only differ in the prefab. A single name is enough for the subroutine.
By all the rules
- Style: defines and aliases, sections, Kelvin or kPa with a comment, no pin.
- Documentation: header with purpose, version, device list and interface. The acceptance test does not check it – but the next person who rebuilds the depot will.
- Robustness: every sensor failure ends in a defined state without dragging the other tank along.
- Test cases: normal case, edge case, failure – the five milestones below are your table.
Milestones
- Tank A fills with hysteresis, the heartbeat runs.
- Tank B works independently of tank A.
- Overpressure opens the valve, stops the pump and reports status 1.
- The display shows the emptier tank in percent.
- A missing analyzer leads into the safe state, the other tank keeps running.
The pump is its own memory: the subroutine reads On back, computes the hysteresis and writes the result into it again. That way a third tank only needs two lines.
Diagram
Project task
Task
Build the gas depot according to the specification A1 to A5. The defines are already there, the rest is your solution.
Milestones
- Milestone 1: tank A fills with hysteresis
- Milestone 2: tank B is independent
- Milestone 3: overpressure
- Milestone 4: display shows the emptier tank
- Milestone 5: analyzer fails
Hints
Hint 1
A subroutine tank with the name in a register, called twice.
Hint 2
Collect the status with max: open valve gives 1, missing analyzer 2.
Hint 3
Fill level: stand to 100 before the calls, in the subroutine min stand stand tmp; with status 2 the display shows −1.
Quiz
1 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in