diff options
author | Sunil Shetye | 2020-09-23 15:11:39 +0530 |
---|---|---|
committer | Sunil Shetye | 2021-04-11 21:23:03 +0530 |
commit | 9bf839605eacd2eadc9af812dade81cdf5e2e91a (patch) | |
tree | f1c597f882d8a51ee8ddef38205000cb854c6d79 | |
parent | e9b56f816355170a5944be17a088159cae601e16 (diff) | |
download | Common-Interface-Project-9bf839605eacd2eadc9af812dade81cdf5e2e91a.tar.gz Common-Interface-Project-9bf839605eacd2eadc9af812dade81cdf5e2e91a.tar.bz2 Common-Interface-Project-9bf839605eacd2eadc9af812dade81cdf5e2e91a.zip |
change from properties to parameter_values
8 files changed, 13 insertions, 419 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js index 85a9d86d..7cd95f91 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js @@ -10,19 +10,13 @@ export default function ComponentProperties () { const isOpen = useSelector(state => state.componentPropertiesReducer.isPropertiesWindowOpen) const id = useSelector(state => state.componentPropertiesReducer.id) const parameter_values = useSelector(state => state.componentPropertiesReducer.parameter_values) - const parameter_values_changed = useSelector(state => state.componentPropertiesReducer.parameter_values_changed) - const block = useSelector(state => state.componentPropertiesReducer.block) const [val, setVal] = useState(parameter_values) const dispatch = useDispatch() useEffect(() => { - if (parameter_values_changed) { - block.parameter_values = parameter_values; - } else { - setVal(parameter_values) - } - }, [parameter_values_changed, parameter_values, block.parameter_values]) + setVal(parameter_values) + }, [parameter_values]) const getInputValues = (evt) => { const value = evt.target.value @@ -33,7 +27,7 @@ export default function ComponentProperties () { } const setProps = () => { - dispatch(setCompProperties(id, val, block)) + dispatch(setCompProperties(id, val)) } return ( diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js index 108070c1..b66de100 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js @@ -61,7 +61,7 @@ export default function LoadGrid (container, sidebar, outline) { mxCell.prototype.symbol = null mxCell.prototype.node = null mxCell.prototype.CompObject = null - mxCell.prototype.properties = {} + mxCell.prototype.parameter_values = {} mxCell.prototype.sourceVertex = false mxCell.prototype.targetVertex = false mxCell.prototype.tarx = 0 @@ -253,11 +253,11 @@ export default function LoadGrid (container, sidebar, outline) { store.subscribe(() => { var id = store.getState().componentPropertiesReducer.id - var props = store.getState().componentPropertiesReducer.compProperties + var parameter_values = store.getState().componentPropertiesReducer.parameter_values var cellList = graph.getModel().cells var c = cellList[id] if (c !== undefined) { - c.properties = props + c.parameter_values = parameter_values } }) diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js deleted file mode 100644 index b6f219d2..00000000 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentParametersData.js +++ /dev/null @@ -1,378 +0,0 @@ -const ComponentParameters = { - // capacitor - C: { - PREFIX: 'C', - NAME: '', - N1: '', - N2: '', - VALUE: '', - EXTRA_EXPRESSION: '', - MODEL: '', - VALUE_UNIT: 'F' - }, - - D: { - PREFIX: 'D', - NAME: '', - N1: '', - N2: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - I: { - - ISOURCE: { - PREFIX: 'I', - NAME: '', - N1: '', - N2: '', - VALUE: '0', - EXTRA_EXPRESSION: '', - MODEL: '', - VALUE_UNIT: 'A' - }, - SINE: { - PREFIX: 'I', - NAME: '', - N1: '', - N2: '', - - OFFSET: '1.0', - AMPLITUDE: '1.0', - FREQUENCY: '1K', - DELAY: '0.0', - DAMPING_FACTOR: '0.0', - PHASE: '0.0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - OFFSET_UNIT: 'A', - AMPLITUDE_UNIT: 'A', - FREQUENCY_UNIT: 'Hz', - DELAY_UNIT: 'S', - DAMPING_FACTOR_UNIT: '1/S', - PHASE_UNIT: 'DEG' - }, - - PULSE: { - PREFIX: 'I', - NAME: '', - N1: '', - N2: '', - - INITIAL_VALUE: '0', - PULSED_VALUE: '1', - DELAY_TIME: '1K', - RISE_TIME: '1u', - FALL_TIME: '1u', - PULSE_WIDTH: '1m', - PERIOD: '1m', - PHASE: '0.0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - INITIAL_VALUE_UNIT: 'A', - PULSED_VALUE_UNIT: 'A', - DELAY_TIME_UNIT: 'S', - RISE_TIME_UNIT: 'S', - FALL_TIME_UNIT: 'S', - PULSE_WIDTH_UNIT: 'S', - PERIOD_UNIT: 'S', - PHASE_UNIT: 'DEG' - }, - - DC: { - PREFIX: 'I', - NAME: '', - N1: '', - N2: '', - VALUE: '0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - VALUE_UNIT: 'A' - }, - - EXP: { - PREFIX: 'I', - NAME: '', - N1: '', - N2: '', - - INITIAL_VALUE: '0', - PULSED_VALUE: '1', - - RISE_DELAY_TIME: '100u', - RISE_TIME_CONSTANT: '20u', - FALL_DELAY_TIME: '500u', - FALL_TIME_CONSTANT: '60u', - - EXTRA_EXPRESSION: '', - MODEL: '', - - INITIAL_VALUE_UNIT: 'A', - PULSED_VALUE_UNIT: 'A', - RISE_DELAY_TIME_UNIT: 'S', - RISE_TIME_CONSTANT_UNIT: 'S', - FALL_DELAY_TIME_UNIT: 'S', - FALL_TIME_CONSTANT_UNIT: 'S' - } - - }, - - G: { - PREFIX: 'G', - NAME: '', - N1: '', - N2: '', - NC1: '', - NC2: '', - VALUE: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - F: { - PREFIX: 'F', - NAME: '', - N1: '', - N2: '', - VNAM: '', - VALUE: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - H: { - PREFIX: 'H', - NAME: '', - N1: '', - N2: '', - VNAM: '', - VALUE: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - J: { - PREFIX: 'J', - NAME: '', - N1: '', - N2: '', - N3: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - O: { - PREFIX: 'O', - NAME: '', - N1: '', - N2: '', - N3: '', - N4: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - T: { - PREFIX: 'T', - NAME: '', - N1: '', - N2: '', - N3: '', - N4: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - // Inductor - L: { - PREFIX: 'L', - NAME: '', - N1: '', - N2: '', - VALUE: '', - EXTRA_EXPRESSION: '', - MODEL: '', - VALUE_UNIT: 'H' - }, - - M: { - PREFIX: 'M', - NAME: '', - N1: '', - N2: '', - N3: '', - N4: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - Q: { - PREFIX: 'Q', - NAME: '', - N1: '', - N2: '', - N3: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - V: { - VSOURCE: { - PREFIX: 'V', - NAME: '', - N1: '', - N2: '', - VALUE: '0', - EXTRA_EXPRESSION: '', - MODEL: '', - VALUE_UNIT: 'V' - }, - SINE: { - PREFIX: 'V', - NAME: '', - N1: '', - N2: '', - - OFFSET: '1.0', - AMPLITUDE: '1.0', - FREQUENCY: '1K', - DELAY: '0.0', - DAMPING_FACTOR: '0.0', - PHASE: '0.0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - OFFSET_UNIT: 'V', - AMPLITUDE_UNIT: 'V', - FREQUENCY_UNIT: 'Hz', - DELAY_UNIT: 'S', - DAMPING_FACTOR_UNIT: '1/S', - PHASE_UNIT: 'DEG' - }, - - PULSE: { - PREFIX: 'V', - NAME: '', - N1: '', - N2: '', - - INITIAL_VALUE: '0', - PULSED_VALUE: '1', - DELAY_TIME: '1K', - RISE_TIME: '1u', - FALL_TIME: '1u', - PULSE_WIDTH: '1m', - PERIOD: '1m', - PHASE: '0.0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - INITIAL_VALUE_UNIT: 'V', - PULSED_VALUE_UNIT: 'V', - DELAY_TIME_UNIT: 'S', - RISE_TIME_UNIT: 'S', - FALL_TIME_UNIT: 'S', - PULSE_WIDTH_UNIT: 'S', - PERIOD_UNIT: 'S', - PHASE_UNIT: 'DEG' - }, - - DC: { - PREFIX: 'V', - NAME: '', - N1: '', - N2: '', - VALUE: '0', - - EXTRA_EXPRESSION: '', - MODEL: '', - - VALUE_UNIT: 'V' - }, - - EXP: { - PREFIX: 'V', - NAME: '', - N1: '', - N2: '', - - INITIAL_VALUE: '0', - PULSED_VALUE: '1', - - RISE_DELAY_TIME: '100u', - RISE_TIME_CONSTANT: '20u', - FALL_DELAY_TIME: '500u', - FALL_TIME_CONSTANT: '60u', - - EXTRA_EXPRESSION: '', - MODEL: '', - - INITIAL_VALUE_UNIT: 'v', - PULSED_VALUE_UNIT: 'v', - RISE_DELAY_TIME_UNIT: 'S', - RISE_TIME_CONSTANT_UNIT: 'S', - FALL_DELAY_TIME_UNIT: 'S', - FALL_TIME_CONSTANT_UNIT: 'S' - } - - }, - // resistor - R: { - PREFIX: 'R', - NAME: '', - N1: '', - N2: '', - VALUE: '1', - EXTRA_EXPRESSION: '', - MODEL: '', - VALUE_UNIT: 'Ohm' - }, - - Z: { - PREFIX: 'Z', - NAME: '', - N1: '', - N2: '', - N3: '', - EXTRA_EXPRESSION: '', - MODEL: '' - }, - - S: { - PREFIX: 'S', - NAME: '', - N1: '', - N2: '', - NC1: '', - NC2: '', - MODEL: '', - EXTRA_EXPRESSION: '' - - }, - W: { - PREFIX: 'W', - NAME: '', - N1: '', - N2: '', - VNAM: '', - MODEL: '', - EXTRA_EXPRESSION: '' - - } - -} - -export default ComponentParameters - -// K coupled inductor -// SWITCHES - -// IF S,W show model diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js index 01b7ca5f..2d5e3890 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js @@ -49,10 +49,6 @@ export function getSvgMetadata (graph, parent, evt, target, x, y, component) { } v1.parameter_values = parameter_values; - var props = {} - props.NAME = component.name - v1.properties = props - v1.setConnectable(false) let ports = component.initial_explicit_input_ports + component.initial_implicit_input_ports; diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js index 4a8103af..6c2b326b 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js @@ -1,7 +1,7 @@ import mxGraphFactory from 'mxgraph' import store from '../../../redux/store' import * as actions from '../../../redux/actions/actions' -import ComponentParameters from './ComponentParametersData' + var graph var undoManager @@ -258,7 +258,6 @@ export function GenerateNetList () { var component = list[property] k = k + component.symbol + c.toString() component.value = component.symbol + c.toString() - component.properties.PREFIX = component.value ++c if (component.children !== null) { @@ -307,11 +306,10 @@ export function GenerateNetList () { compobj.node1 = component.children[0].edges[0].node compobj.node2 = component.children[1].edges[0].node compobj.magnitude = 10 - netlist.componentlist.push(component.properties.PREFIX) netlist.nodelist.push(compobj.node2, compobj.node1) } - console.log('component properties', component.properties) + console.log('component parameter_values', component.parameter_values) k = k + ' \n' } @@ -366,7 +364,6 @@ function parseXmlToGraph (xmlDoc, graph) { var v1 var yPos var xPos - var props var style = graph.getStylesheet().getDefaultVertexStyle() style[mxConstants.STYLE_SHAPE] = 'label' @@ -398,16 +395,9 @@ function parseXmlToGraph (xmlDoc, graph) { const width = Number(geom.width.value) v1 = graph.insertVertex(parent, vertexId, vertexName, xPos, yPos, width, height, style) v1.symbol = cellAttrs.symbol.value - props = Object.assign({}, ComponentParameters[v1.symbol]) - try { props.NAME = cells[i].children[2].attributes.NAME.value } catch (e) { props.NAME = cells[i].children[1].attributes.NAME.value } - v1.properties = props v1.Component = true v1.CellType = 'Component' - console.log(props) - for (var check in props) { - try { v1.properties[check] = cells[i].children[2].attributes[check].value } catch (e) { try { v1.properties[check] = cells[i].children[1].attributes[check].value } catch (e) { console.log('parameter errors') } } - } console.log('component added') } else if (cellAttrs.Pin.value === '1') { const vertexName = cellAttrs.value.value diff --git a/blocks/eda-frontend/src/components/SchematicEditor/RightSidebar.js b/blocks/eda-frontend/src/components/SchematicEditor/RightSidebar.js index 22474878..48e273ff 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/RightSidebar.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/RightSidebar.js @@ -18,7 +18,7 @@ const useStyles = makeStyles((theme) => ({ } })) -// Editor right side pane to display grid and component properties. +// Editor right side pane to display grid and compProperties. export default function RightSidebar ({ window, mobileOpen, mobileClose, children }) { const classes = useStyles() diff --git a/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js b/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js index ce89dbb2..39e8f3ce 100644 --- a/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js +++ b/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js @@ -12,7 +12,6 @@ export const getCompProperties = (block) => (dispatch) => { payload: { id: block.id, parameter_values: block.parameter_values, - block: block, compProperties: res.data[0] } }) @@ -22,18 +21,17 @@ export const getCompProperties = (block) => (dispatch) => { } // Actions for updating entered component properites on clicking set parameters -export const setCompProperties = (id, parameter_values, block) => (dispatch) => { +export const setCompProperties = (id, parameter_values) => (dispatch) => { dispatch({ type: actions.SET_COMP_PROPERTIES, payload: { id: id, - parameter_values: parameter_values, - block: block + parameter_values: parameter_values } }) } -// Handling hiding of component properties sidebar +// Handling hiding of compProperties sidebar export const closeCompProperties = () => (dispatch) => { dispatch({ type: actions.CLOSE_COMP_PROPERTIES diff --git a/blocks/eda-frontend/src/redux/reducers/componentPropertiesReducer.js b/blocks/eda-frontend/src/redux/reducers/componentPropertiesReducer.js index 90e7b8e7..701b54e8 100644 --- a/blocks/eda-frontend/src/redux/reducers/componentPropertiesReducer.js +++ b/blocks/eda-frontend/src/redux/reducers/componentPropertiesReducer.js @@ -4,8 +4,6 @@ import { ZoomAct } from '../../components/SchematicEditor/Helper/ToolbarTools.js const InitialState = { id: 0, parameter_values: {}, - parameter_values_changed: false, - block: {}, isPropertiesWindowOpen: false, compProperties: {} } @@ -17,8 +15,6 @@ export default function (state = InitialState, action) { ...state, id: action.payload.id, parameter_values: action.payload.parameter_values, - parameter_values_changed: false, - block: action.payload.block, isPropertiesWindowOpen: true, compProperties: action.payload.compProperties } @@ -29,9 +25,7 @@ export default function (state = InitialState, action) { ...state, id: action.payload.id, parameter_values: action.payload.parameter_values, - parameter_values_changed: true, - block: action.payload.block, - isPropertiesWindowOpen: false, + isPropertiesWindowOpen: false } } |