FW Profile - C1 Implementation
FwDaTempRecAction.c
Go to the documentation of this file.
1 
10 #include <stdlib.h>
11 #include "FwDaTempRecAction.h"
12 #include "FwDaHwDev.h"
13 #include "FwDaCurCheck.h"
14 #include "FwPrCore.h"
15 #include "FwPrConfig.h"
16 #include "FwPrDCreate.h"
17 
18 /* --------------------------------------------------------------------- */
24 static void HwDevSwitchOff(FwPrDesc_t prDesc);
25 
26 /* --------------------------------------------------------------------- */
33 static void HwDevToStandBy(FwPrDesc_t prDesc);
34 
35 /* --------------------------------------------------------------------- */
42 static void HwDevOperational(FwPrDesc_t prDesc);
43 
44 /* --------------------------------------------------------------------- */
50 static FwPrBool_t WaitN1Cycle(FwPrDesc_t prDesc);
51 
52 /* --------------------------------------------------------------------- */
58 static FwPrBool_t TempBelowT1(FwPrDesc_t prDesc);
59 
60 /* --------------------------------------------------------------------- */
62  static FwPrDesc_t tempRecAction = NULL;
63  const FwPrCounterS1_t nOfANodes = 3; /* Number of action nodes */
64  const FwPrCounterS1_t nOfDNodes = 1; /* Number of decision nodes */
65  const FwPrCounterS1_t nOfFlows = 6; /* Number of control flows */
66  const FwPrCounterS1_t nOfActions = 3; /* Number of actions */
67  const FwPrCounterS1_t nOfGuards = 2; /* Number of guards */
68 
69  if (tempRecAction != NULL) /* Temperature Recovery Action was already created */
70  return tempRecAction;
71 
72  /* Create and configure the procedure */
73  tempRecAction = FwPrCreate(nOfANodes,nOfDNodes,nOfFlows,nOfActions,nOfGuards);
74 
75  FwPrAddActionNode(tempRecAction, 1, &HwDevToStandBy);
76  FwPrAddActionNode(tempRecAction, 2, &HwDevOperational);
77  FwPrAddActionNode(tempRecAction, 3, &HwDevSwitchOff);
78 
79  FwPrAddDecisionNode(tempRecAction, 1, 2);
80 
81  FwPrAddFlowIniToAct(tempRecAction, 1, NULL);
82  FwPrAddFlowActToDec(tempRecAction, 1, 1, &WaitN1Cycle);
83  FwPrAddFlowDecToAct(tempRecAction, 1, 2, &TempBelowT1);
84  FwPrAddFlowDecToAct(tempRecAction, 1, 3, NULL); /* This acts as an "Else" guard */
85  FwPrAddFlowActToFin(tempRecAction, 2, NULL);
86  FwPrAddFlowActToFin(tempRecAction, 3, NULL);
87 
88  return tempRecAction;
89 }
90 
91 /* --------------------------------------------------------------------- */
92 static void HwDevSwitchOff(FwPrDesc_t prDesc) {
94 }
95 
96 /* --------------------------------------------------------------------- */
97 static void HwDevToStandBy(FwPrDesc_t prDesc) {
99 }
100 
101 /* --------------------------------------------------------------------- */
102 static void HwDevOperational(FwPrDesc_t prDesc) {
104 }
105 
106 /* --------------------------------------------------------------------- */
107 static FwPrBool_t WaitN1Cycle(FwPrDesc_t prDesc) {
108  if (FwPrGetNodeExecCnt(prDesc) >= TEMP_REC_ACTION_N1)
109  return 1;
110  else
111  return 0;
112 }
113 
114 /* --------------------------------------------------------------------- */
115 static FwPrBool_t TempBelowT1(FwPrDesc_t prDesc) {
117  return 1;
118  else
119  return 0;
120 }
FwPrCounterU3_t FwPrGetNodeExecCnt(FwPrDesc_t prDesc)
Return the Node Execution Counter.
Definition: FwPrCore.c:141
Declaration of the configuration interface for a FW Procedure.
void FwPrAddFlowActToDec(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from an action node to a decision node and add it to a procedure.
Definition: FwPrConfig.c:190
float GetHwDevTemp()
This function returns the temperature of the Hardware Device.
Definition: FwDaHwDev.c:124
#define TEMP_REC_ACTION_N1
Number of wait cycles between the command sending the Hardware Device to Stand-By and the check on th...
Definition of the Current Failure Detection (FD) Check.
Definition of the Temperature Failure Recovery Action (RA).
Definition of the interface to access the Hardware Device.
int FwPrBool_t
Type used for booleans (0 is "false" and 1 is "true").
Definition: FwPrConstants.h:48
#define TR_HW_DEV_SBY
Name of the transition from OPERATIONAL to STANDBY in the HW Device State Machine.
Definition: FwDaHwDev.h:44
void FwPrAddFlowActToFin(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrGuard_t cfGuard)
Create a control flow from an action node to the final node and add it to a procedure.
Definition: FwPrConfig.c:205
FwPrDesc_t FwPrCreate(FwPrCounterS1_t nOfANodes, FwPrCounterS1_t nOfDNodes, FwPrCounterS1_t nOfFlows, FwPrCounterS1_t nOfActions, FwPrCounterS1_t nOfGuards)
Create a new procedure descriptor.
Definition: FwPrDCreate.c:23
#define TR_HW_DEV_OPER
Name of the transition from STANDBY to OPERATIONAL in the HW Device State Machine.
Definition: FwDaHwDev.h:42
#define TR_HW_DEV_OFF
Name of the transition from ON to OFF in the HW Device State Machine.
Definition: FwDaHwDev.h:40
void FwSmMakeTrans(FwSmDesc_t smDesc, FwSmCounterU2_t transId)
Trigger a transition in a state machine.
Definition: FwSmCore.c:92
void FwPrAddDecisionNode(FwPrDesc_t prDesc, FwPrCounterS1_t nodeId, FwPrCounterS1_t nOfOutFlows)
Create a decision node with the given characteristics and add it to a procedure.
Definition: FwPrConfig.c:134
signed char FwPrCounterS1_t
Type used for signed counters with a "short" range.
Definition: FwPrConstants.h:78
Structure representing a procedure descriptor.
Definition: FwPrPrivate.h:254
FwSmDesc_t GetHwDevSm()
Retrieve the descriptor of the Hardware Device State Machine.
Definition: FwDaHwDev.c:92
void FwPrAddFlowIniToAct(FwPrDesc_t prDesc, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from the initial node to an action node and add it to a procedure.
Definition: FwPrConfig.c:175
#define TEMP_REC_ACTION_T1
Temperature threshold for the Temperature Recovery Action.
Declaration of the dynamical creation interface for a FW Procedure.
void FwPrAddActionNode(FwPrDesc_t prDesc, FwPrCounterS1_t nodeId, FwPrAction_t action)
Create an action node with the given characteristics and add it to a procedure.
Definition: FwPrConfig.c:92
FwPrDesc_t GetTempRecActionPr()
Retrieve the descriptor of the Temperature Recovery Action Procedure.
void FwPrAddFlowDecToAct(FwPrDesc_t prDesc, FwPrCounterS1_t srcId, FwPrCounterS1_t destId, FwPrGuard_t cfGuard)
Create a control flow from a decision node to an action node and add it to a procedure.
Definition: FwPrConfig.c:195
Declaration of the execution interface for a FW Procedure.
P&P Software GmbH, Copyright 2011, All Rights Reserved