/* Action function for state "light_on" in state set "set_lights" */ static void A_set_lights_light_on(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 26 "../srcextrSncLib.st" strcpy(currentstate, "Light Off"); seq_pvPut(ssId, 3 /* currentstate */, 0); # line 29 "../srcextrSncLib.st" light = 0; seq_pvPut(ssId, 1 /* light */, 0); } return; case 1: { # line 34 "../srcextrSncLib.st" strcpy(currentstate, "Fault"); seq_pvPut(ssId, 3 /* currentstate */, 0); # line 37 "../srcextrSncLib.st" light = 1; seq_pvPut(ssId, 2 /* fault */, 0); } return; } }
/* Action function for state "fault" in state set "set_lights" */ static void A_set_lights_fault(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 61 "../srcextrSncLib.st" strcpy(currentstate, "Light On"); seq_pvPut(ssId, 3 /* currentstate */, 0); # line 64 "../srcextrSncLib.st" light = 1; seq_pvPut(ssId, 1 /* light */, 0); } return; case 1: { # line 69 "../srcextrSncLib.st" strcpy(currentstate, "Light Off"); seq_pvPut(ssId, 3 /* currentstate */, 0); # line 72 "../srcextrSncLib.st" light = 0; seq_pvPut(ssId, 1 /* light */, 0); } return; } }
/* Action function for state "findDirectionState" in state set "lockInjectorLaserStateSet" */ static void A_lockInjectorLaserStateSet_findDirectionState(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; case 1: { # line 211 "../seqLockInjectorLaser.stt" (pVar->alpha) = 2 * (pVar->directionBO) - 1; (pVar->actuatorAO) += (pVar->alpha) * (pVar->findDirectionStepSizeAO); # line 212 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 7 /* actuatorAO */, 2); seq_seqLog(ssId, "actuatorAO = %f\n", (pVar->actuatorAO)); } return; case 2: { # line 216 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "Wrong direction!\n"); seq_seqLog(ssId, "highFrequencyLimitLI= %d\n", (pVar->highFrequencyLimitLI)); seq_seqLog(ssId, "directionBO = %d\n", (pVar->directionBO)); # line 221 "../seqLockInjectorLaser.stt" if ((pVar->directionBO) == 1) { (pVar->directionBO) = 0; } # line 223 "../seqLockInjectorLaser.stt" else { (pVar->directionBO) = 1; } # line 224 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 6 /* directionBO */, 2); seq_seqLog(ssId, "directionBO = %d\n", (pVar->directionBO)); seq_seqLog(ssId, "Check readings are still in range\n"); } return; case 3: { # line 229 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "Direction found!\n"); seq_seqLog(ssId, "highFrequencyLimitLI_atEntry = %d\n", (pVar->highFrequencyLimitLI_atEntry)); seq_seqLog(ssId, "highFrequencyLimitLI = %d\n", (pVar->highFrequencyLimitLI)); seq_seqLog(ssId, "directionBO = %d\n", (pVar->directionBO)); seq_seqLog(ssId, "Now will try to minimize high frequency reading!\n"); } return; } }
/* Entry function for state "idleState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_idleState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 127 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> idleState\n"); # line 128 "../seqLockInjectorLaser.stt" (pVar->runBO) = 0; seq_pvPut(ssId, 0 /* runBO */, 2); # line 129 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "runBO = %d\n", (pVar->runBO)); # line 130 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Idle"); seq_pvPut(ssId, 1 /* statusSI */, 0); }
/* Entry function for state "findDirectionState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_findDirectionState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 192 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> findDirectionState\n"); # line 193 "../seqLockInjectorLaser.stt" (pVar->highFrequencyStepSizeAO_atEntry) = (pVar->highFrequencyStepSizeAO); # line 194 "../seqLockInjectorLaser.stt" (pVar->directionBO_atEntry) = (pVar->directionBO); # line 195 "../seqLockInjectorLaser.stt" (pVar->highFrequencyLimitLI_atEntry) = (pVar->highFrequencyLimitLI); # line 196 "../seqLockInjectorLaser.stt" (pVar->actuatorAO_atEntry) = (pVar->actuatorAO); # line 198 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyStepSizeAO_atEntry = %f\n", (pVar->highFrequencyStepSizeAO_atEntry)); # line 199 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "directionBO_atEntry = %d\n", (pVar->directionBO_atEntry)); # line 200 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "actuatorAO_atEntry = %f\n", (pVar->actuatorAO_atEntry)); # line 201 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyLimitLI_atEntry = %d\n", (pVar->highFrequencyLimitLI_atEntry)); # line 202 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencySigmaLO = %d\n", (pVar->highFrequencySigmaLO)); # line 204 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Looking for direction"); seq_pvPut(ssId, 1 /* statusSI */, 0); # line 206 "../seqLockInjectorLaser.stt" (pVar->sigma) = (pVar->highFrequencySigmaLO); }
/* Entry function for state "highFrequencyState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_highFrequencyState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 242 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> highFrequencyState\n"); # line 243 "../seqLockInjectorLaser.stt" (pVar->highFrequencyStepSizeAO_atEntry) = (pVar->highFrequencyStepSizeAO); # line 244 "../seqLockInjectorLaser.stt" (pVar->actuatorAO_atEntry) = (pVar->actuatorAO); # line 245 "../seqLockInjectorLaser.stt" (pVar->directionBO_atEntry) = (pVar->directionBO); # line 246 "../seqLockInjectorLaser.stt" (pVar->highFrequencyLimitLI_atEntry) = (pVar->highFrequencyLimitLI); # line 248 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyStepSizeAO_atEntry = %f\n", (pVar->highFrequencyStepSizeAO_atEntry)); # line 249 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "directionBO_atEntry = %d\n", (pVar->directionBO_atEntry)); # line 250 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "actuatorAO_atEntry = %f\n", (pVar->actuatorAO_atEntry)); # line 251 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyLimitLI_atEntry = %d\n", (pVar->highFrequencyLimitLI_atEntry)); # line 252 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyLimitLI_HOPR = %d\n", (pVar->highFrequencyLimitLI_HOPR)); # line 253 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencySigmaLO = %d\n", (pVar->highFrequencySigmaLO)); # line 255 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Lowering high frequency component"); seq_pvPut(ssId, 1 /* statusSI */, 0); # line 257 "../seqLockInjectorLaser.stt" (pVar->sigma) = (pVar->highFrequencySigmaLO); # line 258 "../seqLockInjectorLaser.stt" (pVar->alpha) = 2 * (pVar->directionBO) - 1; }
/* Entry function for state "lowFrequencyState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_lowFrequencyState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 278 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> lowFrequencyState\n"); # line 279 "../seqLockInjectorLaser.stt" (pVar->lowFrequencyStepSizeAO_atEntry) = (pVar->lowFrequencyStepSizeAO); # line 280 "../seqLockInjectorLaser.stt" (pVar->directionBO_atEntry) = (pVar->directionBO); # line 281 "../seqLockInjectorLaser.stt" (pVar->lowFrequencyLimitLI_atEntry) = (pVar->lowFrequencyLimitLI); # line 283 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "lowFrequencyStepSizeAO_atEntry = %f\n", (pVar->lowFrequencyStepSizeAO_atEntry)); # line 284 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "directionBO_atEntry = %f\n", (pVar->directionBO_atEntry)); # line 285 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "actuatorAO_atEntry = %f\n", (pVar->actuatorAO_atEntry)); # line 286 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "lowFrequencyLimitLI_atEntry = %d\n", (pVar->lowFrequencyLimitLI_atEntry)); # line 287 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "lowFrequencyLimitLI_HOPR = %d\n", (pVar->lowFrequencyLimitLI_HOPR)); # line 288 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "lowFrequencySigmaLO = %d\n", (pVar->lowFrequencySigmaLO)); # line 290 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Lowering low frequency component"); seq_pvPut(ssId, 1 /* statusSI */, 0); # line 292 "../seqLockInjectorLaser.stt" (pVar->sigma) = (pVar->lowFrequencySigmaLO); # line 293 "../seqLockInjectorLaser.stt" (pVar->alpha) = 2 * (pVar->directionBO) - 1; }
/* Action function for state "lowFrequencyState" in state set "lockInjectorLaserStateSet" */ static void A_lockInjectorLaserStateSet_lowFrequencyState(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; case 1: { # line 298 "../seqLockInjectorLaser.stt" (pVar->actuatorAO) += (pVar->alpha) * (pVar->lowFrequencyStepSizeAO); # line 298 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 7 /* actuatorAO */, 2); seq_seqLog(ssId, "actuatorAO = %f\n", (pVar->actuatorAO)); } return; case 2: { # line 302 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "lowFrequencyLimitLI = %d >= HOPR+3*sigma !!!\n", (pVar->lowFrequencyLimitLI)); } return; case 3: { } return; } }
/* Exit function for state "readingsInRangeState" in state set "lockInjectorLaserStateSet" */ static void O_lockInjectorLaserStateSet_readingsInRangeState(SS_ID ssId, struct UserVar *pVar) { /* Exit 1: */ # line 185 "../seqLockInjectorLaser.stt" (pVar->searchStepSizeAO) = (pVar->searchStepSizeAO_atEntry); seq_pvPut(ssId, 2 /* searchStepSizeAO */, 0); # line 186 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "<-- readingsInRangeState\n"); }
/* Action function for state "readingsInRangeState" in state set "lockInjectorLaserStateSet" */ static void A_lockInjectorLaserStateSet_readingsInRangeState(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; case 1: { # line 165 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "highFrequencyLimitLI < HOPR\n"); seq_seqLog(ssId, "Readings are ok. Now attempting to find direction\n"); } return; case 2: { # line 169 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "Looking for valid reading!\n"); (pVar->alpha) = 2 * (pVar->directionBO) - 1; (pVar->actuatorAO) = (pVar->actuatorAO) + (pVar->searchStepSizeAO) * (pVar->alpha); # line 171 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 7 /* actuatorAO */, 2); seq_seqLog(ssId, "actuatorAO = %f\n", (pVar->actuatorAO)); # line 175 "../seqLockInjectorLaser.stt" if ((pVar->directionBO) == 1) { (pVar->directionBO) = 0; } # line 177 "../seqLockInjectorLaser.stt" else { (pVar->directionBO) = 1; } # line 178 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 6 /* directionBO */, 2); seq_seqLog(ssId, "alpha = %d\n", (pVar->alpha)); seq_seqLog(ssId, "directionBO = %d\n", (pVar->directionBO)); (pVar->searchStepSizeAO) += (pVar->searchStepSizeAO_atEntry); seq_delay(ssId, 0); } return; } }
/* Action function for state "START" in state set "limit" */ static void A_limit_2_START(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 138 "../demo.st" pVar->hiLimit = pVar->loLimit; # line 139 "../demo.st" seq_pvPut(ssId, 5/*hiLimit*/, 0); } return; case 1: { # line 143 "../demo.st" pVar->loLimit = pVar->hiLimit; # line 144 "../demo.st" seq_pvPut(ssId, 4/*loLimit*/, 0); } return; } }
/* Entry function for state "initState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_initState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 112 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> initState\n"); # line 113 "../seqLockInjectorLaser.stt" (pVar->p_familyName) = seq_macValueGet(ssId, "familyName"); # line 114 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "familyName is %s\n", (pVar->p_familyName)); # line 115 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Init"); seq_pvPut(ssId, 1 /* statusSI */, 0); }
/* Action function for state "START" in state set "light" */ static void A_light_0_START(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 75 "../demo.st" pVar->light = 0; # line 76 "../demo.st" seq_pvPut(ssId, 0/*light*/, 0); } return; } }
/* Action function for state "LIGHT_ON" in state set "light" */ static void A_light_0_LIGHT_ON(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 90 "../demo.st" pVar->light = 0; # line 91 "../demo.st" seq_pvPut(ssId, 0/*light*/, 0); # line 92 "../demo.st" errlogPrintf("light_on -> light_off\n"); } return; } }
/* Action function for state "START" in state set "ramp" */ static void A_ramp_1_START(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 101 "../demo.st" pVar->voltage = pVar->loLimit; # line 102 "../demo.st" seq_pvPut(ssId, 3/*voltage*/, 0); # line 103 "../demo.st" errlogPrintf("start -> ramp_up\n"); } return; } }
/* Action function for state "idleState" in state set "lockInjectorLaserStateSet" */ static void A_lockInjectorLaserStateSet_idleState(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 134 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "Request from operator to lock IL\n"); seq_seqLog(ssId, "Reset algo values to default\n"); (pVar->directionBO) = 1; # line 136 "../seqLockInjectorLaser.stt" seq_pvPut(ssId, 6 /* directionBO */, 2); seq_seqLog(ssId, "direcionBO = %d\n", (pVar->directionBO)); (pVar->highFrequencyLimitLI_HOPR) = 900; (pVar->highFrequencyLimitLI_LOPR) = 100; (pVar->lowFrequencyLimitLI_HOPR) = 900; (pVar->lowFrequencyLimitLI_LOPR) = 50; } return; } }
/* Entry function for state "readingsInRangeState" in state set "lockInjectorLaserStateSet" */ static void I_lockInjectorLaserStateSet_readingsInRangeState(SS_ID ssId, struct UserVar *pVar) { /* Entry 1: */ # line 151 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "--> readingsInRangeState\n"); # line 152 "../seqLockInjectorLaser.stt" (pVar->actuatorAO_atEntry) = (pVar->actuatorAO); # line 153 "../seqLockInjectorLaser.stt" (pVar->directionBO_atEntry) = (pVar->directionBO); # line 154 "../seqLockInjectorLaser.stt" (pVar->searchStepSizeAO_atEntry) = (pVar->searchStepSizeAO); # line 156 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "searchStepSizeAO_atEntry = %f\n", (pVar->searchStepSizeAO_atEntry)); # line 157 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "direcionBO_atEntry = %d\n", (pVar->directionBO_atEntry)); # line 158 "../seqLockInjectorLaser.stt" seq_seqLog(ssId, "actuatorAO_atEntry = %f\n", (pVar->actuatorAO_atEntry)); # line 160 "../seqLockInjectorLaser.stt" strcpy((pVar->statusSI), "Readings in range?"); seq_pvPut(ssId, 1 /* statusSI */, 0); }
/* Action function for state "RAMP_DOWN" in state set "ramp" */ static void A_ramp_1_RAMP_DOWN(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 122 "../demo.st" errlogPrintf("ramp_down -> ramp_up\n"); } return; case 1: { # line 126 "../demo.st" pVar->voltage -= 0.1; # line 127 "../demo.st" if (seq_pvPut(ssId, 3/*voltage*/, 0) < 0) # line 128 "../demo.st" errlogPrintf("pvPut( voltage ) failed\n"); } return; } }
/* Action function for state "makeRequest" in state set "monitorEvflagTest" */ static void A_monitorEvflagTest_0_makeRequest(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 38 "../monitorEvflag.st" testPass("no error in %d cycles", (20 * 500)); } return; case 2: { # line 41 "../monitorEvflag.st" pVar->requested = pVar->UserVar_monitorEvflagTest.cycleCount; # line 42 "../monitorEvflag.st" seq_pvPut(ssId, 0/*requested*/, 0); } return; } }