AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and...

42
AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B

Transcript of AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and...

Page 1: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

AS-116.2120 (ATJ)

Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B

Page 2: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Project: develop control software for the person lift according to specifications

Page 3: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Purpose of this document

• Lecture slides have extensive information about how the control software is developed

• This document has a subset of that information needed for passing the project:– Specifications for each iteration– Testing requirements for each iteration

• Lecture slides explain the process of moving from machine-level requirements to the tested product (required for exam)

• This document assumes that you have gone through the tutorial in Noppa

Page 4: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

How creative can you be in the design?

• Lecture slides provide the architecture design and leave the detailed design to you

• However, you can do totally your own architecture based on the specifications is this document as long as you present the tests listed in this document– Recommended only for experienced developers who want to do

things their own way

• Teachers are available to help in problem situations only if you follow the main architectural decisions presented in the lecture slides

Page 5: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Demo interviews

• When you demonstrate each iteration, we interview you about the maintainability, scalability and reusability implications of your design decisions

• If you did not follow the architecture in the lecture slides, that is fine, but be ready for this discussion

• Even if you followed the lecture slides, there is no one correct solution

Page 6: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Test coverage

• Test coverage is a measure of the degree to which the source code of a program has been tested

• Good test design gives maximum coverage with minimum number of tests

• You do not need to use the exact test inputs as presented here, but you must provide similar coverage!

Page 7: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Example of coverage

• Pressing button for automatic movement drives platform to stored height

• If current height is less than stored height, platform is driven up– Else, platform is driven down

• Driving up and driving down involve different sections of code

• If our test involves driving up once and driving down once, but you present a test that just drives down twice, we will ask you to update the test

Page 8: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iterations 1A and 1B

- Moving the platform manually from the platform- Control place selection- Joystick mode selection

Page 9: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iterations 1A and 1B

• Functions:– Moving the platform manually from the platform– Control place selection– Joystick mode selection

• Tests for iteration 1A require only movement in vertical direction

• Tests for 1B require that you have both vertical and horizontal movement working

Page 10: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Control place selection

A/D Interface Signal name Interpretation

bool Control_place_selection 0=chassis1=platform

10

• Description: The function either enables the controls on the platform or the chassis (e.g. joystick is on platform). This status information is used to enable or disable other functions (e.g. functions using joystick are disabled if chassis has been selected.)

• Triggering event: Value of “Control_place_selection” signal changes

• States in which enabled: All

Page 11: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Joystick mode selection

A/D Interface Signal name Interpretation

bool Joystick_mode 0=moving platform1=transfer

11

• Description: The function toggles the system state between “moving_platform” or “transfer” (driving with wheels) as described in the table. This status information is used to enable or disable other functions (e.g. Moving platform is disabled in transfer mode)

• Triggering event: Change in value of Joystick_mode signal

• States in which enabled: control place is platform

Page 12: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Moving the platform manually from the platform

A/D (or D/A)Interface

Signal name Scaling Range Interpretation

Bool Joystick_center_position

[0,1] 0 = not in center1 = center position

16-bit (0-65535)

Joystick_up_down 0 -> -165535 -> 1

[-1..1] -1=extreme position down0=center1=extreme position up

Joystick_left_right -1=extreme position left0=center1=extreme position right

Up_actuate 0 -> 01 -> 65535

[0..65535]

0=proportional valve closed65535=proportional valve fully openDown_actuate

Left_actuate

Right_actuate

12

• Use double in Simulink for 16-bit signals

Page 13: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Moving the platform manually from the platform (In terms of scaled signal values)

• Description: see tables

• Safe state: DA = 0; UA = 0; LA = 0; RA = 0

• Triggering event: JUD != 0 OR JLR != 0

• States in which enabled: control place is platform and joystick mode is moving platform. If disabled, go to safe state.

13

Joystick_up_down (JUD) Down_actuate (DA) Up_actuate (UA)

[-1, 0] [0, 1] DA = -1 * JUD 0

[0, 1] 0 [0,1] UA = JUD

Joystick_left_right (JLR) Left_actuate (LA) Right_actuate (RA)

[-1, 0] [0, 1] LA = -1 * JLR 0

[0, 1] 0 [0,1] RA = JLR

Page 14: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Test signal

• You need to create the ”Joystick_up_down” and ”Joystick_center_position” signals for testing

• Latter is true when former is within some tolerance of the center value

Page 15: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

There is only one test for iteration 1A (next 2 slides)

Page 16: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Behavior when place=platform and mode=moving

16

Curving is due to joystick being gradually pushed up

Zoomed in version on next slide

Page 17: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Observe behavior close to center position

17

• Center value of Joystick_up_down=32768

• Joystick_center_position activates at a reasonable time (test block works)

• Height does not change when center_position is true (note the zoom: Platform_height x10^-4)

• Height starts increasing immediately when center_position =0 (correct: simulator does not model inertia)

Page 18: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Tests for iteration 1B

Page 19: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

First, test horizontal movement just like vertical movement was tested in 1A

19

Page 20: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Further testing

• To improve coverage, we try:– Movement with different tempo– Moving joystick into both directions, and– Crossing center position several times from both

directions

20

Page 21: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Using a sine wave as the test input

21

Here the stick passes below the center position of the Y-direction and platform starts moving down.

Stick is now above center of Y-direction and platform starts moving up.

What if joystick movement is reversed before platform reaches extreme position? Next slide.

Page 22: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Previous test with a lower sine amplitude: platform does not reach extreme position

22

Movement of platform is reversed immediately when joystick crosses center. Correct, because simulator does not model inertia.

Page 23: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iteraatio 1B demo exercise (scenario)

23

• System engineer wants to distribute the software:

• Joystick signal processing• Forming cylinder actuation signals

• For safety reasons, center_position signal should be sent separately over the network. This guards against corruption of network messages.

Page 24: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

1B demo task

• Modify the software so that Joystick_center_position is processed in the module that creates the Up/Down/Left/Right_actuate signals

• Then rerun all the earlier tests• Check the next slide before starting

Page 25: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Hint for demo exercise

• Create a block “Forced_Off_Interlock” :• Inputs:

– Signal_In (double)– Forced_off (boolean)

• Output:– Signal_Out (double)

• Behavior:– Forced_off TRUE => Signal_Out:=0– Forced_off FALSE => Signal_Out:=Signal_In

• This block will be needed in the later iterations

Page 26: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iteration 2

- Cylinder limit protection

Page 27: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Cylinder limit protection

A/D D/A interface

Signal name Scale Range Interpretation

bool Left_limit 0=extreme position of cylinder not detected1=extreme position detected Right_limit

Down_limit

Up_limit

16 bit(0-65535)

Up_actuate 0 -> 065535 -> 1

[0..1] 0=proportional valve closed1=proportional valve fully open

Down_actuate

Left_actuate

Right_actuate

27

Page 28: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Cylinder limit protection

28

• Description: If Left_limit = 0, function does not activate

• If Left_limit = 1, Left_actuate is forced to zero even if another function gives other actuation signals. This is a safty function and has highest priority.

• Safe state: Left_actuate = 0

• Triggering event: Left_limit = 1

• States in which enabled: All

• Specifications for other signals: replace ”Left” with ”Right”, ”Down”, ”Up”

Page 29: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Same joystick ramp input as in iteration1

29

At upper limit up_actuate forced to zero

At lower limit down_actuate forced to zero

Page 30: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Same sine input as in iteration 1B

30

Page 31: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Same low-amplitude sine input as in iteration 1B

31

Test shows that limit protection does not activate when it should not activate – important to test this!

Page 32: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iteration 3A

- Prevention of unintentional movement- Automatic driving to stored position

Page 33: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

New input signals in iteration 3A

A/D Signal_name Range Scaling Interpretation

bool Quick_height_A [0,1] 0=not pressed1=pressed

Quick_height_B

Enabling_switch

16-bit (0-65535)

Height_sensor [0..1] 0->0,65535->1

Height of platform from chassis0=lowest position1=highest position

33

Page 34: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Automatic driving to stored position

• Description: Current height can be stored by pressing the quick button A or B for longer than sys_param: quick_position_register_time (hardcode this parameter into your application). Each button can store a separate height. After this, the platform is driven to the stored height by pressing the button shortly and keeping the enabling switch pressed down. If enabling switch is released, manual control is resumed. Horizontal cylinder is not moved.

• Safe state: cylinders are stopped

• Triggering event: Button A or B is pressed

• States in which enabled: control place is platform and joystick mode is moving platform

34

Page 35: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Prevention of unintentional movement

• Description: Cylinders are not driven if enabling switch is not pressed, regardless of joystick position.

• Safe state: Cylinders are stopped• Triggering event: Enabling switch is pressed• States in which enabled: All

35

Page 36: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Joystick is moved gradually from down to up while pressing quick buttons

36

Store height A

Reached A but enabling switch is pressed:Stay in auto mode

Enabling switch released: start moving under manual control

Drive to height A

Page 37: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Zoomed version of previous slideFocus on button B

37

First press takes 100 time stepsHeight is stored after pressing longer than the valuein parameter “quick_position_register_time”.Here the value is 50.

Reached stored position B

When automatic driving is started, actuation signal goes to maximum (65535)

Short press of button B interruptsManual movement and starts automatic driving, which is done at maximum speed.

Page 38: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

This time, the joystick is pulled down

38

• Here we test upward driving with button A and downward driving with button B

• Opposite directions were tested in the previous test. This test increases coverage of the automatic movement logic

Page 39: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

This time, we use the button A twice

39

• E.g. there might be a bug that keeps using the first stored position

• Previous tests would not catch that

Page 40: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Iteration 3B

- No new functionality- Update the design to group several signals to a single port and wire with buses- Then make sure that your the same tests as in iteration 3B still work

Page 41: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

Before you begin

• Technical assistance on using bus objects is in the document Iter3B_Vinkkeja

• Lecture slides describe the design rationale in this iteration

Page 42: AS-116.2120 (ATJ) Specifications and testing requirements for passing iterations 1A, 1B, 2, 3A and 3B.

New interface specification

• Use the following interfaces• Lecture slides have one solution, but yours may be

different, as long as you are ready to discuss its maintainability, scalability and reusability

Bus object Signals

SenLimit Ext_limit, Ret_limit

UI_selectors Joystick_mode, Quick_height_A, Quick_height_B, Control_place_selection

UI_all selectors (of type UI_selectors), Enabling_switch, Joystick_center_position