Skip to content

Commit

Permalink
Add economy of scale page
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Herzog committed Jul 4, 2023
1 parent 7a9381c commit 8be9c1c
Show file tree
Hide file tree
Showing 12 changed files with 966 additions and 117 deletions.
239 changes: 239 additions & 0 deletions docs/images/EconomyOfScale_de.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
235 changes: 235 additions & 0 deletions docs/images/EconomyOfScale_en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ mainNavBar.insertBefore(buildMultiNavDropdown("ACMenu",language.GUI.tabGeneralS,
]),mainNavBar.children[insertCount++]);

mainNavBar.insertBefore(buildMultiNavDropdown("DesignMenu",language.GUI.tabDesign,[
{id: "Compare", name: language.GUI.tabCompare, onlyValues: true},
{id: "ShortestQueue", name: language.GUI.tabShortestQueue}
{id: "Compare", name: language.GUI.tabCompare, modes: {values: true}},
{id: "ShortestQueue", name: language.GUI.tabShortestQueue},
{id: "EconomyOfScale", name: language.GUI.tabEconomyOfScale, modes: {table: true, diagram: true}},
]),mainNavBar.children[insertCount++]);

/* Content */
Expand Down
84 changes: 84 additions & 0 deletions docs/js/Language.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/gui_AC.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

export {tilesAC};
export {tilesAC, calcAC};

import {TilesBuilder, Table} from './tools_gui.js';
import {ErlangC_ENQ, ErlangC_EW} from './Erlang.js';
Expand Down
203 changes: 203 additions & 0 deletions docs/js/gui_EconomyOfScale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
Copyright 2023 Alexander Herzog
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export {tilesEconomyOfScale};

import {TilesBuilder, Table} from './tools_gui.js';
import {language} from './Language.js';
import {calcAC} from './gui_AC.js';

const tilesEconomyOfScale=new TilesBuilder('EconomyOfScale');

tilesEconomyOfScale.add(
language.model.inputInterArrivalTimeCV,
"CV[I]",
"CVI",
1,
0.1,
0,
language.model.invalidNotNegativeFloat,
language.model.invalidPositiveFloat,
language.model.inputInterArrivalTimeCVInfo1,
language.model.inputInterArrivalTimeCVInfo2,
"NotNegativeFloat",
false,
false
);

tilesEconomyOfScale.add(
language.model.inputServiceTimeMean,
"E[S]",
"ES",
400,
5,
200,
language.model.invalidPositiveFloat,
language.model.invalidPositiveFloat,
language.model.inputServiceTimeMeanInfo1,
language.model.inputServiceTimeMeanInfo2,
"PositiveFloat",
false,
false
);

tilesEconomyOfScale.add(
language.model.inputServiceTimeCV,
"CV[S]",
"CVS",
1,
0.1,
0,
language.model.invalidNotNegativeFloat,
language.model.invalidPositiveFloat,
language.model.inputServiceTimeCVInfo1,
language.model.inputServiceTimeCVInfo2,
"NotNegativeFloat",
false,
false
);

tilesEconomyOfScale.add(
language.model.inputNumberOfOperators,
"c",
"c",
2,
1,
10,
language.model.invalidPositiveInt,
language.model.invalidPositiveInt,
language.model.inputNumberOfOperatorsInfo1,
language.model.inputNumberOfOperatorsInfo2,
"PositiveInt"
);

tilesEconomyOfScale.add(
language.model.inputUtilization,
"ρ",
"rho",
0.8,
0.1,
0.8,
language.model.invalidNotNegativeFloat,
language.model.invalidPositiveFloat,
language.model.inputUtilizationInfo1,
language.model.inputUtilizationInfo2,
"rho",
false,
false
);

function calcEconomyOfScale(input) {
/* rho=ES/EI/c => EI=ES/c/rho */
const EI=input[1]/input[3]/input[4];
input.splice(0,0,EI);
return calcAC(input);
}

function calcEconomyOfScaleTable(mode) {
const input=tilesEconomyOfScale.rangeValues(mode);
if (input==null) return null;

let table=new Table();

table.addHeading('E[I]');
table.addHeading('CV[I]');
table.addHeading('E[S]');
table.addHeading('CV[S]');
table.addHeading('c');
table.addHeading('a');
table.addHeading('ρ');
table.addHeading('E[W]');
table.addHeading('E[V]');
table.addHeading('E[N<sub>Q</sub>]');
table.addHeading('E[N<sub>S</sub>]');
table.addHeading('E[N]');

table.calc(input,function(table,input) {
const data=calcEconomyOfScale(input);
table.addCol(data.EI);
table.addCol(data.CVI);
table.addCol(data.ES);
table.addCol(data.CVS);
table.addCol(data.c);
table.addCol(data.a);
table.addColPercent(data.rho);
if (data.rho<1) {
table.addCol(data.EW);
table.addCol(data.EV);
table.addCol(data.ENQ);
table.addCol(data.ENS);
table.addCol(data.EN);
}
});

table.xValuesCol++; /* Die erste Ausgabespalt ist in den Eingaben nicht vorhanden. */
return table;
}

/* Tabelle */

function changeTabEconomyOfScaleTable(sender) {
tilesEconomyOfScale.updateTabs(sender,'Table');
updateEconomyOfScaleTable();
}

function updateEconomyOfScaleTable() {
let table=calcEconomyOfScaleTable('Table');
if (table!=null) {
globalThis["EconomyOfScaleTableData"]=table.text;
const html=table.html+"<p><button type='button' class='btn btn-primary bi-clipboard' onclick='navigator.clipboard.writeText(globalThis.EconomyOfScaleTableData);'> "+language.GUI.copyTable+"</button></p>";
document.getElementById('EconomyOfScaleTable_results').innerHTML=html;
}
}

/* Diagramm */

function changeTabEconomyOfScaleDiagram(sender) {
tilesEconomyOfScale.updateTabs(sender,'Diagram');
updateEconomyOfScaleDiagram();
}

function updateEconomyOfScaleDiagram() {
const table=calcEconomyOfScaleTable('Diagram');
if (table==null) return;

let xAxisTitle='';
switch (table.xValuesCol) {
case 0: xAxisTitle='E[I] ('+language.statistics.unitTime+')'; break;
case 1: xAxisTitle='CV[I]'; break;
case 2: xAxisTitle='E[S] ('+language.statistics.unitTime+')'; break;
case 3: xAxisTitle='CV[S]'; break;
case 4: xAxisTitle='c ('+language.statistics.unitNumber+')'; break;
}

const ySetup=[
{columnIndex: 4+3, color: 'red', mode: 'time'}, /* E[W] */
{columnIndex: 4+4, color: 'green', mode: 'time'}, /* E[V] */
{columnIndex: 4+5, color: 'orange', mode: 'number'}, /* E[NQ] */
{columnIndex: 4+7, color: 'blue', mode: 'number'}, /* E[N] */
{columnIndex: 4+2, color: 'gray', mode: 'percent'}, /* rho */
];

table.diagram('EconomyOfScaleDiagram_results',table.xValuesCol,xAxisTitle,ySetup);
}

/* Allgemeine Vorbereitungen */

window.updateEconomyOfScaleTable=updateEconomyOfScaleTable;
window.updateEconomyOfScaleDiagram=updateEconomyOfScaleDiagram;
window.changeTabEconomyOfScaleTable=changeTabEconomyOfScaleTable;
window.changeTabEconomyOfScaleDiagram=changeTabEconomyOfScaleDiagram;
4 changes: 2 additions & 2 deletions docs/js/gui_ShortestQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function updateShortestQueueValues() {

result+="<h5>"+language.statistics.headingInputParameters+"</h5>\n";
result+="<p>\n";
result+=language.GUI.formulaShortestQueueA,+" <b>a="+data.a+"</b><br>";
result+=language.GUI.formulaShortestQueueB,+" <b>b="+data.b+"</b><br>";
result+=language.GUI.formulaShortestQueueA+": <b>a="+data.a+"</b><br>";
result+=language.GUI.formulaShortestQueueB+": <b>b="+data.b+"</b><br>";
result+="</p>\n";

result+="<h5>"+"Wahrscheinlichkeit an der kürzeren Warteschlange länger warten zu müssen"+"</h5>";
Expand Down
76 changes: 56 additions & 20 deletions docs/js/gui_Start.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import {tilesAC} from './gui_AC.js';
import {tilesExtAC} from './gui_ExtAC.js';
import {tilesCompare} from './gui_Compare.js';
import {tilesShortestQueue} from './gui_ShortestQueue.js';
import {tilesEconomyOfScale} from './gui_EconomyOfScale.js';
import {formulasErlangB, formulasErlangC, formulasExtErlangC, formulasPC, formulasAC, formulasExtAC, formulasCompare, formulasShortestQueue} from './FormulaBuilder.js';
import {language} from './Language.js';



function buildStartTile(size, title, text, id, imgWidth="100%", showMore=false, fileFormat="svg", aspectRatio=null, onlyValues=false, icon="") {
function buildStartTile(size, title, text, id, imgWidth="100%", showMore=false, fileFormat="svg", aspectRatio=null, modes={values: true, table: true, diagram: true}, icon="") {
let block="";

block+="<div class=\"col-lg-"+size+"\"><div class=\"card\">";
Expand All @@ -50,12 +51,15 @@ function buildStartTile(size, title, text, id, imgWidth="100%", showMore=false,
if (showMore) {
block+="<button onclick=\"showTab('"+id+"');\" class=\"btn btn-primary my-1 bi-info-circle\"> "+language.GUI.modeMore+"</button>\n";
} else {
if (onlyValues) {
const showValues=(modes.values==true);
const showTable=(modes.table==true);
const showDiagram=(modes.diagram==true);
if (showValues && !showTable && !showDiagram) {
block+="<button onclick=\"showTab('"+id+"Values');\" class=\"btn btn-primary my-1 bi-123\"> "+language.GUI.modeValuesOnly+"</button>\n";
} else {
block+="<button onclick=\"showTab('"+id+"Values');\" class=\"btn btn-primary my-1 bi-123\"> "+language.GUI.modeValues+"</button>\n";
block+="<button onclick=\"showTab('"+id+"Table');\" class=\"btn btn-primary my-1 bi-table\"> "+language.GUI.modeTable+"</button>\n";
block+="<button onclick=\"showTab('"+id+"Diagram');\" class=\"btn btn-primary my-1 bi-graph-up\"> "+language.GUI.modeDiagram+"</button>";
if (showValues) block+="<button onclick=\"showTab('"+id+"Values');\" class=\"btn btn-primary my-1 bi-123\"> "+language.GUI.modeValues+"</button>\n";
if (showTable) block+="<button onclick=\"showTab('"+id+"Table');\" class=\"btn btn-primary my-1 bi-table\"> "+language.GUI.modeTable+"</button>\n";
if (showDiagram) block+="<button onclick=\"showTab('"+id+"Diagram');\" class=\"btn btn-primary my-1 bi-graph-up\"> "+language.GUI.modeDiagram+"</button>";
}
}
block+="</div></div></div>";
Expand All @@ -74,8 +78,9 @@ function buildStartTiles(isDesktopApp) {
block+=buildStartTile(6,language.GUI.formulaPC,language.GUI.formulaPCInfo,"PC","100%",false,"svg","159.81 / 74.6");
block+=buildStartTile(6,language.GUI.formulaAC,language.GUI.formulaACInfo,"AC","100%",false,"svg","159.82 / 52.78");
block+=buildStartTile(6,language.GUI.formulaExtAC,language.GUI.formulaExtACInfo,"ExtAC","100%",false,"svg","159.82 / 74.05");
block+=buildStartTile(6,language.GUI.formulaCompare,language.GUI.formulaCompareInfo,"Compare","100%",false,"svg","602.67 / 279.23",true);
block+=buildStartTile(6,language.GUI.formulaCompare,language.GUI.formulaCompareInfo,"Compare","100%",false,"svg","602.67 / 279.23",{values: true});
block+=buildStartTile(6,language.GUI.formulaShortestQueue,language.GUI.formulaShortestQueueInfo,"ShortestQueue","100%",false,"svg","602.67 / 319.07");
block+=buildStartTile(6,language.GUI.formulaEconomyOfScale,language.GUI.formulaEconomyOfScaleInfo,"EconomyOfScale","100%",false,"svg","151.34 / 93.66",{table: true, diagram: true});
block+=buildStartTile(6,language.GUI.tabSimulation,language.GUI.tabSimulationInfo,"Simulation","100%",true,'webp','640 / 481',false,"<i class='bi-caret-right-square'></i> ");

block+="<div class=\"col-lg-6\"><div class=\"card\">";
Expand Down Expand Up @@ -137,8 +142,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaErlangBLimitations, body: language.text.ErlangBValuesLimitations},
getNextStepsButtons("ErlangB",language.GUI.nextStepsErlangBTable,language.GUI.nextStepsErlangBDiagram)
],
tableData: language.text.ErlangBTable+tilesErlangB.tableTiles,
diagramData: language.text.ErlangBDiagram+tilesErlangB.diagramTiles
tableInfo: language.text.ErlangBTable,
tableTiles: tilesErlangB.tableTiles,
diagramInfo: language.text.ErlangBDiagram,
diagramTiles: tilesErlangB.diagramTiles
});

/* Erlang-C-Formel */
Expand All @@ -154,8 +161,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaErlangCLimitations, body: language.text.ErlangCValuesLimitations},
getNextStepsButtons("ErlangC",language.GUI.nextStepsErlangCTable,language.GUI.nextStepsErlangCDiagram)
],
tableData: language.text.ErlangCTable+tilesErlangC.tableTiles,
diagramData: language.text.ErlangCDiagram+tilesErlangC.diagramTiles
tableInfo: language.text.ErlangCTable,
tableTiles: tilesErlangC.tableTiles,
diagramInfo: language.text.ErlangCDiagram,
diagramTiles: tilesErlangC.diagramTiles
});

/* Erweiterte Erlang-C-Formel*/
Expand All @@ -171,8 +180,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaExtErlangCLimitations, body: language.text.ExtErlangCValuesLimitations},
getNextStepsButtons("ExtErlangC",language.GUI.nextStepsExtErlangCTable,language.GUI.nextStepsExtErlangCDiagram)
],
tableData: language.text.ExtErlangCTable+tilesExtErlangC.tableTiles,
diagramData: language.text.ExtErlangCDiagram+tilesExtErlangC.diagramTiles
tableInfo: language.text.ExtErlangCTable,
tableTiles: tilesExtErlangC.tableTiles,
diagramInfo: language.text.ExtErlangCDiagram,
diagramTiles: tilesExtErlangC.diagramTiles
});

/* Pollaczek-Chintschin-Formel */
Expand All @@ -188,8 +199,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaPCLimitations, body: language.text.PCValuesLimitations},
getNextStepsButtons("PC",language.GUI.nextStepsPCTable,language.GUI.nextStepsPCDiagram)
],
tableData: language.text.PCTable+tilesPC.tableTiles,
diagramData: language.text.PCDiagram+tilesPC.diagramTiles
tableInfo: language.text.PCTable,
tableTiles: tilesPC.tableTiles,
diagramInfo: language.text.PCDiagram,
diagramTiles: tilesPC.diagramTiles
});

/* Allen-Cunneen-Näherungsformel */
Expand All @@ -205,8 +218,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaACLimitations, body: language.text.ACValuesLimitations},
getNextStepsButtons("AC",language.GUI.nextStepsACTable,language.GUI.nextStepsACDiagram)
],
tableData: language.text.ACTable+tilesAC.tableTiles,
diagramData: language.text.ACDiagram+tilesAC.diagramTiles
tableInfo: language.text.ACTable,
tableTiles: tilesAC.tableTiles,
diagramInfo: language.text.ACDiagram,
diagramTiles: tilesAC.diagramTiles
});

/* Erweiterte Allen-Cunneen-Näherungsformel */
Expand All @@ -222,8 +237,10 @@ function getMainGUI(isDesktopApp) {
{head: language.GUI.formulaExtACLimitations, body: language.text.ExtACValuesLimitations},
getNextStepsButtons("ExtAC",language.GUI.nextStepsExtACTable,language.GUI.nextStepsExtACDiagram)
],
tableData: language.text.ExtACTable+tilesExtAC.tableTiles,
diagramData: language.text.ExtACDiagram+tilesExtAC.diagramTiles
tableInfo: language.text.ExtACTable,
tableTiles: tilesExtAC.tableTiles,
diagramInfo: language.text.ExtACDiagram,
diagramTiles: tilesExtAC.diagramTiles
});

/* Systemdesign: Vergleich verschiedener Strategien */
Expand All @@ -236,6 +253,9 @@ function getMainGUI(isDesktopApp) {
valuesTilesButtons: tilesCompare.valueTilesButtons,
valuesTiles: tilesCompare.valueTiles,
valuesFormula: formulasCompare,
valuesInfoCards: [
{head: language.GUI.formulasCompareMoreInfo, body: language.text.formulasCompareMoreInfo}
]
});

/* Systemdesign: Wahl der kürzesten Schlange */
Expand All @@ -247,8 +267,24 @@ function getMainGUI(isDesktopApp) {
valuesTilesButtons: tilesShortestQueue.valueTilesButtons,
valuesTiles: tilesShortestQueue.valueTiles,
valuesFormula: formulasShortestQueue,
tableData: language.text.ShortestQueueTable+tilesShortestQueue.tableTiles,
diagramData: language.text.ShortestQueueDiagram+tilesShortestQueue.diagramTiles
tableInfo: language.text.ShortestQueueTable,
tableTiles: tilesShortestQueue.tableTiles,
diagramInfo: language.text.ShortestQueueDiagram,
diagramTiles: tilesShortestQueue.diagramTiles
});

/* Systemdesign: Economy of Scale */

result+=getPlaceholder({
id: "EconomyOfScale",
title: language.GUI.formulaEconomyOfScaleLong,
valuesTilesButtons: tilesEconomyOfScale.valueTilesButtons,
tableInfo: language.text.EconomyOfScaleTable,
tableTilesButtons: tilesEconomyOfScale.valueTilesButtons,
tableTiles: tilesEconomyOfScale.tableTiles,
diagramInfo: language.text.EconomyOfScaleDiagram,
diagramTilesButtons: tilesEconomyOfScale.valueTilesButtons,
diagramTiles: tilesEconomyOfScale.diagramTiles
});

/* Simulation */
Expand Down
Loading

0 comments on commit 8be9c1c

Please sign in to comment.