Add a new feature to a model (blackbox)
PRESENTATION
This tutorial can be done in an existing model of car or in a new model (the creation of the model and the project is not presented in this tutorial).
Prerequisites
Have done the previous tutorial: Start to use Sim4Sys with a simple model (whitebox).
News skills that you will acquire
On Virtual Bench:
- Create a HMI Enumeration,
- Use a new Context elements: Commodo, Light signal equipment, Blinking picto,
- Attach an element to another.
Duration
3h
CREATE A NEW SERVICE
- Go into the Project’s structure diagram
- Create a New Service named IndicationManagement, in the composite structure diagram of the product you are specifying


- You should have the following elements: (refresh if all of them don't appear yet)

- Add the life phase “Standard Use” to the Life Phase diagram

USE CASES
- Create an User actor named Driver (you can rename it at its creation, or via its Properties view), in the Use Case Diagram (UCD)
- Create the following use cases of the life phase “Standard Use” and associations between them and Driver:
- Activate_Left_Indication
- Activate_Right_Indication
- Deactivate_Turning_Indication
- Activate_Warnings_Indication
- Deactivate_Warnings_Indication

STORIES
For the following use cases, you will have to create user stories as below:

-
Create the following user story in the use case Activate_Left_Indication:
- The_driver_requests_left_indication
-
Create the following user story in the use case Activate_Right_Indication:
- The_driver_requests_right_indication
-
Create the following user story in the use case Deactivate_Turning_Indication:
- The_driver_requests_to_stop_turning_indication
-
Create the following user story in the use case Activate_Warnings_Indication:
- The_driver_requests_warnings_indication
-
Create the following user story in the use case Deactivate_Warnings_Indication:
- The_driver_requests_to_stop_warnings_indication
REQUEST FLOWS AND INTERFACES
- Open the Request Interfaces diagram.

In this diagram, you will need to specify the interfaces requested from the user.
- You can organize the interfaces and flows as follow:
- I_request_turning_indication
- requests_left_indication
- request_right_indication
- requests_no_turning_indication
- I_request_warnings_indication
- requests_warnings_indication
- requests_no_warnings_indication
- I_request_turning_indication

FEEDBACK FLOWS AND INTERFACES
-
Open the Feedback Interfaces diagram.
-
Here you specify the interfaces provided to the user as feedback from the service:
- I_feed_back_turning_indication
- feed_back_left_indication
- feed_back_right_indication
- feed_back_no_left_indication
- feed_back_no_right_indication
- I_feed_back_warnings_indication
- feed_back_warnings_indication
- feed_back_no_warnings_indication
- I_feed_back_turning_indication

FLOW AND INTERFACES TO ENVIRONMENT
-
Open the ToEnv diagram.
-
Interfaces going to the environment are specified there:
- I_inform_of_turning_indication
- inform_of_left_indication
- inform_of_right_indication
- inform_of_no_left_indication
- inform_of_no_right_indication
- I_inform_of_warnings_indication
- inform_of_warnings_indication
- inform_of_no_warnings_indication
- I_inform_of_turning_indication

TURNING SIDE TYPE
We will need to create a type that can express the side requested by the user. It will be an enumeration with three possible values: Left / None / Right.
-
Go to the Type diagram and create a new Enumeration called TurnSideState.
-
Drag&drop three New Enumeration Literals on the title compartement and named them Left, None, and Right.
FILL ALL THE SEQUENCE DIAGRAMS
Activate_Left_Indication
The_driver_requests_left_indication
The first flow is a request from the user. By its name, it is holding the information that the request is to activate the left indication. A variable has been added to the lifeline. It is called engaged_turn_side and its type is the one created just before: TurnSideState and its default value is None
. This value will allow us to memorize that last request of the user. In our service, we want the user to be able to choose the turning side, but we don't want to be able to activate the right indication while the left indication is still going on. This will help us manage this case. The indication must be turned off before requesting a new side.

- Before activating the left signal, we make sure that the current indication is off, thanks to a condition guard with the following condition:
engaged_turn_side == None
. If the condition is true, we go on to the next step. - An activity that you can name engage_left, will allow us to change the engaged_turn_side variable to its new value: Left.
Remember that you can easily change a variable's value in an activity with a Right-Click on it > Edit > Complete Activity > Set Default Values. Here you can choose the variable you want to change, and the value you want to attribute.
- To finish, a flow will inform the environment, and another one will inform the user with feedback.
Activate_Right_Indication
The_driver_requests_right_indication

The same logic goes for this diagram. A condition guard is still needed to make sure that no turn side is engaged yet. Then another activity called engage_right switch the value of engaged_turn_side to Right. Make sure you don't forget to complete the activity. Then both output flows are sent as the previous one.