diff --git a/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js b/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js index c75a9e249..da9f6cd70 100644 --- a/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js +++ b/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js @@ -202,7 +202,7 @@ const ComponentParameters = { MODEL: '', VALUE_UNIT: 'H', IC: '0', - DTEMP:'27', + DTEMP: '27' }, M: { @@ -215,7 +215,7 @@ const ComponentParameters = { EXTRA_EXPRESSION: '', MULTIPLICITY_PARAMETER: '1', MODEL: '.model mymosfet NMOS', - DTEMP:'27', + DTEMP: '27' }, Q: { @@ -225,9 +225,9 @@ const ComponentParameters = { N2: '', N3: '', EXTRA_EXPRESSION: '', - MODEL: '.model mybjt PNP', + MODEL: '.model mybjt PNP', MULTIPLICITY_PARAMETER: '1', - DTEMP:'27', + DTEMP: '27' }, V: { @@ -342,10 +342,10 @@ const ComponentParameters = { EXTRA_EXPRESSION: '', MODEL: '', VALUE_UNIT: 'Ohm', - SHEET_RESISTANCE:'0', - FIRST_ORDER_TEMPERATURE_COEFF:'0', - SECOND_ORDER_TEMPERATURE_COEFF:'0', - PARAMETER_MEASUREMENT_TEMPERATURE:'27', + SHEET_RESISTANCE: '0', + FIRST_ORDER_TEMPERATURE_COEFF: '0', + SECOND_ORDER_TEMPERATURE_COEFF: '0', + PARAMETER_MEASUREMENT_TEMPERATURE: '27' }, Z: { @@ -389,8 +389,7 @@ const ComponentParameters = { MODEL: '', VALUE: '1', EXTRA_EXPRESSION: '' - }, - + } } diff --git a/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js b/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js index 7523082b5..ddbbb56fc 100644 --- a/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js +++ b/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js @@ -97,18 +97,17 @@ export default function SchematicToolbar ({ mobileClose, gridRef }) { const handleClickOpen = () => { var compNetlist = GenerateNetList() - var printToPlotControlBlock ="" + var printToPlotControlBlock = '' var ctrlblk = netfile.controlBlock.split('\n') for (var line = 0; line < ctrlblk.length; line++) { - if (ctrlblk[line].includes('print')) { - printToPlotControlBlock += 'plot ' - var cleanCode= ctrlblk[line].split('print ')[1] - cleanCode = cleanCode.split('>')[0] - printToPlotControlBlock += cleanCode + '\n' - } - else{ - printToPlotControlBlock += ctrlblk[line] + '\n' - } + if (ctrlblk[line].includes('print')) { + printToPlotControlBlock += 'plot ' + var cleanCode = ctrlblk[line].split('print ')[1] + cleanCode = cleanCode.split('>')[0] + printToPlotControlBlock += cleanCode + '\n' + } else { + printToPlotControlBlock += ctrlblk[line] + '\n' + } } var netlist = netfile.title + '\n\n' + compNetlist.models + '\n' + diff --git a/eda-frontend/src/components/SchematicEditor/SimulationProperties.js b/eda-frontend/src/components/SchematicEditor/SimulationProperties.js index 86e2711b1..361f2d610 100644 --- a/eda-frontend/src/components/SchematicEditor/SimulationProperties.js +++ b/eda-frontend/src/components/SchematicEditor/SimulationProperties.js @@ -84,7 +84,7 @@ export default function SimulationProperties () { const [tfAnalysisControlLine, setTfAnalysisControlLine] = useState({ outputNodes: false, outputVoltageSource: '', - inputVoltageSource: '', + inputVoltageSource: '' }) const [controlBlockParam, setControlBlockParam] = useState('') @@ -92,14 +92,14 @@ export default function SimulationProperties () { const handleControlBlockParam = (evt) => { setControlBlockParam(evt.target.value) } - var analysisNodeArray = [], analysisCompArray = [], nodeArray=[] + var analysisNodeArray = []; var analysisCompArray = []; var nodeArray = [] const pushZero = (nodeArray) => { - nodeArray.push({key:0}) + nodeArray.push({ key: 0 }) } const onDcSweepTabExpand = () => { try { - setComponentsList(['', ...GenerateCompList()]) - setNodeList(['', ...GenerateNodeList()]) + setComponentsList(['', ...GenerateCompList()]) + setNodeList(['', ...GenerateNodeList()]) } catch (err) { setComponentsList([]) setNodeList([]) @@ -108,19 +108,19 @@ export default function SimulationProperties () { } const onTransientAnalysisTabExpand = () => { try { - setComponentsList(['', ...GenerateCompList()]) - setNodeList(['', ...GenerateNodeList()]) + setComponentsList(['', ...GenerateCompList()]) + setNodeList(['', ...GenerateNodeList()]) } catch (err) { setComponentsList([]) setNodeList([]) alert('Circuit not complete. Please Check Connectons.') } - } + } const onTFTabExpand = () => { try { - setComponentsList(['', ...GenerateCompList()]) - setNodeList(['', ...GenerateNodeList()]) + setComponentsList(['', ...GenerateCompList()]) + setNodeList(['', ...GenerateNodeList()]) } catch (err) { setComponentsList([]) setNodeList([]) @@ -171,7 +171,7 @@ export default function SimulationProperties () { }) } const handleTfAnalysisControlLineNodes = (evt) => { - const value = evt.target.checked + const value = evt.target.checked setTfAnalysisControlLine({ ...tfAnalysisControlLine, [evt.target.id]: value @@ -208,115 +208,115 @@ export default function SimulationProperties () { const handleAddSelectedValueDCSweep = (data) => { var f = 0 - selectedValueDCSweep.forEach((value, i) =>{ - if(value[i] !== undefined){ - if(value[i].key === data) f = 1 - } - }) - if(f === 0){ - let tmp = [...selectedValueDCSweep, data] - setSelectedValueDCSweep(tmp) - } - // console.log(selectedValue) + selectedValueDCSweep.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key === data) f = 1 + } + }) + if (f === 0) { + const tmp = [...selectedValueDCSweep, data] + setSelectedValueDCSweep(tmp) + } + // console.log(selectedValue) } const handleRemSelectedValueDCSweep = (data) => { const tmp = [] - selectedValueDCSweep.forEach((value,i) =>{ - if(value[i] !== undefined){ - if( value[i].key !== data) tmp.push(data) - } + selectedValueDCSweep.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key !== data) tmp.push(data) + } }) selectedValueDCSweep = tmp // console.log(selectedValue) } const handleAddSelectedValueTransientAnal = (data) => { var f = 0 - selectedValueTransientAnal.forEach((value, i) =>{ - if(value[i] !== undefined){ - if(value[i].key === data) f = 1 - } - }) - if(f === 0){ - let tmp = [...selectedValueTransientAnal, data] - setSelectedValueTransientAnal(tmp) - } - // console.log(selectedValue) + selectedValueTransientAnal.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key === data) f = 1 + } + }) + if (f === 0) { + const tmp = [...selectedValueTransientAnal, data] + setSelectedValueTransientAnal(tmp) + } + // console.log(selectedValue) } const handleRemSelectedValueTransientAnal = (data) => { const tmp = [] - selectedValueTransientAnal.forEach((value,i) =>{ - if(value[i] !== undefined){ - if( value[i].key !== data) tmp.push(data) - } + selectedValueTransientAnal.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key !== data) tmp.push(data) + } }) selectedValueTransientAnal = tmp // console.log(selectedValue) } const handleAddSelectedValueTFAnal = (data) => { var f = 0 - selectedValueTFAnal.forEach((value, i) =>{ - if(value[i] !== undefined){ - if(value[i].key === data) f = 1 - } - }) - if(f === 0){ - let tmp = [...selectedValueTFAnal, data] - setSelectedValueTFAnal(tmp) - } - // console.log(selectedValue) + selectedValueTFAnal.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key === data) f = 1 + } + }) + if (f === 0) { + const tmp = [...selectedValueTFAnal, data] + setSelectedValueTFAnal(tmp) + } + // console.log(selectedValue) } const handleRemSelectedValueTFAnal = (data) => { const tmp = [] - selectedValueTFAnal.forEach((value,i) =>{ - if(value[i] !== undefined){ - if( value[i].key !== data) tmp.push(data) - } + selectedValueTFAnal.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key !== data) tmp.push(data) + } }) selectedValueTFAnal = tmp // console.log(selectedValue) } const handleAddSelectedValueDCSweepComp = (data) => { var f = 0 - selectedValueDCSweepComp.forEach((value, i) =>{ - if(value[i] !== undefined){ - if(value[i].key === data) f = 1 - } - }) - if(f === 0){ - let tmp = [...selectedValueDCSweepComp, data] - setSelectedValueDCSweepComp(tmp) - } - // console.log(selectedValue) + selectedValueDCSweepComp.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key === data) f = 1 + } + }) + if (f === 0) { + const tmp = [...selectedValueDCSweepComp, data] + setSelectedValueDCSweepComp(tmp) + } + // console.log(selectedValue) } const handleRemSelectedValueDCSweepComp = (data) => { const tmp = [] - selectedValueDCSweepComp.forEach((value,i) =>{ - if(value[i] !== undefined){ - if( value[i].key !== data) tmp.push(data) - } + selectedValueDCSweepComp.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key !== data) tmp.push(data) + } }) selectedValueDCSweepComp = tmp // console.log(selectedValue) } const handleAddSelectedValueTransientAnalComp = (data) => { var f = 0 - selectedValueTransientAnalComp.forEach((value, i) =>{ - if(value[i] !== undefined){ - if(value[i].key === data) f = 1 - } - }) - if(f === 0){ - let tmp = [...selectedValueTransientAnalComp, data] - setSelectedValueTransientAnalComp(tmp) - } - // console.log(selectedValue) + selectedValueTransientAnalComp.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key === data) f = 1 + } + }) + if (f === 0) { + const tmp = [...selectedValueTransientAnalComp, data] + setSelectedValueTransientAnalComp(tmp) + } + // console.log(selectedValue) } const handleRemSelectedValueTransientAnalComp = (data) => { const tmp = [] - selectedValueTransientAnalComp.forEach((value,i) =>{ - if(value[i] !== undefined){ - if( value[i].key !== data) tmp.push(data) - } + selectedValueTransientAnalComp.forEach((value, i) => { + if (value[i] !== undefined) { + if (value[i].key !== data) tmp.push(data) + } }) selectedValueTransientAnalComp = tmp // console.log(selectedValue) @@ -394,7 +394,7 @@ export default function SimulationProperties () { // else { // lab[x] = `V (${lab[x]})` - // } + // } simResultGraph.labels.push(lab[x]) } // populate y_points @@ -416,12 +416,10 @@ export default function SimulationProperties () { let postfixUnit = '' if (temp[i][0].includes('#branch')) { postfixUnit = 'A' - } - else if(temp[i][0].includes('transfer_function')){ - postfixUnit = '' - } - else if(temp[i][0].includes('impedance')){ - postfixUnit = 'Ohm' + } else if (temp[i][0].includes('transfer_function')) { + postfixUnit = '' + } else if (temp[i][0].includes('impedance')) { + postfixUnit = 'Ohm' } else { temp[i][0] = `V(${temp[i][0]})` postfixUnit = 'V' @@ -448,6 +446,7 @@ export default function SimulationProperties () { var controlLine = '' var controlBlock = '' var skipMultiNodeChk = 0 + var nodes = '' switch (type) { case 'DcSolver': // console.log('To be implemented') @@ -464,10 +463,10 @@ export default function SimulationProperties () { break case 'Transient': // console.log(transientAnalysisControlLine) - var uic = "" - if(transientAnalysisControlLine.skipInitial === true) uic="UIC" + var uic = '' + if (transientAnalysisControlLine.skipInitial === true) uic = 'UIC' controlLine = `.tran ${transientAnalysisControlLine.step} ${transientAnalysisControlLine.stop} ${transientAnalysisControlLine.start} ${uic}` - + dispatch(setResultTitle('Transient Analysis Output')) selectedValue = selectedValueTransientAnal selectedValueComp = selectedValueTransientAnalComp @@ -478,20 +477,19 @@ export default function SimulationProperties () { dispatch(setResultTitle('AC Analysis Output')) break - + case 'tfAnalysis': - let nodes = "" + selectedValue = selectedValueTFAnal - if(tfAnalysisControlLine.outputNodes === true){ - selectedValue.forEach((value, i) => { - if(value[i] !== undefined){ - nodes = nodes + " " + String(value[i].key) - } - }) - nodes = "V(" + nodes + ")" - } - else{ - nodes = `I(${tfAnalysisControlLine.outputVoltageSource})` + if (tfAnalysisControlLine.outputNodes === true) { + selectedValue.forEach((value, i) => { + if (value[i] !== undefined) { + nodes = nodes + ' ' + String(value[i].key) + } + }) + nodes = 'V(' + nodes + ')' + } else { + nodes = `I(${tfAnalysisControlLine.outputVoltageSource})` } console.log(tfAnalysisControlLine.outputNodes) controlLine = `.tf ${nodes} ${tfAnalysisControlLine.inputVoltageSource}` @@ -504,41 +502,41 @@ export default function SimulationProperties () { } // console.log(selectedValue) var atleastOne = 0 - let cblockline ="" + let cblockline = '' // if either the extra expression field or the nodes multi select // drop down list in enabled then atleast one value is made non zero // to add add all instead to the print statement. - if(selectedValue.length > 0 && selectedValue !== null && skipMultiNodeChk === 0){ - selectedValue.forEach((value, i) => { - if(value[i] !== undefined && value[i].key !== 0){ - atleastOne = 1 - cblockline = cblockline + " " + String(value[i].key) - } - }) + if (selectedValue.length > 0 && selectedValue !== null && skipMultiNodeChk === 0) { + selectedValue.forEach((value, i) => { + if (value[i] !== undefined && value[i].key !== 0) { + atleastOne = 1 + cblockline = cblockline + ' ' + String(value[i].key) + } + }) + } + if (selectedValueComp.length > 0 && selectedValueComp !== null) { + selectedValueComp.forEach((value, i) => { + if (value[i] !== undefined && value[i].key !== 0) { + atleastOne = 1 + if (value[i].key.charAt(0) === 'V' || value[i].key.charAt(0) === 'v') { + cblockline = cblockline + ' I(' + String(value[i].key) + ') ' + } + } + }) } - if(selectedValueComp.length > 0 && selectedValueComp !== null){ - selectedValueComp.forEach((value, i) => { - if(value[i] !== undefined && value[i].key !== 0){ - atleastOne = 1 - if(value[i].key.charAt(0) === 'V' || value[i].key.charAt(0) === 'v'){ - cblockline = cblockline + " I(" + String(value[i].key)+") " - } - } - }) + if (controlBlockParam.length > 0) { + cblockline = cblockline + ' ' + controlBlockParam + atleastOne = 1 } - if(controlBlockParam.length > 0){ - cblockline = cblockline + " " + controlBlockParam - atleastOne = 1 - } - - if(atleastOne === 0) cblockline = 'all' + + if (atleastOne === 0) cblockline = 'all' controlBlock = `\n.control \nrun \nprint ${cblockline} > data.txt \n.endc \n.end` // console.log(controlLine) dispatch(setControlLine(controlLine)) dispatch(setControlBlock(controlBlock)) // setTimeout(function () { }, 2000) - + var netlist = netfile.title + '\n\n' + compNetlist.models + '\n' + compNetlist.main + '\n' + @@ -566,7 +564,7 @@ export default function SimulationProperties () { return ( <>
- + {/* Simulation modes list */} @@ -579,7 +577,7 @@ export default function SimulationProperties () { expandIcon={} aria-controls="panel1a-content" id="panel1a-header" - style={{ width: '100% '}} + style={{ width: '100% ' }} > DC Solver @@ -608,7 +606,7 @@ export default function SimulationProperties () { }} transformOrigin={{ vertical: 'top', - horizontal: 'left' + horizontal: 'left' }} > @@ -639,7 +637,7 @@ export default function SimulationProperties () { expandIcon={} aria-controls="panel1a-content" id="panel1a-header" - style={{ width: '97%'}} + style={{ width: '97%' }} > DC Sweep @@ -764,9 +762,9 @@ export default function SimulationProperties () { placeholder="Select Node" onSelect={handleAddSelectedValueDCSweep} onRemove={handleRemSelectedValueDCSweep} - options={analysisNodeArray} displayValue="key" + options={analysisNodeArray} displayValue="key" avoidHighlightFirstOption = "true" - /> + /> + /> @@ -833,7 +831,7 @@ export default function SimulationProperties () { expandIcon={} aria-controls="panel1a-content" id="panel1a-header" - style={{ width: '97%'}} + style={{ width: '97%' }} > Transient Analysis @@ -862,20 +860,20 @@ export default function SimulationProperties () { S - Use Initial Conditions - { nodeList.forEach((value) => { - if(value !== null && value !== "") { - analysisNodeArray.push({key:value}) - } - }) + { nodeList.forEach((value) => { + if (value !== null && value !== '') { + analysisNodeArray.push({ key: value }) } - + }) + } + + /> - { - componentsList.forEach((value) => { - if(value !== null && value !== "") { - if(value.charAt(0) === 'V' || value.charAt(0) === 'v'){ - analysisCompArray.push({key:value}) - } - } - }) - } + { + componentsList.forEach((value) => { + if (value !== null && value !== '') { + if (value.charAt(0) === 'V' || value.charAt(0) === 'v') { + analysisCompArray.push({ key: value }) + } + } + }) + } + /> @@ -960,7 +958,7 @@ export default function SimulationProperties () { expandIcon={} aria-controls="panel1a-content" id="panel1a-header" - style={{ width: '100%'}} + style={{ width: '100%' }} > AC Analysis @@ -1069,7 +1067,7 @@ export default function SimulationProperties () { expandIcon={} aria-controls="panel1a-content" id="panel1a-header" - style={{ width: '97%'}} + style={{ width: '97%' }} > Transfer Function Analysis @@ -1077,22 +1075,22 @@ export default function SimulationProperties () {
- - Output By Nodes - + + Output By Nodes + { nodeList.forEach((value) => { - if(value !== null && value !== "") { - nodeArray.push({key:value}) - } - }) + if (value !== null && value !== '') { + nodeArray.push({ key: value }) + } + }) } { pushZero(nodeArray)} @@ -1104,10 +1102,10 @@ export default function SimulationProperties () { onSelect={handleAddSelectedValueTFAnal} onRemove={handleRemSelectedValueTFAnal} selectionLimit="2" - options={nodeArray} displayValue="key" + options={nodeArray} displayValue="key" disable={disabled} avoidHighlightFirstOption = "true" - /> + /> -