You are on page 1of 4

Data flow diagram for ALCS

Sensor(HW)
D1
D5 D7
D3 Transistor
Read (P1) Compare (P2) Control (P3)
(HW)
D6
D14
D2 D4 D8
D12

D9
Storage
D13 Input (P5) Output (P4)
(SW)

D11 D10

Keypad (HW) LCD (HW)

Types of data:

- Integers – numbers without fractional part (ex. 5, 10, -6, 0, etc.)


- Real – any number, may be as integer as with floating point (ex. 8.2, 0.2, 0, 1)
- Boolean – logical value, may be true or false (on or off, 1 or 0)
- Text – set of characters

Data flows specifications (preferable with data types):

D1 – Input signal from sensor S (in a range between 0 and ADCmax) – integer (3.1)

D2 – D2.1 Analog-digital converter range ADCmax - integer (3.2, 2.5)

D2.2 Sensor sensitivity parameter Amax – integer (3.4, 2.6)

D3 – Current light intensity level C – real (3.5, 4.3)

D4 – Preset light intensity level P – integer (2.1, 4.2)

D5 - difference between current and preset levels dif – real (4.1)

D6 – D6.1 predefined increase step Inc - integer (5.5, 2.7)

D6.2 predefined decrease step Dec – integer (5.5, 2.8)

D6.3 predefined precision Prec – integer (5.5, 2.9)

D6.4 previous pulse width PW – real (5.6, 2.10)

D7 – Control signal that is on or off Ctrl – Boolean (not defined in specification, should be added 1):

D8 – Pulse width PW (in a range from 0 to 1) – real (5.4)

D9 - Current light intensity level setting Set – integer (6.2, 1.5)

1
5.8 Control signal is calculated by the specific library function convert from pulse width value
D10 – D10.1 Message about current relative power Msg1 – text (6.1)

D10.2 Message about setting Msg2 – text (6.2)

D11 – D11.1 Up button is pressed up – boolean (1.6)

D11.2 Down button is pressed dn – boolean (1.7)

D11.3 Enter button is pressed ent – boolean (1.8)

D12 - D12.1 Preset light intensity level P – integer (1.4)

D12.2 Minimal level min – integer (1.2, 2.3)

D12.3 Maximal level max – integer (1.3, 2.4)

D13 - Preset light intensity level P – integer (1.8)

D14 – Current pulse width value PW – real (5.7, 2.10)

Process specifications

Process P1

Name: Read

Input: D1: sensor value S; D2: ADCmax, Amax

Output: D3: light intensity C

Actions (to convert input to output):

1. C = S * Amax / ADCmax (3.5)

Process P2

Name: Compare

Input: D3: light intensity C; D4 preset level P

Output: D5: difference dif

Actions (to convert input to output):

1. dif = C – P (4.1)

Process P3 (incorrect)

Name: Control

Input: D5: result of comparison dif ; D6: increment Inc, decrement Dec, precision Prec

Output: D7: Control signal Ctrl; D8: pulse width PW


Actions (to convert input to output):

1. if dif < 0 then PW = ___ + Inc (can not calculate because I don’t have input)
2.

Solution:

Add specifications that explains where to get previous PW value

5.6. Current pulse width value is read from storage in the beginning of the function

5.7. After control pulse width calculation, the value is saved in the storage

2.10. Current value of pulse width is stored as real number, initial value is zero

New specifications will cause new data flows D6.4 and D14 appear in the system

Process P3

Name: Control

Input: D5: result of comparison dif ;

D6: increment Inc, decrement Dec, precision Prec, pulse width PW1

Output: D7: Control signal Ctrl; D8: pulse width PW2; D14: pulse width PW3

Actions (to convert input to output):

1. if dif < 0 then PW2 = PW1 + Inc (5.1)


2. if dif > 0 then PW2 = PW1 - Dec (5.2)
3. if |dif| < Prec then PW2 = PW1 (5.3)
4. Ctrl = convert (PW2) (5.8)
5. PW3 = PW2 (5.7)

Process P4

Name: Output

Input: D8: pulse width PW2

D9: light intensity setting Set

Output: D10: message about power Msg1, message about setting Msg2

Actions (to convert input to output):

1. Msg1 = “Power: “+PW2*100+”%” (6.1)


2. If Set is defined then Msg2 = “Set: “+Set; (6.2)

Process P5
Name: Input

Input: D11: buttons up, dn, ent; D12: previous value of light intensity P1, limits max, min

Output: D9: light intensity setting Set, D13: preset light intensity P2

Actions (to convert input to output):

1. If up=true OR dn=true OR ent=true then Set = P1 (1.4)


2. If up=true then Set = Set + 1 (1.6)
3. If Set>max then Set=max (1.9)
4. If dn=true then Set = Set – 1 (1.7)
5. If Set<min then Set=min (1.9)
6. If ent=true then P2 = Set else repeat from step 2. (1.8)

You might also like