Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 2cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 2cha
Commits
689cba91
Commit
689cba91
authored
Aug 17, 2016
by
Jan Pospisil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bunch-wise configuration possibility
parent
36aac099
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
38 deletions
+26
-38
FFPG_driver.py
sw/FFPG_driver.py
+26
-38
No files found.
sw/FFPG_driver.py
View file @
689cba91
...
...
@@ -461,6 +461,9 @@ def Init(memoryPart = -1):
SetVcxoFrequency
(
-
0.2105
)
# 125.0000 MHz
ClearMemory
(
0
,
'*'
,
memoryPart
)
# how much is RF clock faster than bunch clock
RF_2_BUNCH_RATIO
=
5
# time 't' is in [ns] - same as other times
# output: (bit, delay)
# bit - position of the bit to set
...
...
@@ -469,6 +472,9 @@ def CalculateParams(t):
rfPeriod
=
4.99
delayOffset
=
3.739
if
(
t
<
0
)
or
(
t
>
RF_2_BUNCH_RATIO
*
rfPeriod
):
raise
Exception
(
"Parameter t can be just in one bunch clock period!"
)
bit
=
int
(
t
/
rfPeriod
)
# bit position
rest
=
t
-
bit
*
rfPeriod
# in ns
rest
+=
delayOffset
...
...
@@ -476,55 +482,37 @@ def CalculateParams(t):
return
(
bit
,
delay
)
# delay and width (both in [ns]) of thi pulse within one bunch clock
# output: (setBit, resBit) - bit offset within one bunch clock
def
SetPulseShape
(
channel
,
delay
,
width
):
# calculate bitt shifts and delays
(
setBit
,
setDelay
)
=
CalculateParams
(
delay
)
(
resBit
,
resDelay
)
=
CalculateParams
(
delay
+
width
)
# set delays
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_set'
,
setDelay
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_res'
,
resDelay
+
18
)
# return bit shifts
return
(
setBit
,
resBit
)
def
TestPulse
(
channel
=
1
,
overflow
=
17820
):
# configure channel
WbWrite
(
'overflow'
,
overflow
)
WbWrite
(
'trig_latency'
,
11
)
# start = 5
# length = 20
# stop = start + length
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# start += 1
# CreatePulse(channel, start + 2*channel, stop + 2*channel)
# CreatePulse(channel, 10, 20)
# CreatePulse(channel, 11, 21)
# CreatePulse(channel, 12, 22)
# CreatePulse(channel, 13, 23)
# CreatePulse(channel, 14, 24)
# CreatePulse(channel, 5, 10)
# CreatePulse(channel, 20, 50)
# CreatePulse(channel, 100, 300)
# all times in ns
pulseDelay
=
4.87
pulseWidth
=
12.3
(
setBit
,
setDelay
)
=
CalculateParams
(
pulseDelay
)
(
resBit
,
resDelay
)
=
CalculateParams
(
pulseDelay
+
pulseWidth
)
CreatePulse
(
channel
,
setBit
,
resBit
)
WbWrite
(
'trig_latency'
,
10
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_set'
,
setDelay
)
WbWrite
(
'ch'
+
str
(
channel
)
+
'_delay_res'
,
resDelay
+
18
)
pulseDelay
=
0
# inter-bunch pulse delay in [ns]
pulseWidth
=
12.5
# inter-bunch pulse width in [ns]
bunches
=
(
0
,
1
,
2
,
10
,
50
)
# in which bunches pulse should be
(
setBit
,
resBit
)
=
SetPulseShape
(
channel
,
pulseDelay
,
pulseWidth
)
for
bunch
in
bunches
:
CreatePulse
(
channel
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
setBit
,
(
bunch
*
RF_2_BUNCH_RATIO
)
+
resBit
)
Enable
(
channel
)
Start
(
channel
)
# Init(15)
Init
()
Control
()
Status
()
# TestPulse(1, 600)
TestPulse
(
1
)
# TestPulse(2)
Control
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment