Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of TxDAQController for arbitrary waveforms #68

Draft
wants to merge 148 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
2b02545
removed RP-specific TX channel params
jusack May 15, 2023
7f9e910
add path to configFile to scanner and device
jusack May 16, 2023
9d83966
first version to allow more complex calibration
jusack May 17, 2023
a0e6049
impedance aware sine tx controller working
jusack Jul 4, 2023
1ed5811
fix phase inconsistency
jusack Jul 5, 2023
5ab6f26
added divider! function
jusack Jul 5, 2023
0669810
added function for number of controlled channels
jusack Jul 14, 2023
709302a
added function to apply forward calib to sequence
jusack Aug 14, 2023
a5c9d05
small updates to channels
jusack Aug 14, 2023
98889ed
update component setup
jusack Aug 14, 2023
c50c7d8
WIP: first untested version of new controller
jusack Aug 14, 2023
5da7f39
first set of bug fixes
jusack Aug 14, 2023
4fad273
added option to not change sequence in place
jusack Aug 15, 2023
6252ac3
fix dimension
jusack Aug 15, 2023
c3f9d41
remove attempt to decouple, add warning
jusack Aug 17, 2023
6d785bb
small fixes
jusack Aug 17, 2023
dbd6f04
improve logic on when and how to control
jusack Aug 17, 2023
7c0e0fd
fix parameter check
jusack Aug 17, 2023
ed4c87b
Add function to retrieve Vector of sequences
nHackel Aug 25, 2023
c1b37e3
Init working multi sequence sm protocol
nHackel Aug 25, 2023
129fe0b
fixes while debugging old controller, working
jusack Aug 29, 2023
ad02530
improvement of accuracy definition
jusack Aug 29, 2023
fa1e6e0
extended ArbitraryElectricalComponent
jusack Aug 31, 2023
9645043
small improvements
jusack Aug 31, 2023
441f7ce
Implement init store/restore for multi seq sm
nHackel Sep 1, 2023
3bfa7f4
Implement wait time for multi seq sm protocol
nHackel Sep 1, 2023
15616a5
moved calibration for LUT channels to applyForwardCalibration
jusack Sep 11, 2023
c6e60c7
small fixes
jusack Sep 11, 2023
3324c15
first successful control of triangle wave
jusack Sep 11, 2023
382289b
Init working on n-dims MPS protocol
nHackel Sep 15, 2023
31b3327
fix abs to allow negative offsets
jusack Sep 19, 2023
770c432
added debug message
jusack Sep 19, 2023
6223880
small fixes
jusack Sep 19, 2023
970ab9c
implement zeroing of DC component
jusack Sep 19, 2023
5e93bc7
test time based convergence for AW
jusack Sep 19, 2023
c6d4dba
indexing fixed
jusack Sep 19, 2023
0fbd95d
increase allowed jump in waveform
jusack Sep 20, 2023
807af8f
added slew rate check
jusack Sep 20, 2023
ed70b01
add volt limit check to initial guess
jusack Sep 21, 2023
5669b24
changed jump detection error to warning
jusack Sep 21, 2023
cb94c93
relax threshhold for mean of waveform
jusack Sep 21, 2023
2d708b1
Add setindex! with string index
nHackel Sep 22, 2023
2428bf9
Init working generating signal offset sequence
nHackel Sep 22, 2023
4c9d16d
Attach hbridge to txSlow
nHackel Sep 22, 2023
ffeb1eb
Add value range
nHackel Sep 22, 2023
24886fc
Init offset sequence considering h-bridges
nHackel Sep 29, 2023
2a4fb81
Init working protocol-offset -> stepwise processing with h-bridge pauses
nHackel Sep 29, 2023
2ab1f5f
Minimize h-bridge switches by permuting order of offsets
nHackel Oct 5, 2023
9da5c1b
Automatically add hbridge channel for offset channel
nHackel Oct 5, 2023
badba57
Fix setindex! for seq, fields, electr. channel if key string was miss…
nHackel Oct 5, 2023
27e99df
Add utiltiy function resolve hbridge level for given number
nHackel Oct 5, 2023
9186656
Add offsets for purely non-switching channel
nHackel Oct 5, 2023
92dea72
Refactor and add enable computation
nHackel Oct 5, 2023
f307476
Implement sorting of MPS offsets
nHackel Oct 13, 2023
b611f5e
Hack to MDF acq storage s.t. MPS periods are correctly detected
nHackel Oct 13, 2023
0e1195e
Add numPeriodsPerPatch to MPS protocol
nHackel Oct 13, 2023
e1e71a8
Readd dropping of df periods
nHackel Oct 13, 2023
6c2561d
Correct computation of h-bridge pause für periodsPerPatch
nHackel Oct 17, 2023
94a435f
Take abs for h-bridge channel values
nHackel Oct 17, 2023
e73608c
Merge branch 'master' into nh/mpsProtocol
nHackel Oct 18, 2023
cd489f5
Init work on deadPeriods per Offset Channel
nHackel Oct 20, 2023
0ab748e
Init working patch cutting for pmps @ IBI
nHackel Oct 20, 2023
9b02193
Attempt n-dimensional switch time optimization
nHackel Oct 27, 2023
fdda0f2
Add level switch pauses for mps seq. without hbridge switching
nHackel Nov 3, 2023
922a3b5
MPS Protocol always remove "dead" patches
nHackel Nov 3, 2023
e255cd4
Added missing first pause
nHackel Nov 3, 2023
f667c88
Storing of offsetFields and saving as SM for MPS
nHackel Nov 3, 2023
dc202b6
In first pause let values assert their level towards the end not the …
nHackel Nov 3, 2023
fa4f3e1
JA: fixes on IMT MPS
Nov 21, 2023
40e3748
remove unnecessary restriction on decimation
jusack Nov 22, 2023
291579f
add dfSamplesPerCycle() + small fixes
jusack Nov 22, 2023
7e9db72
Merge remote-tracking branch 'origin/master' into JA/field-control
jusack Nov 22, 2023
bc3829e
Fix CI (#69)
jonschumacher Nov 23, 2023
d9f5200
Readd Statistics dependency
nHackel Dec 8, 2023
c9d3e27
Increase RedPitayaDAQServer compat
nHackel Dec 19, 2023
51a89b2
Increase release number
nHackel Dec 19, 2023
c298d3a
Store calibSize for hybrid mps SMs
nHackel Dec 20, 2023
8bd3f13
Update actions (#70)
jonschumacher Dec 29, 2023
bebc977
Merge remote-tracking branch 'origin/master' into JA/field-control
jusack Jan 8, 2024
a29427f
Fix bugs in level switching and dead patches logic
nHackel Jan 19, 2024
4534a3b
Remove delete df periods from mps protocol
nHackel Jan 19, 2024
ce8c7ae
Allow h-bridge channel comprised of multiple signals
nHackel Feb 2, 2024
ed8c0c3
Make offset channel mutable to allow for updates from GUI
nHackel Feb 9, 2024
787d155
Allow for mmap files based on tuples/vecs without dense arrays
nHackel Feb 9, 2024
2b1a6ee
Add Mmap frame buffer
nHackel Feb 9, 2024
ba446f3
Fix precomile issues with mmap
nHackel Feb 15, 2024
e3f2a43
Interpret MPS protocol periods as frames during acquisition
nHackel Feb 15, 2024
4877414
Init working mps buffer
nHackel Feb 15, 2024
2bc9ccc
Remove MMapBuffer and merge with FrameBuffer
nHackel Feb 15, 2024
4c878d5
Init averaging for MpsBuffer
nHackel Feb 23, 2024
1294012
Fix sorting and not sorting for MPSBuffer
nHackel Feb 23, 2024
dbb8222
Fix calibOffset filtering for MPS protocol
nHackel Feb 23, 2024
3422ac9
WIP Ref Buffers for MPSProtocol (not working atm)
nHackel Feb 23, 2024
61d5eb4
fix progress and time estimation
jusack Apr 9, 2024
2896014
reduce stepduration in case of averaging to allow more efficient wait…
jusack Apr 9, 2024
d75f7e4
fix devices to include config file parameter
jusack Apr 10, 2024
30cba37
fix floating point error
jusack Apr 10, 2024
47983fa
simplify chan and comp creation
jusack Apr 10, 2024
e16c76a
parse divider in .toml
jusack Apr 10, 2024
5a3dd0b
fix frame averages
jusack Apr 10, 2024
3e451fa
add DC calibration and debugging
jusack Apr 10, 2024
97b4472
fix imports and dependencies
jusack Apr 10, 2024
5306d7e
Merge remote-tracking branch 'origin/nh/mpsProtocol' into JA/field-co…
jusack Apr 10, 2024
ae57c0a
allow deepsubtypes on Type, subtypes is also defined on Type
jusack Apr 10, 2024
c61c93b
Merge remote-tracking branch 'origin/nh/smMultiSequence' into JA/fiel…
jusack Apr 10, 2024
14a81c7
fix merge errors
jusack Apr 12, 2024
d884c7a
improve error messages
jusack Apr 12, 2024
dfd4f95
rational dividers (working FFL Sequence)
jusack Nov 22, 2023
4bfe5f9
fixed DC control (v1)
jusack Apr 15, 2024
b0f00d6
implemented iterative DC control
jusack Apr 15, 2024
0e9556f
remove preparation of DAQ, fix controlTx
jusack Apr 16, 2024
64811e4
small fixes
jusack Apr 16, 2024
8e44afe
fixed adjoint/transpose issue
jusack Apr 16, 2024
9532037
update controller params
jusack Apr 16, 2024
b25b66b
add caching to getConcreteType
jusack Apr 23, 2024
9fb3d03
include original error in exception if control fails
jusack Apr 23, 2024
dab3a44
new logic to validate signals (fieldToVolt)
jusack Apr 23, 2024
b06de7b
improved error messages
jusack Apr 25, 2024
aa1c639
fix restoring MultiSequence Protocol
jusack Apr 25, 2024
50abe15
small fix
jusack Apr 25, 2024
460fef0
added function to check if field component is given as a field
jusack Jul 22, 2024
6c9eb6e
restructured check if sequence can be controlled
jusack Jul 22, 2024
4365cda
prepare caching of control results
jusack Jul 22, 2024
28773a8
Merge branch 'JA/rational-dividers' into JA/field-control
jusack Sep 9, 2024
367a184
needed for new versions of rationalize
jusack Sep 9, 2024
b025e9f
fix backup filename
jusack Sep 9, 2024
ddf4136
add caching of control results
jusack Sep 9, 2024
c1beb61
fix Aqua
jusack Sep 10, 2024
cb5c5cf
TF moved from scanner to individual RX channels
jusack Sep 18, 2024
e4b7a47
added missing function for LUT channels
jusack Sep 19, 2024
e65256f
small fixes
jusack Oct 7, 2024
5ac273f
small fix
Oct 11, 2024
09ae372
reset cache on control error
jusack Oct 16, 2024
7ac0f51
cleaned up protocol events (stop->pause)
jusack Oct 16, 2024
ce44dd2
QOL improvements for MultiSequenceProtocol
jusack Oct 16, 2024
0a7470b
include 5
jusack Oct 16, 2024
0761321
fix typo
jusack Oct 17, 2024
9eda019
fixed remember BG in MPI protocol
jusack Oct 17, 2024
e6e9b7b
Merge branch 'JA/field-control' of https://github.com/MagneticParticl…
Oct 18, 2024
2be48bb
clean up
jusack Nov 28, 2024
5afc32c
Parse channel selection of transferfucntion in _init
nHackel Dec 6, 2024
2ace594
Update Project.toml
jusack Dec 17, 2024
4690d05
fix duplicate variable name
jusack Dec 18, 2024
74967ad
output control result as info
jusack Dec 18, 2024
0f1f9d8
fix variable name
jusack Dec 18, 2024
cb76ff7
write frame averages to MDF as well
jusack Dec 20, 2024
1145e30
add caching to cross coupling control sequence
jusack Dec 20, 2024
30c58cb
fix error message
Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add level switch pauses for mps seq. without hbridge switching
nHackel committed Nov 3, 2023
commit fdda0f212dc7c19e669dc53606c4b42c86053605
43 changes: 27 additions & 16 deletions src/Devices/DAQ/RedPitayaDAQ.jl
Original file line number Diff line number Diff line change
@@ -564,11 +564,6 @@ function prepareHSwitchedOffsets(offsetVector::Vector{ProtocolOffsetElectricalCh
end
end

#foreach(x->println(length(x)), values(allSteps))
foreach(x->println(length(x)), values(allEnables))
foreach(x->println(length(filter(y -> ismissing(y) ? false : y, x))), values(allEnables))


hbridges = prepareHBridgeLevels(allSteps, daq)

# Compute switch timing, assumption step is held for df * numPeriodsPerPatch
@@ -611,10 +606,7 @@ function prepareHSwitchedOffsets(offsetVector::Vector{ProtocolOffsetElectricalCh

# Construct permutation mask
# Generate offsets without permutation
offsets = Vector{Vector{Any}}()
for ch in offsetVector
push!(offsets, values(ch))
end
offsets = map(values, offsetVector)
offsets = hcat(prepareOffsets(offsets, daq)...)
# Map each offset combination to its original index
offsetDict = Dict{Vector, Int64}()
@@ -624,7 +616,6 @@ function prepareHSwitchedOffsets(offsetVector::Vector{ProtocolOffsetElectricalCh

# Permutation Mask
enableMatrix = hcat(values(allEnables)...)
#@show enableMatrix
permutationMask = map(all, eachrow(enableMatrix))
# Sort patches according to their value in the index dictionary
permoffsets = hcat(map(x-> allSteps[x], offsetVector)...)
@@ -644,19 +635,37 @@ function prepareOffsets(offsetVector::Vector{ProtocolOffsetElectricalChannel}, d
allSteps = Dict{ProtocolOffsetElectricalChannel, Vector{Any}}()
enables = Dict{ProtocolOffsetElectricalChannel, Vector{Bool}}()

offsets = prepareOffsets(map(values, offsetVector), daq)
for (i, channel) in enumerate(offsetVector)
allSteps[channel] = offsets[i]
enables[channel] = fill(true, length(offsets[i]))
offsets = map(values, offsetVector)
steps, othersPause, perm = prepareOffsetSwitches(offsets, offsetVector, daq, stepduration)
for (i, ch) in enumerate(offsetVector[perm])
allSteps[ch] = steps[i]
enables[ch] = map(x-> channel(daq, id(ch)).switchEnable ? true : !x, othersPause[i])
end

# Construct permutation mask
# Map each offset combination to its original index
offsets = hcat(prepareOffsets(offsets, daq)...)
offsetDict = Dict{Vector, Int64}()
for (i, row) in enumerate(eachrow(offsets))
offsetDict[row] = i
end

# Permutation Mask
enableMatrix = hcat(values(enables)...)
permutationMask = map(all, eachrow(enableMatrix))
# Sort patches according to their value in the index dictionary
permoffsets = hcat(map(x-> allSteps[x], offsetVector)...)
patchPermutation = sortperm(map(pair -> permutationMask[pair[1]] ? offsetDict[identity(pair[2])] : typemax(Int64), enumerate(eachrow(permoffsets))))
# Switching patches are sorted to the end and need to be removed
patchPermutation = patchPermutation[1:end-length(filter(!identity, permutationMask))]

hbridges = prepareHBridgeLevels(allSteps, daq)
# Remove (negative) sign from all channels with an h-bridge
for (ch, steps) in filter(x->haskey(hbridges, x[1]), allSteps)
allSteps[ch] = abs.(steps)
end

return allSteps, enables, hbridges, 1:length(first(allSteps)[2])
return allSteps, enables, hbridges, patchPermutation
end

function prepareHBridgeLevels(allSteps, daq::RedPitayaDAQ)
@@ -700,6 +709,7 @@ function prepareOffsetSwitches(offsets::Vector{Vector{T}}, channels::Vector{Prot
return prepareOffsets(offsets, daq), Dict(ch => fill(true, length(first(offsets))), channels), 1:length(channels)
end

# Sorting is not optimal, but allows us in the next step to consider pauses individually and not have to take max of all possible pauses at a point
perm = sortperm(map(x-> haskey(switchSteps, x) ? switchSteps[x] : 0, channels))

sortedOffsets = offsets[perm]
@@ -737,9 +747,10 @@ function prepareOffsetSwitches(offsets::Vector{Vector{T}}, channels::Vector{Prot
tempOthersPause = repeat(tempOthersPause, outer = length(sortedOffsets[i]) - 1)
# Add last repetition without a following pause
sortedOffsetsWithPause[j] = vcat(tempOffs, otherOffs)
sortedOthersPause[j] = vcat(tempOthersPause, otherOthersPause)
sortedOthersPause[j] = vcat(tempOthersPause, sortedOthersPause[j])
end

push!(sortedOthersPause, othersPause)
push!(sortedOffsetsWithPause, offs)
end