The Event Generator is a piece of hardware that broadcasts pulses in a well-defined frequency together with useful data for other interested systems. The idea is to get everybody synchronized with the same data, acting in the same beat frequency.

Resultado de imagem para cartoon people marching with drums

Credit: Red Music Cartoon Uniform Playing Marching Band Bands by Vector.me (by johnny_automatic)

And what is the main heartbeat used in LCLS1? 360Hz. This is called the fiducial frequency.

  360Hz Heartbeat

Credit Dennis Cox in dreamstime.com

Why 360 Hz? You can take a look at the explanation in the Technical Stuff.

The Event Generator sends numbers called Event Codes each 2.78 ms (360 Hz) to systems that are connected. Each event code means something that is happening in the accelerator. Event code 1, for instance, is the fiducial event. These codes were chosen when the timing system was designed and they were attributed to events with relevant meaning for the operation of the machine.

Examples of some event codes can be seen here:

Together with the event code, the Event Generator sends a timestamp. Every system receiving the event code knows exactly at what time this event happened.

Let's synchronize our watches!

Another interesting data that is sent is the pulse id. It is a number that is incremented in each fiducial pulse. This number goes from zero to 131,040 (0x1FFE0 or 0b1 1111 1111 1110 0000) and back again to zero. With this number, it is possible to count how many fiducial events happened between two other events.

The timestamp is structured by a 32-bits word representing seconds and another 32-bits word representing fractions of a second. Due to a convenient design choice, 17 bits from the fraction word were given to the pulse id. So, the price to board the pulse id inside the timestamp was to reduce the precision of the time. Before we could represent about 200 ps and now we can represent about 30 us.

EVG timestamp

Other types of events that are important are the fixed frequency ones, like 120 Hz, 60 Hz, 30 Hz, etc. They can be used to trigger equipment or update data in software screens, for example. For this, the concept of timeslot must be introduced. There are 6 different timeslots and each fiducial pulse belongs to one of these timeslots. Why? The curious one can find the explanation in the Technical Stuff session. So, given that 360 / 6 = 60, we have each timeslot pulsing in 60 Hz. See this image for better understanding:

Timeslots

The image shows that there is 2.78 ms between TS1 and TS2, TS2 and TS3, and so on. In other words, the frequency considering all timeslots is 360 Hz. Also, there is 16.67 ms between two consecutive pulses of TS1, as well as TS2, TS3, etc. This means that the frequency for one specific timeslot is 60 Hz. The image also shows a time difference between TS1 and TS4. For those who read the Technical Stuff, this choice is based on the fact that this pair is related to the same power supply phase. The same happens to pairs TS2 and TS5, and pairs TS3 and TS6. The time between those pairs is 8.33 ms, what gives us a frequency of 120 Hz between the elements of the pair.

And how is this related to the event codes? There are specific event codes for each timeslot. For example, event 11 gives us the fiducial that is in TS1, pulsing at 60 Hz. When using event 11, you are sure to receive 60 Hz pulses while the event generator is operating. Event 21 corresponds to fiducial that is in TS2. It is also a 60 Hz pulse. So could you say that events 11 and 21 are the same thing? No! Their frequencies are the same, but they are out of phase. Remember: TS2 pulses 2.78 ms after TS1. Events 31, 41, 51, and 61 are related to TS3, TS4, TS5, and TS6, all of them giving a 60 Hz pulse.

And what if you need a 30 Hz pulse? Then you can use event code 12. This gives you a pulse for every other TS1. So, one TS1 pulse is considered and the next one is ignored. Event codes 22, 32, 42, 52, and 62 have the same characteristics for the other timeslots. It is possible to use the same rationality for other frequencies, like 10 Hz, 5 Hz, 1 Hz, and 0.5 Hz.

And what to do if you need a 120 Hz pulse, as each timeslot pulses at 60 Hz? In this case, you need to combine the pairs that are in the same power supply phases: TS1 and TS4, TS2 and TS5, TS3 and TS6. There are event codes that already do this combination for you! Event code 10 combines TS1 and TS4 in a 120 Hz frequency. Event code 40 do the same thing. Is there a difference between event 10 and 40? No, they are there just to match the sequence of event codes without roles. For example, you have events 10, 11, 12, etc for timeslot 1 and 40, 41, 42, etc for timeslot 4. It would be weird if event 40 was absent.

Here is a picture that shows the event codes related to the timeslots:

Back to the Future

Resultado de imagem para back to the future cartoon

There is a tricky architecture running behind the scenes. First, the Event Generator sends all event codes related to the present pulse. After some microseconds, data is sent. This data is called Timing Pattern. One thing special about the Timing Pattern is that its contents are related to 3 pulses in the future! Why? Because it gives a chance for subsystem receivers to prepare before the event takes place. This gives it 3 x 2.78 ms = 8.33 ms to prepare for running something that must be run at that time.

Technical Stuff

This session is meant to describe how the fiducial and timeslots are related to the electrical power supply.

In the USA, electricity companies provide a 127 V AC power supply with a 60 Hz frequency:

mono phase

For the accelerator, it is important to take some actions when the voltage crosses the zero volts line. This corresponds to a specific moment in time when we have zero volts between the phase and the common line. For a complete cycle, we have two moments like this, one at 8.3 ms and another one at 16.67 ms, and then the cycle restarts.

So, let's build a system that gives us a pulse every time our power supply sinusoid crosses zero volts. So, we will have a pulse in time 0, another one 8.3 ms after time zero, another one 8.3 ms after the second pulse and so on. The result is that this sequence of pulses is pulsing at 120 Hz.

Now, let's call these pulses "timeslots". The first timeslot happens when the sinusoid is going up and the second one when the sinusoid is going down. So, it is better to consider this two moments as different things. So, let's call the first moment the timeslot x or TSx and the second moment the timeslot y or TSy.

Well, now it is time to complicate. Electricity companies offer three flavors (or phases) of AC power supply lines. All of them are 60 Hz sinusoids with amplitude +127 V and -127 V. The difference is that they are out of phase by 120 degrees. This means that when one sinusoid is at the +127 V peak the other two are not. Only 5.56 ms after the first sinusoid gets its peak, the second one arrives. But at this time, the first sinusoid is not at the peak anymore. The picture below shows each phase in a different color:

3 phase power supply

Now we need to know each time one of the sinusoids crosses the zero voltage line. Now it is not only two times when this happens as described in the monophase earlier description. In total, for the 3-phase system, there are 6 different times when one of the voltages crosses zero. If you see the diagram above, we have one such moment each 2.78 ms. If our system pulses every 2.78 ms to alert when we achieved this condition, we have a 360 Hz pulsed system. This frequency is called fiducial for LCLS 1.

So, now, using the same rationality as before, let's give a name for each of these 6 moments. Let's call them, in sequence, timeslot 1 (or TS1) for the moment zero represented on the diagram; timeslot 2 (or TS2) for the moment when the blue sinusoid crosses zero, 2.78 ms after TS1; timeslot 3 (or TS3) for the moment when the red sinusoid crosses zero, 2.78 ms after TS2; and so on, until TS6 when the red sinusoid crosses zero, 2.78 ms after TS5.

It's important to note that we have pairs of timeslots associated with each phase:

  • TS1 and TS4 happen when the black sinusoid crosses zero;
  • TS2 and TS5 happen when the blue sinusoid crosses zero;
  • TS3 and TS6 happen when the red sinusoid crosses zero.

For LCLS1, pairs TS1 and TS4 are used by the accelerator. FACET gets TS2 and TS5.

  • No labels