Compare commits

...

14 Commits

15 changed files with 182 additions and 36 deletions
+1 -1
View File
@@ -179,7 +179,7 @@
{{ props.rowData.name }}
</template>
<template slot="parameter_set" slot-scope="props">
{{ getWorkingMode(props.rowData.device.library_name, props.rowData.parameter_set.MODE) }}
{{ (props.rowData.type==='folder') ? '' : getWorkingMode(props.rowData.device.library_name, props.rowData.parameter_set.MODE) }}
</template>
<template slot="created_at" slot-scope="props">
{{transDate(props.rowData.created_at)}}
@@ -89,8 +89,14 @@ export default {
resetParameter: function (mode) {
// get Device
this.device = this.getDeviceProject(this.deviceSelectKey)
console.log('this.device', this.device)
// get Config
this.config = configTable.getConfig(this.device.library.value)
if (typeof this.device.library === 'string') { // string
this.config = configTable.getConfig(this.device.library)
} else { // object
this.config = configTable.getConfig(this.device.library.value)
}
console.log('this.config', this.config)
// create default parameter
const defaultValue = {}
for (const key in this.config) {
@@ -505,7 +505,7 @@ export default {
// },
// {
// id: 11,
// description: 'Cali ADC - test',
// description: 'Cali Mode - test',
// },
// {
// id: 12,
@@ -576,6 +576,10 @@ export default {
value: 1,
label: 'Vin',
},
{
value: 2,
label: 'Vout'
},
],
startVoltNumber: null,
stopVoltNumber: null,
@@ -36,13 +36,13 @@
{{ task.name }}
</td>
<td align="center">
<va-button :flat="true" @click="openConfig(1, taskIndex)" small>Add device</va-button>
<va-button :flat="true" @click="openConfig(1, taskIndex)" small>Add Device</va-button>
</td>
<td align="center">
<va-button :flat="true" @click="openConfig(3, taskIndex)" small>Add event</va-button>
<va-button :flat="true" @click="openConfig(3, taskIndex)" small>+ New Action/Condition</va-button>
</td>
<td align="center">
<va-button :flat="true" @click="openConfig(4, taskIndex)" small>Add parameter</va-button>
<va-button :flat="true" @click="openConfig(4, taskIndex)" small>Add Parameter</va-button>
</td>
<td align="center">
<va-icon class="fa fa-close" @click.native="() => deleteTask({ index: taskIndex})"></va-icon>
@@ -98,21 +98,21 @@
<div v-for="conditionKey in action.condition" :key="conditionKey">
<div small>
{{ action.type }} {{ task.condition[conditionKey].type }} {{ task.condition[conditionKey].value }}
<va-icon class="fa fa-close" @click.native="delAction(action, conditionKey)"/>
<va-icon class="fa fa-close" @click.native="delAction(task, actionKey, conditionKey)"/>
</div>
<va-button :flat="true" @click="openConfig(3, taskIndex, deviceUUID)" small>
+ New Action/Condition
</va-button>
</div>
</div>
</div>
<va-button :flat="true" @click="openConfig(3, taskIndex, deviceUUID)" small>
+ New Action/Condition
</va-button>
</div>
</td>
<!-- action end -->
<td align="center">
<div v-if="Object.keys(task.parameter_set).length === 0">
<va-button :flat="true" @click="openConfig(4, taskIndex, deviceUUID)" small>
Add parameter
Add Parameter
</va-button>
</div>
<va-button :flat="true" @click="openConfig(4, taskIndex, deviceUUID)" v-else class="flex d-flex">
@@ -191,19 +191,28 @@ export default {
}
},
methods: {
delAction: function (action, conditionKey) {
// console.log(action.condition)
console.log(action.condition)
delAction: function (task, actionKey, conditionKey) {
// console.log(action)
// console.log(conditionKey)
// console.log(action.condition[0])
// console.log(action.condition.length)
for (let i = 0; i < action.condition.length; i++) {
if (String(action.condition[i]) === String(conditionKey)) {
delete action.condition[i]
break
}
}
console.log(action.condition)
// for (let i = 0; i < action.condition.length; i++) {
// if (String(action.condition[i]) === String(conditionKey)) {
// delete action.condition[i]
// break
// }
// }
const _action = JSON.parse(JSON.stringify(task.action))
const _condition = JSON.parse(JSON.stringify(task.condition))
// console.log(Object.keys(_task.action))
delete _action[actionKey]
delete _condition[conditionKey]
// delete _task.action[actionKey]
// delete _task.condition[conditionKey]
// console.log(Object.keys(_task.action))
task.action = _action
task.condition = _condition
console.log('task', task)
// delete action.condition[0]
},
switchInput: function (tag, index) {
@@ -94,15 +94,21 @@ export default {
// set name, sourceIndex in data.series
_newChannel.name = this.data.gridSource[gridIndex][channelIndex].name
_newChannel.seriesSource = this.data.series.findIndex((ele) => ele.name === _newChannel.name)
// add device mode condition
const device = this.deviceListNew.find(ele => String(ele.memory_board) === String(this.chartData[this.chartID].mappingID))
let mode = -1
if (device !== undefined) mode = device.configuration.MODE
// set x-axis
_newChannel.xValue = 0
_newChannel.xUnit = _xAxis.default.defaultUnit
_newChannel.xUnit = (typeof _xAxis.default.defaultUnit === 'function') ? _xAxis.default.defaultUnit(mode) : _xAxis.default.defaultUnit
_newChannel.xScale = _xAxis.default.unit
_newChannel.xUnitOption = Object.keys(_xAxis.default.unit)
_newChannel.xName = _xAxis.default.name
// set y-axis
_newChannel.yValue = 0
_newChannel.yUnit = _yAxis.default.defaultUnit
_newChannel.yUnit = (typeof _yAxis.default.defaultUnit === 'function') ? _yAxis.default.defaultUnit(mode) : _yAxis.default.defaultUnit
_newChannel.yScale = _yAxis.default.unit
_newChannel.yUnitOption = Object.keys(_yAxis.default.unit)
_newChannel.yName = _yAxis.default.name
@@ -57,7 +57,7 @@ const chartTable = {
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
defaultUnit: (Mode) => { return (Mode === 10 || Mode === 11) ? 'nA' : 'mA' },
downloadUnit: 'mA',
},
// Q = ∫ I dt
@@ -152,7 +152,7 @@ const chartTable = {
mA: 1e6,
A: 1e9,
},
defaultUnit: 'mA',
defaultUnit: (Mode) => { return (Mode === 10 || Mode === 11) ? 'nA' : 'mA' },
downloadUnit: 'mA',
},
// Gm = dI/dV
@@ -81,6 +81,7 @@
:parameterName="name"
:inputValue="parameter[name]"
:disable="name === 'CTRL_HIGH_Z_15' && device && device.status === 0"
:syncParameter="parameterTable[name].syncParameter"
v-bind="parameterTable[name]"
@parameterChange="parameterChange"
@getParameter="getParameter"
@@ -75,6 +75,10 @@ export default {
type: Boolean,
default: false,
},
syncParameter: {
type: Object,
default: () => {},
},
},
created () {
},
@@ -87,6 +91,13 @@ export default {
methods: {
buttonSelectChange (value) {
this.$emit('parameterChange', this.parameterName, value)
this.syncParameter && Object.keys(this.syncParameter).forEach(element => {
if (String(element) === String(value)) {
this.syncParameter[value].forEach(element => {
this.$emit('parameterChange', element[0], element[1])
})
}
})
},
},
async mounted () {
+5 -4
View File
@@ -1,7 +1,8 @@
export default {
name: 'Cali ADC - test',
parameter: ['DAC_VOLT', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'ADC_DAC_CHANNEL_15'], // 這個mode用到的參數
showParameter: ['DAC_VOLT', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'ADC_DAC_CHANNEL_15'], // 有要秀給user看的參數
name: 'Cali Mode - test',
parameter: ['ADC_DAC_CHANNEL_15', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'DAC_LEVEL_V_OUT_15', 'DAC_VOLT_BUTTON'], // 這個mode用到的參數
showParameter: ['ADC_DAC_CHANNEL_15', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'DAC_LEVEL_V_OUT_15', 'DAC_VOLT_BUTTON'], // 有要秀給user看的參數
headerParameter: () => ['ADC_DAC_CHANNEL_15', 'ADC_LEVEL_I_15', 'ADC_LEVEL_V_IN_15', 'DAC_LEVEL_V_OUT_15', 'DAC_VOLT_BUTTON'], // export header的參數
valScales: {
linear: {
func: (val) => {
@@ -52,7 +53,7 @@ export default {
charts: {
default: [
{
name: 'Cali ADC - test',
name: 'Cali Mode - test',
description: '',
subplot: [
{
+71 -4
View File
@@ -162,17 +162,24 @@ const EliteZM15 = {
options: [
{ value: 0, label: 'Iin' },
{ value: 1, label: 'Vin' },
{ value: 2, label: 'Vout' },
],
range: ['Iin', 'Vin'],
range: ['Iin', 'Vin', 'Vout'],
defaultValue: 0,
outputRawData: (val) => {
const caliChannelArr = ['Iin', 'Vin']
const caliChannelArr = ['Iin', 'Vin', 'Vout']
return caliChannelArr.indexOf(val.toString())
},
outputReadabilityData: (idx) => {
const caliChannelArr = ['Iin', 'Vin']
const caliChannelArr = ['Iin', 'Vin', 'Vout']
return caliChannelArr[parseInt(idx)]
},
syncParameter: {
0: [['ADC_LEVEL_V_IN_15', 3], ['ADC_LEVEL_I_15', 0], ['DAC_LEVEL_V_OUT_15', 2]],
1: [['ADC_LEVEL_V_IN_15', 0], ['ADC_LEVEL_I_15', 0], ['DAC_LEVEL_V_OUT_15', 2]],
2: [['ADC_LEVEL_V_IN_15', 3], ['ADC_LEVEL_I_15', 4], ['DAC_LEVEL_V_OUT_15', 0]],
},
},
VOLT_ORIGIN: {
type: 'number',
@@ -255,6 +262,26 @@ const EliteZM15 = {
},
downloadUnit: 's',
},
DAC_LEVEL_V_OUT_15: {
type: 'array',
showName: 'DAC range',
componentType: 'input-button-toggle',
options: [
{ value: 0, label: '0' },
{ value: 1, label: '1' },
{ value: 2, label: 'Auto' },
],
range: ['0', '1', 'Auto'],
defaultValue: 2,
outputRawData: (val) => {
const caliChannelArr = ['0', '1', 'Auto']
return caliChannelArr.indexOf(val.toString())
},
outputReadabilityData: (idx) => {
const caliChannelArr = ['0', '1', 'Auto']
return caliChannelArr[parseInt(idx)]
},
},
DAC_VOLT: {
type: 'number',
showName: 'Volt out',
@@ -274,6 +301,46 @@ const EliteZM15 = {
return parseInt((parseFloat(val) - 25000) / 5) / scale
},
},
DAC_VOLT_SCROLL: {
type: 'number',
showName: 'DAC code',
componentType: 'input-range',
range: Object.freeze({ min: 0, max: 60000 }),
defaultValue: 25000,
defaultUnit: '',
downloadUnit: 'mV',
unit: {
mV: 1,
V: 1e3,
},
outputRawData: (val, scale = 1) => {
return parseInt(parseFloat(val))
},
outputReadabilityData: (val, scale = 0) => {
return parseInt(parseFloat(val))
},
},
DAC_VOLT_BUTTON: {
type: 'array',
showName: 'DAC code',
componentType: 'input-button-toggle',
options: [
{ value: 0, label: '10000' },
{ value: 1, label: '25000' },
{ value: 2, label: '50000' },
{ value: 3, label: '60000' },
],
range: ['10000', '25000', '50000', '60000'],
defaultValue: 1,
outputRawData: (val) => {
const caliChannelArr = ['10000', '25000', '50000', '60000']
return caliChannelArr.indexOf(val.toString())
},
outputReadabilityData: (idx) => {
const caliChannelArr = ['10000', '25000', '50000', '60000']
return caliChannelArr[parseInt(idx)]
},
},
SAMPLE_RATE: {
type: 'number',
componentType: 'input-range',
@@ -981,7 +1048,7 @@ const EliteZM15 = {
},
{
id: 11,
description: 'Cali ADC - test',
description: 'Cali Mode - test',
img_src: 'CADC-Wire',
},
],
+39
View File
@@ -4,6 +4,24 @@ import DevMode from './DevMode'
import Chronoamperometry from './Chronoamperometry'
const EliteEIS = {
VOLT_VSCAN: {
type: 'number',
showName: 'Volt (v.s. ref)',
componentType: 'input-range',
range: Object.freeze({ min: 2500, max: 50000 }),
outputRawData: (val, scale = 1) => {
return parseInt(parseFloat(val) * scale * 12.5 + 25000)
},
outputReadabilityData: (val, scale = 1) => {
return parseInt((parseFloat(val) - 25000) / 12.5) / scale
},
defaultUnit: 'V',
downloadUnit: 'mV',
unit: {
mV: 1,
V: 1e3,
},
},
ADC_VALUE_I: {
type: 'none',
showName: 'Instruction',
@@ -227,6 +245,27 @@ const EliteEIS = {
return voltageInRangeArr[parseInt(idx)]
},
},
TIME_DURATION: {
type: 'number',
showName: 'Time duration',
componentType: 'input-range',
range: Object.freeze({ min: 0, max: 86400 }), // UI上能輸入的最大最小值
defaultValue: 0,
defaultUnit: 's',
downloadUnit: 's',
unit: {
ms: 1e-3,
s: 1,
m: 60,
h: 3600,
},
outputRawData: (val) => {
return parseInt(parseFloat(val))
},
outputReadabilityData: (val) => {
return parseInt(parseFloat(val))
},
},
CTRL_HIGH_Z_15: {
type: 'array',
showName: 'HighZ',
+2 -1
View File
@@ -47,7 +47,8 @@ const getDefaultChartTypeByMode = (mode, lib) => {
const settings = {}
settings[0] = ['EliteEIS', 6, 'EliteEIS', 5]
settings[1] = ['Elite', 2, 'Elite', 1]
settings[2] = ['Time', 2, 'Elite', 2]
settings[2] = ['Time', 2, 'Elite', 1]
settings[3] = ['Time', 2, 'Elite', 2]
return settings[mode]
} else if (lib === 'Elite_TRI') {
// const settings = {}
@@ -61,7 +61,7 @@ function newAction () {
},
{
id: 11,
description: 'Cali ADC - test',
description: 'Cali Mode - test',
select: false,
},
{
@@ -54,7 +54,7 @@ function newEliteZm15Parameter () {
// },
// {
// id: 11,
// description: 'Cali ADC - test',
// description: 'Cali Mode - test',
// },
// {
// id: 12,
@@ -80,6 +80,7 @@ const projectActs = {
await api.project.update(project.id, { deleted: true })
await api.project.del()
state.projectList.splice(index, 1)
state.projectSelectIndex = -1
return true
},