How shawneetz/luzon-gridsim-project works
Luzon GridSim is a web interface over an R electricity-dispatch optimizer. Users choose plant groups and an optional daily CO₂ cap, submit a solve, then inspect cost, dispatch, prices, or simplex iterations. The frontend’s page owns UI state and requests; the R API calculates the plan. README documents plant data and the API/solver split, but the R implementation was not excerpted, so internal solver relationships are shown only as unverified dashed links.
Main entry points: page.tsx App page · solve.R Solve workflow · ResultsTab.tsx Results view · api.ts API client
Components 19
Web app
- App page
src/app/page.tsx - Plant controls
src/components/ControlPanel.tsx - API client
src/lib/api.ts - Results view
src/components/ResultsTab.tsx - Dispatch chart
src/components/DispatchChart.tsx - Data table
src/components/DataTable.tsx - Tableau viewer
src/components/TableauTab.tsx - Number formatting
src/lib/format.ts
R solver
- HTTP endpoints
api/plumber.R - Input checks
api/R/check.R - Initial tableau
api/R/initial.R - Primal solver
api/R/primal.R - Simplex operations
api/R/simplex.R - Solve workflow
api/R/solve.R - Result assembly
api/R/results.R
Shared data
- Plant styles
src/lib/plants.ts - API data types
src/lib/types.ts - Plant data and limits
api/R/data.R
Other components
- Grid planner
Connections 21
- Grid planner → App page: sets choices
src/app/page.tsx - App page → Plant controls: renders controls
src/app/page.tsx - App page → API client: fetches and solves
src/app/page.tsx - API client → HTTP endpoints: HTTP requests
src/lib/api.ts - App page → Results view: renders results
src/app/page.tsx - App page → Tableau viewer: renders iterations
src/app/page.tsx - Results view → Dispatch chart: renders chart
src/components/ResultsTab.tsx - Results view → Data table: renders dispatch
src/components/ResultsTab.tsx - Tableau viewer → Data table: renders tableau
src/components/TableauTab.tsx - Results view → Number formatting: formats cost
src/components/ResultsTab.tsx - Data table → Number formatting: formats values
src/components/DataTable.tsx - Plant controls → Plant styles: reads styles
src/components/ControlPanel.tsx - Dispatch chart → Plant styles: reads styles
src/components/DispatchChart.tsx - API client → API data types: uses types
src/lib/api.ts - HTTP endpoints → Input checks: validates input
- HTTP endpoints → Solve workflow: dispatches solve
- Solve workflow → Plant data and limits: uses limits
- Solve workflow → Initial tableau: builds tableau
- Solve workflow → Primal solver: runs optimization
- Primal solver → Simplex operations: uses operations
- Solve workflow → Result assembly: assembles output