st.setNext(num++, CyclePeriodCalibration, 1, 0, 1, 0, 0, 1);
st.state.calStop = 2;
cpl.append(st);
st.setNext(num++, CyclePeriodAll, 0, 1, 1, 0, 0, 1);
st.state.injection = 3;
cpl.append(st);
st.setNext(num++, CyclePeriodEvent0, 1, 0, 1, 0, 0, 1);
st.state.hchange = 4;
cpl.append(st);
st.setNext(num++, CyclePeriodEvent1, 1, 0, 1, 0, 0, 1);
st.lo1Harmonic = 16;
st.lo1Phase = 0.0;
st.bunchMask = 0x03C0;
st.mean1Mask = 0x03C0;
st.mean2Mask = 0x0040;
cpl.append(st);
if(err = ocycleParam.setStates(cpl))
return err;
ofile.writeString(ocycleParam.getString());
ofile.close();
return err;
}
BError Gen::genBeam3Delay(){
BError err;
CycleParamState st;
BList<CycleParamState> cpl;
BUInt num = 0;
// Set up base parameters
ocycleParam.cycleType = oname;
ocycleParam.info += "Beam with 4 particle bunches at harmonic 8. Beam then moves to 4 particle bunches at harmonic 16. With delay state.";
ocycleParam.channel = 0;
ocycleParam.pllCycleStartFrequency = int(pow(2.0, 32) / (pllFrequency / ofref));
ocycleParam.pllInitialFrequency = int(pow(2.0, 32) / (pllFrequency / ofref));
ocycleParam.pllInitialFrequencyDelay = opllInitialFrequencyDelay;
ocycleParam.pllFrefGain = defaultFrefGain;
ocycleParam.pllGain = defaultPllGain;
ocycleParam.pllDdsMinimum = 0;
ocycleParam.pllDdsMaximum = 0;
ocycleParam.stateDelay = 5;
// Set up Positions
setPhaseDelay();
// Set up States
ocycleParam.getDefaultState(st);
st.setNext(num++, CyclePeriodAll, 0, 1, 1, 0, 0, 1);
st.state.calStart = 1;
st.state.injection = 3;
st.lo1Harmonic = 8;
st.lo1Phase = 0.0;
st.lo2Harmonic = 8;
st.lo2Phase = 0.0;