Type Diagram
Types
Types are used in the model to specify the nature of the parameters of flows or variables.
Open the Type Diagram
You can open the Type Diagram via "Create Type":

It will open a Type Diagram:

On this diagram, you can create :
- Primitive Types
- Data Types and their attributes
- Enumerations and their literals.
Primitive Type
A primitive type is a data type which represents atomic data values. Use of new primitive types is strongly advised, in order to avoid mismatches in your model (comparison of a speed and a distance for example).
Sim4Sys Designer has 3 primitive type :
- integer
- decimal
- text
In C++ code, they are generated as :
- int
- double
- std::string
When creating a primitive type, you will be asked to select if your primitive type is a redefinition of decimal, integer or text :

Naming rule: Simple Type naming consist on the name of a quantity followed by "_Type" Examples: Speed_Type ; Luminosity_Type
You will have to give values to variables typed by your primitive type conform to that choice. Ex : 10.1 for decimal, 2 for int, "text" for text.

Then you can specify :
- its unit
- its description
- its resolution
- its accuracy
- its minimum value
- its maximum value
Those informations have no effect on the generated code.
Data Type
A data type is a complex type. Data types contains attributes.
In C++, data types are generated as structures. For more information on how to manipulate structures in c++, you can see this link : https://web.maths.unsw.edu.au/~lafaye/CCM/cpp/cppstruct.htm
Naming rule: Data Type naming consist on a name followed by "_Structure" Examples: Dictionary_Structure ; User_data_Structure
Attributes
When creating an attribute in a data type:
- you have to choose its type from existing types in your model.
- you have to choose multiplicity "One" or "Many".

When generating code, an attribute with multiplicity "Many" is generated as a Vector (in C++). For more information on how to manipulate vectors in c++, you can see this link : https://openclassrooms.com/fr/courses/1894236-apprenez-a-programmer-en-c/7711021-manipulez-des-tableaux-dynamiques
Sim4Sys Designer does not allow to create multiplicity with a fix value (a Table) for the time being.
Enumeration
An enumeration is a type whose values are enumerated in the model as user-defined enumeration literals.
Naming rule: Enumeration naming consist on a name followed by "_Enum" Examples: Group_Enum ; Priority_Enum
Change the order of Enumeration Literal in an Enumeration
The order that is taken into account when generating the code is the one in the Properties tab > UML > Owned literal.
The display in the diagram itself is only purely HMI.

Make the modification in two places, to avoid any errors, especially if a third party takes your model again.
Additional informations
If you created multiple attributes or enumerations for a type and you don't see them, they might be hidden. Right click on your type then Filters → Show/Hide contents. Then select all the attributes/enumerations to show.
