Reference Manual: DSL extraDefinition
From DSL
This class supplies the functions which define the necessary variables within a diagnosis session. So all the nodes in the available network are divided into three types: target, observation, and auxiliary. Each node may only be one of the three types. The target and observation nodes represent the hypothesis and test variables. From each of the target nodes a number of states are denoted as target states.
To perform diagnosis the nodes are assigned with additional information apart from the definitions they already have. The two main additional information are: troubleType and showAsType.
The troubleType consists of three types, which represent the function of a node in a diagnostic network:
- target: represents a node that contains the states that the user wishes to pursue.
- observation: represents a test that the user can perform during the diagnostic process.
- auxiliary: (standard type) when a node is nor a target or an observation he has no function, apart from probabilistic influence or modeling purposes.
Each node is associated with this troubleType and each node can only be one of the three types.
The states that the users want to pursue are called faultStates and will always belong to a target node. To indicate if a state is a faultState there is the array faultStates, which contains a 1 at the place of the state. The array faultStates is declared as follows:
DSL_intArray faultStates; // contains a 1 if the state is a fault state
The information showAsType defines how the states of a target node should be displayed. The following types are available:
- userDefined: The state will be shown according to the preferences set by the user.
- nodeName: The states will be displayed with the name of the node.
- stateName: The states will be displayed by their own name.
- nodeAndStatename: The states will be displayed with the name of the node followed by the name of the state.
- inherit: This is the standard display of the states according to the settings of the network.
Along with the types of the nodes there are three flags available:
| Flag | Description |
| ranked | Flag describes if this observation node should get a ranking about how usefulness the test is |
| mandatory | Flag if the observation node has to be instantiated before starting the diagnosis session. |
| setToDefault | Flag describes that the observation node has a default outcome. When the diagnosis session starts the observation node will be instantiated with this default outcome. Each observation node with this flag can only have one defaultOutcome state, which is set with the function SetDefaultOutcome.
An observation node can be accompanied with a string describing what question to ask when performing the test. |
The class provides functions for setting the nodes to the different types and assigning them with flags. Additional functions are for setting the label of a node, and providing the node with additional documentation like, RepairInfo or Question.
Types
- enum troubleType {target = 0, observation = 1, auxiliary = 2};
Declaration of the information troubleType as an enumeration type with the options:
{target = 0, observation = 1, auxiliary = 2}
- enum showAsType {userDefined = 0, nodeName = 1, stateName = 2, nodeAndStateName = 3, inherit = 4};
Declaration of the information showAsType as an enumeration type with the options:
{userDefined = 0, nodeName = 1, stateName = 2, nodeAndStateName = 3, inherit = 4}. For more information about these types, see the introduction of this paragraph.
Methods
- troubleType GetType(void)
Returns the troubletype of the node, this can only be one of the three following: {target = 0, observation = 1, auxiliary = 2}.
- bool IsRanked(void)
Returns true if the node has the flag ranked and false if not. For more information about Ranked, see the introduction of this paragraph.
- bool IsMandatory(void)
Returns true if the node has the flag mandatory and false if not. For more information about Mandatory, see the introduction of this paragraph.
- bool IsSetToDefault(void)
Returns true if the node has the flag setToDefault and false if not. For more information about setToDefault, see the introduction of this paragraph.
- void SetType(troubleType newType)
Changes the type of the node to the newType. The newType is an element of TroubleType and can therefore be only one of the following: {target = 0, observation = 1, auxiliary = 2}.
- void SetFlags(bool setRanked = false, bool setMandatory = false, bool setSetToDefault = false)
Sets the flags: {ranked, mandatory, setToDefault} of the node to the boolean variables: {setRanked, setMandatory, setSetToDefault} in this case all will get the value false.
- void SetShowAs(showAsType asThis)
Changes the showAsType of the node to the type asThis. asThis is an element of showAsType and can therefore be only one of the following:
{userDefined = 0, nodeName = 1, stateName = 2, nodeAndStateName = 3, inherit = 4}.
- showAsType GetShowAs(void)
Returns the showAsType of the node, which can only be one of the following {userDefined = 0, nodeName = 1, stateName = 2, nodeAndStateName = 3, inherit = 4}.
- int GetDefaultOutcome(void)
Returns the defaultOutcome state of the node and when defaultOutcome is not defined it will return 0.
- int SetDefaultOutcome(int thisOne)
Sets the defaultOutcome of the node to the thisOne state. The function returns DSL_OUT_OF_RANGE when thisOne is smaller then 0 and bigger then the number of the node.
- void SetFaultState(int thisState, int isFault = DSL_TRUE)
Sets the state thisState to a faultState if isFault is DSL_TRUE, by assigning it the value DSL_TRUE in the array faultStates. When isFault is DSL_FALSE the state isState in the list faultStates will be assigned the value DSL_FALSE.
- int IsFaultState(int thisState)
Returns DSL_TRUE when the state thisState is a faultState by checking if the state has the value DSL_TRUE in the array faultStates and it will return the number DSL_FALSE when the state has the value DSL_FALSE in the array faultStates.
- int SetFaultStates(DSL_intArray &fromHere)
Sets the array faultStates according to the array fromHere. The function checks if the number of items in fromHere is the same, as the number of elements in the array faultStates, if this is not the case the error DSL_OUT_OF_RANGE will be returned.
- DSL_intArray &GetFaultStates(void)
Returns an array with the handles of the faultStates of the node.
- DSL_documentation &GetDocumentation(int forThisState)
Returns the documentation of the state with the handle forThisState. The documentation of the states is stored in the array stateDocumentation, which is indexed by the states of the node. The class DSL_documentation represents the documentation part on another component like, for example, a state of a node.
- char *GetStateDescription(int forThisState)
Returns a pointer to a string containing the stateDescription of the state with the handle forThisState. The description of the states is stored in the array stateDescriptions, which is indexed by the states of the node.
- char *GetStateRepairInfo(int forThisState)
Returns a pointer to a string containing the StateRepairInfo of the state with the handle forThisState. The repairinfo of the states is stored in the array stateRepairInfo which is indexed by the states of the node.
- int SetStateDescription(int forThisState, char *newDescription)
Sets the StateDesciption of the state forThisState, to the string newDescription using the function SetString to allow proper allocation/deallocation of memory. The function returns any error message that occurs in the function SetString. The description of the states is stored in the list stateDescriptions, which is indexed by the states of the node.
- int SetStateRepairInfo(int forThisState, char *newInfo)
Sets the StateRepairInfo of the state forThisState to the string newInfo using the function SetString to allow proper allocation/deallocation of memory. The function will return any error message that occurred in the function SetString. The repairinfo of the states is stored in the array stateRepairInfo, which is indexed by the states of the node.
- DSL_stringArray &GetStateDescriptions(void)
Returns an array of strings with the descriptions of all the states of the node. The description of the states is stored in the array stateDescriptions, which is indexed by the states of the node.
- DSL_stringArray &GetFaultNames(void)
Returns an array of strings with the names of all the faultStates of the node.
- DSL_idArray &GetFaultLabels(void)
Returns an array with the handles of the labels of all the faultStates of the node.
- DSL_stringArray &GetStateRepairInfos(void)
Returns an array of strings with all the repairinfo of the node.
- std::string &GetQuestion(void)
Returns a string with the question of the node.
- int SetLabel(int thisOne, char *theLabel)
Sets the faultlabel of the state with the handle thisOne of the current node to the string theLabel. To do this, it first checks if the string theLabel is unique for the nodes in the network. When theLabel is not unique the function will return the error DSL_OUT_OF_RANGE. The faultlabel of a state is stored in an array of faultlabels where the array is indexed by the states and not by the faulty states.
- int SetLabels(DSL_idArray &theLabels)
Changes the array of faultlabels of the nodes according to the array theLabels. All the labels of the array theLabels should be unique, or the function will return the error: DSL_OUT_OF_RANGE.
- std::string GetEffectiveFaultName(int state, bool forceCompose = false)
Calls GetEffectiveFaultName with forceCompose to get effective name even if node is not target or state is not a faultState, this functionality is used by node description page.
- std::string GetEffectiveFaultName(int state, showAsType format, const char *szStateName, bool forceCompose)
This override accepts alternate state name passed in szStateName parameter. Set szStateName to NULL if you want to use real state name. This functionality is used by node description page.
