Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Final Bugfixes and units addition
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvrose committed Mar 4, 2019
1 parent f9f3898 commit 407abbd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# eee-assn-freq

Project for Semester 2 - Program to calculate the effect of change in frequency on the series AC circuit

Languages used: `HTML`,`CSS`,`Javascript`
## Usage
- Grab the latest release based on the required platform

*OR*

1. `npm -i` - Setup all dependencies
2. `npm test` - Start the app (Debugging only)

## Info

Languages:
`HTML`,`CSS`,`Javascript`



Base: `nodeJS` + `electron`
Base:
`nodeJS` + `electron`

Dependencies: `electron`,`math.js`,`plotly.js`,`jquery`
Dependencies:
`electron`,`math.js`,`plotly.js`,`jquery`
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let graphingwin = null;
graphSet = []

function initGrapher(functionCall= ()=>{}){
graphingwin = new BrowserWindow({show:false,minWidth:854,minHeight:480,frame:false,webPreferences:{devTools:true}/*,parent:win*/});
graphingwin = new BrowserWindow({show:false,minWidth:854,minHeight:480,frame:false,webPreferences:{devTools:false}/*,parent:win*/});
graphingwin.loadFile('./resources/grapher.html')
graphingwin.setMenuBarVisibility(false)
graphingwin.on('closed',()=>{
Expand Down Expand Up @@ -42,7 +42,7 @@ app.on('ready',()=>{
minHeight:720,
frame:false,
webPreferences:{
devTools:true
devTools:false
}
})
win.loadFile('./resources/index.html')
Expand Down
7 changes: 3 additions & 4 deletions resources/graphing.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ $(document).ready(function(){
math.round(args[args.length-1][1].i*Math.SQRT2,4),
]
const prettyToolTips=[
`v = ${prettyVals[4]} * sin(${prettyVals[3]} * x + ${prettyVals[2]})`,
`i = ${prettyVals[5]} * sin(${prettyVals[3]} * x)`
`v = ${prettyVals[4]} * sin(${prettyVals[3]} * t + ${prettyVals[2]})`,
`i = ${prettyVals[5]} * sin(${prettyVals[3]} * t)`
]
$('#ordered-plots').append(`<li id='plot-list-item'><span title="${prettyToolTips[0]}">V<sub>rms</sub> = ${prettyVals[0]}</span>,<br /><span title="${prettyToolTips[1]}">I<sub>rms</sub> = ${prettyVals[1]}</span>,<br /> &#981; = ${prettyVals[2]}</li>`);
//console.log("YEET")
$('#ordered-plots').append(`<li id='plot-list-item'><span title="${prettyToolTips[0]}">V<sub>rms</sub> = ${prettyVals[0]} V</span>,<br /><span title="${prettyToolTips[1]}">I<sub>rms</sub> = ${prettyVals[1]} A</span>,<br /> &#981; = ${prettyVals[2]} rad</li>`);
args.forEach(element => {
if(element[0].F > maxF) maxF = element[0].F
if(element[0].V > maxV) maxV = element[0].V
Expand Down
11 changes: 2 additions & 9 deletions resources/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,13 @@ function setResults(rState){

function calculateResults(cState){
resultStates.X = 2*Math.PI*cState.F*cState.L - (1/(2*Math.PI*cState.F*cState.C))
//console.log(resultStates.X)
resultStates.Z = Math.sqrt(resultStates.X * resultStates.X + cState.R*cState.R)
resultStates.phi = Math.atan2(resultStates.X, currentState.R)
resultStates.i = currentState.V/resultStates.Z;
resultStates.P = currentState.V*resultStates.i*(resultStates.cphi = Math.cos(resultStates.phi))
resultStates.Q = currentState.V*resultStates.i*Math.sin(resultStates.phi)
resultStates.S = currentState.V*resultStates.i
//resultStates.P = currentState.V * currentState.V / (resultStates.Z * resultStates.Z) * currentState.R;
//console.log("UPDATE",cState)

setResults(resultStates)
return null;
}




//ipcRenderer.send('setGWV',true);
}

0 comments on commit 407abbd

Please sign in to comment.