From ab1f9cbef37d8aef618488677aa7a238deedf14f Mon Sep 17 00:00:00 2001 From: pavannarayana Date: Mon, 22 Sep 2025 15:10:09 +0530 Subject: [PATCH 1/9] Add missing parameter values in step and sweep --- .vscode/settings.json | 64 +++++++++++++++++++ .../src/instr_metadata/base_metadata.rs | 14 ++-- .../src/script_component/sweep.rs | 25 ++++---- .../src/resources/sweep/MP5000Sweep.xml | 24 +++---- 4 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0c5f5e1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,64 @@ +{ + "Lua.workspace.preloadFileSize": 2000, + "Lua.workspace.ignoreDir": [], + "Lua.diagnostics.libraryFiles": "Disable", + "Lua.runtime.version": "Lua 5.1", + "Lua.runtime.builtin": { + "basic": "enable", + "bit": "disable", + "bit32": "disable", + "builtin": "enable", + "coroutine": "disable", + "debug": "disable", + "ffi": "disable", + "io": "disable", + "jit": "disable", + "jit.profile": "disable", + "jit.util": "disable", + "math": "disable", + "os": "disable", + "package": "disable", + "string": "disable", + "string.buffer": "disable", + "table": "enable", + "table.clear": "disable", + "table.new": "disable", + "utf8": "disable" + }, + "Lua.workspace.library": [ + "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\tsp-lua-5.0", + "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MP5103\\Helper", + "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MP5103\\AllTspCommands", + "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MSMU60-2\\Helper", + "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\nodes_definitions" + ], + "tsp.tspLinkSystemConfigurations": [ + { + "name": "testSystem1", + "localNode": "MP5103", + "isActive": true, + "slots": [ + { + "slotId": "slot[1]", + "module": "MSMU60-2" + }, + { + "slotId": "slot[2]", + "module": "MSMU60-2" + }, + { + "slotId": "slot[3]", + "module": "MSMU60-2" + } + ] + } + ], + "tsp.script_generation": { + "I-V Characterization": [ + { + "name": "sess1", + "config": "{\"request_type\":\"evaluated_response\",\"additional_info\":\"Updated sweep model with new system configuration\",\"json_value\":\"{\\\"sweep_model\\\":{\\\"sweep_config\\\":{\\\"bias_channels\\\":[{\\\"bias\\\":{\\\"id\\\":\\\"bias\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"bias1\\\",\\\"device_id\\\":\\\"localnode.slot[2].psu[1]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"555e4975-f2f8-474a-a2d7-fb744d87a3c5\\\"}}],\\\"device_list\\\":[{\\\"_id\\\":\\\"localnode.slot[1].psu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].psu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].psu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[3].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[3]\\\"},{\\\"_id\\\":\\\"localnode.slot[3].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[3]\\\"}],\\\"global_parameters\\\":{\\\"sweep_timing_config\\\":{\\\"measure_count\\\":{\\\"id\\\":\\\"measureCount\\\",\\\"value\\\":1},\\\"psu_timing\\\":{\\\"rate\\\":{\\\"id\\\":\\\"rate\\\",\\\"range\\\":[\\\"Normal\\\",\\\"Fast\\\"],\\\"value\\\":\\\"Normal\\\"}},\\\"smu_timing\\\":{\\\"aperture\\\":{\\\"id\\\":\\\"aperture\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":1e-6},\\\"measure_auto_delay\\\":{\\\"id\\\":\\\"measureAutoDelay\\\",\\\"range\\\":[\\\"OFF\\\",\\\"ON\\\"],\\\"value\\\":\\\"ON\\\"},\\\"measure_delay\\\":{\\\"id\\\":\\\"measureDelay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0},\\\"nplc\\\":{\\\"id\\\":\\\"nplc\\\",\\\"unit\\\":null,\\\"value\\\":1.0},\\\"nplc_type\\\":{\\\"id\\\":\\\"nplcType\\\",\\\"range\\\":[\\\"NPLC\\\",\\\"Aperture\\\"],\\\"value\\\":\\\"NPLC\\\"},\\\"source_auto_delay\\\":{\\\"id\\\":\\\"sourceAutoDelay\\\",\\\"range\\\":[\\\"OFF\\\",\\\"ON\\\"],\\\"value\\\":\\\"OFF\\\"},\\\"source_delay\\\":{\\\"id\\\":\\\"sourceDelay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0}}}},\\\"status_msg\\\":{\\\"message\\\":\\\"Some channels in use are invalid. Re-assign the invalid channels for the generated script to be functional.\\\",\\\"status_type\\\":\\\"Error\\\",\\\"time_stamp\\\":\\\"2025-09-15 15:16:44\\\"},\\\"step_channels\\\":[{\\\"start_stop_channel\\\":{\\\"asymptote\\\":0.0,\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"step1\\\",\\\"device_id\\\":\\\"localnode.slot[1].psu[1]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"58129413-7584-4db0-9466-d9be048ba30f\\\"},\\\"list\\\":[{\\\"id\\\":\\\"list_0\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_1\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_2\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_3\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_4\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_5\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_6\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_7\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_8\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_9\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0}],\\\"start\\\":{\\\"id\\\":\\\"start\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},\\\"stop\\\":{\\\"id\\\":\\\"stop\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1.0},\\\"style\\\":{\\\"id\\\":\\\"style\\\",\\\"range\\\":[\\\"LIN\\\",\\\"LOG\\\"],\\\"value\\\":\\\"LIN\\\"}}}],\\\"step_global_parameters\\\":{\\\"list_step\\\":false,\\\"step_points\\\":{\\\"id\\\":\\\"step_points\\\",\\\"value\\\":10},\\\"step_to_sweep_delay\\\":{\\\"id\\\":\\\"step_to_sweep_delay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0}},\\\"sweep_channels\\\":[{\\\"start_stop_channel\\\":{\\\"asymptote\\\":0.0,\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"sweep1\\\",\\\"device_id\\\":\\\"localnode.slot[1].psu[2]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"36fb196d-4f64-4b1a-8be0-05fcb23436a9\\\"},\\\"list\\\":[{\\\"id\\\":\\\"list_0\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_2\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_4\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_6\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_8\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_10\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_12\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_14\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_16\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_18\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0}],\\\"start\\\":{\\\"id\\\":\\\"start\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1e-12},\\\"stop\\\":{\\\"id\\\":\\\"stop\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1.0},\\\"style\\\":{\\\"id\\\":\\\"style\\\",\\\"range\\\":[\\\"LIN\\\",\\\"LOG\\\"],\\\"value\\\":\\\"LIN\\\"}}}],\\\"sweep_global_parameters\\\":{\\\"list_sweep\\\":false,\\\"sweep_points\\\":{\\\"id\\\":\\\"sweep_points\\\",\\\"value\\\":10}}}}}\"}\nSignal received to start script generation!\n" + } + ] + } +} \ No newline at end of file diff --git a/script-gen-manager/src/instr_metadata/base_metadata.rs b/script-gen-manager/src/instr_metadata/base_metadata.rs index 8f5044b..950ccc0 100644 --- a/script-gen-manager/src/instr_metadata/base_metadata.rs +++ b/script-gen-manager/src/instr_metadata/base_metadata.rs @@ -46,12 +46,12 @@ impl BaseMetadata { pub const USER_DEFINED_VALUE: &'static str = "USER DEFINED"; pub const MOVING_AVG: &'static str = "MOVING AVG"; pub const REPEAT_AVG: &'static str = "REPEAT AVG"; - pub const FUNCTION_VOLTAGE: &'static str = "Voltage"; - pub const FUNCTION_CURRENT: &'static str = "Current"; - pub const FUNCTION_IV: &'static str = "Current,Voltage"; + pub const FUNCTION_VOLTAGE: &'static str = "FUNC_DC_VOLTAGE"; + pub const FUNCTION_CURRENT: &'static str = "FUNC_DC_CURRENT"; + pub const FUNCTION_IV: &'static str = "FUNC_DC_IV_COMBINED"; pub const RANGE_FOLLOW_LIMITI: &'static str = "follow limiti"; - pub const SENSE_MODE_TWO_WIRE: &'static str = "Two-wire"; - pub const SENSE_MODE_FOUR_WIRE: &'static str = "Four-wire"; + pub const SENSE_MODE_TWO_WIRE: &'static str = "SENSE_2WIRE"; + pub const SENSE_MODE_FOUR_WIRE: &'static str = " SENSE_4WIRE"; pub const RATE_NORMAL: &'static str = "Normal"; pub const RATE_FAST: &'static str = "Fast"; @@ -76,8 +76,8 @@ impl BaseMetadata { ], ); - names.insert("sense=Two-wire", "SENSE_LOCAL"); - names.insert("sense=Four-wire", "SENSE_REMOTE"); + names.insert("sense=SENSE_2WIRE", "SENSE_2WIRE"); + names.insert("sense=SENSE_4WIRE", "SENSE_4WIRE"); BaseMetadata { options, diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index f31256f..56cc82a 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -114,6 +114,7 @@ impl SweepModel { .to_lowercase() .clone(), ); + self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", self.format_range(bias_channel.common_chan_attributes.source_range.clone()), @@ -125,7 +126,6 @@ impl SweepModel { .common_chan_attributes .meas_function .value - .to_lowercase() .clone(), ); @@ -218,13 +218,13 @@ impl SweepModel { self.val_replacement_map.insert( instr_name.clone() + ":SFUNCTION", step_channel - .start_stop_channel - .common_chan_attributes - .source_function - .value - .to_lowercase() - .clone(), + .start_stop_channel + .common_chan_attributes + .source_function + .value + .clone(), ); + self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", self.format_range( @@ -243,7 +243,6 @@ impl SweepModel { .common_chan_attributes .meas_function .value - .to_lowercase() .clone(), ); @@ -262,9 +261,8 @@ impl SweepModel { self.val_replacement_map.insert( instr_name.clone() + ":SENSE", String::from(sense_mode_value), + ); - } else { - //TODO: error handling for sense mode value not found } } @@ -418,7 +416,6 @@ impl SweepModel { .common_chan_attributes .source_function .value - .to_lowercase() .clone(), ); self.val_replacement_map.insert( @@ -439,10 +436,14 @@ impl SweepModel { .common_chan_attributes .meas_function .value - .to_lowercase() .clone(), ); + // self.val_replacement_map.insert( + // instr_name.clone() + ":MODE", + // "LIST".to_string(), + // ); + //sense mode exists only for SMU if let Some(sense_mode) = &sweep_channel .start_stop_channel diff --git a/xml-handler/src/resources/sweep/MP5000Sweep.xml b/xml-handler/src/resources/sweep/MP5000Sweep.xml index e2bb927..1951a41 100644 --- a/xml-handler/src/resources/sweep/MP5000Sweep.xml +++ b/xml-handler/src/resources/sweep/MP5000Sweep.xml @@ -1420,7 +1420,7 @@ buffers = { - current + FUNC_DC_CURRENT { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1429,7 +1429,7 @@ - voltage + FUNC_DC_VOLTAGE { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1438,7 +1438,7 @@ - current,voltage + FUNC_DC_IV_COMBINED { buffer = %NODE%.slot[%BIAS-DEVICE:SLOT-IDX%].smu[%BIAS-DEVICE:CHANNEL-IDX%].defbuffer1, @@ -1473,6 +1473,7 @@ %SENSE% %LIMITI% %LIMITV% + %MODE% local %MUX% = UTILITY.insert(nodes.steps, UTILITY.makestep({ node_idx = %NODE-IDX%, @@ -1522,7 +1523,7 @@ buffers = { - current + FUNC_DC_CURRENT { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1531,7 +1532,7 @@ - voltage + FUNC_DC_VOLTAGE { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1540,7 +1541,7 @@ - current,voltage + FUNC_DC_IV_COMBINED { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1575,13 +1576,14 @@ %SENSE% %LIMITI% %LIMITV% + %MODE% local %MUX% = UTILITY.insert(nodes.sweeps, UTILITY.makesweep({ node_idx = %NODE-IDX%, slot_idx = %SLOT-IDX%, channel_idx = %CHANNEL-IDX%, model = "%MODEL%", - sense = CONSTANTS.%SENSE, -- must be SENSE_2WIRE or SENSE_4WIRE + sense = CONSTANTS.%SENSE%, -- must be SENSE_2WIRE or SENSE_4WIRE source = { @@ -1620,11 +1622,11 @@ nplc = nplc, count = measure_count, delay = measure_delay, - func = CONSTANTS["%MFUNCTION%"], -- must be FUNC_DC_VOLTAGE, FUNC_DC_CURRENT, or FUNC_DC_IV_COMBINED + func = CONSTANTS.%MFUNCTION%, -- must be FUNC_DC_VOLTAGE, FUNC_DC_CURRENT, or FUNC_DC_IV_COMBINED buffers = { - current + FUNC_DC_CURRENT { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1633,7 +1635,7 @@ - voltage + FUNC_DC_VOLTAGE { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, @@ -1642,7 +1644,7 @@ - current,voltage + FUNC_DC_IV_COMBINED { buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, From 2c75f67989178f852f4b69e55ac81e3bad19515e Mon Sep 17 00:00:00 2001 From: jharajeev55 Date: Mon, 13 Oct 2025 17:48:13 +0530 Subject: [PATCH 2/9] Fixed values table is not getting created in script (#25) Parameters name has been changes to match with function functionality Also fixed, snippets hardcode values problem --- .gitignore | 1 + .../src/script_component/sweep.rs | 54 ++++++++++--------- .../src/resources/sweep/MP5000Sweep.xml | 14 ++--- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 5fc48ee..30c89c3 100644 --- a/.gitignore +++ b/.gitignore @@ -157,3 +157,4 @@ test-results/ # SBOM file generated by cargo-cyclonedx **/*.cdx.json +.vscode/settings.json diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index f3debc6..bc3582d 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -79,9 +79,9 @@ impl SweepModel { } } - fn define_bias_channels(&mut self, sweep_config: &SweepConfig) { + fn define_bias_channels(&mut self, bias_config: &SweepConfig) { let mut index = 1; - for bias_channel in sweep_config.bias_channels.iter() { + for bias_channel in bias_config.bias_channels.iter() { let instr_name = format!("bias{index}"); self.attributes.bias_names.push(instr_name.clone()); @@ -182,9 +182,9 @@ impl SweepModel { } } - fn define_step_channels(&mut self, sweep_config: &SweepConfig) { + fn define_step_channels(&mut self, step_config: &SweepConfig) { let mut index = 1; - for step_channel in sweep_config.step_channels.iter() { + for step_channel in step_config.step_channels.iter() { let instr_name = format!("step{index}"); self.attributes.step_names.push(instr_name.clone()); @@ -223,11 +223,11 @@ impl SweepModel { self.val_replacement_map.insert( instr_name.clone() + ":SFUNCTION", step_channel - .start_stop_channel - .common_chan_attributes - .source_function - .value - .clone(), + .start_stop_channel + .common_chan_attributes + .source_function + .value + .clone(), ); self.val_replacement_map.insert( @@ -251,6 +251,15 @@ impl SweepModel { .clone(), ); + self.val_replacement_map.insert( + instr_name.clone() + ":MODE", + if step_config.step_global_parameters.list_step { + "LIST".to_string() + } else { + step_channel.start_stop_channel.style.value.clone() + }, + ); + //sense mode exists only for SMU if let Some(sense_mode) = &step_channel .start_stop_channel @@ -266,7 +275,6 @@ impl SweepModel { self.val_replacement_map.insert( instr_name.clone() + ":SENSE", String::from(sense_mode_value), - ); } } @@ -310,17 +318,17 @@ impl SweepModel { ); self.process_list( - sweep_config.step_global_parameters.list_step, + step_config.step_global_parameters.list_step, &step_channel.start_stop_channel.list, instr_name, - sweep_config.step_global_parameters.step_points.value as usize, + step_config.step_global_parameters.step_points.value as usize, ); index += 1; } let step_count = if !self.attributes.step_names.is_empty() { - sweep_config + step_config .step_global_parameters .step_points .value @@ -330,12 +338,7 @@ impl SweepModel { }; let step_to_sweep_delay = if !self.attributes.step_names.is_empty() { - self.format( - sweep_config - .step_global_parameters - .step_to_sweep_delay - .value, - ) + self.format(step_config.step_global_parameters.step_to_sweep_delay.value) } else { String::from("0") }; @@ -447,11 +450,14 @@ impl SweepModel { .clone(), ); - // self.val_replacement_map.insert( - // instr_name.clone() + ":MODE", - // "LIST".to_string(), - // ); - + self.val_replacement_map.insert( + instr_name.clone() + ":MODE", + if sweep_config.sweep_global_parameters.list_sweep { + "LIST".to_string() + } else { + sweep_channel.start_stop_channel.style.value.clone() + }, + ); //sense mode exists only for SMU if let Some(sense_mode) = &sweep_channel .start_stop_channel diff --git a/xml-handler/src/resources/sweep/MP5000Sweep.xml b/xml-handler/src/resources/sweep/MP5000Sweep.xml index e963151..4e09dcc 100644 --- a/xml-handler/src/resources/sweep/MP5000Sweep.xml +++ b/xml-handler/src/resources/sweep/MP5000Sweep.xml @@ -1274,16 +1274,16 @@ local errorTag = "[{error}]" - local numberOfSteps = 10 - local numberOfSweeps = 10 + local numberOfSteps = %STEP-COUNT% + local numberOfSweeps = %SWEEP-POINTS% - local stepToSweepDelay = 0 + local stepToSweepDelay = %STEP-TO-SWEEP-DELAY% - local nplc = 1 + local nplc = %NPLC% - local source_delay = 0 - local measure_delay = nil - local measure_count = 1 + local source_delay = %SOURCE-DELAY% + local measure_delay = %MEASURE-DELAY% + local measure_count = %MEASURE-COUNT% From 746be781af6b66e7d26dceeb489b64f076da1a9e Mon Sep 17 00:00:00 2001 From: pavannarayana Date: Mon, 13 Oct 2025 18:17:00 +0530 Subject: [PATCH 3/9] Use CONSTANTS for source.range --- xml-handler/src/resources/sweep/MP5000Sweep.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xml-handler/src/resources/sweep/MP5000Sweep.xml b/xml-handler/src/resources/sweep/MP5000Sweep.xml index 4e09dcc..3830659 100644 --- a/xml-handler/src/resources/sweep/MP5000Sweep.xml +++ b/xml-handler/src/resources/sweep/MP5000Sweep.xml @@ -1317,7 +1317,7 @@ sense = CONSTANTS.%SENSE%, -- must be SENSE_2WIRE or SENSE_4WIRE source = { values = { scalar = %BIAS% }, - range = %SRANGE%, + range = CONSTANTS.%SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, @@ -1420,7 +1420,7 @@ - range = %SRANGE%, + range = CONSTANTS.%SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, @@ -1523,7 +1523,7 @@ - range = %SRANGE%, + range = CONSTANTS.%SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, From c375d1f7cecbfcfbc295b2b12f6bd4555f4a7e30 Mon Sep 17 00:00:00 2001 From: pavannarayana Date: Fri, 17 Oct 2025 00:14:55 +0530 Subject: [PATCH 4/9] Differentiate UI text and script variable --- .../src/script_component/sweep.rs | 107 +++++++++++------- 1 file changed, 68 insertions(+), 39 deletions(-) diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index bc3582d..fd9778a 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -4,7 +4,8 @@ use crate::{ instr_metadata::base_metadata::BaseMetadata, model::{ chan_data::channel_range::ChannelRange, - sweep_data::{parameters::ParameterFloat, sweep_config::SweepConfig}, + sweep_data::{parameters::ParameterFloat, sweep_config::SweepConfig, + parameters::ParameterString}, }, }; @@ -105,14 +106,11 @@ impl SweepModel { bias_channel.common_chan_attributes.device.get_model(), ); + let val = self.get_function_value(&bias_channel.common_chan_attributes.source_function) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":SFUNCTION", - bias_channel - .common_chan_attributes - .source_function - .value - .to_lowercase() - .clone(), + val, ); self.val_replacement_map.insert( @@ -120,13 +118,11 @@ impl SweepModel { self.format_range(bias_channel.common_chan_attributes.source_range.clone()), ); + let val = self.get_function_value(&bias_channel.common_chan_attributes.meas_function) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":MFUNCTION", - bias_channel - .common_chan_attributes - .meas_function - .value - .clone(), + val, ); //sense mode exists only for SMU @@ -136,9 +132,10 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { + let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map.insert( instr_name.clone() + ":SENSE", - String::from(sense_mode_value), + val, ); } else { //TODO: error handling for sense mode value not found @@ -182,6 +179,28 @@ impl SweepModel { } } + //Returns the value used in the script + fn get_function_value(&mut self, source_function: &ParameterString) -> String { + if source_function.value.to_lowercase() == BaseMetadata::FUNCTION_VOLTAGE.to_lowercase() { + "FUNC_DC_VOLTAGE".to_string() + } else if source_function.value.to_lowercase() + == BaseMetadata::FUNCTION_CURRENT.to_lowercase() + { + "FUNC_DC_CURRENT".to_string() + } else { + "FUNC_DC_IV_COMBINED".to_string() + } + } + + //Returns the value used in the script + fn get_sense_mode_value(&mut self, sense_mode: &str) -> String { + if sense_mode.to_lowercase() == BaseMetadata::SENSE_MODE_TWO_WIRE.to_lowercase() { + "SENSE_2WIRE".to_string() + } else { + "SENSE_4WIRE".to_string() + } + } + fn define_step_channels(&mut self, step_config: &SweepConfig) { let mut index = 1; for step_channel in step_config.step_channels.iter() { @@ -220,14 +239,16 @@ impl SweepModel { .get_model(), ); + let val = self.get_function_value( + &step_channel + .start_stop_channel + .common_chan_attributes + .source_function, + ) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":SFUNCTION", - step_channel - .start_stop_channel - .common_chan_attributes - .source_function - .value - .clone(), + val, ); self.val_replacement_map.insert( @@ -241,14 +262,16 @@ impl SweepModel { ), ); + let val = self.get_function_value( + &step_channel + .start_stop_channel + .common_chan_attributes + .meas_function + ) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":MFUNCTION", - step_channel - .start_stop_channel - .common_chan_attributes - .meas_function - .value - .clone(), + val, ); self.val_replacement_map.insert( @@ -272,9 +295,10 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { + let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map.insert( instr_name.clone() + ":SENSE", - String::from(sense_mode_value), + val, ); } } @@ -420,14 +444,16 @@ impl SweepModel { .get_model(), ); + let val = self.get_function_value( + &sweep_channel + .start_stop_channel + .common_chan_attributes + .source_function + ) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":SFUNCTION", - sweep_channel - .start_stop_channel - .common_chan_attributes - .source_function - .value - .clone(), + val, ); self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", @@ -440,14 +466,16 @@ impl SweepModel { ), ); + let val = self.get_function_value( + &sweep_channel + .start_stop_channel + .common_chan_attributes + .meas_function + ) + .clone(); self.val_replacement_map.insert( instr_name.clone() + ":MFUNCTION", - sweep_channel - .start_stop_channel - .common_chan_attributes - .meas_function - .value - .clone(), + val, ); self.val_replacement_map.insert( @@ -470,9 +498,10 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { + let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map.insert( instr_name.clone() + ":SENSE", - String::from(sense_mode_value), + val, ); } else { //TODO: error handling for sense mode value not found From 064e29ed29116e1c6dfd5a789fac334a75533987 Mon Sep 17 00:00:00 2001 From: pavannarayana Date: Fri, 17 Oct 2025 09:47:20 +0530 Subject: [PATCH 5/9] Remove unused file --- .vscode/settings.json | 64 ------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0c5f5e1..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "Lua.workspace.preloadFileSize": 2000, - "Lua.workspace.ignoreDir": [], - "Lua.diagnostics.libraryFiles": "Disable", - "Lua.runtime.version": "Lua 5.1", - "Lua.runtime.builtin": { - "basic": "enable", - "bit": "disable", - "bit32": "disable", - "builtin": "enable", - "coroutine": "disable", - "debug": "disable", - "ffi": "disable", - "io": "disable", - "jit": "disable", - "jit.profile": "disable", - "jit.util": "disable", - "math": "disable", - "os": "disable", - "package": "disable", - "string": "disable", - "string.buffer": "disable", - "table": "enable", - "table.clear": "disable", - "table.new": "disable", - "utf8": "disable" - }, - "Lua.workspace.library": [ - "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\tsp-lua-5.0", - "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MP5103\\Helper", - "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MP5103\\AllTspCommands", - "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\MSMU60-2\\Helper", - "c:\\Users\\pnarayan\\.vscode\\extensions\\tektronix.tsp-toolkit-1.3.0-win32-x64\\node_modules\\@tektronix\\keithley_instrument_libraries\\keithley_instrument_libraries\\nodes_definitions" - ], - "tsp.tspLinkSystemConfigurations": [ - { - "name": "testSystem1", - "localNode": "MP5103", - "isActive": true, - "slots": [ - { - "slotId": "slot[1]", - "module": "MSMU60-2" - }, - { - "slotId": "slot[2]", - "module": "MSMU60-2" - }, - { - "slotId": "slot[3]", - "module": "MSMU60-2" - } - ] - } - ], - "tsp.script_generation": { - "I-V Characterization": [ - { - "name": "sess1", - "config": "{\"request_type\":\"evaluated_response\",\"additional_info\":\"Updated sweep model with new system configuration\",\"json_value\":\"{\\\"sweep_model\\\":{\\\"sweep_config\\\":{\\\"bias_channels\\\":[{\\\"bias\\\":{\\\"id\\\":\\\"bias\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"bias1\\\",\\\"device_id\\\":\\\"localnode.slot[2].psu[1]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"555e4975-f2f8-474a-a2d7-fb744d87a3c5\\\"}}],\\\"device_list\\\":[{\\\"_id\\\":\\\"localnode.slot[1].psu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].psu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].psu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Psu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":true,\\\"is_valid\\\":false,\\\"model\\\":\\\"MPSU50-2ST\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[1].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[1]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[2].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[2]\\\"},{\\\"_id\\\":\\\"localnode.slot[3].smu[1]\\\",\\\"chan_num\\\":1,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[3]\\\"},{\\\"_id\\\":\\\"localnode.slot[3].smu[2]\\\",\\\"chan_num\\\":2,\\\"device_type\\\":\\\"Smu\\\",\\\"fw_version\\\":\\\"\\\",\\\"in_use\\\":false,\\\"is_valid\\\":true,\\\"model\\\":\\\"MSMU60-2\\\",\\\"node_id\\\":\\\"localnode\\\",\\\"slot_id\\\":\\\"slot[3]\\\"}],\\\"global_parameters\\\":{\\\"sweep_timing_config\\\":{\\\"measure_count\\\":{\\\"id\\\":\\\"measureCount\\\",\\\"value\\\":1},\\\"psu_timing\\\":{\\\"rate\\\":{\\\"id\\\":\\\"rate\\\",\\\"range\\\":[\\\"Normal\\\",\\\"Fast\\\"],\\\"value\\\":\\\"Normal\\\"}},\\\"smu_timing\\\":{\\\"aperture\\\":{\\\"id\\\":\\\"aperture\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":1e-6},\\\"measure_auto_delay\\\":{\\\"id\\\":\\\"measureAutoDelay\\\",\\\"range\\\":[\\\"OFF\\\",\\\"ON\\\"],\\\"value\\\":\\\"ON\\\"},\\\"measure_delay\\\":{\\\"id\\\":\\\"measureDelay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0},\\\"nplc\\\":{\\\"id\\\":\\\"nplc\\\",\\\"unit\\\":null,\\\"value\\\":1.0},\\\"nplc_type\\\":{\\\"id\\\":\\\"nplcType\\\",\\\"range\\\":[\\\"NPLC\\\",\\\"Aperture\\\"],\\\"value\\\":\\\"NPLC\\\"},\\\"source_auto_delay\\\":{\\\"id\\\":\\\"sourceAutoDelay\\\",\\\"range\\\":[\\\"OFF\\\",\\\"ON\\\"],\\\"value\\\":\\\"OFF\\\"},\\\"source_delay\\\":{\\\"id\\\":\\\"sourceDelay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0}}}},\\\"status_msg\\\":{\\\"message\\\":\\\"Some channels in use are invalid. Re-assign the invalid channels for the generated script to be functional.\\\",\\\"status_type\\\":\\\"Error\\\",\\\"time_stamp\\\":\\\"2025-09-15 15:16:44\\\"},\\\"step_channels\\\":[{\\\"start_stop_channel\\\":{\\\"asymptote\\\":0.0,\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"step1\\\",\\\"device_id\\\":\\\"localnode.slot[1].psu[1]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"58129413-7584-4db0-9466-d9be048ba30f\\\"},\\\"list\\\":[{\\\"id\\\":\\\"list_0\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_1\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_2\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_3\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_4\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_5\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_6\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_7\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_8\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_9\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0}],\\\"start\\\":{\\\"id\\\":\\\"start\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},\\\"stop\\\":{\\\"id\\\":\\\"stop\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1.0},\\\"style\\\":{\\\"id\\\":\\\"style\\\",\\\"range\\\":[\\\"LIN\\\",\\\"LOG\\\"],\\\"value\\\":\\\"LIN\\\"}}}],\\\"step_global_parameters\\\":{\\\"list_step\\\":false,\\\"step_points\\\":{\\\"id\\\":\\\"step_points\\\",\\\"value\\\":10},\\\"step_to_sweep_delay\\\":{\\\"id\\\":\\\"step_to_sweep_delay\\\",\\\"unit\\\":\\\"s\\\",\\\"value\\\":0.0}},\\\"sweep_channels\\\":[{\\\"start_stop_channel\\\":{\\\"asymptote\\\":0.0,\\\"common_chan_attributes\\\":{\\\"chan_name\\\":\\\"sweep1\\\",\\\"device_id\\\":\\\"localnode.slot[1].psu[2]\\\",\\\"meas_function\\\":{\\\"id\\\":\\\"meas_function\\\",\\\"range\\\":[\\\"Voltage\\\",\\\"Current\\\",\\\"Current,Voltage\\\"],\\\"value\\\":\\\"Current\\\"},\\\"meas_range\\\":{\\\"range\\\":[\\\"5 A\\\"],\\\"value\\\":\\\"5 A\\\"},\\\"sense_mode\\\":null,\\\"source_function\\\":{\\\"id\\\":\\\"source_function\\\",\\\"range\\\":[\\\"Voltage\\\"],\\\"value\\\":\\\"Voltage\\\"},\\\"source_limiti\\\":{\\\"id\\\":\\\"source_limiti\\\",\\\"unit\\\":\\\"A\\\",\\\"value\\\":0.1},\\\"source_limitv\\\":null,\\\"source_range\\\":{\\\"range\\\":[\\\"50 V\\\"],\\\"value\\\":\\\"50 V\\\"},\\\"uuid\\\":\\\"36fb196d-4f64-4b1a-8be0-05fcb23436a9\\\"},\\\"list\\\":[{\\\"id\\\":\\\"list_0\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_2\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_4\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_6\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_8\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_10\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_12\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_14\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_16\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0},{\\\"id\\\":\\\"list_18\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":0.0}],\\\"start\\\":{\\\"id\\\":\\\"start\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1e-12},\\\"stop\\\":{\\\"id\\\":\\\"stop\\\",\\\"unit\\\":\\\"V\\\",\\\"value\\\":1.0},\\\"style\\\":{\\\"id\\\":\\\"style\\\",\\\"range\\\":[\\\"LIN\\\",\\\"LOG\\\"],\\\"value\\\":\\\"LIN\\\"}}}],\\\"sweep_global_parameters\\\":{\\\"list_sweep\\\":false,\\\"sweep_points\\\":{\\\"id\\\":\\\"sweep_points\\\",\\\"value\\\":10}}}}}\"}\nSignal received to start script generation!\n" - } - ] - } -} \ No newline at end of file From 7cbb5e50ae815de3fa0421f781b09bbe12915f13 Mon Sep 17 00:00:00 2001 From: pavannarayana Date: Fri, 17 Oct 2025 09:49:45 +0530 Subject: [PATCH 6/9] Fix formatting --- .../src/script_component/sweep.rs | 83 ++++++++----------- 1 file changed, 36 insertions(+), 47 deletions(-) diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index fd9778a..4beca7d 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -4,8 +4,9 @@ use crate::{ instr_metadata::base_metadata::BaseMetadata, model::{ chan_data::channel_range::ChannelRange, - sweep_data::{parameters::ParameterFloat, sweep_config::SweepConfig, - parameters::ParameterString}, + sweep_data::{ + parameters::ParameterFloat, parameters::ParameterString, sweep_config::SweepConfig, + }, }, }; @@ -106,24 +107,22 @@ impl SweepModel { bias_channel.common_chan_attributes.device.get_model(), ); - let val = self.get_function_value(&bias_channel.common_chan_attributes.source_function) + let val = self + .get_function_value(&bias_channel.common_chan_attributes.source_function) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":SFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SFUNCTION", val); self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", self.format_range(bias_channel.common_chan_attributes.source_range.clone()), ); - let val = self.get_function_value(&bias_channel.common_chan_attributes.meas_function) + let val = self + .get_function_value(&bias_channel.common_chan_attributes.meas_function) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":MFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":MFUNCTION", val); //sense mode exists only for SMU if let Some(sense_mode) = &bias_channel.common_chan_attributes.sense_mode { @@ -133,10 +132,8 @@ impl SweepModel { .get_name_for(&sense_mode_key) { let val = self.get_sense_mode_value(&sense_mode_value); - self.val_replacement_map.insert( - instr_name.clone() + ":SENSE", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SENSE", val); } else { //TODO: error handling for sense mode value not found } @@ -239,17 +236,16 @@ impl SweepModel { .get_model(), ); - let val = self.get_function_value( + let val = self + .get_function_value( &step_channel .start_stop_channel .common_chan_attributes .source_function, ) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":SFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SFUNCTION", val); self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", @@ -262,17 +258,16 @@ impl SweepModel { ), ); - let val = self.get_function_value( + let val = self + .get_function_value( &step_channel .start_stop_channel .common_chan_attributes - .meas_function + .meas_function, ) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":MFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":MFUNCTION", val); self.val_replacement_map.insert( instr_name.clone() + ":MODE", @@ -296,10 +291,8 @@ impl SweepModel { .get_name_for(&sense_mode_key) { let val = self.get_sense_mode_value(&sense_mode_value); - self.val_replacement_map.insert( - instr_name.clone() + ":SENSE", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SENSE", val); } } @@ -444,17 +437,16 @@ impl SweepModel { .get_model(), ); - let val = self.get_function_value( + let val = self + .get_function_value( &sweep_channel .start_stop_channel .common_chan_attributes - .source_function + .source_function, ) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":SFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SFUNCTION", val); self.val_replacement_map.insert( instr_name.clone() + ":SRANGE", self.format_range( @@ -466,17 +458,16 @@ impl SweepModel { ), ); - let val = self.get_function_value( + let val = self + .get_function_value( &sweep_channel .start_stop_channel .common_chan_attributes - .meas_function + .meas_function, ) .clone(); - self.val_replacement_map.insert( - instr_name.clone() + ":MFUNCTION", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":MFUNCTION", val); self.val_replacement_map.insert( instr_name.clone() + ":MODE", @@ -499,10 +490,8 @@ impl SweepModel { .get_name_for(&sense_mode_key) { let val = self.get_sense_mode_value(&sense_mode_value); - self.val_replacement_map.insert( - instr_name.clone() + ":SENSE", - val, - ); + self.val_replacement_map + .insert(instr_name.clone() + ":SENSE", val); } else { //TODO: error handling for sense mode value not found } From 119719a79bf95867faf10cef6242708488da1480 Mon Sep 17 00:00:00 2001 From: "GLOBAL\\rjha" Date: Fri, 17 Oct 2025 18:38:46 +0530 Subject: [PATCH 7/9] Fix: allocation type request is not getting correct model object Fix: script is not getting correct Device type for buffer Remove few unused imports Sense configuration has been removed for PSU UI string has been corrected --- kic-script-gen/src/back_end/data_model.rs | 2 + .../src/instr_metadata/base_metadata.rs | 16 +-- .../src/instr_metadata/msmu60_metadata.rs | 2 +- .../src/model/chan_data/start_stop_channel.rs | 1 - .../src/script_component/sweep.rs | 117 +++++++++++------- .../src/resources/sweep/MP5000Sweep.xml | 41 +++--- xml-handler/src/snippet/mod.rs | 3 +- 7 files changed, 108 insertions(+), 74 deletions(-) diff --git a/kic-script-gen/src/back_end/data_model.rs b/kic-script-gen/src/back_end/data_model.rs index 9a5f7e3..1a61c79 100644 --- a/kic-script-gen/src/back_end/data_model.rs +++ b/kic-script-gen/src/back_end/data_model.rs @@ -154,6 +154,8 @@ impl DataModel { // remove unused and invalid channels sweep_model.sweep_config.remove_unused_invalid_channels(); + sweep_model.sweep_config.evaluate(); + self.sweep_model = sweep_model.clone(); self.serialize_sweep_model( &sweep_model, diff --git a/script-gen-manager/src/instr_metadata/base_metadata.rs b/script-gen-manager/src/instr_metadata/base_metadata.rs index 97f4cb2..9694467 100644 --- a/script-gen-manager/src/instr_metadata/base_metadata.rs +++ b/script-gen-manager/src/instr_metadata/base_metadata.rs @@ -48,15 +48,17 @@ impl BaseMetadata { pub const USER_DEFINED_VALUE: &'static str = "USER DEFINED"; pub const MOVING_AVG: &'static str = "MOVING AVG"; pub const REPEAT_AVG: &'static str = "REPEAT AVG"; - pub const FUNCTION_VOLTAGE: &'static str = "FUNC_DC_VOLTAGE"; - pub const FUNCTION_CURRENT: &'static str = "FUNC_DC_CURRENT"; - pub const FUNCTION_IV: &'static str = "FUNC_DC_IV_COMBINED"; + pub const FUNCTION_VOLTAGE: &'static str = "Voltage"; + pub const FUNCTION_CURRENT: &'static str = "Current"; + pub const FUNCTION_IV: &'static str = "Current,Voltage"; pub const RANGE_FOLLOW_LIMITI: &'static str = "follow limiti"; - pub const SENSE_MODE_TWO_WIRE: &'static str = "SENSE_2WIRE"; - pub const SENSE_MODE_FOUR_WIRE: &'static str = " SENSE_4WIRE"; + pub const SENSE_MODE_TWO_WIRE: &'static str = "Two-wire"; + pub const SENSE_MODE_FOUR_WIRE: &'static str = "Four-wire"; pub const RATE_NORMAL: &'static str = "Normal"; pub const RATE_FAST: &'static str = "Fast"; + pub const UNDEFINED: &'static str = "UNDEFINED"; + pub const UNIT_VOLTS: &'static str = "V"; pub const UNIT_AMPERES: &'static str = "A"; pub const UNIT_SECONDS: &'static str = "s"; @@ -79,8 +81,8 @@ impl BaseMetadata { ], ); - names.insert("sense=SENSE_2WIRE", "SENSE_2WIRE"); - names.insert("sense=SENSE_4WIRE", "SENSE_4WIRE"); + names.insert("sense=Two-wire", "SENSE_2WIRE"); + names.insert("sense=Four-wire", "SENSE_4WIRE"); BaseMetadata { options, diff --git a/script-gen-manager/src/instr_metadata/msmu60_metadata.rs b/script-gen-manager/src/instr_metadata/msmu60_metadata.rs index 389dee9..418f8ee 100644 --- a/script-gen-manager/src/instr_metadata/msmu60_metadata.rs +++ b/script-gen-manager/src/instr_metadata/msmu60_metadata.rs @@ -1,6 +1,6 @@ use crate::model::{ chan_data::region_map::RegionMapMetadata, - sweep_data::{number_limit::NumberLimit, parameters::ParameterFloat}, + sweep_data::number_limit::NumberLimit, }; use super::base_metadata::{BaseMetadata, Metadata}; diff --git a/script-gen-manager/src/model/chan_data/start_stop_channel.rs b/script-gen-manager/src/model/chan_data/start_stop_channel.rs index 81c6106..3b036ca 100644 --- a/script-gen-manager/src/model/chan_data/start_stop_channel.rs +++ b/script-gen-manager/src/model/chan_data/start_stop_channel.rs @@ -1,4 +1,3 @@ -use core::num; use serde::{Deserialize, Serialize}; diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index 4beca7d..f283f28 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -1,13 +1,13 @@ use std::{any::Any, collections::HashMap}; use crate::{ - instr_metadata::base_metadata::BaseMetadata, - model::{ + device::DeviceType, instr_metadata::base_metadata::BaseMetadata, model::{ chan_data::channel_range::ChannelRange, sweep_data::{ - parameters::ParameterFloat, parameters::ParameterString, sweep_config::SweepConfig, + parameters::{ParameterFloat, ParameterString}, + sweep_config::SweepConfig, }, - }, + } }; use super::function::FunctionModel; @@ -107,20 +107,28 @@ impl SweepModel { bias_channel.common_chan_attributes.device.get_model(), ); + self.val_replacement_map.insert( + instr_name.clone() + ":MODEL-TYPE", + bias_channel + .common_chan_attributes + .device.device_type.to_string(), + ); + let val = self .get_function_value(&bias_channel.common_chan_attributes.source_function) .clone(); self.val_replacement_map .insert(instr_name.clone() + ":SFUNCTION", val); - self.val_replacement_map.insert( - instr_name.clone() + ":SRANGE", - self.format_range(bias_channel.common_chan_attributes.source_range.clone()), + self.set_source_range( + bias_channel.common_chan_attributes.source_range.clone(), + &instr_name, ); let val = self .get_function_value(&bias_channel.common_chan_attributes.meas_function) .clone(); + self.val_replacement_map .insert(instr_name.clone() + ":MFUNCTION", val); @@ -131,12 +139,14 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { - let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map - .insert(instr_name.clone() + ":SENSE", val); - } else { - //TODO: error handling for sense mode value not found + .insert(instr_name.clone() + ":SENSE", sense_mode_value.to_owned()); } + } else { + self.val_replacement_map.insert( + instr_name.clone() + ":SENSE", + BaseMetadata::UNDEFINED.to_string(), + ); } //source_limitv exists only for SMU @@ -176,6 +186,17 @@ impl SweepModel { } } + fn set_source_range(&mut self, channel_range: ChannelRange, instr_name: &String) { + let mut val = self.format_range(channel_range.clone()); + + if channel_range.is_range_auto() { + val = "CONSTANTS.AUTO".to_string(); + } + + self.val_replacement_map + .insert(instr_name.clone() + ":SRANGE", val); + } + //Returns the value used in the script fn get_function_value(&mut self, source_function: &ParameterString) -> String { if source_function.value.to_lowercase() == BaseMetadata::FUNCTION_VOLTAGE.to_lowercase() { @@ -189,15 +210,6 @@ impl SweepModel { } } - //Returns the value used in the script - fn get_sense_mode_value(&mut self, sense_mode: &str) -> String { - if sense_mode.to_lowercase() == BaseMetadata::SENSE_MODE_TWO_WIRE.to_lowercase() { - "SENSE_2WIRE".to_string() - } else { - "SENSE_4WIRE".to_string() - } - } - fn define_step_channels(&mut self, step_config: &SweepConfig) { let mut index = 1; for step_channel in step_config.step_channels.iter() { @@ -236,6 +248,14 @@ impl SweepModel { .get_model(), ); + self.val_replacement_map.insert( + instr_name.clone() + ":MODEL-TYPE", + step_channel + .start_stop_channel + .common_chan_attributes + .device.device_type.to_string(), + ); + let val = self .get_function_value( &step_channel @@ -247,15 +267,12 @@ impl SweepModel { self.val_replacement_map .insert(instr_name.clone() + ":SFUNCTION", val); - self.val_replacement_map.insert( - instr_name.clone() + ":SRANGE", - self.format_range( - step_channel - .start_stop_channel - .common_chan_attributes - .source_range - .clone(), - ), + self.set_source_range( + step_channel + .start_stop_channel + .common_chan_attributes + .source_range.clone(), + &instr_name, ); let val = self @@ -290,10 +307,14 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { - let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map - .insert(instr_name.clone() + ":SENSE", val); + .insert(instr_name.clone() + ":SENSE", sense_mode_value.to_owned()); } + } else { + self.val_replacement_map.insert( + instr_name.clone() + ":SENSE", + BaseMetadata::UNDEFINED.to_string(), + ); } //source_limitv exists only for SMU @@ -437,6 +458,14 @@ impl SweepModel { .get_model(), ); + self.val_replacement_map.insert( + instr_name.clone() + ":MODEL-TYPE", + sweep_channel + .start_stop_channel + .common_chan_attributes + .device.device_type.to_string(), + ); + let val = self .get_function_value( &sweep_channel @@ -447,15 +476,13 @@ impl SweepModel { .clone(); self.val_replacement_map .insert(instr_name.clone() + ":SFUNCTION", val); - self.val_replacement_map.insert( - instr_name.clone() + ":SRANGE", - self.format_range( - sweep_channel - .start_stop_channel - .common_chan_attributes - .source_range - .clone(), - ), + + self.set_source_range( + sweep_channel + .start_stop_channel + .common_chan_attributes + .source_range.clone(), + &instr_name, ); let val = self @@ -489,12 +516,14 @@ impl SweepModel { .common_chan_attributes .get_name_for(&sense_mode_key) { - let val = self.get_sense_mode_value(&sense_mode_value); self.val_replacement_map - .insert(instr_name.clone() + ":SENSE", val); - } else { - //TODO: error handling for sense mode value not found + .insert(instr_name.clone() + ":SENSE", sense_mode_value.to_owned()); } + } else { + self.val_replacement_map.insert( + instr_name.clone() + ":SENSE", + BaseMetadata::UNDEFINED.to_string(), + ); } //source_limitv exists only for SMU diff --git a/xml-handler/src/resources/sweep/MP5000Sweep.xml b/xml-handler/src/resources/sweep/MP5000Sweep.xml index e0e11d4..c42d965 100644 --- a/xml-handler/src/resources/sweep/MP5000Sweep.xml +++ b/xml-handler/src/resources/sweep/MP5000Sweep.xml @@ -42,6 +42,7 @@ --#region Util CONSTANTS = { + UNDEFINED = nil, AUTO = "AUTO", localnode = 0, SENSE_2WIRE = 0, @@ -82,9 +83,9 @@ ---@class Source ---@field values ScalarValue | LogValues | LinearValues | ListValues The value or values to source - ---@field range number | `CONSTANTS.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 The voltage limit + ---@field limitv number | nil The voltage limit ---@field delay number The time to delay before sourcing ---@field func `self.slot.smu.FUNC_DC_VOLTAGE` | `self.slot.smu.FUNC_DC_CURRENT` @@ -741,8 +742,7 @@ ---@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 }) - -- Sense setting -- - self.channel.sense = self.sense + local event_id = UTILITY.get_slot_event_id(self.slot) if event_id then @@ -1301,6 +1301,7 @@ %SLOT-IDX% %CHANNEL-IDX% %MODEL% + %MODEL-TYPE% %SFUNCTION% %SRANGE% %BIAS% @@ -1317,7 +1318,7 @@ sense = CONSTANTS.%SENSE%, -- must be SENSE_2WIRE or SENSE_4WIRE source = { values = { scalar = %BIAS% }, - range = CONSTANTS.%SRANGE%, + range = %SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, @@ -1334,7 +1335,7 @@ FUNC_DC_CURRENT { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, @@ -1343,7 +1344,7 @@ FUNC_DC_VOLTAGE { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_VOLTAGE }, @@ -1352,11 +1353,11 @@ FUNC_DC_IV_COMBINED { - buffer = %NODE%.slot[%BIAS-DEVICE:SLOT-IDX%].smu[%BIAS-DEVICE:CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%BIAS-DEVICE:SLOT-IDX%].%MODEL-TYPE%[%BIAS-DEVICE:CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer2, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer2, type = CONSTANTS.FUNC_DC_VOLTAGE }, @@ -1375,6 +1376,7 @@ %SLOT-IDX% %CHANNEL-IDX% %MODEL% + %MODEL-TYPE% %SFUNCTION% %SRANGE% %START% @@ -1421,7 +1423,7 @@ - range = CONSTANTS.%SRANGE%, + range = %SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, @@ -1438,7 +1440,7 @@ FUNC_DC_CURRENT { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, @@ -1447,7 +1449,7 @@ FUNC_DC_VOLTAGE { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_VOLTAGE }, @@ -1456,11 +1458,11 @@ FUNC_DC_IV_COMBINED { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer2, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer2, type = CONSTANTS.FUNC_DC_VOLTAGE }, @@ -1479,6 +1481,7 @@ %SLOT-IDX% %CHANNEL-IDX% %MODEL% + %MODEL-TYPE% %SFUNCTION% %SRANGE% %START% @@ -1525,7 +1528,7 @@ - range = CONSTANTS.%SRANGE%, + range = %SRANGE%, limiti = %LIMITI%, limitv = %LIMITV%, delay = source_delay, @@ -1542,7 +1545,7 @@ FUNC_DC_CURRENT { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, @@ -1551,7 +1554,7 @@ FUNC_DC_VOLTAGE { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_VOLTAGE }, @@ -1560,11 +1563,11 @@ FUNC_DC_IV_COMBINED { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer1, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer1, type = CONSTANTS.FUNC_DC_CURRENT }, { - buffer = %NODE%.slot[%SLOT-IDX%].smu[%CHANNEL-IDX%].defbuffer2, + buffer = %NODE%.slot[%SLOT-IDX%].%MODEL-TYPE%[%CHANNEL-IDX%].defbuffer2, type = CONSTANTS.FUNC_DC_VOLTAGE }, diff --git a/xml-handler/src/snippet/mod.rs b/xml-handler/src/snippet/mod.rs index 208d5de..1086b30 100644 --- a/xml-handler/src/snippet/mod.rs +++ b/xml-handler/src/snippet/mod.rs @@ -1,8 +1,7 @@ use std::{ any::Any, collections::HashMap, - fs::File, - io::{self, BufRead, Cursor, Write}, + io::{self, BufRead, Cursor}, }; use quick_xml::{events::Event, name::QName, Reader}; From a6d043e50fb28c71a20e9501134c9788f86d91ef Mon Sep 17 00:00:00 2001 From: "GLOBAL\\rjha" Date: Fri, 17 Oct 2025 18:46:54 +0530 Subject: [PATCH 8/9] cargo fmt --- .../src/instr_metadata/base_metadata.rs | 2 +- .../src/instr_metadata/msmu60_metadata.rs | 3 +-- .../src/model/chan_data/start_stop_channel.rs | 1 - .../src/script_component/sweep.rs | 26 +++++++++++++------ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/script-gen-manager/src/instr_metadata/base_metadata.rs b/script-gen-manager/src/instr_metadata/base_metadata.rs index 9694467..aaac93a 100644 --- a/script-gen-manager/src/instr_metadata/base_metadata.rs +++ b/script-gen-manager/src/instr_metadata/base_metadata.rs @@ -57,7 +57,7 @@ impl BaseMetadata { pub const RATE_NORMAL: &'static str = "Normal"; pub const RATE_FAST: &'static str = "Fast"; - pub const UNDEFINED: &'static str = "UNDEFINED"; + pub const UNDEFINED: &'static str = "UNDEFINED"; pub const UNIT_VOLTS: &'static str = "V"; pub const UNIT_AMPERES: &'static str = "A"; diff --git a/script-gen-manager/src/instr_metadata/msmu60_metadata.rs b/script-gen-manager/src/instr_metadata/msmu60_metadata.rs index 418f8ee..fa7217d 100644 --- a/script-gen-manager/src/instr_metadata/msmu60_metadata.rs +++ b/script-gen-manager/src/instr_metadata/msmu60_metadata.rs @@ -1,6 +1,5 @@ use crate::model::{ - chan_data::region_map::RegionMapMetadata, - sweep_data::number_limit::NumberLimit, + chan_data::region_map::RegionMapMetadata, sweep_data::number_limit::NumberLimit, }; use super::base_metadata::{BaseMetadata, Metadata}; diff --git a/script-gen-manager/src/model/chan_data/start_stop_channel.rs b/script-gen-manager/src/model/chan_data/start_stop_channel.rs index 3b036ca..7c23546 100644 --- a/script-gen-manager/src/model/chan_data/start_stop_channel.rs +++ b/script-gen-manager/src/model/chan_data/start_stop_channel.rs @@ -1,4 +1,3 @@ - use serde::{Deserialize, Serialize}; use super::default_channel::CommonChanAttributes; diff --git a/script-gen-manager/src/script_component/sweep.rs b/script-gen-manager/src/script_component/sweep.rs index f283f28..b4b4b45 100644 --- a/script-gen-manager/src/script_component/sweep.rs +++ b/script-gen-manager/src/script_component/sweep.rs @@ -1,13 +1,15 @@ use std::{any::Any, collections::HashMap}; use crate::{ - device::DeviceType, instr_metadata::base_metadata::BaseMetadata, model::{ + device::DeviceType, + instr_metadata::base_metadata::BaseMetadata, + model::{ chan_data::channel_range::ChannelRange, sweep_data::{ parameters::{ParameterFloat, ParameterString}, sweep_config::SweepConfig, }, - } + }, }; use super::function::FunctionModel; @@ -111,7 +113,9 @@ impl SweepModel { instr_name.clone() + ":MODEL-TYPE", bias_channel .common_chan_attributes - .device.device_type.to_string(), + .device + .device_type + .to_string(), ); let val = self @@ -253,7 +257,9 @@ impl SweepModel { step_channel .start_stop_channel .common_chan_attributes - .device.device_type.to_string(), + .device + .device_type + .to_string(), ); let val = self @@ -271,7 +277,8 @@ impl SweepModel { step_channel .start_stop_channel .common_chan_attributes - .source_range.clone(), + .source_range + .clone(), &instr_name, ); @@ -458,12 +465,14 @@ impl SweepModel { .get_model(), ); - self.val_replacement_map.insert( + self.val_replacement_map.insert( instr_name.clone() + ":MODEL-TYPE", sweep_channel .start_stop_channel .common_chan_attributes - .device.device_type.to_string(), + .device + .device_type + .to_string(), ); let val = self @@ -481,7 +490,8 @@ impl SweepModel { sweep_channel .start_stop_channel .common_chan_attributes - .source_range.clone(), + .source_range + .clone(), &instr_name, ); From aa2e877b185d5613894837ebe96b0224f184b0b3 Mon Sep 17 00:00:00 2001 From: "GLOBAL\\rjha" Date: Wed, 22 Oct 2025 16:28:54 +0530 Subject: [PATCH 9/9] Making timing and open script div to sticky, so that it will be visiable always when UI scroll Correcting commad in case of Scalar value --- .../components/main-sweep/main-sweep.component.scss | 11 +++++++---- xml-handler/src/resources/sweep/MP5000Sweep.xml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/script-gen-ui/src/app/components/main-sweep/main-sweep.component.scss b/script-gen-ui/src/app/components/main-sweep/main-sweep.component.scss index dbff548..a613556 100644 --- a/script-gen-ui/src/app/components/main-sweep/main-sweep.component.scss +++ b/script-gen-ui/src/app/components/main-sweep/main-sweep.component.scss @@ -241,11 +241,14 @@ display: flex; justify-content: space-between; color: var(--vscode-editor-foreground); - // border: 1px solid var(--vscode-editorWidget-border); border-radius: 10px; - padding-left: 1px; - padding-right: 1px; - padding-top: 7px; + padding: 7px 10px; + background-color: var(--vscode-editor-background); + position: sticky; + top: 0; + z-index: 100; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + margin-bottom: 10px; } .timing { diff --git a/xml-handler/src/resources/sweep/MP5000Sweep.xml b/xml-handler/src/resources/sweep/MP5000Sweep.xml index c42d965..1831c5a 100644 --- a/xml-handler/src/resources/sweep/MP5000Sweep.xml +++ b/xml-handler/src/resources/sweep/MP5000Sweep.xml @@ -326,7 +326,7 @@ self.channel.source.levelv = self.source.values.scalar elseif self.source.func == CONSTANTS.FUNC_DC_CURRENT then self.channel.source.func = self.slot.smu.FUNC_DC_CURRENT - self.channel.trigger.source.leveli = self.source.values.scalar + self.channel.source.leveli = self.source.values.scalar end elseif self.source.values.list ~= nil then if self.source.func == CONSTANTS.FUNC_DC_VOLTAGE then