Skip to content
Merged
Changes from all commits
Commits
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
122 changes: 71 additions & 51 deletions xml-handler/src/resources/sweep/MP5000Sweep.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

---@class Source
---@field values ScalarValue | LogValues | LinearValues | ListValues The value or values to source
---@field range number | "AUTO" The range to use, or Auto
---@field range number | "AUTO" The range to use, or Auto
---@field limiti number The current limit
---@field limitv number | nil The voltage limit
---@field delay number The time to delay before sourcing
Expand All @@ -98,7 +98,7 @@
---@field nplc number | nil
---@field aperture number | nil
---@field rate `CONSTANTS.RATE_FAST` | `CONSTANTS.RATE_NORMAL` | nil
---@field range number | "AUTO" The range to use, or Auto
---@field range number | "AUTO" The range to use, or Auto
-- ---@field autozero boolean Whether autozero should be turned on or not
---@field count integer The number of measurments to take
-- ---@field filter_enable boolean Whether to enable the filter or not
Expand Down Expand Up @@ -147,7 +147,7 @@
---@class ModelComponent
---@field reset fun(self: Device) The function used to reset the device
---@field config fun(self: Device) The function used to configure the device settings
---@field trigger_model_setup fun(self: Device) The function used to set up the trigger model
---@field trigger_model_setup fun(self: Device, bias_source_event: any | nil, bias_measure_event: any| nil, step_source_event: any | nil, step_measure_event: any | nil, sweep_source_event: any | nil, sweep_measure_event: any | nil, bias_source_complete_events: any[] | nil, bias_measure_complete_events: any[] | nil) The function used to set up the trigger model
---@field trigger_model_initiate fun(self: Device) The function used to initiate the trigger model

UTILITY = {
Expand Down Expand Up @@ -268,7 +268,7 @@

---Functions for the MSMU60-2 module for MP5000-series mainframes
---@return Model
MSMU60_2 = function()
MSMU = function()
return {
common = {
--- Resets this MSMU60-2
Expand All @@ -282,13 +282,10 @@
self.node.trigger.timer[2].reset()
self.node.trigger.timer[3].reset()
self.node.trigger.timer[4].reset()
--for _, v in ipairs(self.slot.trigger.model.table()) do
self.slot.trigger.model.abort()
self.slot.trigger.model.delete(self.node_name .. " Bias Trigger Model")
self.slot.trigger.model.delete(self.node_name .. " Step Trigger Model")
self.slot.trigger.model.delete(self.node_name .. " Sweep Trigger Model")
-- self.slot.trigger.model.delete(v)
--end
end,
--- Configures this MSMU60-2
---@param self Device
Expand Down Expand Up @@ -524,13 +521,13 @@
end

-- Loop back to `bias_wait_sweep_block` until all iterations are complete
if sweep_measure_event ~= nil then
if step_measure_event ~= nil then
tm_add.branch.counter(self.trigger_model, block.loop,
block.wait_sweep,
block.bias_notify,
UTILITY.TOTAL_COUNT)
elseif step_measure_event ~= nil then
elseif sweep_measure_event ~= nil then
tm_add.branch.counter(self.trigger_model, block.loop,
block.bias_notify,
block.wait_sweep,
UTILITY.TOTAL_COUNT)
end
end,
Expand Down Expand Up @@ -580,7 +577,6 @@

if step_source_complete_events ~= nil and table.getn(step_source_complete_events) > 0 then
-- Add an optional wait for other sweep events only on the first stepper
--logevent(self, "WAIT ALL STEPS")
UTILITY.make_waitall(self.slot.trigger.model, self.trigger_model,
block.waitall_steps,
step_source_complete_events)
Expand Down Expand Up @@ -739,12 +735,12 @@
}
end,

---Functions for the MPSU-2ST module for MP5000-series mainframes
---Functions for MPSU modules for MP5000-series mainframes
---@return Model
MPSU50_2ST = function()
MPSU = function()
return {
common = {
--- Resets this MPSU50_2ST
--- Resets this MPSU
---@param self Device
reset = function(self)
self.channel.reset()
Expand All @@ -755,35 +751,32 @@
self.node.trigger.timer[2].reset()
self.node.trigger.timer[3].reset()
self.node.trigger.timer[4].reset()
--for _, v in ipairs(self.slot.trigger.model.table()) do
self.slot.trigger.model.abort()
-- self.slot.trigger.model.delete(v)
--end
end,
--- Configures this MPSU50_2ST
--- Configures this MPSU
---@param self Device
config = function(self)
UTILITY.init_slot_event_ids(self.slot, { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 })


local event_id = UTILITY.get_slot_event_id(self.slot)
if event_id then
self.event_source = event_id
local event_source_id = UTILITY.get_slot_event_id(self.slot)
if event_source_id then
self.event_source = event_source_id
else
error("Unable to assign event ID to channel: all event IDs for slot[" ..
error("Unable to assign event source ID to channel: all event IDs for slot[" ..
self.slot_idx .. "] have been consumed.")
exit()
end

event_id = UTILITY.get_slot_event_id(self.slot)
if event_id then
self.event_measure = event_id
local event_measure_id = UTILITY.get_slot_event_id(self.slot)
if event_measure_id then
self.event_measure = event_measure_id
else
error("Unable to assign event ID to channel: all event IDs for slot[" ..
error("Unable to assign event measure ID to channel: all event IDs for slot[" ..
self.slot_idx .. "] have been consumed.")
exit()
end


-- Source Settings --
-- func, level/list/log/linear
if self.source.values.scalar ~= nil then
Expand Down Expand Up @@ -865,32 +858,59 @@
bias = {
--- Configure the trigger model for a Bias
---@param self Device
---@param bias_event nil Unused
---@param step_event any | nil The event ID associated with all the steps completing (only one)
---@param sweep_event any | nil The event ID associated with all the sweep steps completing (only one)
---@param bias_complete_events any[] | nil The event ID(s) associated with all other bias steps completing. Should only be passed to one bias channel.
trigger_model_setup = function(self, bias_event, step_event, sweep_event, bias_complete_events)
---@param bias_source_event nil Unused
---@param bias_measure_event nil Unused
---@param step_source_event any | nil The event ID associated with all the steps completing source actions (only one)
---@param step_measure_event any | nil The event ID associated with all the steps completing measure actions (only one)
---@param sweep_source_event any | nil The event ID associated with all the sweep steps completing source actions (only one)
---@param sweep_measure_event any | nil The event ID associated with all the sweep steps completing measure actions (only one)
---@param bias_source_complete_events any[] | nil The event ID(s) associated with all other bias source-action steps completing. Should only be passed to one bias channel.
---@param bias_measure_complete_events any[] | nil The event ID(s) associated with all other bias measure-action steps completing. Should only be passed to one bias channel.
trigger_model_setup = function(self, bias_source_event, bias_measure_event, step_source_event,
step_measure_event, sweep_source_event, sweep_measure_event,
bias_source_complete_events, bias_measure_complete_events)
UTILITY.MSMU().bias.trigger_model_setup(self, bias_source_event, bias_measure_event,
step_source_event, step_measure_event, sweep_source_event, sweep_measure_event,
bias_source_complete_events, bias_measure_complete_events)
end,
},
step = {
--- Configure the trigger model for a Step
---@param self Device
---@param bias_event any The event that indicates the biases are fully started.
---@param step_event nil Unused
---@param sweep_event any The event that indicates the sweepsare fully started.
---@param step_complete_events any[] | nil The event ID(s) associated with all other steps completing. Should only be passed to one bias channel.
trigger_model_setup = function(self, bias_event, step_event, sweep_event, step_complete_events)
---@param bias_source_event any|nil The event ID associated with all the biases completing source actions (only one)
---@param bias_measure_event any | nil The event ID associated with all the biases completing measure actions (only one)
---@param step_source_event nil Unused
---@param step_measure_event nil Unused
---@param sweep_source_event any | nil The event ID associated with all the sweep steps completing source actions (only one)
---@param sweep_measure_event any | nil The event ID associated with all the sweep steps completing measure actions (only one)
---@param step_source_complete_events any[] | nil The event ID(s) associated with all other source-action steps completing. Should only be passed to one bias channel.
---@param step_measure_complete_events any[] | nil The event ID(s) associated with all other measure-action steps completing. Should only be passed to one bias channel.
trigger_model_setup = function(self, bias_source_event, bias_measure_event, step_source_event,
step_measure_event, sweep_source_event, sweep_measure_event,
step_source_complete_events, step_measure_complete_events)
UTILITY.MSMU().step.trigger_model_setup(self, bias_source_event, bias_measure_event,
step_source_event, step_measure_event, sweep_source_event, sweep_measure_event,
step_source_complete_events, step_measure_complete_events)
end,
},

sweep = {
--- Configure the trigger model for a Step
---@param self Device
---@param bias_event any
---@param step_event any
---@param sweep_event nil Unused
---@param sweep_complete_events any
trigger_model_setup = function(self, bias_event, step_event, sweep_event, sweep_complete_events)
---@param bias_source_event any|nil The event ID associated with all the biases completing source actions (only one)
---@param bias_measure_event any | nil The event ID associated with all the biases completing measure actions (only one)
---@param step_source_event any | nil The event ID associated with all the steps completing source actions (only one)
---@param step_measure_event any | nil The event ID associated with all the steps completing measure actions (only one)
---@param sweep_source_event nil Unused
---@param sweep_measure_event nil Unused
---@param sweep_source_complete_events any
---@param sweep_measure_complete_events any
trigger_model_setup = function(self, bias_source_event, bias_measure_event, step_source_event,
step_measure_event, sweep_source_event, sweep_measure_event,
sweep_source_complete_events, sweep_measure_complete_events)
UTILITY.MSMU().sweep.trigger_model_setup(self, bias_source_event, bias_measure_event,
step_source_event, step_measure_event, sweep_source_event, sweep_measure_event,
sweep_source_complete_events, sweep_measure_complete_events)
end,

},
Expand All @@ -901,12 +921,11 @@
---@param device DeviceDetails
---@return Model | nil, "smu" | "psu" | nil
get_model_from_device = function(device)
-- XXX: DEBUG ONLY, REMOVE MSMU200-2
if device.model == "MSMU60-2" then
return UTILITY.MSMU60_2(), "smu"
if string.find(device.model, "MSMU") ~= nil then
return UTILITY.MSMU(), "smu"
end
if device.model == "MPSU50-2ST" then
return UTILITY.MPSU50_2ST(), "psu"
if string.find(device.model, "MPSU") ~= nil then
return UTILITY.MPSU(), "psu"
end
return nil, nil
end,
Expand Down Expand Up @@ -1279,13 +1298,13 @@

for i, n in ipairs(nodes.biases) do
for _, buf in ipairs(n.measure.buffers) do
table.insert(buffers, { heading = "Bias[" .. i .. "]." .. iv_to_string(buf.type), buffer = buf.buffer })
table.insert(buffers, { heading = "bias[" .. i .. "]." .. iv_to_string(buf.type), buffer = buf.buffer })
end
end

for i, n in ipairs(nodes.steps) do
for _, buf in ipairs(n.measure.buffers) do
table.insert(buffers, { heading = "Step[" .. i .. "]." .. iv_to_string(buf.type), buffer = buf.buffer })
table.insert(buffers, { heading = "step[" .. i .. "]." .. iv_to_string(buf.type), buffer = buf.buffer })
end
end

Expand All @@ -1298,6 +1317,7 @@
print_table_from_buffers(buffers)
end


--#endregion Util

--==========================================================================
Expand Down Expand Up @@ -1530,7 +1550,7 @@
<substitute name="SWEEP-DEVICE:SRANGE">%SRANGE%</substitute>
<substitute name="SWEEP-DEVICE:START">%START%</substitute>
<substitute name="SWEEP-DEVICE:STOP">%STOP%</substitute>
<substitute name="SWEEP-DEVICE:LIST">%LIST%</substitute>
<substitute name="SWEEP-DEVICE:LIST">%LIST%</substitute>
<substitute name="SWEEP-DEVICE:MRANGE">%MRANGE%</substitute>
<substitute name="SWEEP-DEVICE:MFUNCTION">%MFUNCTION%</substitute>
<substitute name="SWEEP-DEVICE:SENSE">%SENSE%</substitute>
Expand Down
Loading