summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2021-12-15 12:25:33 +0530
committerSunil Shetye2021-12-15 20:00:01 +0530
commit25c5f305f77c904e14c3d6ea4bbd30d098777b24 (patch)
tree24a0871efcdb7fc2f0bd8bdcdad55ffa8d63102c
parentcef53f5ddeac759fa4f88dadeaa65ddceb6e887e (diff)
downloadCommon-Interface-Project-25c5f305f77c904e14c3d6ea4bbd30d098777b24.tar.gz
Common-Interface-Project-25c5f305f77c904e14c3d6ea4bbd30d098777b24.tar.bz2
Common-Interface-Project-25c5f305f77c904e14c3d6ea4bbd30d098777b24.zip
stream the data to the browser
add events to React to receive the stream
-rw-r--r--blocks/eda-frontend/package-lock.json423
-rw-r--r--blocks/eda-frontend/package.json3
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js8
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js2
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js8
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js622
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js20
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen2.js149
-rw-r--r--blocks/eda-frontend/src/components/Shared/Graph2.js139
-rw-r--r--blocks/eda-frontend/src/components/Simulator/SimulationScreen.js2
-rw-r--r--blocks/eda-frontend/src/pages/Simulator.js2
-rw-r--r--blocks/eda-frontend/src/redux/actions/actions.js6
-rw-r--r--blocks/eda-frontend/src/redux/actions/datapointActions.js31
-rw-r--r--blocks/eda-frontend/src/redux/actions/index.js1
-rw-r--r--blocks/eda-frontend/src/redux/reducers/datapointReducer.js44
-rw-r--r--blocks/eda-frontend/src/redux/reducers/index.js2
-rw-r--r--blocks/eda-frontend/src/utils/Queue.js3
-rw-r--r--blocks/eda-frontend/src/utils/Sigbuilder-graph.js322
-rw-r--r--blocks/eda-frontend/src/utils/dependencies.js153
-rw-r--r--blocks/simulationAPI/negotiation.py1
-rw-r--r--blocks/simulationAPI/renderer.py17
21 files changed, 1918 insertions, 40 deletions
diff --git a/blocks/eda-frontend/package-lock.json b/blocks/eda-frontend/package-lock.json
index 3a38d38c..be2b2396 100644
--- a/blocks/eda-frontend/package-lock.json
+++ b/blocks/eda-frontend/package-lock.json
@@ -22,7 +22,9 @@
"file-saver": "^2.0.2",
"highcharts": "^9.1.0",
"highcharts-react-official": "^3.0.0",
+ "jquery": "^3.6.0",
"material-ui-popup-state": "^1.5.4",
+ "mathjs": "^10.0.0",
"mxgraph": "^4.2.2",
"query-string": "^6.12.1",
"react": "^16.13.1",
@@ -37,6 +39,7 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"typescript": "^3.9.3",
+ "xlsx": "^0.17.4",
"xml-beautifier": "^0.4.3"
},
"devDependencies": {
@@ -1179,11 +1182,14 @@
}
},
"node_modules/@babel/runtime": {
- "version": "7.9.6",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.6.tgz",
- "integrity": "sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ==",
+ "version": "7.16.3",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.3.tgz",
+ "integrity": "sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ==",
"dependencies": {
"regenerator-runtime": "^0.13.4"
+ },
+ "engines": {
+ "node": ">=6.9.0"
}
},
"node_modules/@babel/runtime-corejs3": {
@@ -2732,6 +2738,21 @@
"inherits": "2.0.1"
}
},
+ "node_modules/adler-32": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz",
+ "integrity": "sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=",
+ "dependencies": {
+ "exit-on-epipe": "~1.0.1",
+ "printj": "~1.1.0"
+ },
+ "bin": {
+ "adler32": "bin/adler32.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/aggregate-error": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
@@ -4396,6 +4417,52 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
},
+ "node_modules/cfb": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.1.tgz",
+ "integrity": "sha512-wT2ScPAFGSVy7CY+aauMezZBnNrfnaLSrxHUHdea+Td/86vrk6ZquggV+ssBR88zNs0OnBkL2+lf9q0K+zVGzQ==",
+ "dependencies": {
+ "adler-32": "~1.3.0",
+ "crc-32": "~1.2.0",
+ "printj": "~1.3.0"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/cfb/node_modules/adler-32": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.0.tgz",
+ "integrity": "sha512-f5nltvjl+PRUh6YNfUstRaXwJxtfnKEWhAWWlmKvh+Y3J2+98a0KKVYDEhz6NdKGqswLhjNGznxfSsZGOvOd9g==",
+ "dependencies": {
+ "printj": "~1.2.2"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/cfb/node_modules/adler-32/node_modules/printj": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.2.3.tgz",
+ "integrity": "sha512-sanczS6xOJOg7IKDvi4sGOUOe7c1tsEzjwlLFH/zgwx/uyImVM9/rgBkc8AfiQa/Vg54nRd8mkm9yI7WV/O+WA==",
+ "bin": {
+ "printj": "bin/printj.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/cfb/node_modules/printj": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.3.0.tgz",
+ "integrity": "sha512-017o8YIaz8gLhaNxRB9eBv2mWXI2CtzhPJALnQTP+OPpuUfP0RMWqr/mHCzqVeu1AQxfzSfAtAq66vKB8y7Lzg==",
+ "bin": {
+ "printj": "bin/printj.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -4653,6 +4720,14 @@
"node": ">=0.10.0"
}
},
+ "node_modules/codepage": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
+ "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/collection-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
@@ -4738,6 +4813,18 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
+ "node_modules/complex.js": {
+ "version": "2.0.15",
+ "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.0.15.tgz",
+ "integrity": "sha512-gDBvQU8IG139ZBQTSo2qvDFP+lANMGluM779csXOr6ny1NUtA3wkUnCFjlDNH/moAVfXtvClYt6G0zarFbtz5w==",
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "type": "patreon",
+ "url": "https://www.patreon.com/infusion"
+ }
+ },
"node_modules/component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@@ -4969,6 +5056,21 @@
"node": ">=4"
}
},
+ "node_modules/crc-32": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
+ "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==",
+ "dependencies": {
+ "exit-on-epipe": "~1.0.1",
+ "printj": "~1.1.0"
+ },
+ "bin": {
+ "crc32": "bin/crc32.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/create-ecdh": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
@@ -5465,6 +5567,11 @@
"node": ">=0.10.0"
}
},
+ "node_modules/decimal.js": {
+ "version": "10.3.1",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz",
+ "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ=="
+ },
"node_modules/decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
@@ -6135,6 +6242,11 @@
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
"dev": true
},
+ "node_modules/escape-latex": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
+ "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
+ },
"node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -6860,6 +6972,14 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/exit-on-epipe": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
+ "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==",
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/expand-brackets": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
@@ -7610,6 +7730,26 @@
"node": ">= 0.6"
}
},
+ "node_modules/frac": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
+ "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/fraction.js": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.2.tgz",
+ "integrity": "sha512-o2RiJQ6DZaR/5+Si0qJUIy637QMRudSi9kU/FFzx9EZazrIdnBgpU+3sEWCxAVhH2RtxW2Oz+T4p2o8uOPVcgA==",
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "type": "patreon",
+ "url": "https://www.patreon.com/infusion"
+ }
+ },
"node_modules/fragment-cache": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
@@ -9339,6 +9479,11 @@
"node": ">=6"
}
},
+ "node_modules/javascript-natural-sort": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
+ "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
+ },
"node_modules/jest": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz",
@@ -10173,6 +10318,11 @@
"decamelize": "^1.2.0"
}
},
+ "node_modules/jquery": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
+ "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -10894,6 +11044,28 @@
"@types/react": "*"
}
},
+ "node_modules/mathjs": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-10.0.0.tgz",
+ "integrity": "sha512-PZcQ73mVvVG2GZXvE47q+j7P3ALVxWUM51wTmlVX3F/3IJMLNziNIqStwyIDAO64ZGB8u3iFlQwxT7DIijtNlw==",
+ "dependencies": {
+ "@babel/runtime": "^7.16.0",
+ "complex.js": "^2.0.15",
+ "decimal.js": "^10.3.1",
+ "escape-latex": "^1.2.0",
+ "fraction.js": "^4.1.1",
+ "javascript-natural-sort": "^0.7.1",
+ "seedrandom": "^3.0.5",
+ "tiny-emitter": "^2.1.0",
+ "typed-function": "^2.0.0"
+ },
+ "bin": {
+ "mathjs": "bin/cli.js"
+ },
+ "engines": {
+ "node": ">= 12"
+ }
+ },
"node_modules/md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
@@ -13600,6 +13772,17 @@
"node": ">= 6"
}
},
+ "node_modules/printj": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
+ "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==",
+ "bin": {
+ "printj": "bin/printj.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
@@ -15656,6 +15839,11 @@
"node": ">= 8.9.0"
}
},
+ "node_modules/seedrandom": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
+ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
+ },
"node_modules/select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
@@ -16378,6 +16566,17 @@
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
+ "node_modules/ssf": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
+ "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
+ "dependencies": {
+ "frac": "~1.1.2"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
@@ -17118,6 +17317,11 @@
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
"dev": true
},
+ "node_modules/tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+ },
"node_modules/tiny-invariant": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
@@ -17335,6 +17539,14 @@
"node": ">= 0.6"
}
},
+ "node_modules/typed-function": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-2.0.0.tgz",
+ "integrity": "sha512-Hhy1Iwo/e4AtLZNK10ewVVcP2UEs408DS35ubP825w/YgSBK1KVLwALvvIG4yX75QJrxjCpcWkzkVRB0BwwYlA==",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
"node_modules/typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -18380,6 +18592,22 @@
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
+ "node_modules/wmf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
+ "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/word": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
+ "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -18653,6 +18881,26 @@
"async-limiter": "~1.0.0"
}
},
+ "node_modules/xlsx": {
+ "version": "0.17.4",
+ "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.17.4.tgz",
+ "integrity": "sha512-9aKt8g9ZLP0CUdBX8L5xnoMDFwSiLI997eQnDThCaqQMYB9AEBIRzblSSNN/ICMGLYIHUO3VKaItcedZJ3ijIg==",
+ "dependencies": {
+ "adler-32": "~1.2.0",
+ "cfb": "^1.1.4",
+ "codepage": "~1.15.0",
+ "crc-32": "~1.2.0",
+ "ssf": "~0.11.2",
+ "wmf": "~1.0.1",
+ "word": "~0.3.0"
+ },
+ "bin": {
+ "xlsx": "bin/xlsx.njs"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
"node_modules/xml-beautifier": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/xml-beautifier/-/xml-beautifier-0.4.3.tgz",
@@ -20008,9 +20256,9 @@
}
},
"@babel/runtime": {
- "version": "7.9.6",
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.6.tgz",
- "integrity": "sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ==",
+ "version": "7.16.3",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.3.tgz",
+ "integrity": "sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ==",
"requires": {
"regenerator-runtime": "^0.13.4"
}
@@ -21357,6 +21605,15 @@
}
}
},
+ "adler-32": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz",
+ "integrity": "sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=",
+ "requires": {
+ "exit-on-epipe": "~1.0.1",
+ "printj": "~1.1.0"
+ }
+ },
"aggregate-error": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
@@ -22812,6 +23069,38 @@
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
},
+ "cfb": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.1.tgz",
+ "integrity": "sha512-wT2ScPAFGSVy7CY+aauMezZBnNrfnaLSrxHUHdea+Td/86vrk6ZquggV+ssBR88zNs0OnBkL2+lf9q0K+zVGzQ==",
+ "requires": {
+ "adler-32": "~1.3.0",
+ "crc-32": "~1.2.0",
+ "printj": "~1.3.0"
+ },
+ "dependencies": {
+ "adler-32": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.0.tgz",
+ "integrity": "sha512-f5nltvjl+PRUh6YNfUstRaXwJxtfnKEWhAWWlmKvh+Y3J2+98a0KKVYDEhz6NdKGqswLhjNGznxfSsZGOvOd9g==",
+ "requires": {
+ "printj": "~1.2.2"
+ },
+ "dependencies": {
+ "printj": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.2.3.tgz",
+ "integrity": "sha512-sanczS6xOJOg7IKDvi4sGOUOe7c1tsEzjwlLFH/zgwx/uyImVM9/rgBkc8AfiQa/Vg54nRd8mkm9yI7WV/O+WA=="
+ }
+ }
+ },
+ "printj": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.3.0.tgz",
+ "integrity": "sha512-017o8YIaz8gLhaNxRB9eBv2mWXI2CtzhPJALnQTP+OPpuUfP0RMWqr/mHCzqVeu1AQxfzSfAtAq66vKB8y7Lzg=="
+ }
+ }
+ },
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@@ -23033,6 +23322,11 @@
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true
},
+ "codepage": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
+ "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA=="
+ },
"collection-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
@@ -23109,6 +23403,11 @@
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
"dev": true
},
+ "complex.js": {
+ "version": "2.0.15",
+ "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.0.15.tgz",
+ "integrity": "sha512-gDBvQU8IG139ZBQTSo2qvDFP+lANMGluM779csXOr6ny1NUtA3wkUnCFjlDNH/moAVfXtvClYt6G0zarFbtz5w=="
+ },
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
@@ -23309,6 +23608,15 @@
"parse-json": "^4.0.0"
}
},
+ "crc-32": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz",
+ "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==",
+ "requires": {
+ "exit-on-epipe": "~1.0.1",
+ "printj": "~1.1.0"
+ }
+ },
"create-ecdh": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz",
@@ -23729,6 +24037,11 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
+ "decimal.js": {
+ "version": "10.3.1",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz",
+ "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ=="
+ },
"decode-uri-component": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
@@ -24328,6 +24641,11 @@
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
"dev": true
},
+ "escape-latex": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
+ "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
+ },
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@@ -24917,6 +25235,11 @@
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"dev": true
},
+ "exit-on-epipe": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
+ "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw=="
+ },
"expand-brackets": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
@@ -25541,6 +25864,16 @@
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
"dev": true
},
+ "frac": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
+ "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
+ },
+ "fraction.js": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.1.2.tgz",
+ "integrity": "sha512-o2RiJQ6DZaR/5+Si0qJUIy637QMRudSi9kU/FFzx9EZazrIdnBgpU+3sEWCxAVhH2RtxW2Oz+T4p2o8uOPVcgA=="
+ },
"fragment-cache": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
@@ -26956,6 +27289,11 @@
"html-escaper": "^2.0.0"
}
},
+ "javascript-natural-sort": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
+ "integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
+ },
"jest": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest/-/jest-24.9.0.tgz",
@@ -27654,6 +27992,11 @@
}
}
},
+ "jquery": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
+ "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
+ },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -28273,6 +28616,22 @@
}
}
},
+ "mathjs": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-10.0.0.tgz",
+ "integrity": "sha512-PZcQ73mVvVG2GZXvE47q+j7P3ALVxWUM51wTmlVX3F/3IJMLNziNIqStwyIDAO64ZGB8u3iFlQwxT7DIijtNlw==",
+ "requires": {
+ "@babel/runtime": "^7.16.0",
+ "complex.js": "^2.0.15",
+ "decimal.js": "^10.3.1",
+ "escape-latex": "^1.2.0",
+ "fraction.js": "^4.1.1",
+ "javascript-natural-sort": "^0.7.1",
+ "seedrandom": "^3.0.5",
+ "tiny-emitter": "^2.1.0",
+ "typed-function": "^2.0.0"
+ }
+ },
"md5.js": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz",
@@ -30489,6 +30848,11 @@
"react-is": "^16.8.4"
}
},
+ "printj": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
+ "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ=="
+ },
"private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
@@ -32214,6 +32578,11 @@
"ajv-keywords": "^3.4.1"
}
},
+ "seedrandom": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-3.0.5.tgz",
+ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
+ },
"select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
@@ -32863,6 +33232,14 @@
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
+ "ssf": {
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
+ "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
+ "requires": {
+ "frac": "~1.1.2"
+ }
+ },
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
@@ -33464,6 +33841,11 @@
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=",
"dev": true
},
+ "tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+ },
"tiny-invariant": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
@@ -33641,6 +34023,11 @@
"mime-types": "~2.1.24"
}
},
+ "typed-function": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-2.0.0.tgz",
+ "integrity": "sha512-Hhy1Iwo/e4AtLZNK10ewVVcP2UEs408DS35ubP825w/YgSBK1KVLwALvvIG4yX75QJrxjCpcWkzkVRB0BwwYlA=="
+ },
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -34516,6 +34903,16 @@
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
+ "wmf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
+ "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
+ },
+ "word": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
+ "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
+ },
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -34775,6 +35172,20 @@
"async-limiter": "~1.0.0"
}
},
+ "xlsx": {
+ "version": "0.17.4",
+ "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.17.4.tgz",
+ "integrity": "sha512-9aKt8g9ZLP0CUdBX8L5xnoMDFwSiLI997eQnDThCaqQMYB9AEBIRzblSSNN/ICMGLYIHUO3VKaItcedZJ3ijIg==",
+ "requires": {
+ "adler-32": "~1.2.0",
+ "cfb": "^1.1.4",
+ "codepage": "~1.15.0",
+ "crc-32": "~1.2.0",
+ "ssf": "~0.11.2",
+ "wmf": "~1.0.1",
+ "word": "~0.3.0"
+ }
+ },
"xml-beautifier": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/xml-beautifier/-/xml-beautifier-0.4.3.tgz",
diff --git a/blocks/eda-frontend/package.json b/blocks/eda-frontend/package.json
index 069cf661..89bed5c8 100644
--- a/blocks/eda-frontend/package.json
+++ b/blocks/eda-frontend/package.json
@@ -18,7 +18,9 @@
"file-saver": "^2.0.2",
"highcharts": "^9.1.0",
"highcharts-react-official": "^3.0.0",
+ "jquery": "^3.6.0",
"material-ui-popup-state": "^1.5.4",
+ "mathjs": "^10.0.0",
"mxgraph": "^4.2.2",
"query-string": "^6.12.1",
"react": "^16.13.1",
@@ -33,6 +35,7 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"typescript": "^3.9.3",
+ "xlsx": "^0.17.4",
"xml-beautifier": "^0.4.3"
},
"scripts": {
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
index 62e75403..3c21fbd0 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js
@@ -200,7 +200,6 @@ export default function LoadGrid (container, sidebar, outline) {
const labelBackground = (invert) ? '#000000' : '#FFFFFF'
const fontColor = (invert) ? '#FFFFFF' : '#000000'
const strokeColor = (invert) ? '#C0C0C0' : '#000000'
- // var fillColor = (invert) ? 'none' : '#FFFFFF'
let style = graph.getStylesheet().getDefaultEdgeStyle()
delete style.endArrow
@@ -230,8 +229,6 @@ export default function LoadGrid (container, sidebar, outline) {
style.rounded = '1'
style.strokeWidth = strokeWidth
- // var parent = graph.getDefaultParent()
-
SideBar(graph, sidebar)
KeyboardShorcuts(graph)
// NetlistInfoFunct(graph)
@@ -287,7 +284,7 @@ export default function LoadGrid (container, sidebar, outline) {
}
// Grid
- /* var checkbox2 = document.createElement('input')
+ /* const checkbox2 = document.createElement('input')
checkbox2.setAttribute('type', 'checkbox')
checkbox2.setAttribute('checked', 'true')
@@ -433,7 +430,6 @@ export default function LoadGrid (container, sidebar, outline) {
mxEdgeHandler.prototype.connect = function (edge, terminal, isSource, isClone, me) {
let result = null
const model = this.graph.getModel()
- // var parent = model.getParent(edge)
model.beginUpdate()
try {
@@ -606,7 +602,7 @@ export default function LoadGrid (container, sidebar, outline) {
// FIXME: First segment not movable
/* hint = state.view.transformControlPoint(state, hints[0]);
mxLog.show();
- mxLog.debug(hints.length,'hints0.y='+hint.y, pt.y)
+ mxLog.debug(hints.length, 'hints0.y=' + hint.y, pt.y)
if (horizontal && Math.floor(hint.y) != Math.floor(pt.y))
{
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js
index ed27d855..b33d5765 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js
@@ -54,7 +54,7 @@ export function AddComponent (component, imgref) {
}
graph.setSelectionCell(v1)
- /* var preview = new mxPrintPreview(graph)
+ /* const preview = new mxPrintPreview(graph)
preview.open() */
}
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
index 273d7486..1ee8c91b 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
@@ -296,9 +296,7 @@ export function GenerateNetList () {
}
pin.edges[wire].value = pin.edges[wire].node
}
- console.log('Check the wires here ')
- console.log(pin.edges[wire].sourceVertex)
- console.log(pin.edges[wire].targetVertex)
+ console.log('Check the wires here', pin.edges[wire].sourceVertex, pin.edges[wire].targetVertex)
}
k = k + ' ' + pin.edges[0].node
}
@@ -489,9 +487,7 @@ function XMLWireConnections () {
pin.edges[wire].targetVertex = pin.edges[wire].target.id
}
}
- console.log('Check the wires here ')
- console.log(pin.edges[wire].sourceVertex)
- console.log(pin.edges[wire].targetVertex)
+ console.log('Check the wires here', pin.edges[wire].sourceVertex, pin.edges[wire].targetVertex)
}
}
} catch (e) { console.log('error', e) }
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js b/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
index f2f295c1..d806f3b7 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
@@ -14,10 +14,13 @@ import {
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import { makeStyles } from '@material-ui/core/styles'
import { useSelector, useDispatch } from 'react-redux'
+import $ from 'jquery'
-import { setResultTitle, setResultGraph, setResultText } from '../../redux/actions/index'
+import { Queue } from '../../utils/Queue'
+import { setResultTitle, setResultGraph, setResultText, addDatapointChart } from '../../redux/actions/index'
import { Save } from './Helper/ToolbarTools'
-import SimulationScreen from './SimulationScreen'
+import SimulationScreen2 from './SimulationScreen2'
+import { addPointToQueue, setStatusDone } from '../Shared/Graph2'
import api from '../../utils/Api'
const useStyles = makeStyles((theme) => ({
@@ -117,23 +120,620 @@ export default function SimulationProperties () {
const [isResult, setIsResult] = useState(false)
- function streamSimulationResult(streamingUrl) {
+ const chart_id_list = [];
+ const points_list = [];
+ const series_list = [];
+ // Keep track of block number for each graph(chart)
+ const block_list = [];
+ // Keep track of RANGE of each graph(chart)
+ const RANGE = [];
+ let clientID;
+ // define variables for block event
+ // fig_id - figure_id of blocks,
+ // pnts - Points list of the blocks
+ let fig_id
+ const pnts = [];
+ const name_values_colormap = new Map(); //for storing colormap values of cmatview and cmat3d block
+
+/*
+ * Function to display values of all affich blocks
+ * displayParameter : Contains the data which is display as data of affich
+ * block
+ * blockId : is used to get needed div according to affichm id
+ */
+function create_affich_displaytext (displayParameter, blockId) {
+ $('#img_loader').html(""); // remove loading image once data is received
+ // updating html data of div html for each time change according to each
+ // affich
+ $('#affichdata-'+blockId).html(displayParameter);
+};
+
+// Function to create a new chart
+function create_new_chart (id, no_of_graph, ymin, ymax, xmin, xmax, type_chart, title_text) {
+ /*
+ * id - container id for graph(chart),
+ * no_of_graph - number of graphs in output of a block,
+ * ymin - minimum y-axis value,
+ * ymax - maximum y-axis value,
+ * xmin - minimum x-axis value,
+ * xmax - maximum x-axis value,
+ * type_chart - type of chart to be drawn,
+ * title_text - title to be given to the chart
+ */
+
+ // convert String values to desired datatype
+ xmin = parseFloat(xmin);
+ xmax = parseFloat(xmax);
+ ymin = parseFloat(ymin);
+ ymax = parseFloat(ymax);
+
+ // default value of pointpadding added for ceventscope
+ let pointWidth=0.1;
+ let pointRange = null;
+
+ let lineWidth = 2;
+ if (title_text.substring(0, 5) === "BARXY") {
+ lineWidth = no_of_graph;
+ no_of_graph = 1;
+ } else if (title_text.substring(0, 7) === "CSCOPXY") {
+ // disable line by putting lineWidth as 0
+ lineWidth = 0
+ } else if (title_text.substring(0, 7) === "CANIMXY") {
+ // disable line by putting lineWidth as 0
+ lineWidth = 0
+ } else if (title_text.substring(0, 7) === "CEVSCPE") {
+ // To manipulate the graph width of ceventscope
+ pointWidth = 2;
+ pointRange = 0.05;
+ }
+
+ dispatch(addDatapointChart(id, type_chart, title_text, xmin, ymin, xmax, ymax, pointRange, lineWidth, pointWidth));
+
+ if (title_text.substring(0, 5) !== "BARXY") {
+ chart_id_list.push(id);
+ points_list.push(new Queue());
+ series_list.push([]);
+ }
+};
+
+//To create coloraxis array which will be passed to cmatview chart for heatmap creation
+function get_color_axis_for_points (block_uid) {
+ const color_axis_array = [];
+ const get_hex_color_array = name_values_colormap.get(block_uid);
+ for (let i = 0; i < get_hex_color_array.length; i++) {
+ const color_values = {};
+ const temp = i;
+ color_values["from"] = temp + 1;
+ color_values["to"] = temp + 2;
+ color_values["color"] = get_hex_color_array[i];
+ color_axis_array.push(color_values);
+ }
+ return color_axis_array;
+}
+
+//Gets data (array with x , y and coloraxis values) to be passed to chart points
+function get_points_for_data (data, m, n) {
+ const array_data = [];
+ let i = 12;
+ for (let x = (m-2) ; x >= 0; x--) {
+ for (let y = 0 ; y < (n-1) ; y++) {
+ const data_values = [];
+ data_values[0] = x;
+ data_values[1] = y;
+ data_values[2] = parseInt(data[i]);
+ array_data.push(data_values);
+ i++;
+ }
+ }
+ return array_data;
+}
+
+//Chart function for cmatview which has less than 10*10 matrix size
+function create_chart_for_cmatview (id, m, n, title_text, color_axis) {
+ let xmin = 0;
+ let xmax = m;
+ let ymin = 0;
+ let ymax = n;
+ $('#charts').append("<div id='chart-"+id+"' style = 'height:100%;width:100%'></div>");
+ let elem = $('#chart-'+id.toString());
+ elem.highcharts({
+ tooltip: {
+ enabled: false
+ },
+ chart: {
+ type: 'heatmap'
+ },
+ title: {
+ text: title_text
+ },
+ xAxis: {
+ min: xmin,
+ max: xmax
+ },
+ yAxis: {
+ min: ymin,
+ max: ymax,
+ },
+ plotOptions: {
+ marker: {
+ enabled: false
+ },
+ series: {
+ enableMouseTracking: false
+ }
+ },
+ colorAxis: {
+ dataClasses: color_axis
+ },
+ legend: {
+ enabled: false
+ },
+ series: []
+ });
+
+ chart_id_list.push(id);
+ points_list.push(new Queue());
+ series_list.push([]);
+};
+
+//Chart function for cmatview large data ie matrix more than 10*10 size
+function create_chart_for_large_data_cmatview (id, m, n, title_text, color_axis) {
+ let xmax = m;
+ let ymax = n;
+ $('#charts').append("<div id='chart-"+id+"' style = 'height:100%;width:100%'></div>");
+ let elem = $('#chart-'+id.toString());
+ elem.highcharts({
+ tooltip: {
+ enabled: false
+ },
+ chart: {
+ type: 'heatmap'
+ },
+ boost: {
+ useGPUTranslations: true,
+ usePreallocated: true
+ },
+ title: {
+ text: title_text
+ },
+ xAxis: {
+ min: 0,
+ max: xmax
+ },
+ yAxis: {
+ min: 0,
+ max: ymax
+ },
+ plotOptions: {
+ series: {
+ animation:false,
+ boostThreshold : 400000,
+ turboThreshold : 0,
+ stickyTracking: false,
+ shadow: false
+ },
+ marker: {
+ enabled: false
+ },
+ heatmap: {
+ shadow: false,
+ animation: false
+ }
+ },
+ legend: {
+ enabled: false
+ },
+ colorAxis: {
+ dataClasses: color_axis
+ },
+ series: [{
+ seriesThreshold: 2
+ }]
+ });
+
+ chart_id_list.push(id);
+ points_list.push(new Queue());
+ series_list.push([]);
+};
+
+
+// Function to create a new 3d-chart
+function create_new_chart_3d (id, no_of_graph, xmin, xmax, ymin, ymax, zmin, zmax, type_chart, title_text, alpha, theta) {
+ /*
+ * id - container id for graph(chart),
+ * no_of_graph - number of graphs in output of a block,
+ * ymin - minimum y-axis value,
+ * ymax - maximum y-axis value,
+ * xmin - minimum x-axis value,
+ * xmax - maximum x-axis value,
+ * zmin - minimum z-axis value,
+ * zmax - maximum z-axis value,
+ * type_chart - type of chart to be drawn,
+ * title_text - title to be given to the chart,
+ * alpha - Angle of rotation for graph for 3D chart
+ * theta - Angle of rotation for graph for 3D chart
+ */
+
+ // convert String values to desired datatype
+ xmin = parseFloat(xmin);
+ xmax = parseFloat(xmax);
+ ymin = parseFloat(ymin);
+ ymax = parseFloat(ymax);
+ zmin = parseFloat(zmin);
+ zmax = parseFloat(zmax);
+ // Assigning angle theta of 3D block to beta angle of highchart ( Can be
+ // modified later)
+ let beta = theta;
+ let lineWidth = 1;
+ let radius = 1;
+ if (title_text.substring(0, 9) === "CANIMXY3D") {
+ lineWidth = 0;
+ radius = 3;
+ }
+ $('#charts').append("<div id='chart-"+id.toString()+"' style = 'height:200px'></div>");
+
+ let elem = $('#chart-'+id.toString());
+ // change graph height if block has only 1 output graph
+ if (no_of_graph === 1)
+ elem.css('height', '400px');
+
+ elem.highcharts({
+ chart: {
+ type: type_chart,
+ zoomtype: 'xy',
+ options3d: {
+ enabled: true,
+ alpha: alpha,
+ beta: beta,
+ depth: 100,
+ viewDistance: 100,
+ frame: {
+ bottom: {
+ size: 0,
+ color: '#FFFFFF'
+ },
+ back: {
+ size: 0,
+ color: '#FFFFFF'
+ },
+ side: {
+ size: 0,
+ color: '#FFFFFF'
+ }
+ }
+ }
+ },
+ title: {
+ text: title_text
+ },
+ tooltip: {
+ enabled: false
+ },
+ yAxis: {
+ // Manipulation for showing z axis vertically instead of Y axis
+ // (only for 3D graph).
+ min: zmin,
+ max: zmax,
+ gridLineWidth: 1,
+ tickInterval: 1,
+ title: {
+ rotation: 0,
+ style: {
+ fontWeight: 'bold',
+ fontSize: '15px'
+ },
+ text: 'z'
+ }
+ },
+ xAxis: {
+ min: xmin,
+ max: xmax,
+ tickInterval: 1,
+ gridLineWidth: 1,
+ title: {
+ style: {
+ fontWeight: 'bold',
+ fontSize: '15px'
+ },
+ text: 'x' // title for X for differentiating axis
+ }
+ },
+ zAxis: {
+ // Manipulation for showing y axis values in place of z axis (only
+ // for 3D graph).
+ min: ymin,
+ max: ymax,
+ tickInterval: 1,
+ gridLineWidth: 1,
+ title: {
+ rotation: 300,
+ margin: -30,
+ style: {
+ fontWeight: 'bold',
+ fontSize: '15px'
+ },
+ text: 'y'
+ }
+ },
+ plotOptions: {
+ marker: {
+ enabled: false
+ },
+ series: {
+ lineWidth: lineWidth,
+ states: {
+ hover: {
+ lineWidth: lineWidth
+ }
+ }
+ },
+ scatter: {
+ marker: {
+ radius: radius,
+ states: {
+ hover: {
+ enabled: true,
+ lineColor: 'rgb(100,100,100)'
+ }
+ }
+ }
+ }
+ },
+ series: []
+ });
+
+ chart_id_list.push(id);
+ points_list.push(new Queue());
+ series_list.push([]);
+};
+
+ function streamSimulationResult (streamingUrl) {
+ let block;
+ // Initialise variable for entry condition of creating chart for BARXY and
+ // AFFICH_m
+ let block_entry_BARXY = 1;
+ let cmatview_counter = 0; // counter to know how many line in log
+ let loglines = 0;
+
+ function printloglines () {
+ if (loglines > 0) {
+ console.log(loglines, 'log lines');
+ loglines = 0;
+ }
+ }
+
const sse = new EventSource('/api/' + streamingUrl, { withCredentials: true })
sse.addEventListener('log', e => {
- console.log('log', e);
+ ++loglines;
+
+ let data = e.data.split(' ');
+
+ // store block info. from the data line
+ block = parseInt(data[0]);
+
+ // For BARXY
+ if (block === 11) {
+ let x1 = parseFloat(data[4]);
+ let y1 = parseFloat(data[5]);
+ let x2 = parseFloat(data[6]);
+ let y2 = parseFloat(data[7]);
+
+ if (block_entry_BARXY === 1) {
+ fig_id = data[2];
+
+ create_new_chart(fig_id, data[12], data[10], data[11], data[8], data[9], 'line', data[13]+'-'+fig_id);
+ block_entry_BARXY = block_entry_BARXY + 1;
+ let chart = $('#chart-'+fig_id).highcharts();
+ chart.addSeries({
+ id: fig_id,
+ data: []
+ });
+ }
+
+ pnts.push([x1, y1]);
+ pnts.push([x2, y2]);
+
+ // Ending condition for blocks not having a dataline for 'Ending'
+ if (pnts.length === (this.finalIntegrationTime*10-1)) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", "/endBlock/"+fig_id, true);
+ xhr.send();
+ }
+ } else if (block === 21 || block === 22) {
+ // handle writec_f and writeau_f
+ // create a form and add the filename to it
+ let form = new FormData()
+ form.append('path', data[4]);
+ let xhr = new XMLHttpRequest();
+ xhr.responseType = 'blob';
+ // sending form to get file for download
+ xhr.open("POST", "/downloadfile", true);
+ xhr.onload = function () {
+ if (this.status === 200) {
+ // blob data type to receive the file
+ let blob = this.response;
+ let url = window.URL.createObjectURL(blob);
+ // popup for download option of the file
+ let anchor = document.createElement("a");
+ document.body.appendChild(anchor);
+ anchor.style = "display: none";
+ anchor.href = url;
+ if (block === 21) {
+ anchor.download = "writec-" + clientID + ".datas";
+ } else {
+ anchor.download = "audio-" + clientID + ".au";
+ }
+ anchor.click();
+ document.body.removeChild(anchor);
+ window.URL.revokeObjectURL(url);
+ }
+ };
+ xhr.send(form);
+ let xhr2 = new XMLHttpRequest();
+ xhr2.open("POST", "/deletefile");
+ xhr2.onload = function () {
+ };
+ xhr2.send(form);
+ } else if (block < 5 ||block === 9 ||block === 23 ||block === 12) {
+ // added new condition for ceventscope
+ // process data for 2D-SCOPE blocks
+ let figure_id = 0 ;
+ if (block === 2) { //For cmscope block
+ figure_id = data[4];
+ } else {
+ figure_id = data[2];
+ }
+ let line_id = parseInt(data[6]);
+ let x = parseFloat(data[8]);
+ let y = parseFloat(data[9]);
+ if (chart_id_list.indexOf(figure_id) < 0) {
+ // set default chart type
+
+ // if sink block is CSCOPXY or CANIMXY
+ if (block === 4 || block === 9) {
+ let chart_type = 'scatter';
+ if (block === 4) {
+ create_new_chart(figure_id, data[10], data[13], data[14], data[11], data[12], chart_type, data[15]+'-'+data[2]);
+ } else {
+ create_new_chart(figure_id, data[10], data[13], data[14], data[11], data[12], chart_type, data[16]+'-'+data[2]);
+ }
+ RANGE[chart_id_list.indexOf(figure_id)] = parseFloat(data[12]);
+ } else {
+ // Event Handling block is ceventscope
+ if (block === 23) {
+ let chart_type = 'column';
+ create_new_chart(figure_id, data[10], 0, 1, 0, data[11], chart_type, data[12]+'-'+data[2]);
+ RANGE[chart_id_list.indexOf(figure_id)] = parseFloat(data[11]);
+ } else if (block === 12) {
+ // process data for CMATVIEW blocks
+ let m = data[8];
+ let n = data[10];
+ // let chart_type = 'heatmap';
+ // let title_text = "CMATVIEW-" + figure_id;
+ let color_axis = get_color_axis_for_points(figure_id);
+ if (m*n <= 100) {
+ create_chart_for_cmatview(figure_id, m, n, data[data.length-1]+'-'+figure_id, color_axis);
+ } else {
+ create_chart_for_large_data_cmatview(figure_id, m, n, data[data.length-1]+'-'+figure_id, color_axis);
+ }
+ RANGE[chart_id_list.indexOf(figure_id)] = parseFloat(30);
+ } else {
+ // sink block is not CSCOPXY
+ let chart_type = 'line';
+ create_new_chart(figure_id, data[10], data[11], data[12], 0, data[13], chart_type, data[14]+'-'+data[2]);
+ RANGE[chart_id_list.indexOf(figure_id)] = parseFloat(data[13]);
+ }
+ }
+ }
+ let index = chart_id_list.indexOf(figure_id);
+ // store 2d-data
+ if (block !== 12) {
+ points_list[index].enqueue([line_id, x, y]);
+ addPointToQueue(figure_id, [line_id, x, y]);
+ } else {
+ let values = get_points_for_data(data, data[8], data[10]);
+ cmatview_counter++; // to count lines from log
+ if (cmatview_counter === 1) {
+ //Only add points of line 1, so that no delay in chart appearance)
+ points_list[index].enqueue([line_id, values]);
+ } else if (cmatview_counter < 16) {
+ //Only add points of line which are multiple of 5, till 15 like 5 10 15 (this is to reduce load on browser)
+ let count = cmatview_counter % 5;
+ if (count === 0) {
+ points_list[index].enqueue([line_id, values]);
+ }
+ } else {
+ //Only add points of line which are multiple of 10 but after 16 like 20 30 ... (this is to reduce load on browser)
+ let count = cmatview_counter % 10;
+ if (count === 0) {
+ points_list[index].enqueue([line_id, values]);
+ }
+ }
+ }
+ // store block number for chart creation
+ block_list[index] = block;
+ } else if (block === 5 || block === 10) {
+ // process data for 3D-SCOPE blocks
+
+ let figure_id = data[2];
+ let line_id = parseInt(data[6]);
+ let x = parseFloat(data[8]);
+ let y = parseFloat(data[9]);
+ let z = parseFloat(data[10]);
+ if (chart_id_list.indexOf(figure_id) < 0) {
+ let chart_type = 'scatter';
+ if (block === 10) {
+ create_new_chart_3d(figure_id, data[11], data[12], data[13], data[14], data[15], data[16], data[17], chart_type, data[21]+'-'+data[2], data[18], data[19]);
+ } else {
+ create_new_chart_3d(figure_id, data[11], data[12], data[13], data[14], data[15], data[16], data[17], chart_type, data[20]+'-'+data[2], data[18], data[19]);
+ }
+ }
+ let index = chart_id_list.indexOf(figure_id);
+ // store 3d-data
+ points_list[index].enqueue([line_id, x, y, z]);
+ // store block number for chart creation
+ block_list[index] = block;
+ } else if (block === 13) {
+ // process data for CMAT3D blocks
+ // let block_uid = data[2];
+ // let m = data[8];
+ // let n = data[10];
+ // let xmin = data[12];
+ // let xmax = data[14];
+ // let ymin = data[16];
+ // let ymax = data[18];
+ // let zmin = data[20];
+ // let zmax = data[22];
+ // let alpha = data[24];
+ // let theta = data[26];
+ // Chart function need to be written
+ } else if (block === 20) {
+ // Process data for Affich_m block
+
+ // store length of data for each line
+ let length_of_data = data.length;
+ let block_id = data[2]; // to store block id of affichm block
+ let columns = data[5]; // gets column of matrix
+
+ // below code creates a html code which is table with data in that
+ // (To display it as matrix)
+ let p = "<b>Value of Block : " + data[length_of_data-1] + "-" + block_id + "</b> (Refer to label on block)<br><br><table style='width:100%'><tr>";
+ let count = 1;
+ for (let k = 6; k < (length_of_data-1); k++) {
+ if (data[k].length !== 0) {
+ p += "<td>";
+ p += data[k];
+ if ((count % columns) === 0) {
+ // to break into new column of table
+ p += "</td></tr><tr>";
+ } else {
+ p += "</td>";
+ }
+ count++;
+ }
+ }
+ p += "</table>";
+ // to send data to display result
+ create_affich_displaytext(p, block_id);
+ }
}, false)
sse.addEventListener('duplicate', e => {
+ printloglines();
console.log('duplicate', e);
}, false)
- sse.addEventListener('DONE', e => {
- console.log('DONE', e);
+ sse.addEventListener('DONE', () => {
+ printloglines();
+ console.log('DONE');
sse.close();
+ setStatusDone();
}, false)
sse.addEventListener('ERROR', e => {
+ printloglines();
console.log('ERROR', e);
sse.close();
}, false)
sse.addEventListener('MESSAGE', e => {
+ printloglines();
console.log('MESSAGE', e);
sse.close();
}, false)
@@ -152,6 +752,8 @@ export default function SimulationProperties () {
case 'STREAMING':
streamSimulationResult(streamingUrl)
+ setIsResult(true)
+ dispatch(setResultGraph(null))
break
default:
@@ -168,7 +770,7 @@ export default function SimulationProperties () {
for (let i = 0; i < data.length; i++) {
simResultGraph.labels[0] = data[i].labels[0]
const lab = data[i].labels
- // lab is an array containeing labels names ['time','abc','def']
+ // lab is an array containeing labels names ['time', 'abc', 'def']
simResultGraph.x_points = data[0].x
// labels
@@ -241,7 +843,11 @@ export default function SimulationProperties () {
return (
<>
<div className={classes.SimulationOptions}>
- <SimulationScreen open={simulateOpen} isResult={isResult} close={handleSimulateClose} />
+ {
+ simulateOpen
+ ? <SimulationScreen2 open={simulateOpen} isResult={isResult} close={handleSimulateClose} />
+ : <div />
+ }
{/* Simulation modes list */}
<List>
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js
index 1949d246..26aa230f 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js
@@ -1,23 +1,23 @@
import React from 'react'
import PropTypes from 'prop-types'
import {
- Slide,
+ AppBar,
Button,
+ Container,
Dialog,
- AppBar,
- Toolbar,
- IconButton,
- Typography,
Grid,
+ IconButton,
TextField,
Paper,
- Container,
+ Slide,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
- TableRow
+ TableRow,
+ Toolbar,
+ Typography
} from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import CloseIcon from '@material-ui/icons/Close'
@@ -52,8 +52,8 @@ const useStyles = makeStyles((theme) => ({
// Screen to display simulation result in graph or text format
export default function SimulationScreen ({ open, close, isResult }) {
const classes = useStyles()
- const result = useSelector((state) => state.simulationReducer)
- const stitle = useSelector((state) => state.netlistReducer.title)
+ const result = useSelector(state => state.simulationReducer)
+ const stitle = useSelector(state => state.netlistReducer.title)
const [xscale, setXScale] = React.useState('si')
const [yscale, setYScale] = React.useState('si')
const [precision, setPrecision] = React.useState(5)
@@ -112,7 +112,7 @@ export default function SimulationScreen ({ open, close, isResult }) {
justify='center'
alignItems='center'
>
- {/* Card to display simualtion result screen header */}
+ {/* Card to display simulation result screen header */}
<Grid item xs={12} sm={12}>
<Paper className={classes.paper}>
<Typography variant='h2' align='center' gutterBottom>
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen2.js b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen2.js
new file mode 100644
index 00000000..19d8d4c9
--- /dev/null
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen2.js
@@ -0,0 +1,149 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import {
+ AppBar,
+ Button,
+ Container,
+ Dialog,
+ Grid,
+ IconButton,
+ Paper,
+ Slide,
+ Toolbar,
+ Typography
+} from '@material-ui/core'
+import { makeStyles } from '@material-ui/core/styles'
+import CloseIcon from '@material-ui/icons/Close'
+import { useSelector } from 'react-redux'
+
+import Graph2 from '../Shared/Graph2'
+
+const Transition = React.forwardRef(function Transition (props, ref) {
+ return <Slide direction='up' ref={ref} {...props} />
+})
+
+const useStyles = makeStyles((theme) => ({
+ appBar: {
+ position: 'relative'
+ },
+ title: {
+ marginLeft: theme.spacing(2),
+ flex: 1
+ },
+ header: {
+ padding: theme.spacing(5, 0, 6),
+ color: '#fff'
+ },
+ paper: {
+ padding: theme.spacing(2),
+ textAlign: 'center',
+ backgroundColor: '#404040',
+ color: '#fff'
+ }
+}))
+
+// Screen to display simulation result in graph or text format
+export default function SimulationScreen2 ({ open, close, isResult }) {
+ const classes = useStyles()
+ const result = useSelector(state => state.simulationReducer)
+ const datapoint = useSelector(state => state.datapointReducer)
+ const stitle = useSelector(state => state.netlistReducer.title)
+ const ref = React.useRef(null);
+
+ const typography1 = 'SOMETHING WENT WRONG. Please Check The Simulation Parameters.'
+ const typography2 = 'SOMETHING WENT WRONG. Please Check The Simulation Parameters And ' + process.env.REACT_APP_DIAGRAM_NAME + '.'
+ return (
+ <div>
+ <Dialog
+ fullScreen open={open} onClose={close} TransitionComponent={Transition} PaperProps={{
+ style: {
+ backgroundColor: '#4d4d4d',
+ boxShadow: 'none'
+ }
+ }}
+ >
+ <AppBar position='static' elevation={0} className={classes.appBar}>
+ <Toolbar variant='dense' style={{ backgroundColor: '#404040' }}>
+ <IconButton edge='start' color='inherit' onClick={close} aria-label='close'>
+ <CloseIcon />
+ </IconButton>
+ <Typography variant='h6' className={classes.title}>
+ Simulation Result
+ </Typography>
+ <Button autoFocus color='inherit' onClick={close}>
+ close
+ </Button>
+ </Toolbar>
+ </AppBar>
+ <Container maxWidth='lg' className={classes.header}>
+ <Grid
+ container
+ spacing={3}
+ direction='row'
+ justify='center'
+ alignItems='center'
+ >
+ {/* Card to display simulation result screen header */}
+ <Grid item xs={12} sm={12}>
+ <Paper className={classes.paper}>
+ <Typography variant='h2' align='center' gutterBottom>
+ {result.title}
+ </Typography>
+ <Typography variant='h5' align='center' component='p' gutterBottom>
+ Simulation Result for {stitle} *
+ </Typography>
+ </Paper>
+ </Grid>
+
+ {/* Display graph result */}
+ {isResult === true && datapoint.datapointId !== 0
+ ? <>
+ {
+ (result.graph !== {} && result.isGraph === 'true')
+ ? <Grid item xs={12} sm={12}>
+ <Paper className={classes.paper}>
+ <Typography variant='h4' align='center' gutterBottom>
+ GRAPH OUTPUT
+ </Typography>
+ <Graph2
+ ref={ref}
+ datapoint={datapoint}
+ />
+ </Paper>
+ </Grid>
+ : (result.isGraph === 'true') ? <span>{typography1}</span> : <span />
+ }
+
+ {/* Display text result */}
+ {
+ (result.isGraph === 'false')
+ ? <Grid item xs={12} sm={12}>
+ <Paper className={classes.paper}>
+ <Typography variant='h4' align='center' gutterBottom>
+ OUTPUT
+ </Typography>
+ </Paper>
+ </Grid>
+ : <span />
+ }
+ </>
+ : <Grid item xs={12} sm={12}>
+ <Paper className={classes.paper}>
+ <Typography variant='h6' align='center' gutterBottom>
+ {typography2} {/* Error handling message in case of null result */}
+ </Typography>
+ </Paper>
+ </Grid>
+ }
+ </Grid>
+ </Container>
+ </Dialog>
+ </div>
+ )
+}
+
+SimulationScreen2.propTypes = {
+ open: PropTypes.bool,
+ close: PropTypes.func,
+ isResult: PropTypes.bool
+}
diff --git a/blocks/eda-frontend/src/components/Shared/Graph2.js b/blocks/eda-frontend/src/components/Shared/Graph2.js
new file mode 100644
index 00000000..e8ea01e1
--- /dev/null
+++ b/blocks/eda-frontend/src/components/Shared/Graph2.js
@@ -0,0 +1,139 @@
+import React, { Component } from 'react'
+import Highcharts from 'highcharts';
+import HighchartsReact from 'highcharts-react-official';
+import Chart from 'chart.js'
+import 'chartjs-plugin-colorschemes'
+import { Queue } from '../../utils/Queue'
+
+// Chart Style Options
+Chart.defaults.global.defaultFontColor = '#e6e6e6'
+
+let pointList = new Queue();
+let statusDone = false;
+
+export function addPointToQueue (id, point) {
+ pointList.enqueue(point);
+}
+
+export function setStatusDone () {
+ statusDone = true;
+}
+
+class Graph2 extends Component {
+ constructor(props) {
+ super(props)
+ const datapoint = props.datapoint;
+ this.state = {
+ options: {
+ chart: {
+ events: {
+ load: function () {
+ // set up the updating of the chart each second
+ let chart = this;
+ let series = this.series[0];
+ let starttime = Date.now();
+ function addPoints () {
+ while (!pointList.isEmpty()) {
+ let point = pointList.peek();
+ let x = parseFloat(point[1]);
+ let timediff = (starttime + x * 1000) - Date.now();
+ if (timediff > 0) {
+ setInterval(addPoints, timediff);
+ return;
+ }
+ let y = parseFloat(point[2]);
+ series.addPoint([x, y]);
+ pointList.dequeue();
+ }
+ chart.redraw();
+ if (!pointList.isEmpty() || !statusDone) {
+ setInterval(addPoints, 1000);
+ }
+ }
+ addPoints();
+ }
+ },
+ type: datapoint.datapointType,
+ animation: false,
+ zoomType: 'xy'
+ },
+ title: {
+ text: datapoint.datapointTitle
+ },
+ xAxis: {
+ title: {
+ text: 'x'
+ },
+ tickInterval: 2,
+ startOnTick: true,
+ endOnTick: true,
+ showLastLabel: true,
+ min: parseFloat(datapoint.datapointXMin),
+ max: parseFloat(datapoint.datapointXMax)
+ },
+ yAxis: {
+ title: {
+ text: 'y'
+ },
+ min: parseFloat(datapoint.datapointYMin),
+ max: parseFloat(datapoint.datapointYMax),
+ plotLines: [{
+ width: 2,
+ color: '#808080'
+ }]
+ },
+ plotOptions: {
+ marker: {
+ enabled: false
+ },
+ column: {
+ pointPlacement: 0,
+ pointRange: datapoint.datapointPointRange
+ },
+ series: {
+ lineWidth: datapoint.datapointLineWidth,
+ pointWidth: datapoint.datapointPointWidth,
+ enableMouseTracking: false,
+ states: {
+ hover: {
+ lineWidth: datapoint.datapointLineWidth
+ }
+ }
+ },
+ scatter: {
+ marker: {
+ radius: 1,
+ states: {
+ hover: {
+ enabled: true,
+ lineColor: 'rgb(100,100,100)'
+ }
+ }
+ }
+ }
+ },
+ legend: {
+ enabled: false
+ },
+ tooltip: {
+ enabled: false
+ },
+ series: [
+ {
+ data: []
+ }
+ ]
+ }
+ }
+ }
+
+ render () {
+ return (
+ <div>
+ <HighchartsReact highcharts={Highcharts} options={this.state.options} />
+ </div>
+ )
+ }
+}
+
+export default Graph2
diff --git a/blocks/eda-frontend/src/components/Simulator/SimulationScreen.js b/blocks/eda-frontend/src/components/Simulator/SimulationScreen.js
index 41ebd998..f48fc8e9 100644
--- a/blocks/eda-frontend/src/components/Simulator/SimulationScreen.js
+++ b/blocks/eda-frontend/src/components/Simulator/SimulationScreen.js
@@ -48,7 +48,7 @@ const useStyles = makeStyles((theme) => ({
color: '#fff'
}
}))
-// {details:{},title:''} simResults
+// { details: {}, title: '' } simResults
export default function SimulationScreen ({ open, close, isResult }) {
const classes = useStyles()
const result = useSelector((state) => state.simulationReducer)
diff --git a/blocks/eda-frontend/src/pages/Simulator.js b/blocks/eda-frontend/src/pages/Simulator.js
index bbd56ec4..833d442b 100644
--- a/blocks/eda-frontend/src/pages/Simulator.js
+++ b/blocks/eda-frontend/src/pages/Simulator.js
@@ -113,7 +113,7 @@ export default function Simulator () {
for (let i = 0; i < data.length; i++) {
simResultGraph.labels[0] = data[i].labels[0]
const lab = data[i].labels
- // lab is an array containeing labels names ['time','abc','def']
+ // lab is an array containeing labels names ['time', 'abc', 'def']
simResultGraph.x_points = data[0].x
// labels
diff --git a/blocks/eda-frontend/src/redux/actions/actions.js b/blocks/eda-frontend/src/redux/actions/actions.js
index 9f9b25ad..4fc94ec3 100644
--- a/blocks/eda-frontend/src/redux/actions/actions.js
+++ b/blocks/eda-frontend/src/redux/actions/actions.js
@@ -15,11 +15,15 @@ export const SET_NETLIST = 'SET_NETLIST'
export const SET_TITLE = 'SET_TITLE'
export const SET_MODEL = 'SET_MODEL'
-// Actions for handling simualtion result display
+// Actions for handling simulation result display
export const SET_RESULT_TITLE = 'SET_RESULT_TITLE'
export const SET_RESULT_GRAPH = 'SET_RESULT_GRAPH'
export const SET_RESULT_TEXT = 'SET_RESULT_TEXT'
+// Actions for handling simulation result display
+export const ADD_DATAPOINT_CHART = 'ADD_DATAPOINT_CHART'
+export const ADD_DATAPOINT_POINT = 'ADD_DATAPOINT_POINT'
+
// Actions for handling user authentication and registeration
export const USER_LOADING = 'USER_LOADING'
export const USER_LOADED = 'USER_LOADED'
diff --git a/blocks/eda-frontend/src/redux/actions/datapointActions.js b/blocks/eda-frontend/src/redux/actions/datapointActions.js
new file mode 100644
index 00000000..2053dbea
--- /dev/null
+++ b/blocks/eda-frontend/src/redux/actions/datapointActions.js
@@ -0,0 +1,31 @@
+import * as actions from './actions'
+
+// Actions to update title for simulation result screen
+export const addDatapointChart = (id, type, title, xMin, yMin, xMax, yMax, pointRange, lineWidth, pointWidth) => (dispatch) => {
+ dispatch({
+ type: actions.ADD_DATAPOINT_CHART,
+ payload: {
+ datapointId: id,
+ datapointType: type,
+ datapointTitle: title,
+ datapointXMin: xMin,
+ datapointYMin: yMin,
+ datapointXMax: xMax,
+ datapointYMax: yMax,
+ datapointPointRange: pointRange,
+ datapointLineWidth: lineWidth,
+ datapointPointWidth: pointWidth
+ }
+ })
+}
+
+// Action to update store with graphical result points
+export const addDatapointPoint = (id, point) => (dispatch) => {
+ dispatch({
+ type: actions.ADD_DATAPOINT_POINT,
+ payload: {
+ datapointId: id,
+ datapointPoint: point
+ }
+ })
+}
diff --git a/blocks/eda-frontend/src/redux/actions/index.js b/blocks/eda-frontend/src/redux/actions/index.js
index b13059d3..2a851b78 100644
--- a/blocks/eda-frontend/src/redux/actions/index.js
+++ b/blocks/eda-frontend/src/redux/actions/index.js
@@ -3,6 +3,7 @@ export * from './schematicEditorActions'
export * from './componentPropertiesActions'
export * from './netlistActions'
export * from './simulationActions'
+export * from './datapointActions'
export * from './authActions'
export * from './saveSchematicActions'
export * from './dashboardActions'
diff --git a/blocks/eda-frontend/src/redux/reducers/datapointReducer.js b/blocks/eda-frontend/src/redux/reducers/datapointReducer.js
new file mode 100644
index 00000000..99bff1a7
--- /dev/null
+++ b/blocks/eda-frontend/src/redux/reducers/datapointReducer.js
@@ -0,0 +1,44 @@
+import * as actions from '../actions/actions'
+
+const initialState = {
+ datapointId: 0,
+ datapointType: '',
+ datapointTitle: '',
+ datapointXMin: 0,
+ datapointYMin: 0,
+ datapointXMax: 0,
+ datapointYMax: 0,
+ datapointPointRange: null,
+ datapointLineWidth: 2,
+ datapointPointWidth: 2,
+ datapointPoint: []
+}
+
+export default function (state = initialState, action) {
+ switch (action.type) {
+ case actions.ADD_DATAPOINT_CHART: {
+ return {
+ ...state,
+ datapointId: action.payload.datapointId,
+ datapointType: action.payload.datapointType,
+ datapointTitle: action.payload.datapointTitle,
+ datapointXMin: action.payload.datapointXMin,
+ datapointYMin: action.payload.datapointYMin,
+ datapointXMax: action.payload.datapointXMax,
+ datapointYMax: action.payload.datapointYMax,
+ datapointPointRange: action.payload.datapointPointRange,
+ datapointLineWidth: action.payload.datapointLineWidth,
+ datapointPointWidth: action.payload.datapointPointWidth
+ }
+ }
+ case actions.ADD_DATAPOINT_POINT: {
+ return {
+ ...state,
+ datapointPoint: action.payload.datapointPoint
+ }
+ }
+
+ default:
+ return state
+ }
+}
diff --git a/blocks/eda-frontend/src/redux/reducers/index.js b/blocks/eda-frontend/src/redux/reducers/index.js
index a694d2b2..59fab1ed 100644
--- a/blocks/eda-frontend/src/redux/reducers/index.js
+++ b/blocks/eda-frontend/src/redux/reducers/index.js
@@ -3,6 +3,7 @@ import schematicEditorReducer from './schematicEditorReducer'
import componentPropertiesReducer from './componentPropertiesReducer'
import netlistReducer from './netlistReducer'
import simulationReducer from './simulationReducer'
+import datapointReducer from './datapointReducer'
import authReducer from './authReducer'
import saveSchematicReducer from './saveSchematicReducer'
import dashboardReducer from './dashboardReducer'
@@ -11,6 +12,7 @@ export default combineReducers({
componentPropertiesReducer,
netlistReducer,
simulationReducer,
+ datapointReducer,
authReducer,
saveSchematicReducer,
dashboardReducer
diff --git a/blocks/eda-frontend/src/utils/Queue.js b/blocks/eda-frontend/src/utils/Queue.js
new file mode 100644
index 00000000..4ffea3d5
--- /dev/null
+++ b/blocks/eda-frontend/src/utils/Queue.js
@@ -0,0 +1,3 @@
+/* eslint-disable */
+//code.stephenmorley.org
+export function Queue(){let a=[],b=0;this.getLength=function(){return a.length-b};this.isEmpty=function(){return 0===a.length};this.enqueue=function(b){a.push(b)};this.dequeue=function(){if(0!==a.length){const c=a[b];if(2*(++b)>=a.length){a=a.slice(b);b=0};return c}};this.peek=function(){return 0<a.length?a[b]:void 0}}; \ No newline at end of file
diff --git a/blocks/eda-frontend/src/utils/Sigbuilder-graph.js b/blocks/eda-frontend/src/utils/Sigbuilder-graph.js
new file mode 100644
index 00000000..c467ec3a
--- /dev/null
+++ b/blocks/eda-frontend/src/utils/Sigbuilder-graph.js
@@ -0,0 +1,322 @@
+import mxGraphFactory from 'mxgraph'
+import Highcharts from 'highcharts'
+import { getmethod, showModalWindow } from './dependencies'
+
+const {
+ mxEvent
+} = new mxGraphFactory()
+
+export const graphSigbuilder = ""
+export let sigbuilderGraph = ""
+
+let wind = ""
+
+// Function to create a chart with responsive points for Sigbuilder
+function createDraggablePointsChartSigbuilder (graphParameters, pointsHistory, xmin, xmax, ymin, ymax, chartType, points, method, xmaxtitle, step, stepname) {
+ graphParameters.mtd = method
+ const subtitle = updateSubtitleForSigbuilderGraph(points, graphParameters.mtd, xmaxtitle, graphParameters.PeriodicOption)
+ pointsHistory.push(graphParameters.graphPoints.slice())
+
+ sigbuilderGraph = Highcharts.chart('drag_sig_chart', {
+ chart: {
+ type: chartType,
+ animation: false,
+ events: {
+ click: function (e) {
+ const xValue = e.xAxis[0].value
+ const yValue = e.yAxis[0].value
+ addPointsOnChart(graphParameters, pointsHistory, xValue, yValue)
+ }
+ }
+ },
+ tooltip: {
+ enabled: false
+ },
+ title: {
+ text: ""
+ },
+ subtitle: {
+ text: subtitle
+ },
+
+ yAxis: {
+ title: {
+ text: 'Output'
+ },
+ min: parseFloat(ymin),
+ max: parseFloat(ymax),
+ gridLineWidth: 1,
+ gridLineDashStyle: 'dash'
+ },
+
+ xAxis: {
+ title: {
+ text: 'time'
+ },
+ min: parseFloat(xmin),
+ max: parseFloat(xmax),
+ gridLineWidth: 1,
+ gridLineDashStyle: 'dash'
+ },
+
+ plotOptions: {
+ series: {
+ point: {
+ events: {
+ drag: function (e) {
+ if (e.y >= ymax) {
+ this.y = ymax
+ return false
+ }
+ if (e.y <= ymin) {
+ this.y = ymin
+ return false
+ }
+ if (e.x >= xmax) {
+ this.x = xmax
+ return false
+ }
+ if (e.x <= xmin) {
+ this.x = xmin
+ return false
+ }
+ },
+ drop: function (e) {
+ pointsHistory.push(graphParameters.graphPoints.slice())
+ },
+ dblclick: function (e) {
+ const graphObject = e
+ editPointsValue(graphObject, graphParameters, pointsHistory)
+ },
+ contextmenu: function (e) {
+ const graphObject = e
+ removePointsFromChart(graphObject, graphParameters, pointsHistory)
+ }
+ },
+ stickyTracking: false
+ },
+ column: {
+ stacking: 'normal'
+ },
+ marker: {
+ enabled: true,
+ symbol: 'url(../images/plus-icon.png)'
+ }
+ }
+ },
+ series: [{
+ draggableX: true,
+ draggableY: true,
+ showInLegend: false,
+ data: graphParameters.graphPoints,
+ step: step,
+ name: stepname
+ }]
+ })
+}
+
+export function updateSubtitleForSigbuilderGraph (points, method, xmaxtitle, periodicFlag) {
+ let subTitle = ""
+ if (periodicFlag === "y") {
+ subTitle = "<b>" + points + " points, Method: " + getmethod(method) + ", periodic, T = " + xmaxtitle + "</b>"
+ } else {
+ subTitle = "<b>" + points + " points, Method: " + getmethod(method) + ", aperiodic</b>"
+ }
+ return subTitle
+}
+
+function autoscaleFunctionalityForGraph (graphParameters, pointsHistory) {
+ // Added for postive/maximum value autoscale functionality
+ const maxXValueNew = sigbuilderGraph.xAxis[0].getExtremes().dataMax // get max x point's value
+ const minXValueNew = sigbuilderGraph.xAxis[0].getExtremes().dataMin // get min x point's value
+ const maxYValueNew = sigbuilderGraph.yAxis[0].getExtremes().dataMax // get max y point's value
+ let minYValueNew = sigbuilderGraph.yAxis[0].getExtremes().dataMin // get min y point's value
+ const diffX = ((Math.abs(maxXValueNew - minXValueNew)) / 100) * 10
+ const diffY = ((Math.abs(maxYValueNew - minYValueNew)) / 100) * 10
+ graphParameters.xmin = 0 // set min x axis value
+ graphParameters.xmax = maxXValueNew + diffX // set max x axis value
+ if (minYValueNew > 0) {
+ minYValueNew = 0
+ }
+ graphParameters.ymin = minYValueNew - diffY // set min y axis value
+ graphParameters.ymax = maxYValueNew + diffY // set max y axis value
+ graphParameters.points = graphParameters.graphPoints.length
+ createDraggablePointsChartSigbuilder(graphParameters, pointsHistory, graphParameters.xmin, graphParameters.xmax, graphParameters.ymin, graphParameters.ymax, graphParameters.chartType, graphParameters.points, graphParameters.mtd, graphParameters.xmaxTitle, graphParameters.step, graphParameters.stepname)
+}
+
+export function editPointsValue (graphObject, graphParameters, pointsHistory) {
+ document.getElementById("messageLabel").innerHTML = ""
+ // Making graph window inaccessible
+ const graphWind = document.getElementById("graphcontentwind")
+ graphWind.style.pointerEvents = "none"
+ // Create basic structure for the form
+ const content = document.createElement('div')
+ content.setAttribute("id", "editCoordinates")
+
+ // Add Form
+ const myform = document.createElement("form")
+ myform.method = "post"
+ myform.id = "formEditCoordinate"
+ myform.style.padding = "10px"
+
+ const titlelabel = document.createElement('span')
+ titlelabel.innerHTML = "Enter new x and y"
+ myform.appendChild(titlelabel)
+ // Line break
+ const linebreak = document.createElement('br')
+ myform.appendChild(linebreak)
+ myform.appendChild(linebreak)
+
+ const keys = Object.keys(graphObject.point.options)
+ const len = keys.length
+ for (let i = 0; i < len; i++) {
+ // Input Title
+ const namelabel = document.createElement('label')
+ namelabel.innerHTML = keys[i].toString()
+ namelabel.style.marginLeft = "30px"
+ myform.appendChild(namelabel)
+
+ let value = 0
+ if (((graphObject.point.options[keys[i]]).toString()).includes(".")) {
+ value = (graphObject.point.options[keys[i]]).toFixed(6)
+ } else {
+ value = (graphObject.point.options[keys[i]])
+ }
+ // Input
+ const input = document.createElement("input")
+ input.name = "edit_" + keys[i]
+ input.value = value
+ input.setAttribute("id", "edit_" + keys[i])
+ input.setAttribute("class", "fieldInput")
+ myform.appendChild(input)
+
+ myform.appendChild(linebreak)
+ myform.appendChild(linebreak)
+ }
+
+ myform.appendChild(linebreak)
+
+ // Button - Cancel
+ const cancelBtn = document.createElement("button")
+ cancelBtn.style.cssFloat = "right"
+ cancelBtn.innerHTML = 'Cancel'
+ cancelBtn.type = "button"
+ cancelBtn.name = "Cancel"
+ myform.appendChild(cancelBtn)
+
+ // Button - OK
+ const okBtn = document.createElement("button")
+ okBtn.style.cssFloat = "right"
+ okBtn.style.marginRight = "20px"
+ okBtn.innerHTML = 'OK'
+ okBtn.type = "button"
+ okBtn.name = "OK"
+
+ myform.appendChild(okBtn)
+ content.appendChild(myform)
+ const height = 150
+ wind = showModalWindow(graphSigbuilder, 'Scilab Multiple Values Request', content, 200, height)
+ wind.addListener(mxEvent.DESTROY, function (evt) {
+ graphWind.style.pointerEvents = "auto"
+ })
+ // Executes when button 'cancelBtn' is clicked
+ cancelBtn.onclick = function () {
+ document.getElementById("messageLabel").innerHTML = ""
+ graphWind.style.pointerEvents = "auto"
+ wind.destroy()
+ }
+ // Executes when button 'okBtn' is clicked
+ okBtn.onclick = function () {
+ let xValue = parseFloat(document.getElementById("edit_x").value)
+ if (xValue < 0) {
+ xValue = 0
+ }
+ const yValue = parseFloat(document.getElementById("edit_y").value)
+ const points = graphParameters.graphPoints
+ const xArry = []
+ for (let i = 0; i < points.length; i++) {
+ xArry[i] = points[i][0]
+ }
+ xArry[points.length] = xValue
+ const result = checkDuplicateXValues(xArry)
+ const mtdCheck = [0, 1, 2].includes(graphParameters.mtd)
+ if (result) {
+ removePointsFromChart(graphObject, graphParameters, pointsHistory)
+ addPointsOnChart(graphParameters, pointsHistory, xValue, yValue)
+ autoscaleFunctionalityForGraph(graphParameters, pointsHistory)
+ document.getElementById("messageLabel").innerHTML = ""
+ graphWind.style.pointerEvents = "auto"
+ wind.destroy()
+ } else {
+ if (mtdCheck) {
+ removePointsFromChart(graphObject, graphParameters, pointsHistory)
+ addPointsOnChart(graphParameters, pointsHistory, xValue, yValue)
+ autoscaleFunctionalityForGraph(graphParameters, pointsHistory)
+ document.getElementById("messageLabel").innerHTML = ""
+ graphWind.style.pointerEvents = "auto"
+ wind.destroy()
+ } else {
+ document.getElementById("messageLabel").innerHTML = "ERROR IN SPLINE : " + getmethod(graphParameters.mtd)
+ wind.destroy()
+ graphWind.style.pointerEvents = "auto"
+ throw "incorrect"
+ }
+ }
+ }
+}
+
+export function removePointsFromChart (graphObject, graphParameters, pointsHistory) {
+ const counter = graphObject.point.index
+ sigbuilderGraph.series[0].data[counter].remove()
+ pointsHistory.push(graphParameters.graphPoints.slice())
+ graphParameters.points = sigbuilderGraph.series[0].data.length
+ graphParameters.xmaxTitle = sigbuilderGraph.xAxis[0].getExtremes().dataMax.toFixed(6)
+ sigbuilderGraph.setTitle(null, { text: updateSubtitleForSigbuilderGraph(graphParameters.points, graphParameters.mtd, graphParameters.xmaxTitle, graphParameters.PeriodicOption) })
+}
+
+export function addPointsOnChart (graphParameters, pointsHistory, xValue, yValue) {
+ document.getElementById("messageLabel").innerHTML = ""
+ if (xValue === 0 && yValue === 0) {
+ graphParameters.flag_for_zeros = true
+ }
+ const points = graphParameters.graphPoints
+ const xArry = []
+ for (let i = 0; i < points.length; i++) {
+ xArry[i] = points[i][0]
+ }
+ xArry[points.length] = xValue
+ const result = checkDuplicateXValues(xArry)
+ const mtdCheck = [0, 1, 2].includes(graphParameters.mtd)
+ if (result) {
+ sigbuilderGraph.series[0].addPoint([xValue, yValue])
+ pointsHistory.push(graphParameters.graphPoints.slice())
+ graphParameters.points = sigbuilderGraph.series[0].data.length
+ graphParameters.xmaxTitle = sigbuilderGraph.xAxis[0].getExtremes().dataMax.toFixed(6)
+ sigbuilderGraph.setTitle(null, { text: updateSubtitleForSigbuilderGraph(graphParameters.points, graphParameters.mtd, graphParameters.xmaxTitle, graphParameters.PeriodicOption) })
+ } else {
+ if (mtdCheck) {
+ sigbuilderGraph.series[0].addPoint([xValue, yValue])
+ pointsHistory.push(graphParameters.graphPoints.slice())
+ graphParameters.points = sigbuilderGraph.series[0].data.length
+ graphParameters.xmaxTitle = sigbuilderGraph.xAxis[0].getExtremes().dataMax.toFixed(6)
+ sigbuilderGraph.setTitle(null, { text: updateSubtitleForSigbuilderGraph(graphParameters.points, graphParameters.mtd, graphParameters.xmaxTitle, graphParameters.PeriodicOption) })
+ } else {
+ document.getElementById("messageLabel").innerHTML = "ERROR IN SPLINE : " + getmethod(graphParameters.mtd)
+ throw "incorrect"
+ }
+ }
+}
+
+function checkDuplicateXValues (xxArry) {
+ const arrayForCompare = []
+ const result = xxArry.slice(0).every(function (item, index, array) {
+ if (arrayForCompare.indexOf(item) > -1) {
+ array.length = 0
+ return false
+ } else {
+ arrayForCompare.push(item)
+ return true
+ }
+ })
+ return result
+}
diff --git a/blocks/eda-frontend/src/utils/dependencies.js b/blocks/eda-frontend/src/utils/dependencies.js
new file mode 100644
index 00000000..5f4a65ce
--- /dev/null
+++ b/blocks/eda-frontend/src/utils/dependencies.js
@@ -0,0 +1,153 @@
+import mxGraphFactory from 'mxgraph'
+
+const {
+ mxClient,
+ mxUtils,
+ mxEvent,
+ mxDivResizer,
+ mxWindow,
+ mxEffects,
+ mxCodec
+} = new mxGraphFactory()
+
+// Added to handle ordering for a few blocks.
+
+window.inBitMap = '0'
+window.outBitMap = '0'
+
+export function showModalWindow (graph, title, content, width, height) {
+ const background = document.createElement('div')
+ background.style.position = 'absolute'
+ background.style.left = '0px'
+ background.style.top = '0px'
+ background.style.right = '0px'
+ background.style.bottom = '0px'
+ background.style.background = 'black'
+ mxUtils.setOpacity(background, 50)
+ document.body.appendChild(background)
+
+ if (mxClient.IS_IE) {
+ new mxDivResizer(background)
+ }
+
+ const x = Math.max(0, document.body.scrollWidth / 2 - width / 2)
+ const y = Math.max(10, (document.body.scrollHeight || document.documentElement.scrollHeight) / 2 - height * 2 / 3)
+ const wind = new mxWindow(title, content, x, y, width, height, false, true)
+ wind.setClosable(true)
+
+ // Fades the background out after after the window has been closed
+ wind.addListener(mxEvent.DESTROY, function (evt) {
+ graph.setEnabled(true)
+ mxEffects.fadeOut(background, 50, true, 10, 30, true)
+ })
+
+ graph.setEnabled(false)
+ graph.tooltipHandler.hide()
+ wind.setVisible(true)
+ return wind
+}
+
+export function updateDetails (graph, cell, details, detailsInstance, styleName, geometryCell, create = false) {
+ const enc = new mxCodec(mxUtils.createXmlDocument())
+ const node = enc.encode(details)
+
+ const fullStyleName = styleName
+ if (styleName != null) {
+ const idx = styleName.indexOf(';')
+ if (styleName.startsWith("SELF_SWITCH")) {
+ const stateOpen = detailsInstance.stateOpen
+ styleName = stateOpen ? "SELF_SWITCH_OFF" : "SELF_SWITCH_ON"
+ } else {
+ if (idx !== -1) {
+ styleName = styleName.substring(0, idx)
+ }
+ }
+ }
+
+ const stylesheet = graph.getStylesheet()
+ const style = stylesheet.styles[styleName]
+
+ const dimensionForBlock = detailsInstance.getDimensionForDisplay()
+ let height = dimensionForBlock.height
+ let width = dimensionForBlock.width
+ if (geometryCell.height != null && geometryCell.height > 1) {
+ height = geometryCell.height
+ }
+ if (geometryCell.width != null && geometryCell.width > 1) {
+ width = geometryCell.width
+ }
+
+ /*
+ * When a particular block is loaded for the first time, the image in the
+ * style of the block will be a path to the image. Set the label in the
+ * style property of the block has a html image, and set the image in the
+ * style property as null
+ *
+ * NOTE: Since the image of any block need not be changed for every
+ * movement of that block, the image must be set only once.
+ */
+ if (style != null && style.image != null) {
+ // Make label as a image html element
+ const label = '<img src="' + style.image + '" height="' + (height * 0.9) + '" width="' + (width * 0.9) + '">'
+
+ // Set label
+ style.label = label
+ style.imagePath = style.image
+ // Set image as null
+ style.image = null
+
+ // Add the label as a part of node
+ node.setAttribute('label', label)
+ }
+
+ /*
+ * If a particular block with image tag in its style property has been
+ * invoked already, the image tag would be null for any successive
+ * instances of the same block. Hence, set the label from the label tag in
+ * style which was set when that blockModel was invoked on the first time.
+ */
+ if (style != null && style.label != null) {
+ // Set label from the label field in the style property
+ node.setAttribute('label', style.label)
+ }
+
+ const parent = graph.getDefaultParent()
+ node.setAttribute('parent', parent.id)
+
+ if (create) {
+ return graph.insertVertex(parent, null, node, geometryCell.x, geometryCell.y, width, height, fullStyleName)
+ }
+
+ cell.setValue(node)
+}
+
+// To convert graph points to array which have been converted
+// to objects because of dragging the points
+export function objToArrayList (graphPoints) {
+ const tempPoints = []
+ for (let i = 0; i < graphPoints.length; i++) {
+ if (graphPoints[i].x) {
+ tempPoints.push([graphPoints[i].x, graphPoints[i].y])
+ } else {
+ tempPoints.push(graphPoints[i])
+ }
+ }
+ return tempPoints
+}
+
+// For Sigbuilder block
+export function getmethod (mtd) {
+ let METHOD = ""
+ switch (mtd) {
+ case 0: METHOD = "zero order"; break
+ case 1: METHOD = "linear"; break
+ case 2: METHOD = "order 2"; break
+ case 3: METHOD = "not_a_knot"; break
+ case 4: METHOD = "periodic"; break
+ case 5: METHOD = "monotone"; break
+ case 6: METHOD = "fast"; break
+ case 7: METHOD = "clamped"; break
+ default: METHOD = "zero order"; break
+ }
+ return METHOD
+}
diff --git a/blocks/simulationAPI/negotiation.py b/blocks/simulationAPI/negotiation.py
index c94f0ac5..98d04d94 100644
--- a/blocks/simulationAPI/negotiation.py
+++ b/blocks/simulationAPI/negotiation.py
@@ -1,5 +1,6 @@
from rest_framework.negotiation import BaseContentNegotiation
+
class IgnoreClientContentNegotiation(BaseContentNegotiation):
def select_parser(self, request, parsers):
"""
diff --git a/blocks/simulationAPI/renderer.py b/blocks/simulationAPI/renderer.py
new file mode 100644
index 00000000..20c9752b
--- /dev/null
+++ b/blocks/simulationAPI/renderer.py
@@ -0,0 +1,17 @@
+from rest_framework import renderers
+
+
+class PlainTextRenderer(renderers.BaseRenderer):
+ media_type = 'text/plain'
+ format = 'txt'
+
+ def render(self, data, media_type=None, renderer_context=None):
+ return data.encode(self.charset)
+
+
+class EventStreamRenderer(renderers.BaseRenderer):
+ media_type = 'text/event-stream'
+ format = 'txt'
+
+ def render(self, data, media_type=None, renderer_context=None):
+ return data.encode(self.charset)