From 3463ab8a6df6494999a96a7b0477e1c0bf033480 Mon Sep 17 00:00:00 2001 From: Kai Nagel Date: Fri, 7 Jun 2024 12:54:36 +0200 Subject: [PATCH] adding rail. some adaptation for road plots --- .../analysis/RailAnalysisDataContainer.java | 2 +- .../tub/vsp/bvwp/data/type/Einstufung.java | 9 +- .../org/tub/vsp/bvwp/users/kn/Figures1KN.java | 131 +--- .../tub/vsp/bvwp/users/kn/Figures1RailKN.java | 653 ++++++++++++++++++ .../org/tub/vsp/bvwp/users/kn/Figures2KN.java | 166 ++++- .../bvwp/users/kn/RunLocalCsvScrapingKN.java | 77 ++- .../bvwp/users/kn/RunLocalRailScrapingKN.java | 78 ++- 7 files changed, 962 insertions(+), 154 deletions(-) create mode 100644 src/main/java/org/tub/vsp/bvwp/users/kn/Figures1RailKN.java diff --git a/src/main/java/org/tub/vsp/bvwp/data/container/analysis/RailAnalysisDataContainer.java b/src/main/java/org/tub/vsp/bvwp/data/container/analysis/RailAnalysisDataContainer.java index 5199d1c..ded9e61 100644 --- a/src/main/java/org/tub/vsp/bvwp/data/container/analysis/RailAnalysisDataContainer.java +++ b/src/main/java/org/tub/vsp/bvwp/data/container/analysis/RailAnalysisDataContainer.java @@ -61,7 +61,7 @@ private void addComputations() { entries.put(Headers.NKV_CO2, NkvCalculatorRail.calculateNkv(new Modifications(co2Price700, 0., 1, 1.), baseDataContainer)); entries.put(Headers.NKV_CO2_700_EN, NkvCalculatorRail.calculateNkv(new Modifications(co2Price700, 0., 1, 1.), baseDataContainer)); entries.put(Headers.NKV_CARBON700, NkvCalculatorRail.calculateNkv(new Modifications(co2Price700, 0., 1, 1.), baseDataContainer)); - entries.put(Headers.NKV_CO2_2000_EN, NkvCalculatorRail.calculateNkv( new Modifications( 2000 * INFLATION_Factor2022to2012, 0, 1, 1. ), baseDataContainer ) ); + entries.put(Headers.NKV_CO2_2000_EN, NkvCalculatorRail.calculateNkv( new Modifications( 2000 * INFLATION_Factor2022to2012, 0, 1, 1 ), baseDataContainer ) ); // entries.put(Headers.NKV_EL03, NkvCalculatorRail.calculateNkv( new Modifications( co2PriceBVWP, addtlFzkmBeyondPrinsEl03, 1, 1. ), baseDataContainer ) ); // entries.put(Headers.NKV_EL03_CARBON215_INVCOSTTUD, NkvCalculatorRail.calculateNkv( new Modifications( co2Price215, addtlFzkmBeyondPrinsEl03, constructionCostFactor, 1. ), baseDataContainer ) ); // entries.put(Headers.NKV_EL03_CARBON700tpr0_INVCOSTTUD, NkvCalculatorRail.calculateNkv( new Modifications( co2Price700, addtlFzkmBeyondPrinsEl03, constructionCostFactor, 1.75 ), baseDataContainer ) ); diff --git a/src/main/java/org/tub/vsp/bvwp/data/type/Einstufung.java b/src/main/java/org/tub/vsp/bvwp/data/type/Einstufung.java index 6d44c0d..81a9ea1 100644 --- a/src/main/java/org/tub/vsp/bvwp/data/type/Einstufung.java +++ b/src/main/java/org/tub/vsp/bvwp/data/type/Einstufung.java @@ -7,8 +7,9 @@ public enum Einstufung{ VBE("Vordringlicher Bedarf - Engpassbeseitigung (VB-E)"), VB("Vordringlicher Bedarf (VB)"), WBP("Weiterer Bedarf mit Planungsrecht (WB*)"), - WB( "Weiterer Bedarf (WB)") - ,@Deprecated /* yyyyyy lieber aufklären!! */ UNDEFINED("undefined") + WB( "Weiterer Bedarf (WB)"), + KB( "Kein Bedarf (KB)") +// ,@Deprecated /* yyyyyy lieber aufklären!! */ UNDEFINED("undefined") ; private static final Logger log = LogManager.getLogger( Einstufung.class ); @@ -29,7 +30,7 @@ public static Einstufung getFromString( String description ) { } } log.warn( "description=" + description ); -// throw new RuntimeException( "unknown Einstufung=" + description ); - return UNDEFINED; + throw new RuntimeException( "unknown Einstufung=" + description ); +// return UNDEFINED; } } diff --git a/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1KN.java b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1KN.java index 724c8eb..663ffe9 100644 --- a/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1KN.java +++ b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1KN.java @@ -37,8 +37,14 @@ class Figures1KN{ final double nkvCappedMax; final double nkvMin; private static boolean init = true ; - Figures1KN( Table table ){ + Figures1KN( Table table, String xName ){ + this.xName = xName; Axis.AxisBuilder xAxisBuilder = Axis.builder(); + + if ( xName!=null && xName.contains( "NKV" ) ) { + xAxisBuilder.autoRange( Axis.AutoRange.REVERSED ); + } + // --------------------------------------------------------------- { // xName = Headers.B_CO2_NEU; @@ -48,7 +54,7 @@ class Figures1KN{ // --------------------------------------------------------------- // --------------------------------------------------------------- // { - xName = NKV_ORIG_CAPPED5; +// this.xName = NKV_ORIG_CAPPED5; // xName = Headers.NKV_INDUZ_CO2; // xName = Headers.NKV_DIFF; // xName = Headers.ADDITIONAL_LANE_KM; @@ -108,7 +114,7 @@ class Figures1KN{ { DoubleColumn column = DoubleColumn.create( EINSTUFUNG_AS_NUMBER ); final double factor = 8.; - final double offset = 3.; + final double offset = 2.; for( String prio : table.stringColumn( EINSTUFUNG ) ){ switch( Einstufung.valueOf( prio ) ){ case VBE -> { @@ -127,7 +133,7 @@ class Figures1KN{ // column.append( 2. ); // } default -> { - column.append( 2. ); + column.append( offset ); // throw new IllegalStateException( "Unexpected value: " + prio ); } } @@ -147,9 +153,11 @@ class Figures1KN{ } - table = table.sortAscendingOn( xName ); + if ( this.xName != null ){ + table = table.sortAscendingOn( this.xName ); + } - this.xAxis = xAxisBuilder.title( xName ) + this.xAxis = xAxisBuilder.title( this.xName ) // .type( Axis.Type.LOG ) .build(); @@ -160,55 +168,6 @@ class Figures1KN{ - } - // ################################################################ - // ################################################################ - Figure invcost_tud_vs_orig(){ - String xName = INVCOST_ORIG; - - String yName = INVCOST_TUD; -// String y3Name = Headers.COST_OVERALL; - String y2Name = INVCOST_TUD; - - String plotTitle = ""; - - Axis xAxis = Axis.builder() - .title( xName ) - .type( Axis.Type.LOG) - .build(); - - Axis yAxis = Axis.builder() - .type( Axis.Type.LOG ) - // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) - .title( yName ) - .build(); - Layout layout = Layout.builder( plotTitle ) - .xAxis( xAxis ) - .yAxis( yAxis ) - .width( plotWidth ) - .build(); - - List traces = new ArrayList<>(); - -// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) -// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) -// .name( String.format( legendFormat, yName ) ) -// .build(); - - traces.add( getTraceCyan( table, xName, y2Name ) ); - traces.add( getTraceMagenta( table, xName, y2Name ) ); - traces.add( getTraceOrange( table, xName, y2Name ) ); - traces.add( getTraceRed( table, xName, y2Name ) ); - - { - double[] xx = new double[]{ table.numberColumn( xName ).min(), table.numberColumn( xName ).max() }; - double[] yy = new double[]{ table.numberColumn( xName ).min(), table.numberColumn( xName ).max() }; - traces.add( ScatterTrace.builder( xx, yy ) - .mode( ScatterTrace.Mode.LINE ) - .build() ); - } - Figure figure3 = new Figure( layout, traces.toArray( new Trace[0] ) ); - return figure3; } // ======================================================================================== // ======================================================================================== @@ -558,20 +517,12 @@ Figure carbon(){ Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); - Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) - .name( String.format( legendFormat, yName ) ) - .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) - .build(); - - final Trace traceWb = getTraceCyan( table, xName, y2Name ); - final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); - final Trace traceVb = getTraceOrange( table, xName, y2Name ); - final Trace traceVbe = getTraceRed( table, xName, y2Name ); - - - return new Figure( layout - , trace - , traceWb, traceWbp, traceVb, traceVbe ); + List traces = new ArrayList<>( ); + traces.add( getTraceCyan( table, xName, y2Name ) ); + traces.add( getTraceMagenta( table, xName, y2Name ) ); + traces.add( getTraceOrange( table, xName, y2Name ) ); + traces.add( getTraceRed( table, xName, y2Name ) ); + return new Figure( layout, traces.toArray(new Trace[]{}) ); } // ======================================================================================== // ======================================================================================== @@ -665,41 +616,17 @@ public Figure fzkmDiff(){ return new Figure( layout, traces.toArray(new Trace[]{} ) ); } - public Figure fzkmFromTtime_vs_fzkmOrig(){ - String xName = ADDTL_PKWKM_ORIG; - - String y2Name = ADDTL_PKWKM_FROM_TTIME; - String yName = ADDTL_PKWKM_FROM_TTIME; - - Axis xAxis = Axis.builder().title( xName ).build(); - - Axis yAxis = Axis.builder().title( y2Name ).build(); - - Layout layout = Layout.builder().xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); - - List traces = new ArrayList<>(); - - traces.add( getTraceCyan( table, xName, y2Name ) ); - traces.add( getTraceMagenta( table, xName, y2Name ) ); - traces.add( getTraceOrange( table, xName, y2Name ) ); - traces.add( getTraceRed( table, xName, y2Name ) ); - - return new Figure( layout, traces.toArray(new Trace[]{} ) ); - } - public Figure fzkmFromTtimeSum_vs_fzkmOrig(){ - String xName = ADDTL_PKWKM_ORIG; - - final String ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG = "additional pkwkm from ttime plus orig"; - - table.addColumns( table.numberColumn( ADDTL_PKWKM_FROM_TTIME ).add( table.numberColumn( ADDTL_PKWKM_ORIG ) ).setName( ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG ) ); - - String y2Name = ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG; + public Figure invCostTud(){ + String y2Name = INVCOST_TUD; - Axis xAxis = Axis.builder().title( xName ).build(); + Axis yAxis = Axis.builder().title( y2Name ).type( Axis.Type.LOG ).build(); - Axis yAxis = Axis.builder().title( y2Name ).build(); + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "addtl_veh-km_diff are SIM addtl_lane-km:"; + } - Layout layout = Layout.builder().xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); List traces = new ArrayList<>(); @@ -728,7 +655,7 @@ static Trace getTraceRed( Table table, String xName, String y2Name ){ final Trace traceVbe = getTrace( xName, y2Name, tableVbe, nameInLegend, color ); return traceVbe; } - private static Trace getTrace( String xName, String y2Name, Table tableVbe, String nameInLegend, String color ){ + static Trace getTrace( String xName, String y2Name, Table tableVbe, String nameInLegend, String color ){ Trace traceVbe = ScatterTrace.builder( tableVbe.numberColumn( xName ), tableVbe.numberColumn( y2Name ) ) .text( tableVbe.stringColumn( PROJECT_NAME ).asObjectArray() ) .name( String.format( legendFormat, nameInLegend ) ) diff --git a/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1RailKN.java b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1RailKN.java new file mode 100644 index 0000000..e13f10e --- /dev/null +++ b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures1RailKN.java @@ -0,0 +1,653 @@ +package org.tub.vsp.bvwp.users.kn; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.tub.vsp.bvwp.computation.ComputationKN; +import org.tub.vsp.bvwp.data.Headers; +import org.tub.vsp.bvwp.data.type.Einstufung; +import tech.tablesaw.api.DoubleColumn; +import tech.tablesaw.api.NumericColumn; +import tech.tablesaw.api.Table; +import tech.tablesaw.columns.Column; +import tech.tablesaw.io.csv.CsvWriteOptions; +import tech.tablesaw.io.csv.CsvWriter; +import tech.tablesaw.plotly.components.Axis; +import tech.tablesaw.plotly.components.Figure; +import tech.tablesaw.plotly.components.Layout; +import tech.tablesaw.plotly.traces.ScatterTrace; +import tech.tablesaw.plotly.traces.Trace; + +import java.io.File; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import static org.tub.vsp.bvwp.data.Headers.*; +import static org.tub.vsp.bvwp.users.kn.Figures1KN.*; + +class Figures1RailKN{ + private static final Logger log = LogManager.getLogger( Figures1RailKN.class ); + static final int plotWidth = 2000; + static final String legendFormat = "%30s"; + static final String dotSizeString = "largest = VB-E; large = VB; small = WB*; tiny = WB"; + final Table table; + private final Axis xAxis; + private final String xName; + final double nkvCappedMax; + final double nkvMin; + private static boolean init = true ; + Figures1RailKN( Table table, String xName ){ + this.xName = xName; + Axis.AxisBuilder xAxisBuilder = Axis.builder(); + // --------------------------------------------------------------- + { +// xName = Headers.B_CO2_NEU; +// xName = INVCOST_ORIG; +// xName = Headers.VERKEHRSBELASTUNG_PLANFALL; + } + // --------------------------------------------------------------- + // --------------------------------------------------------------- +// { +// this.xName = NKV_ORIG_CAPPED5; +// xName = Headers.NKV_INDUZ_CO2; +// xName = Headers.NKV_DIFF; +// xName = Headers.ADDITIONAL_LANE_KM; +// xAxisBuilder +// .type( Axis.Type.LOG ) +//// .autoRange( Axis.AutoRange.REVERSED ) +// .range(0,1) +// ; +// } + // --------------------------------------------------------------- + +// switch( xName ){ +// case NKV_ORIG +// , Headers.VERKEHRSBELASTUNG_2030 +// -> xAxisBuilder.type( Axis.Type.LOG ); + // wirft NKV<0 raus, was bei "orig" nicht passiert, aber dann doch, wenn man andere NKVs auf die y-Achse + // plottet, und dort nun auch logscale verwenden sollte, um etwas zu sehen. +// } + +// xAxisBuilder.type( Axis.Type.LOG ); + + + if ( init ){ + init = false; + + // =========================== + table.addColumns( +// table.numberColumn( NKV_EL03_CARBON215_INVCOSTTUD ).subtract( table.numberColumn( NKV_ORIG ) ).setName( NKV_EL03_DIFF ) +// , table.numberColumn( ADDTL_PKWKM_EL03 ).subtract( table.numberColumn( ADDTL_PKWKM_ORIG ) ).setName( ADDTL_PKWKM_EL03_DIFF ) + ); + // =========================== + // =========================== +// Headers.addCap5( table, NKV_EL03_CARBON215_INVCOSTTUD ); +// Headers.addCap5( table, NKV_EL03_CARBON700tpr0_INVCOSTTUD ); +// Headers.addCap5( table, NKV_ELTTIME_CARBON215_INVCOSTTUD ); +// Headers.addCap5( table, NKV_ELTTIME_CARBON700TPR0_INVCOSTTUD ); + Headers.addCap5( table, NKV_ORIG ); +// Headers.addCap5( table, NKV_EL03 ); +// Headers.addCap5( table, NKV_EL03_CARBON700tpr0 ); + Headers.addCap5( table, NKV_CARBON700 ); +// Headers.addCap5( table, NKV_ELTTIME_CARBON2000_INVCOSTTUD ); + +// Headers.addCap( 10, table, NKV_EL03_CARBON215_INVCOSTTUD ); + // =========================== + // =========================== + { + DoubleColumn column = DoubleColumn.create( EINSTUFUNG_AS_NUMBER ); + final double factor = 8.; + final double offset = 8.; + for( String prio : table.stringColumn( EINSTUFUNG ) ){ + switch( Einstufung.valueOf( prio ) ){ + case VBE -> { + column.append( 4. * factor + offset ); + } + case VB -> { + column.append( 3. * factor + offset ); + } + case WBP -> { + column.append( 2. * factor + offset ); + } + case WB -> { + column.append( 1. * factor + offset ); + } + case KB -> { + column.append( offset ); + } +// case UNDEFINED -> { +// column.append( 2. ); +// } + default -> { +// column.append( 2. ); + throw new IllegalStateException( "Unexpected value: " + prio ); + } + } + } + table.addColumns( column ); + } + // =========================== + + NumberFormat nf = NumberFormat.getInstance( Locale.GERMAN ); + for( Column column : table.columns() ){ + if ( column instanceof NumericColumn ) { + ((NumericColumn) column).setPrintFormatter( nf, "" ); + } + } + + new CsvWriter().write( table, CsvWriteOptions.builder( new File( "output.tsv" ) ).separator( '\t' ).usePrintFormatters( true ).build() ); + + } + + if ( this.xName != null ){ + table = table.sortAscendingOn( this.xName ); + } + + this.xAxis = xAxisBuilder.title( this.xName ) +// .type( Axis.Type.LOG ) + .build(); + + this.table = table; + + nkvCappedMax = table.doubleColumn( NKV_ORIG_CAPPED5 ).max() + 0.2 ; +// nkvMin = table.doubleColumn( NKV_EL03_CARBON215_INVCOSTTUD_CAPPED5 ).min(); + nkvMin = table.doubleColumn( NKV_CARBON700 ).min(); + + + + } + // ======================================================================================== + // ======================================================================================== + Figure nkv_el03_diff(){ + String yName = NKV_EL03_DIFF; +// String y3Name = Headers.NKV_CO2; + String y2Name = NKV_EL03_DIFF; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "since (co2_cost SIMTO lane-km) and (cost SIMTO lane-km), the division of the two does not depend on lane-km:"; + } + Layout layout = Layout.builder( title ) + .xAxis( xAxis ) + .yAxis( yAxis ) + .width( plotWidth ) + .build(); +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, String.format( "%30s" , yName ) ) ) +// .build(); + + final Trace traceCyan = getTraceCyan( table, xName, y2Name ); + final Trace traceMagenta = getTraceMagenta( table, xName, y2Name ); + final Trace traceOrange = getTraceOrange( table, xName, y2Name ); + final Trace traceRed = getTraceRed( table, xName, y2Name ); + + +// Trace trace3 = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( y3Name ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, y3Name ) ) +// .marker( Marker.builder().color( "gray" ).build() ) +// .build(); + +// double[] xx = new double[]{0., 1.1* table.numberColumn( xName ).max() }; +// double[] yy = new double[]{1., 1.}; +// Trace trace4 = ScatterTrace.builder( xx, yy ) +// .mode( ScatterTrace.Mode.LINE ) +// .build(); + + Figure figure2 = new Figure( layout +// , trace +// , trace3 + , traceCyan, traceMagenta + , traceOrange, traceRed +// , trace4 + ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure nkv_el03(){ + String yName = NKV_EL03_CAPPED5; + String y2Name = NKV_EL03_CAPPED5; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, String.format( "%30s" , yName ) ) ) +// .build(); + + final Trace traceCyan = getTraceCyan( table, xName, y2Name ); + final Trace traceMagenta = getTraceMagenta( table, xName, y2Name ); + final Trace traceOrange = getTraceOrange( table, xName, y2Name ); + final Trace traceRed = getTraceRed( table, xName, y2Name ); + + +// Trace trace3 = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( y3Name ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, y3Name ) ) +// .marker( Marker.builder().color( "gray" ).build() ) +// .build(); + +// double[] xx = new double[]{0., 1.1* table.numberColumn( xName ).max() }; +// double[] yy = new double[]{1., 1.}; +// Trace trace4 = ScatterTrace.builder( xx, yy ) +// .mode( ScatterTrace.Mode.LINE ) +// .build(); + + Figure figure2 = new Figure( layout +// , trace +// , trace3 + , traceCyan, traceMagenta + , traceOrange, traceRed +// , trace4 + ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure nkv_orig(){ + String yName = NKV_ORIG_CAPPED5; + String y2Name = NKV_ORIG_CAPPED5; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + final Trace traceWb = getTrace( xName, y2Name, table, "null", "cyan" ); + traces.add( traceWb ); + + Figure figure2 = new Figure( layout, traces.toArray(new Trace[0]) ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure invCost_orig(){ + String yName = INVCOST_ORIG; + String y2Name = yName; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + final Trace traceWb = getTrace( xName, y2Name, table, "null", "cyan" ); + traces.add( traceWb ); + + Figure figure2 = new Figure( layout, traces.toArray(new Trace[0]) ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure invCost_orig_cumulative(){ + String yName = INVCOST_ORIG; + String y2Name = yName; + + Table table2 = Table.create( table.stringColumn( PROJECT_NAME ), table.doubleColumn( INVCOST_ORIG ), table.doubleColumn( xName ) ).sortDescendingOn( xName ); + + table2 = table2.sortDescendingOn( xName ); // necessary to get cumulative cost right + + DoubleColumn cumulativeCost = DoubleColumn.create( "cumulative_cost" ); + { + double sum = 0.; + for( Double cost : table2.doubleColumn( INVCOST_ORIG ) ){ + sum += cost; + cumulativeCost.append( sum ); + } + } + + Axis yAxis = Axis.builder().title( "Kumulierte Investitionskosten (orig) [Mio]" ).build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + var nameInLegend = "cumulative cost"; + traces.add( ScatterTrace.builder( table2.doubleColumn( xName ), cumulativeCost ).mode( ScatterTrace.Mode.LINE ).showLegend( true ).name( String.format( legendFormat, nameInLegend ) ).build() ); + + return new Figure( layout, traces.toArray(new Trace[]{} ) ); + } + // ======================================================================================== + // ======================================================================================== + Figure nkv_carbon700(){ + String yName = NKV_CARBON700_CAPPED5; + String y2Name = NKV_CARBON700_CAPPED5; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + final Trace traceWb = getTrace( xName, y2Name, table, "null", "cyan" ); + traces.add( traceWb ); + + Figure figure2 = new Figure( layout, traces.toArray(new Trace[0]) ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure nkv_el03_carbon700(){ + String yName = NKV_EL03_CARBON700tpr0; + String y2Name = NKV_EL03_CARBON700_CAPPED5; + + Axis yAxis = Axis.builder() +// .type( Axis.Type.LOG ) // wirft NKV < 0 raus! + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "since (co2_cost SIMTO lane-km) and (cost SIMTO lane-km), the division of the two does not depend on lane-km:"; + } + Layout layout = Layout.builder( title ) + .xAxis( xAxis ) + .yAxis( yAxis ) + .width( plotWidth ) + .build(); +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, String.format( "%30s" , yName ) ) ) +// .build(); + + final Trace traceCyan = getTraceCyan( table, xName, y2Name ); + final Trace traceMagenta = getTraceMagenta( table, xName, y2Name ); + final Trace traceOrange = getTraceOrange( table, xName, y2Name ); + final Trace traceRed = getTraceRed( table, xName, y2Name ); + + +// Trace trace3 = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( y3Name ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, y3Name ) ) +// .marker( Marker.builder().color( "gray" ).build() ) +// .build(); + +// double[] xx = new double[]{0., 1.1* table.numberColumn( xName ).max() }; +// double[] yy = new double[]{1., 1.}; +// Trace trace4 = ScatterTrace.builder( xx, yy ) +// .mode( ScatterTrace.Mode.LINE ) +// .build(); + + Figure figure2 = new Figure( layout +// , trace +// , trace3 + , traceCyan, traceMagenta + , traceOrange, traceRed +// , trace4 + ); + return figure2; + } + // ======================================================================================== + // ======================================================================================== + Figure createFigurePkwKm( ){ + String yName = ADDTL_PKWKM_INDUZ_ORIG; + String y2Name = ADDTL_PKWKM_EL03; + + Axis yAxis = Axis.builder() + .title( yName ) + .type( Axis.Type.LOG ) // sonst "0" nicht darstellbar + .build(); + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ) + .width( plotWidth ) + .build(); + + Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) + .name( String.format( legendFormat, yName ) ) + .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) + .build(); + + final Trace traceWb = getTraceCyan( table, xName, y2Name ); + final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); + final Trace traceVb = getTraceOrange( table, xName, y2Name ); + final Trace traceVbe = getTraceRed( table, xName, y2Name ); + + // double[] xx = new double[]{1., 200.}; + // Trace trace1 = ScatterTrace.builder( xx, xx ) + // .mode( ScatterTrace.Mode.LINE ) + // .build(); + + Figure figure = new Figure( layout, trace, traceWb, traceWbp, traceVb, traceVbe ); + return figure; + } + // ======================================================================================== + // ======================================================================================== + public Figure elasticities(){ + String yName = "elasticity_old"; + String y2Name = "elasticity_new"; + + table.addColumns( table.numberColumn( ADDTL_PKWKM_ORIG ) + .divide( ComputationKN.FZKM_AB ) + .multiply( ComputationKN.LANE_KM_AB ) + .divide( table.numberColumn( ADDTL_LANE_KM ) ).setName("elasticity_old" ), + table.numberColumn( ADDTL_PKWKM_EL03 ) + .divide( ComputationKN.FZKM_AB ) + .multiply( ComputationKN.LANE_KM_AB ) + .divide( table.numberColumn( ADDTL_LANE_KM ) ).setName("elasticity_new" ) + ); + + double xMin = table.numberColumn( xName ).min(); + double xMax = table.numberColumn( xName ).max(); + + Axis yAxis = Axis.builder().title( yName ) +// .type( Axis.Type.LOG ) +// .range( -0.3, 0.8 ) + .build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "elasticities are indep of lane-km:"; + } + Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) + .name( String.format( legendFormat, yName ) ) + .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) + .build(); + + Trace trace1 = ScatterTrace.builder( new double[]{xMin,xMax}, new double[]{ 0.2, 0.2 } ) + .mode( ScatterTrace.Mode.LINE ) + .build(); + Trace trace2 = ScatterTrace.builder( new double[]{xMin, xMax}, new double[]{ 0.6, 0.6 } ) + .mode( ScatterTrace.Mode.LINE ) + .build(); + +// final Trace traceWb = getTraceWb( table, xName, y2Name ); +// final Trace traceWbp = getTraceWbp( table, xName, y2Name ); +// final Trace traceVb = getTraceVb( table, xName, y2Name ); +// final Trace traceVbe = getTraceVbe( table, xName, y2Name ); + + + return new Figure( layout, trace, +// traceWb, traceWbp, traceVb, traceVbe + trace1, trace2 ); + } + // ======================================================================================== + // ======================================================================================== + public Figure fzkm(){ + String y2Name = ADDTL_PKWKM_EL03; + String yName = ADDTL_PKWKM_ORIG; + + Axis yAxis = Axis.builder().title( yName ) + .type( Axis.Type.LOG ) +// .range( 0.,400. ) + .build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) + .name( String.format( legendFormat, yName ) ) + .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) + .build(); + + final Trace traceWb = getTraceCyan( table, xName, y2Name ); + final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); + final Trace traceVb = getTraceOrange( table, xName, y2Name ); + final Trace traceVbe = getTraceRed( table, xName, y2Name ); + +// Trace trace1 = ScatterTrace.builder( new double[]{1,700}, new double[]{ 1 , 700./ComputationKN.LANE_KM_AB * ComputationKN.FZKM_AB*0.3} ) +// .mode( ScatterTrace.Mode.LINE ) +// .build(); +// Trace trace2 = ScatterTrace.builder( new double[]{1,700}, new double[]{ 1 , 700./ComputationKN.LANE_KM_AB * ComputationKN.FZKM_AB*0.6} ) +// .mode( ScatterTrace.Mode.LINE ) +// .build(); + + return new Figure( layout, trace + ,traceWb, traceWbp, traceVb, traceVbe +// ,trace1, trace2 + ); + } + + // ======================================================================================== + // ======================================================================================== + Figure carbon(){ + String yName = CO2_COST_ORIG; + String y2Name = CO2_COST_EL03; + + Axis yAxis = Axis.builder().title( yName ).type( Axis.Type.LOG ).build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ) { + title = "CO2 costs SIMTO addtl lane-km:"; + } + + Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) + .name( String.format( legendFormat, yName ) ) + .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) + .build(); + + final Trace traceWb = getTraceCyan( table, xName, y2Name ); + final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); + final Trace traceVb = getTraceOrange( table, xName, y2Name ); + final Trace traceVbe = getTraceRed( table, xName, y2Name ); + + + return new Figure( layout + , trace + , traceWb, traceWbp, traceVb, traceVbe ); + } + // ======================================================================================== + // ======================================================================================== + public Figure dtv(){ + String yName = VERKEHRSBELASTUNG_PLANFALL; + String y2Name = VERKEHRSBELASTUNG_PLANFALL; + + Axis yAxis = Axis.builder().title( yName ).type( Axis.Type.LOG ).build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .name( String.format( legendFormat, yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .build(); + + final Trace traceWb = getTraceCyan( table, xName, y2Name ); + final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); + final Trace traceVb = getTraceOrange( table, xName, y2Name ); + final Trace traceVbe = getTraceRed( table, xName, y2Name ); + + + return new Figure( layout +// , trace + , traceWb + ,traceWbp + , traceVb + , traceVbe + ); + } + public Figure fzkmNew(){ + String yName = ADDTL_PKWKM_ORIG; + String y2Name = ADDTL_PKWKM_EL03; + + Axis yAxis = Axis.builder().title( y2Name ).type( Axis.Type.LOG ).build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "addtl_veh-km are PROPTO addtl_lane-km:"; + } + + Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) + .name( String.format( legendFormat, yName ) ) + .text( table.stringColumn( PROJECT_NAME ).asObjectArray() ) + .build(); + + final Trace traceWb = getTraceCyan( table, xName, y2Name ); + final Trace traceWbp = getTraceMagenta( table, xName, y2Name ); + final Trace traceVb = getTraceOrange( table, xName, y2Name ); + final Trace traceVbe = getTraceRed( table, xName, y2Name ); + +// log.warn( table.where( table.stringColumn( Headers.PROJECT_NAME ).startsWith( "A008" ) ) ); +// log.warn("here"); + + return new Figure( layout + , trace + , traceWb + ,traceWbp + , traceVb + , traceVbe + ); + } + // ======================================================================================== + // ======================================================================================== + public Figure fzkmDiff(){ + String y2Name = ADDTL_PKWKM_EL03_DIFF; + + Axis yAxis = Axis.builder().title( y2Name ).type( Axis.Type.LOG ).build(); + + String title = ""; + if ( ADDTL_LANE_KM.equals( xName ) ){ + title = "addtl_veh-km_diff are SIM addtl_lane-km:"; + } + + Layout layout = Layout.builder( title ).xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .name( String.format( legendFormat, yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .build(); + + traces.add( getTraceCyan( table, xName, y2Name ) ); + traces.add( getTraceMagenta( table, xName, y2Name ) ); + traces.add( getTraceOrange( table, xName, y2Name ) ); + traces.add( getTraceRed( table, xName, y2Name ) ); + + return new Figure( layout, traces.toArray(new Trace[]{} ) ); + + } + + + // ======================================================================================== +} diff --git a/src/main/java/org/tub/vsp/bvwp/users/kn/Figures2KN.java b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures2KN.java index 863eea5..be80955 100644 --- a/src/main/java/org/tub/vsp/bvwp/users/kn/Figures2KN.java +++ b/src/main/java/org/tub/vsp/bvwp/users/kn/Figures2KN.java @@ -19,7 +19,7 @@ class Figures2KN extends Figures1KN { Figures2KN( Table table ){ - super( table ); + super( table, null); } // ======================================================================================== // ======================================================================================== @@ -312,6 +312,76 @@ public Figure invcosttud_vs_nkvElttimeCarbon700Invcosttud( int cap ){ return investmentCostTud( cap, xName ); } + // ======================================================================================== + // ======================================================================================== + public Figure carbon_vs_inv(){ + String xName = INVCOST_TUD; + Axis.AxisBuilder xAxisBuilder = Axis.builder(); + + Table table2 = table.sortDescendingOn( xName ); // cannot remember why this is necessary + + String yName = CO2_COST_EL03; + Axis yAxis = Axis.builder().title( yName ).build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxisBuilder.title( xName ).build() ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + traces.add( getTraceCyan( table2, xName, yName ) ); + traces.add( getTraceMagenta( table2, xName, yName ) ); + traces.add( getTraceOrange( table2, xName, yName ) ); + traces.add( getTraceRed( table2, xName, yName ) ); + return new Figure( layout, traces.toArray( new Trace[]{} ) ); + } + + // ======================================================================================== + // ======================================================================================== + public Figure nco2v_vs_vs_nkvElttimeCarbon700Invcosttud( int cap ){ + String xName = Headers.cappedOf( cap, NKV_ELTTIME_CARBON700TPR0_INVCOSTTUD ); + Axis.AxisBuilder xAxisBuilder = Axis.builder(); + + if ( cap ==Integer.MAX_VALUE ) { + xName = NKV_ELTTIME_CARBON700TPR0_INVCOSTTUD; + xAxisBuilder.autoRange( Axis.AutoRange.REVERSED ); + } else { + xAxisBuilder.range( nkvCappedMax, nkvMin ); + } + + Table table2 = Table.create( table.stringColumn( PROJECT_NAME ) + , table.stringColumn( BAUTYP ) + , table.numberColumn( EINSTUFUNG_AS_NUMBER ) + , table.doubleColumn( NKV_ELTTIME_CARBON700TPR0_INVCOSTTUD ) + , table.doubleColumn( xName ) + , table.doubleColumn( INVCOST_TUD ) + , table.doubleColumn( CO2_COST_EL03 ) // should be ELTTIME!! + ); + + final String N_CO2_V = "N-CO2-V"; + table2.addColumns( table2.doubleColumn( NKV_ELTTIME_CARBON700TPR0_INVCOSTTUD ) + .multiply( table2.doubleColumn( INVCOST_TUD ) ) + .divide( table2.doubleColumn( CO2_COST_EL03 ) ).setName( N_CO2_V ) + ) ; + + + String yName = N_CO2_V; + Axis yAxis = Axis.builder().title( yName ).build(); + + Layout layout = Layout.builder( "" ).xAxis( xAxisBuilder.title( xName ).build() ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + // the nkv=1 line: + double[] xx = new double[]{1., 1.}; + double[] yy = new double[]{0., 1.1* table2.numberColumn( yName ).max() }; + traces.add( ScatterTrace.builder( xx, yy ).mode( ScatterTrace.Mode.LINE ).name("NKV=1").build() ); + + traces.add( getTraceCyan( table2, xName, yName ) ); + traces.add( getTraceMagenta( table2, xName, yName ) ); + traces.add( getTraceOrange( table2, xName, yName ) ); + traces.add( getTraceRed( table2, xName, yName ) ); + + return new Figure( layout, traces.toArray( new Trace[]{} ) ); + } + // ======================================================================================== // ======================================================================================== public Figure invcosttud_vs_nkvElttimeCarbon2000Invcosttud(){ @@ -343,6 +413,100 @@ public Figure invcosttud_vs_nkvElttimeCarbon2000Invcosttud(){ private ScatterTrace vertialNkvOneLine( String y2Name ){ return vertialNkvOneLine( table, y2Name ); } + // ################################################################ + // ################################################################ + Figure invcost_tud_vs_orig(){ + String xName = INVCOST_ORIG; + + String yName = INVCOST_TUD; +// String y3Name = Headers.COST_OVERALL; + String y2Name = INVCOST_TUD; + + String plotTitle = ""; + + Axis xAxis = Axis.builder() + .title( xName ) + .type( Axis.Type.LOG) + .build(); + + Axis yAxis = Axis.builder() + .type( Axis.Type.LOG ) + // .range( 1.1*table.numberColumn( y2Name ).min(),4. ) + .title( yName ) + .build(); + Layout layout = Layout.builder( plotTitle ) + .xAxis( xAxis ) + .yAxis( yAxis ) + .width( plotWidth ) + .build(); + + List traces = new ArrayList<>(); + +// Trace trace = ScatterTrace.builder( table.numberColumn( xName ), table.numberColumn( yName ) ) +// .text( table.stringColumn( Headers.PROJECT_NAME ).asObjectArray() ) +// .name( String.format( legendFormat, yName ) ) +// .build(); + + traces.add( getTraceCyan( table, xName, y2Name ) ); + traces.add( getTraceMagenta( table, xName, y2Name ) ); + traces.add( getTraceOrange( table, xName, y2Name ) ); + traces.add( getTraceRed( table, xName, y2Name ) ); + + { + double[] xx = new double[]{ table.numberColumn( xName ).min(), table.numberColumn( xName ).max() }; + double[] yy = new double[]{ table.numberColumn( xName ).min(), table.numberColumn( xName ).max() }; + traces.add( ScatterTrace.builder( xx, yy ) + .mode( ScatterTrace.Mode.LINE ) + .build() ); + } + Figure figure3 = new Figure( layout, traces.toArray( new Trace[0] ) ); + return figure3; + } + public Figure fzkmFromTtime_vs_fzkmOrig(){ + String xName = ADDTL_PKWKM_ORIG; + + String y2Name = ADDTL_PKWKM_FROM_TTIME; + String yName = ADDTL_PKWKM_FROM_TTIME; + + Axis xAxis = Axis.builder().title( xName ).build(); + + Axis yAxis = Axis.builder().title( y2Name ).build(); + + Layout layout = Layout.builder().xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + traces.add( getTraceCyan( table, xName, y2Name ) ); + traces.add( getTraceMagenta( table, xName, y2Name ) ); + traces.add( getTraceOrange( table, xName, y2Name ) ); + traces.add( getTraceRed( table, xName, y2Name ) ); + + return new Figure( layout, traces.toArray(new Trace[]{} ) ); + } + public Figure fzkmFromTtimeSum_vs_fzkmOrig(){ + String xName = ADDTL_PKWKM_ORIG; + + final String ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG = "additional pkwkm from ttime plus orig"; + + table.addColumns( table.numberColumn( ADDTL_PKWKM_FROM_TTIME ).add( table.numberColumn( ADDTL_PKWKM_ORIG ) ).setName( ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG ) ); + + String y2Name = ADDTL_PKWKM_FROM_TTIME_PLUS_ORIG; + + Axis xAxis = Axis.builder().title( xName ).build(); + + Axis yAxis = Axis.builder().title( y2Name ).build(); + + Layout layout = Layout.builder().xAxis( xAxis ).yAxis( yAxis ).width( plotWidth ).build(); + + List traces = new ArrayList<>(); + + traces.add( getTraceCyan( table, xName, y2Name ) ); + traces.add( getTraceMagenta( table, xName, y2Name ) ); + traces.add( getTraceOrange( table, xName, y2Name ) ); + traces.add( getTraceRed( table, xName, y2Name ) ); + + return new Figure( layout, traces.toArray(new Trace[]{} ) ); + } private static ScatterTrace vertialNkvOneLine( Table table, String y2Name ){ return ScatterTrace.builder( new double[]{1., 1.}, new double[]{0., 1.1 * table.numberColumn( y2Name ).max()} ).mode( ScatterTrace.Mode.LINE ).name( "NKV=1" ).build(); } diff --git a/src/main/java/org/tub/vsp/bvwp/users/kn/RunLocalCsvScrapingKN.java b/src/main/java/org/tub/vsp/bvwp/users/kn/RunLocalCsvScrapingKN.java index 78dd5e3..c10b099 100644 --- a/src/main/java/org/tub/vsp/bvwp/users/kn/RunLocalCsvScrapingKN.java +++ b/src/main/java/org/tub/vsp/bvwp/users/kn/RunLocalCsvScrapingKN.java @@ -21,6 +21,8 @@ import java.text.NumberFormat; import java.util.*; +import static org.tub.vsp.bvwp.data.Headers.NKV_ORIG_CAPPED5; + public class RunLocalCsvScrapingKN{ private static final Logger logger = LogManager.getLogger( RunLocalCsvScrapingKN.class ); @@ -62,65 +64,64 @@ public static void main(String[] args) throws IOException{ Table table = csvWriter.writeCsv( allStreetBaseData ); // === - Figures1KN figures1 = new Figures1KN( table ); + Figures1KN figures1 = new Figures1KN( table, NKV_ORIG_CAPPED5 ); Figures2KN figures2 = new Figures2KN( table ); List
plots1 = new ArrayList<>(); List
plots2 = new ArrayList<>(); - - plots1.add( figures1.fzkmFromTtime_vs_fzkmOrig() ); - plots1.add( figures1.fzkmFromTtimeSum_vs_fzkmOrig() ); - - plots1.add( figures1.invcost_tud_vs_orig() ); - plots1.add( figures1.nkv_el03() ); - plots1.add( figures1.nkv_carbon700() ); - plots1.add( figures1.nkv_el03_carbon700() ); - +// plots1.add( figures1.invCostTud() ); +// +// plots1.add( figures1.carbon() ); +// +// +// plots1.add( figures2.fzkmFromTtime_vs_fzkmOrig() ); +// plots1.add( figures2.fzkmFromTtimeSum_vs_fzkmOrig() ); +// +// plots1.add( figures1.nkv_el03() ); +// plots1.add( figures1.nkv_carbon700() ); +// plots1.add( figures1.nkv_el03_carbon700() ); +// // plots1.add( figures1.elasticities() ); // plots1.add( figures1.fzkmDiff() ); -// plots1.add( figures1.carbon() ); -// plots1.add( figures1.invcost() ); // plots1.add( figures1.nkv_el03_diff() ); // plots1.add( figures1.dtv() ); // plots1.add( figures1.fzkmNew() ); +// +// plots2.add( figures2.invcost_tud_vs_orig() ); +// plots2.add( figures2.nkvVsDtv() ); +// +// plots2.add( figures2.cost_VS_nkvOrig() ); +// +// plots2.add( figures2.costOrigVsCumulativeCostOrig() ); +// +// plots2.addAll( figures2.nkvElttimeCarbon215(5 ) ); +// +// plots2.add( figures2.invcosttud_vs_nkvEl03Cprice215Invcosttud( 5) ); +// plots2.add( figures2.cumulativeCostTud_vs_nkvEl03Cprice215InvcostTud(5 ) ); +// plots2.add( figures2.cumulativeCostTud_vs_nkvEl03Cprice215InvcostTud(Integer.MAX_VALUE ) ); +// plots2.add( figures2.invcosttud_vs_nkvEl03Cprice215Invcosttud( Integer.MAX_VALUE) ); +// +// plots2.add( figures2.invcosttud_vs_nkvElttimeCarbon700Invcosttud(5) ); +// plots2.add( figures2.invcost50_vs_NkvEl03Cprice700InvcostTud() ); +// plots2.add( figures2.cumcost50_vs_nkvEl03Cprice700InvcostTud() ); +// plots2.add( figures2.invcosttud_vs_nkvElttimeCarbon2000Invcosttud() ); +// +// plots2.add( figures2.carbon_vs_nkvEl03Cprice215Invcost50Capped5() ); +// +// plots2.add( figures2.nco2v_vs_vs_nkvElttimeCarbon700Invcosttud(5 ) ); - plots2.add( figures2.nkvVsDtv() ); - - plots2.add( figures2.cost_VS_nkvOrig() ); - - plots2.add( figures2.costOrigVsCumulativeCostOrig() ); - - plots2.addAll( figures2.nkvElttimeCarbon215(5 ) ); - - - - - - plots2.add( figures2.invcosttud_vs_nkvEl03Cprice215Invcosttud( 5) ); - plots2.add( figures2.cumulativeCostTud_vs_nkvEl03Cprice215InvcostTud(5 ) ); - plots2.add( figures2.cumulativeCostTud_vs_nkvEl03Cprice215InvcostTud(Integer.MAX_VALUE ) ); - plots2.add( figures2.invcosttud_vs_nkvEl03Cprice215Invcosttud( Integer.MAX_VALUE) ); - - plots2.add( figures2.invcosttud_vs_nkvElttimeCarbon700Invcosttud(5) ); - plots2.add( figures2.invcost50_vs_NkvEl03Cprice700InvcostTud() ); - plots2.add( figures2.cumcost50_vs_nkvEl03Cprice700InvcostTud() ); - plots2.add( figures2.invcosttud_vs_nkvElttimeCarbon2000Invcosttud() ); - - plots2.add( figures2.carbon_vs_nkvEl03Cprice215Invcost50Capped5() ); + plots2.add( figures2.carbon_vs_inv() ); // === - - String page = MultiPlotUtils.pageTop() + System.lineSeparator(); for( int ii=0; ii allRailData = scraper.extractAllLocalBaseData("./data/rail/all", "", "^2.*", "") - .stream() - .map(RailAnalysisDataContainer::new) - .toList(); + List allRailData = scraper + .extractAllLocalBaseData("./data/rail/all", "", "^2.*", "") + .stream() + .map(RailAnalysisDataContainer::new) + .toList(); + + Table table = new RailTableCreator().computeTable(allRailData ); + + // === + + Figures1RailKN figures1 = new Figures1RailKN( table, NKV_ORIG_CAPPED5 ); +// Figures2KN figures2 = new Figures2KN( table ); + + List
plots1 = new ArrayList<>(); + List
plots2 = new ArrayList<>(); + + // === + +// plots1.add( figures1.nkv_orig() ); +// plots1.add( figures1.nkv_carbon700() ); + + plots1.add( figures1.invCost_orig()); + plots1.add( figures1.invCost_orig_cumulative()); + +// plots1.add( figures1.fzkmFromTtime_vs_fzkmOrig() ); +// plots1.add( figures1.fzkmFromTtimeSum_vs_fzkmOrig() ); + +// plots1.add( figures1.nkv_el03() ); +// plots1.add( figures1.nkv_carbon700() ); +// plots1.add( figures1.nkv_el03_carbon700() ); +// +// plots1.add( figures1.elasticities() ); +// plots1.add( figures1.fzkmDiff() ); +// plots1.add( figures1.carbon() ); +// plots1.add( figures1.nkv_el03_diff() ); +// plots1.add( figures1.dtv() ); +// plots1.add( figures1.fzkmNew() ); + + // === + + StringBuilder page = new StringBuilder( MultiPlotUtils.pageTop() + System.lineSeparator() ); + for( int ii=0; ii