edit_in_place : ajax_field.js

暂时只提供输入框的切换功能,以后实现属性的Ajax.update功能

/* Ajax Field , version 1.0.0
* (c) 2006 discolt <discolt@sohu.com>
*
* Team by Vnetoo
/*--------------------------------------------------------------------------*/

AjaxField = Class.create();

AjaxField.prototype = {

initialize: function(input) {
this.field = input;
this.wrapper = null;
this.injectWrapper();
this.addHandleEvent();
},

// 插入Wrapper对象到页面
injectWrapper: function() {
this.createWrapper();
this.positionWrapper();
},

// 创建Wrapper对象
createWrapper: function() {
this.wrapper = document.createElement("span");
this.setWrapperValue();
this.field.parentNode.appendChild(this.wrapper);
},

// 定位Wrapper到属性的位置
positionWrapper: function() {
var wrapperStyle = this.wrapper.style;
wrapperStyle.textDecoration = 'underline';
wrapperStyle.position = 'absolute';
var fieldPos = RicoUtil.toDocumentPosition(this.field);
wrapperStyle.top = fieldPos.y + 'px';
wrapperStyle.left = fieldPos.x + 'px';
wrapperStyle.width = this.field.offsetWidth + '100px';
this.hideField();
},

// 设置Wrapper值,如果值没改变返回false
setWrapperValue: function() {
var text = this.field.tagName == 'SELECT' ? this.field[this.field.selectedIndex].text : this.field.value;
if (text.length == 0) {
text = "-请输入-";
}
if (text != this.wrapper.innerHTML) {
this.wrapper.innerHTML = text;
return true;
} else {
return false;
}
},

// 隐藏Field
hideField: function() {
this.field.style.display = 'none';
this.wrapper.style.display = '';
},

// 添加事件
addHandleEvent: function() {

var field = this.field;
var wrapper = this.wrapper;
var ajaxField = this;

// 覆盖类被双击时
// 隐藏Wrapper对象并显示元素
this.wrapper.ondblclick = function() {
wrapper.style.display='none';
field.style.display = '';
field.focus();
};

// 当元素失去焦点时,设置覆盖类的值,并隐藏元素,显示覆盖类
this.field.onblur=function() {
if (ajaxField.setWrapperValue()) {
//alert('ajax updating ...');
alert(field.form.name + " submit : for " + field.form.action + " update field:" + field.name + " to value:" + field.value);
}
field.style.display='none';
wrapper.style.display='';
};

}
}


var __EDITABLE_CLASS_NAME = 'editable';
/** makeEditable */
function makeEditable() {
var inputs = document.getElementsByClassName(__EDITABLE_CLASS_NAME);
inputs.each(function(el) {
new AjaxField(el);
});
}
Event.observe(window, 'load', makeEditable, false);
<template> <div class="erp-config"> <title>{{ $route.name }}</title> <h1>{{ $route.name }}</h1> <aui-form id="editForm" label-width="100px"> <div class="first-field" :class="isShowMore ? 'showMore' : 'hideMore'"> <aui-form-item label="时间"> <aui-dropdown v-model="searchForm.dateTime" class="operationClas" :op="dateMainOp" place-holder="请输入" ></aui-dropdown> </aui-form-item> <aui-form-item label="工序"> <aui-dropdown size="small" v-model="searchForm.workSerctionListStr" :op="workSerctionMainOp"></aui-dropdown> </aui-form-item> <aui-form-item label="交付部门"> <aui-dropdown size="small" v-model="searchForm.deptCodeStr" :op="deptCodeMainOp"></aui-dropdown> </aui-form-item> <aui-form-item label="产品系列"> <aui-dropdown size="small" v-model="searchForm.prodSeriesCodeListStr" :op="prodSeriesMainOp" place-holder="请选择" ></aui-dropdown> </aui-form-item> <aui-form-item class="first-field-btn" label-width="0px"> <i v-show="true" class="hae-icon" :class="isShowMore ? 'icon-down' : 'icon-left-o'" @click="isShowMore = !isShowMore" ></i> <aui-button hue="primary" round="true" size="small" @click="formValid">查询</aui-button> <aui-button hue="primary" round="true" size="small" @click="reset">重置</aui-button> </aui-form-item> </div> </aui-form> <aui-grid ref="grid" :op="createGridOp"></aui-grid> <aui-dialog-box v-model="lineCommandVisible" :dragable="true" title="架线指令" @close="handleLineCommandClose" width="90%" top="4%" > <cap-dept-line-command v-if="lineCommandVisible" :deptCode="deptCode" :workStation="workStation" :prodSeriesCode="prodSeriesCode" :bucketStr="bucketStr" :isCommandEdit="isCommandEdit" ></cap-dept-line-command> </aui-dialog-box> <!-- 架线 --> <aui-dialog-box id="gridTableDialog" title="导入产能规划" v-model="MaintainDeptProductionCapacityLinDialog.show" width="90%" top="4%" :dragable="true" @close="deptPlandClose" > <maintain-dept-production-capacity-lin v-if="MaintainDeptProductionCapacityLinDialog.show" :deptCodeStr="deptCode" :workSerctionListStr="workStation" :prodSeriesCodeListStr="prodSeriesCode" :bucketStr="bucketStr" ></maintain-dept-production-capacity-lin> </aui-dialog-box> <aui-row class="gridTopImportBtns"> <i class="hae-icon icon-setup" @click.stop="toolBoxShow = !toolBoxShow"> <div v-show="toolBoxShow"> <aui-fileupload round="true" size="small" :mini-mode="true" class='hae-btn' :op="importop">导入</aui-fileupload> <aui-button round="true" size="small" @click="dynamicExportClick">导出</aui-button> <aui-button round="true" size="small" @click="downloadFile" resetTime='5000'>导入模板下载</aui-button> </div> </i> </aui-row> </div> </template> <script> import { publicFun } from '../unit/js/public.js' import { Grid, Form, FormItem, Dropdown, Button, Hae, DialogBox, $ } from '@aurora/ui3' import moment from 'moment' import CapDeptLineCommand from '../unit/prodforecast/CapDeptLineCommand' import MaintainDeptProductionCapacityLin from '../prodforecast/MaintainDeptProductionCapacityLin' export default { components: { MaintainDeptProductionCapacityLin, AuiButton: Button, AuiGrid: Grid, AuiForm: Form, AuiFormItem: FormItem, AuiDropdown: Dropdown, AuiDialogBox: DialogBox, CapDeptLineCommand }, data() { let that = this return { isCommandEdit: this.$service.privilege.check('Service$linePlanInstructMaintainServiceImpl$save'), deptCode: '', workStation: '', prodSeriesCode: '', bucketStr: '', updateMap: [], // 新版是否显示更多条件 toolBoxShow: false, isShowMore: false, isTriangleIconShow: true, // 三角形图标显示 lineCommandVisible: false, initBucketStr: '', // 新版是否显示更多条件end MaintainDeptProductionCapacityLinDialog: { show: false }, dataForUpdate: [], searchForm: { prodSeriesCodeListStr: '', workSerctionListStr: '裸机', deptCodeStr: '', dateTime: '' }, // 产品系列 prodSeriesMainOp: { id: 'prodSeriesMainOp', multi: false, alwaysLoad: true, showClearBtn: true, editable: true, autoSelect: true, textField: 'prodSeriesEnName', valueField: 'prodSeriesCode', placeHolder: '-----请选择-----', dataset: { source: { type: 'post', url: 'services/linePlanFormulateService/getAllProdSeriesList' } }, emptyDataMsg: '-----没有数据-----' }, // 工序 workSerctionMainOp: { id: 'workSerctionMainOp', multi: false, showClearBtn: true, editable: true, validation: { required: true }, textField: 'key', valueField: 'value', placeHolder: '-----请选择-----', dataset: { source: { type: 'POST', url: 'services/linePlanFormulateService/getWorkStationList', data: { serviceType: '系统', serviceName: '架线计划制定', keyInfo: '工序' } } }, emptyDataMsg: '-----没有数据-----' }, // 交付部门 deptCodeMainOp: { id: 'deptCodeMainOp', multi: false, alwaysLoad: true, autoSelect: true, showClearBtn: true, editable: true, textField: 'deptName', valueField: 'deptCode', placeHolder: '-----请选择-----', dataset: { source: { type: 'post', url: 'services/linePlanFormulateService/getDeptList' } }, emptyDataMsg: '-----没有数据-----' }, // 时间 dateMainOp: { multi: true, id: 'dateMainOp', autoSelect: true, showClearBtn: true, editable: true, validation: { required: true }, emptyDataMsg: '-----没有数据-----', textField: 'key', valueField: 'value', placeHolder: '-----请选择-----', dataset: { source: { type: 'post', url: 'services/linePlanFormulateService/getDateList' } } }, // 表格的配置 createGridOp: { name: 'baseGrid_V241015', // name值,配置个性化customSetting/customized id: 'capDeptLinePlanGrid', showTip: true, tipOp: { type: 'normal' }, customized: false, // 是否打开隐藏列功能(动态列不能打开) allowFreeze: true, // 冻结选项 allowResize: true, allowSort: true, percentWidth: false, showStatus: false, showPager: true, // 展示分页 autoLoad: true, // 自动加载 showSeq: false, // 展示序号 cssName: 'text-center', rowRender: 'rowspan', editMode: true, columns: [], pagerOp: { mode: 'number', pageSizes: [5, 10, 15], pageVO: { curPage: 1, pageSize: 5 } }, dataset: { source: { type: 'post' } }, onRenderRow(tr, rowData, rowIdx) {}, onBeforeEdit(cellValue, rowData, td, col) { const regex = /f\d+/ if (regex.test(col.field)) { let typeCodeList = ['nowQty', 'piecemealReqLineQty'] if (!typeCodeList.includes(rowData.typeCode) || rowData.deptCode === 'TBD') { return false } } if (col.field === 'nowQty') { if (rowData.deptCode === 'TBD') { return false } else if (rowData.typeCode !== 'existingLineQty') { return false } } }, // 更新的操作,编辑完成后则执行的操作 onAfterEdit(value, rowData, td, col, oldValue) { let reg = /^(0|[1-9][0-9]*)$/ if (!reg.test(value) && value !== '') { Hae.topBox('请输入大于等于0的整数', 'warning', false, 2000) return false } let param = { prodSeriesCode: rowData.prodSeriesCode, deptCode: rowData.deptCode, workStation: rowData.workStation, qty: Number(value) } if (col.field === 'nowQty') { param.typeCode = 'nowQty' param.bucketValueStr = null } else { param.typeCode = rowData.typeCode param.bucketValueStr = col.header } const index = that.updateMap.findIndex( (item) => item.bucketValueStr === param.bucketValueStr && item.deptCode === param.deptCode && item.typeCode === param.typeCode && item.prodSeriesCode === param.prodSeriesCode ) if (index < 0) { that.updateMap.push(param) } else { that.updateMap[index].qty = param.qty } }, operation: { save: { onBeforeSave(ajax, optOp, grid) { Hae.ajax({ url: 'services/linePlanFormulateService/save', type: 'post', async: false, data: that.updateMap, dataType: 'text', success: function (result) { if (result === 'SUCCESS') { Hae.topBox('保存成功', 'successful', false, 2000) setTimeout(() => { that.formValid() }, 200) } else { Hae.topBox(result, 'error', false, 2000) } } }) return false } }, deptPlan: { id: 'deptPlan', text: '导入产能规划', onClick: this.searchToMaintain }, editLineCommand: { id: 'editLineCommand', text: this.$service.privilege.check('Service$linePlanInstructMaintainServiceImpl$save') ? '创建架线指令' : '查看架线指令', onClick: this.editLineCommand }, refresh: { id: 'refresh', text: '刷新预测需求线', onClick: this.refresh } }, onCellStyle(field, rowData) {}, // 组件渲染完成时执行的事件。 onRender(grid) {} } } }, created() {}, mounted() { let that = this // 注册全局单机事件隐藏导入按钮栏 document.addEventListener('click', (e) => { setTimeout(() => { if ($(e.target).hasClass('icon-setup') || $(e.target).hasClass('gridTopBtnDiv')) { return false } else { if (that.toolBoxShow) { that.toolBoxShow = false } } }, 300) }) // 判断是否有更多条件显示隐藏小三角 let editFormHeight = $('.first-field').outerHeight() that.isTriangleIconShow = !(editFormHeight < 38) that.isShowMore = false that.selectStartTime() that.MaintainDeptProductionCapacityLinDialog.show = false setTimeout(() => { that.formValid() }, 800) }, methods: { searchToMaintain() { this.MaintainDeptProductionCapacityLinDialog.show = true this.prodSeriesCode = this.searchForm.prodSeriesCodeListStr this.workStation = this.searchForm.workSerctionListStr this.deptCode = this.searchForm.deptCodeStr }, // 导出 dynamicExportClick() { let that = this let initExportData = { tableName: that.tableName } that.arrayList.forEach(res => { res[`${res.lineColumnName}`] = res.detail initExportData[`${res.lineColumnName}`] = res.detail }) Hae.ajax({ url: 'services/baseCommDetailService/export', data: initExportData, type: 'post', success(data) { Hae.confirm( '导出任务已开始,你可以进入[我的导入导出>导出查询]中查看任务状态并下载导出文件!', function(bool) { if (bool) { window.open('#/ListExport') } } ) } }) }, // 校验搜索 formValid() { let that = this Hae.validForm($('#editForm'), (result) => { if (result === false) { return false } else { that.getGirdMovingList() } }) }, selectStartTime() { let that = this Hae.ajax({ url: 'services/linePlanFormulateService/getDateList', type: 'post', async: false, data: {}, success: function (result) { if (result) { const currentDate = moment() // 获取当前日期 const monday = currentDate.day(1).startOf('day') // 获取周一的日期 const futureThreeWeeks = moment(monday).add(4, 'weeks') // 未来三周的日期 let dateTimeStr = '' let dateTimeArr = [] result.forEach((item) => { if ( (moment(item.value).isAfter(monday) && moment(item.value).isBefore(futureThreeWeeks)) || moment(item.value).isSame(monday) ) { dateTimeArr.push(item.value) } }) dateTimeStr = dateTimeArr.slice(0, 9).join(',') that.searchForm.dateTime = dateTimeStr } } }) }, // 编辑架线指令 editLineCommand() { let that = this if (!that.isCommandEdit) { this.lineCommand() return } let { widget } = that.$refs.grid let data = widget.getSelectedRecords() let selectData = data.filter((item) => { return item.deptCode !== 'ALL' }) // 架线指令初始化 if (selectData.length) { selectData.forEach((obj) => { obj.bucketStr = that.initBucketStr }) Hae.ajax({ url: 'services/linePlanInstructMaintainService/initLineTask', type: 'post', data: selectData, dataType: 'text', success() { that.lineCommand() } }) } else { that.lineCommand() } }, lineCommand() { this.deptCode = this.searchForm.deptCodeStr this.workStation = this.searchForm.workSerctionListStr this.prodSeriesCode = this.searchForm.prodSeriesCodeListStr this.bucketStr = this.searchForm.dateTime this.lineCommandVisible = true }, searchToMaintainClose() { this.MaintainDeptProductionCapacityLinDialog = true }, handleLineCommandClose() { this.lineCommandVisible = false }, deptPlandClose() { this.MaintainDeptProductionCapacityLinDialog.show = false }, refresh() { let that = this let searchForm = that.searchForm Hae.ajax({ url: 'services/linePlanFormulateService/refreshForecastRequireLine', type: 'post', data: searchForm, dataType: 'text', success(result) { if (result === 'SUCCESS') { Hae.topBox(result, 'successful', false, 2000) let gridWidger = that.$refs['grid'].widget publicFun.jumpFormerPage(gridWidger) } else { Hae.topBox(result, 'error', false, 2000) let gridWidger = that.$refs['grid'].widget publicFun.jumpFormerPage(gridWidger) } } }) }, getGirdMovingList() { let that = this let gridColumns = [] let param = {} param.deptCode = that.searchForm.deptCodeStr param.prodSeriesCode = that.searchForm.prodSeriesCodeListStr param.workStation = that.searchForm.workSerctionListStr param.bucketStr = that.searchForm.dateTime Hae.ajax({ url: 'services/linePlanFormulateService/getHeadBucketList', type: 'post', async: false, data: param, dataType: 'json', success(result) { that.isShowMore = false gridColumns = [ { multi: true, columnType: 'select' }, { field: 'prodSeriesEnName', headCss: 'text-center', cssName: 'text-center', width: '180px', header: '产品系列', showTip: 'true', rowspan: true, editable: false }, { field: 'deptName', headCss: 'text-center', cssName: 'text-center', width: '180px', header: '交付部门', showTip: 'true', rowspan: true, editable: false }, { field: 'nowQty', headCss: 'text-center', cssName: 'text-center', width: '130px', header: '现有线体', showTip: 'true', rowspan: true, editable: true }, { field: 'typeName', headCss: 'text-center', cssName: 'text-center', width: '180px', header: '维度', showTip: 'true', editable: false } ] if (result !== undefined) { const currentDate = moment() // 获取当前日期 const monday = currentDate.day(1).startOf('day') // 获取周一的日期 const currentWeekMonday = moment(monday) for (let i = 0; i < result.length; i++) { let date = result[i].value let field = result[i].key let newDate = moment(date) if (newDate.isAfter(currentWeekMonday) || newDate.isSame(currentWeekMonday)) { gridColumns.push({ field, header: date, headCss: 'text-center', cssName: 'text-center', editable: true }) } else { gridColumns.push({ field, header: date, headCss: 'text-center', cssName: 'text-center', editable: false }) } } that.initBucketStr = result.map((obj) => obj.value).join(',') } } }) let newCol = { columns: gridColumns, dataset: { source: { url: 'services/linePlanFormulateService/getLinePlanList/page/{{pageSize}}/{{curPage}}', data: param } } } that.updateMap = [] that.$refs.grid.widget.reInit(newCol) }, reset() { let that = this that.searchForm = { prodSeriesCodeListStr: '', workSerctionListStr: '裸机', deptCodeStr: '', dateTime: '' } that.selectStartTime() } } } </script> <style scoped src='./../unit/css/newModelPublic.css'/> <style scoped> .template-main { position: relative; } .gridTopImportBtns { width: 200px; position: absolute; top: 62px; left: 410px; z-index: 30; } .erp-config :deep(#capDeptLinePlanGrid .grid-body) { height: calc(100% - 48px); } .grid-head-config { height: 100%; } #capDeptLinePlanGrid { height: calc(100% - 120px); } .erp-config :deep(#capDeptLinePlanGrid .hae-grid-body) { height: 100%; } .erp-config { height: 100%; } .hae-dialog-box .hae-dialog__body { padding: 6px; } .erp-config :deep(.hae-dialog-box .hae-dialog__body) { text-align: initial; padding: 24px; color: #5a5e66; font-size: 14px; overflow: hidden; max-height: 95vh; } </style> 导出功能不起作用
10-30
【电力系统】单机无穷大电力系统短路故障暂态稳定Simulink仿真(带说明文档)内容概要:本文档围绕“单机无穷大电力系统短路故障暂态稳定Simulink仿真”展开,提供了完整的仿真模型与说明文档,重点研究电力系统在发生短路故障后的暂态稳定性问题。通过Simulink搭建单机无穷大系统模型,模拟不同类型的短路故障(如三相短路),分析系统在故障期间及切除后的动态响应,包括发电机转子角度、转速、电压和功率等关键参数的变化,进而评估系统的暂态稳定能力。该仿真有助于理解电力系统稳定性机理,掌握暂态过程分析方法。; 适合人群:电气工程及相关专业的本科生、研究生,以及从事电力系统分析、运行与控制工作的科研人员和工程师。; 使用场景及目标:①学习电力系统暂态稳定的基本概念与分析方法;②掌握利用Simulink进行电力系统建模与仿真的技能;③研究短路故障对系统稳定性的影响及提高稳定性的措施(如故障清除时间优化);④辅助课程设计、毕业设计或科研项目中的系统仿真验证。; 阅读建议:建议结合电力系统稳定性理论知识进行学习,先理解仿真模型各模块的功能与参数设置,再运行仿真并仔细分析输出结果,尝试改变故障类型或系统参数以观察其对稳定性的影响,从而深化对暂态稳定问题的理解。
本研究聚焦于运用MATLAB平台,将支持向量机(SVM)应用于数据预测任务,并引入粒子群优化(PSO)算法对模型的关键参数进行自动调优。该研究属于机器学习领域的典型实践,其核心在于利用SVM构建分类模型,同时借助PSO的全局搜索能力,高效确定SVM的最优超参数配置,从而显著增强模型的整体预测效能。 支持向量机作为一种经典的监督学习方法,其基本原理是通过在高维特征空间中构造一个具有最大间隔的决策边界,以实现对样本数据的分类或回归分析。该算法擅长处理小规模样本集、非线性关系以及高维度特征识别问题,其有效性源于通过核函数将原始数据映射至更高维的空间,使得原本复杂的分类问题变得线性可分。 粒子群优化算法是一种模拟鸟群社会行为的群体智能优化技术。在该算法框架下,每个潜在解被视作一个“粒子”,粒子群在解空间中协同搜索,通过不断迭代更新自身速度与位置,并参考个体历史最优解和群体全局最优解的信息,逐步逼近问题的最优解。在本应用中,PSO被专门用于搜寻SVM中影响模型性能的两个关键参数——正则化参数C与核函数参数γ的最优组合。 项目所提供的实现代码涵盖了从数据加载、预处理(如标准化处理)、基础SVM模型构建到PSO优化流程的完整步骤。优化过程会针对不同的核函数(例如线性核、多项式核及径向基函数核等)进行参数寻优,并系统评估优化前后模型性能的差异。性能对比通常基于准确率、精确率、召回率及F1分数等多项分类指标展开,从而定量验证PSO算法在提升SVM模型分类能力方面的实际效果。 本研究通过一个具体的MATLAB实现案例,旨在演示如何将全局优化算法与机器学习模型相结合,以解决模型参数选择这一关键问题。通过此实践,研究者不仅能够深入理解SVM的工作原理,还能掌握利用智能优化技术提升模型泛化性能的有效方法,这对于机器学习在实际问题中的应用具有重要的参考价值。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
function SEQEDTR_1B_Disp_FSE_SeqPara(I_lFSESeqParap:PGEIFSESeqPara; I_lTSC:integer):LongWord; begin try if I_lFSESeqParap=nil then begin Result:=$05701B01; Exit; end; with MAISeqEditorForm do begin TabSheetFSE.TabVisible:=True; FSE_TDT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t10); ESPEdit.Caption := Format('%1.1f',[I_lFSESeqParap^.fse_Gm4]); FSE_RefTE1_Edit.Caption :=Format('%1.1f',[I_lFSESeqParap^.fse_Gm1/500]); FSE_RefTE2_Edit.Caption :=Format('%1.1f',[I_lFSESeqParap^.fse_Gm2/500]); FSE_RefTE3_Edit.Caption :=Format('%1.1f',[I_lFSESeqParap^.fse_Gm3/500]); ComboBoxDW.ItemIndex := Round(I_lFSESeqParap^.fse_DwellTime); FSE_EffEcho_Edit.Text:= IntToStr(I_lFSESeqParap^.fse_EffEcho); FSE_subtype_Edit.Text:= IntToStr(I_lFSESeqParap^.fse_SubType); FSE_RFSh1_Edit.text := IntToStr(I_lFSESeqParap^.fse_RFShape1); //RF FSE_RFA1_Edit.text := Format('%1.2f',[I_lFSESeqParap^.fse_RFAtten1]); FSE_TRF1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_RFDuration1); FSE_RFSh2_Edit.text := IntToStr(I_lFSESeqParap^.fse_RFShape2); FSE_RFA2_Edit.text := Format('%1.2f',[I_lFSESeqParap^.fse_RFAtten2]); FSE_TRF2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_RFDuration2); CheckBoxSliceInterval.Checked := I_lFSESeqParap^.fse_InterBool; FSE_X2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFOVr); FSE_Yp_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFOVp); FSE_Z1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFovs); FSE_TrampEdit.Text := IntToStr(I_lFSESeqParap^.fse_Tramp); FSE_DscrdPntEdit.Text := IntToStr(I_lFSESeqParap^.fse_DiscardPnts); FSE_D1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t1);//Duration FSE_D2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t2); FSE_D3_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t3); FSE_D4_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t4); FSE_D5_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t5); //PreEmphasis EditPreEmphasisT.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisT); EditPreEmphasisS.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisS); EditPreEmphasisC.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisC); //read grad direction and Grad Sign(+/-) SEQEDTR_26_Disp_GradDir(@(I_lFSESeqParap^.fse_GradDir)); case I_lTSC of //C_SLICE_Transversal****************************************************** C_SLICE_Transversal://T begin FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGr2); FSE_XT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGr3); FSE_Z2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGs2); FSE_Z4_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGs3); FSE_ZT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGs4); FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Tt6); FSE_D1a_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Tt1a); end; //C_SLICE_Transversal****************************************************** //C_SLICE_Sagittal********************************************************* C_SLICE_Sagittal://S begin FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGr2); FSE_XT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGr3); FSE_Z2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGs2); FSE_Z4_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGs3); FSE_ZT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGs4); FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_St6); FSE_D1a_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_St1a); end; //C_SLICE_Sagittal********************************************************* //C_SLICE_Coronal********************************************************** C_SLICE_Coronal://C begin FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGr2); FSE_XT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGr3); FSE_Z2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGs2); FSE_Z4_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGs3); FSE_ZT_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGs4); FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Ct6); FSE_D1a_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Ct1a); end; //C_SLICE_Coronal********************************************************** end; CheckBoxFSEIsAr.Checked:= I_lFSESeqParap^.fse_IsFR<>0; FSE_DummyScanEdit.Text := IntToStr(I_lFSESeqParap^.fse_DummyScan); end; //with O_lFormp^ do Result:=0; except Result:=$05701B00; end; end;
11-21
你提供的函数 `SEQEDTR_1B_Disp_FSE_SeqPara` 是一个 **MRI 系统图形界面中用于显示 FSE(Fast Spin Echo)序列参数的 Delphi 函数**,它将底层结构体中的物理参数“映射”到 GUI 控件上,供工程师或调试人员查看。 --- ## ✅ 函数功能概述 ```pascal function SEQEDTR_1B_Disp_FSE_SeqPara( I_lFSESeqParap: PGEIFSESeqPara; // 输入:指向 FSE 序列参数结构体的指针 I_lTSC: Integer // 输入:切片方向类型(横断面/矢状面/冠状面) ): LongWord; // 返回值:0 表示成功,非零为错误码 ``` > **作用**:将 `PGEIFSESeqPara` 结构体中的字段值填充到名为 `MAISeqEditorForm` 的窗体控件中,实现参数可视化。 --- ## 🔍 逐段代码解析与说明 ### 1. 参数校验 ```pascal if I_lFSESeqParap = nil then begin Result := $05701B01; Exit; end; ``` - 安全检查:防止空指针访问。 - 错误码 `$05701B01` 含义:输入参数为空。 --- ### 2. 使用 `with MAISeqEditorForm do` 简化控件引用 ```pascal with MAISeqEditorForm do begin TabSheetFSE.TabVisible := True; ... end; ``` - 所有后续对 `FSE_X1_Edit`, `CheckBoxSliceInterval` 等控件的操作都属于 `MAISeqEditorForm` 对象。 - 提高可读性,避免重复写 `MAISeqEditorForm.` 前缀。 --- ### 3. 基本参数显示 | 控件 | 来源字段 | 单位/说明 | |------|--------|----------| | `FSE_TDT_Edit.Text` | `fse_t10` | TR 时间?需结合上下文确认 | | `ESPEdit.Caption` | `fse_Gm4` | 回波间距(Echo Spacing),单位 ms | | `FSE_RefTE1_Edit` ~ `FSE_RefTE3_Edit` | `fse_Gm1..3 / 500` | 实际 TE 分量,除以 500 可能是时间缩放因子 | 📌 注意: ```pascal Format('%1.1f',[I_lFSESeqParap^.fse_Gm1/500]) ``` 表示将整数型 `Gm1` 转换为秒级时间(如 `Gm1=50000 → 100.0ms`),说明原始数据可能是微秒或任意内部单位。 --- ### 4. 采样与回波设置 | 控件 | 字段 | 说明 | |------|------|------| | `ComboBoxDW.ItemIndex` | `fse_DwellTime` | 采样点驻留时间索引(可能对应带宽) | | `FSE_EffEcho_Edit.Text` | `fse_EffEcho` | 有效回波数(ETL, Echo Train Length) | | `FSE_subtype_Edit.Text` | `fse_SubType` | 子类型标志(如是否脂肪抑制、运动补偿等) | --- ### 5. 射频脉冲参数(90° 和 180°) #### 90° 激发脉冲(RF1) | 控件 | 字段 | 说明 | |------|------|------| | `FSE_RFSh1_Edit.text` | `fse_RFShape1` | RF 波形形状 ID(如 1=Sinc, 2=Gaussian) | | `FSE_RFA1_Edit.text` | `fse_RFAtten1` | RF 幅度衰减(dB 或相对强度) | | `FSE_TRF1_Edit.Text` | `fse_RFDuration1` | 脉冲持续时间(μs 或 ms) | #### 180° 重聚脉冲(RF2) | 控件 | 字段 | 说明 | |------|------|------| | `FSE_RFSh2_Edit.text` | `fse_RFShape2` | 180° 脉冲波形 | | `FSE_RFA2_Edit.text` | `fse_RFAtten2` | 幅度控制 | | `FSE_TRF2_Edit.Text` | `fse_RFDuration2` | 持续时间通常比 90° 长 | 💡 这些参数直接影响 SAR(比吸收率)和图像对比度。 --- ### 6. 切片间隔与几何参数 ```pascal CheckBoxSliceInterval.Checked := I_lFSESeqParap^.fse_InterBool; ``` - 是否启用切片间隔(gap)模式。 ```pascal FSE_X2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFOVr); // Read FOV ratio? FSE_Yp_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFOVp); // Phase FOV FSE_Z1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_GFovs); // Slice FOV? ``` - 可能是各方向 FOV 缩放比例(0.5~1.0),用于 partial FOV 设置。 --- ### 7. 梯度爬升时间与丢弃点 ```pascal FSE_TrampEdit.Text := IntToStr(I_lFSESeqParap^.fse_Tramp); FSE_DscrdPntEdit.Text := IntToStr(I_lFSESeqParap^.fse_DiscardPnts); ``` - `Tramp`: 梯度上升时间(μs),影响最小 TE - `DiscardPnts`: ADC 前丢弃的采样点数(去伪影) --- ### 8. 关键时间段 D1 ~ D5 ```pascal FSE_D1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t1); ... FSE_D5_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_t5); ``` 这些是 **FSE 脉冲时序的关键定时参数**: | 符号 | 推测含义 | |------|---------| | `t1` | 90° 脉冲开始到选层梯度结束 | | `t2` | 90° 到第一个 180° 的延迟 ≈ TE/2 | | `t3` | 180° 脉冲宽度 | | `t4` | 读出梯度预相位 | | `t5` | ADC 采集窗口长度 | > ⚠️ 实际命名可能因厂商而异,但整体构成一个完整的 timing diagram。 --- ### 9. 预加重(Pre-emphasis)参数 ```pascal EditPreEmphasisT.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisT); EditPreEmphasisS.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisS); EditPreEmphasisC.Text := IntToStr(I_lFSESeqParap^.fse_PreEmphasisC); ``` - **Pre-emphasis**: 在梯度跳变瞬间叠加短暂高压信号,用以补偿涡流引起的磁场延迟。 - T/X/Y/Z/S/C 分别代表不同轴向(Transverse, Sagittal, Coronal)或通道。 --- ### 10. 梯度方向显示 ```pascal SEQEDTR_26_Disp_GradDir(@(I_lFSESeqParap^.fse_GradDir)); ``` - 调用另一个函数显示梯度逻辑方向(哪个物理轴是 read, phase, slice)。 - `fse_GradDir` 是一个子结构体,包含方向编码信息。 --- ### 11. 不同切片方向下的梯度/时间参数分支 使用 `case I_lTSC of` 区分三种正交平面: #### 📌 横断面(Transverse, C_SLICE_Transversal) ```pascal FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGr2); FSE_Z2_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_TGs2); ... FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Tt6); ``` #### 📌 矢状面(Sagittal, C_SLICE_Sagittal) ```pascal FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_SGr2); ... FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_St6); ``` #### 📌 冠状面(Coronal, C_SLICE_Coronal) ```pascal FSE_X1_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_CGr2); ... FSE_D6_Edit.Text := FloatToStr(I_lFSESeqParap^.fse_Ct6); ``` 🔍 观察规律: - 每个方向都有独立的梯度幅度(`Gr2`, `Gr3`, `Gs2`, `Gs3`, `Gs4`)和时间参数(`t6`, `t1a`) - 命名规则:`[方向首字母][参数名]` → 如 `TGr2` = Transverse Gradient r2 💡 这是因为不同方向的梯度负载不同(涡流效应差异),需分别优化参数。 --- ### 12. 其他高级功能开关 ```pascal CheckBoxFSEIsAr.Checked := I_lFSESeqParap^.fse_IsFR <> 0; ``` - `fse_IsFR`: 可能表示 “Field-of-view Reordering” 或 “Frequency Reuse”,即角度重建(ARC)技术,用于减少 aliasing。 ```pascal FSE_DummyScanEdit.Text := IntToStr(I_lFSESeqParap^.fse_DummyScan); ``` - Dummy Scan 数量:用于让磁化达到稳态后再正式采集。 --- ## 🧱 结构体推测(TGEIFSESeqPara) 虽然未给出定义,但我们可以通过字段前缀反推其大致结构: ```pascal TGEIFSESeqPara = packed record // Timing & Echo fse_t10: Single; // TR? fse_Gm1, fse_Gm2, fse_Gm3: Integer; // TE 相关时间片段 fse_Gm4: Single; // ESP (echo spacing) // Echo Train fse_EffEcho: Integer; // ETL fse_DwellTime: Single; // Dwell time index // RF Pulses fse_RFShape1, fse_RFShape2: Integer; fse_RFAtten1, fse_RFAtten2: Single; fse_RFDuration1, fse_RFDuration2: Single; // Geometry fse_GFOVr, fse_GFOVp, fse_GFovs: Single; // FOV ratios fse_Tramp: Integer; // Gradient ramp time (us) fse_DiscardPnts: Integer; // ADC discard points // Duration times fse_t1, fse_t2, fse_t3, fse_t4, fse_t5: Single; // Pre-emphasis fse_PreEmphasisT, fse_PreEmphasisS, fse_PreEmphasisC: Integer; // Gradient direction fse_GradDir: TGEIGradDir; // Plane-specific parameters // Transverse fse_TGr2, fse_TGr3: Single; fse_TGs2, fse_TGs3, fse_TGs4: Single; fse_Tt6, fse_Tt1a: Single; // Sagittal fse_SGr2, fse_SGr3: Single; fse_SGs2, fse_SGs3, fse_SGs4: Single; fse_St6, fse_St1a: Single; // Coronal fse_CGr2, fse_CGr3: Single; fse_CGs2, fse_CGs3, fse_CGs4: Single; fse_Ct6, fse_Ct1a: Single; // Flags fse_IsFR: Integer; // Angle Reconstruction enable fse_DummyScan: Integer; // Number of dummy scans fse_InterBool: Integer; // Slice interval enabled fse_SubType: Integer; // Sequence subtype end; ``` --- ## ✅ 总结:这个函数的意义 `SEQEDTR_1B_Disp_FSE_SeqPara` 是 MRI 开发调试工具链中的 **关键可视化组件**,它的作用是: - 将二进制化的序列参数“解码”为人可读的形式 - 支持跨切片方向的参数展示(T/S/C) - 集成预加重、梯度方向、dummy scan 等高级设置 - 便于 QA 工程师验证序列生成正确性 它是连接 **算法计算模块** 与 **操作员界面** 的桥梁。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值