@@ -2,7 +2,7 @@ import fs from "fs";
2
2
import { Cfg } from "./Cfg" ;
3
3
import { setEnsureMonotonicSteps } from "./bruteForceMonotonic" ;
4
4
import { MarkdownExporter } from "./MarkdownExporter" ;
5
- import { SolutionCalculationResult , calulateSolutionMassesByEC } from "./calulateSolutionMassesByEC " ;
5
+ import { SolutionCalculationResult , calculateSolutionMassesByEC } from "./calculateSolutionMassesByEC " ;
6
6
7
7
let cfg : Cfg ;
8
8
let saltSymbolsAfterPoint : number ;
@@ -26,6 +26,8 @@ async function main() {
26
26
fs . writeFileSync ( 'tmp/NaClSolutions.html' , html ) ;
27
27
let pdf = await MarkdownExporter . export ( markdown , false ) ;
28
28
fs . writeFileSync ( 'NaClSolutions.pdf' , pdf ) ;
29
+
30
+ console . log ( "Done" ) ;
29
31
}
30
32
31
33
function getTable ( ECs : Array < number > , minWaterGrams : number , maxWatergrams : number , printingAccuracyShift : number = 0 ) {
@@ -36,7 +38,32 @@ function getTable(ECs: Array<number>, minWaterGrams: number, maxWatergrams: numb
36
38
str += '| ' + dashes . join ( ' | ' ) + '|\n' ;
37
39
for ( let EC of ECs ) {
38
40
let targetNumDigits = getSymbolsAfterPoint ( EC ) ;
39
- let res : SolutionCalculationResult = calulateSolutionMassesByEC ( EC , minWaterGrams , maxWatergrams , cfg . waterScalesDivisionValue , cfg . saltScalesDivisionValue ) ;
41
+ let res : SolutionCalculationResult = calculateSolutionMassesByEC ( EC , minWaterGrams , maxWatergrams , cfg . waterScalesDivisionValue , cfg . saltScalesDivisionValue ) ;
42
+ let ecAccuracyPercentage = ( res . ECAccuracy / EC * 100 ) . toFixed ( printingAccuracyShift + 2 ) + '%' ;
43
+ str += '| ' + [
44
+ EC ,
45
+ res . waterGrams . toFixed ( waterSymbolsAfterPoint ) ,
46
+ res . saltGrams . toFixed ( saltSymbolsAfterPoint ) ,
47
+ res . realEC . toFixed ( printingAccuracyShift + targetNumDigits + 2 ) ,
48
+ res . minEC . toFixed ( printingAccuracyShift + targetNumDigits ) + ' - ' + res . maxEC . toFixed ( printingAccuracyShift + targetNumDigits ) ,
49
+ ecAccuracyPercentage ,
50
+ res . rho . toFixed ( printingAccuracyShift + targetNumDigits + 2 ) ,
51
+ res . ECError . toExponential ( printingAccuracyShift + 2 ) ,
52
+ res . volume . toFixed ( waterSymbolsAfterPoint + 2 ) ,
53
+ ] . join ( ' | ' ) + '|\n' ;
54
+ }
55
+ return str ;
56
+ }
57
+
58
+ function getTablePharmacySolution ( ECs : Array < number > , minWaterGrams : number , maxWatergrams : number , printingAccuracyShift : number = 0 ) {
59
+ let str = '' ;
60
+ let columns = [ 'EC' , 'H2O(г)' , 'NaCl 0.9%(г)' , 'Рассчетный EC' , 'Диапазон EC' , 'Диапазон EC%' , '$\\rho$(г/л)' , 'Отклонение EC' , 'Объём раствора(мл)' ] ;
61
+ str += '| ' + columns . join ( ' | ' ) + '|\n' ;
62
+ let dashes = columns . map ( ( ) => '---' ) ;
63
+ str += '| ' + dashes . join ( ' | ' ) + '|\n' ;
64
+ for ( let EC of ECs ) {
65
+ let targetNumDigits = getSymbolsAfterPoint ( EC ) ;
66
+ let res : SolutionCalculationResult = calculateSolutionMassesByEC ( EC , minWaterGrams , maxWatergrams , cfg . waterScalesDivisionValue , cfg . saltScalesDivisionValue ) ;
40
67
let ecAccuracyPercentage = ( res . ECAccuracy / EC * 100 ) . toFixed ( printingAccuracyShift + 2 ) + '%' ;
41
68
str += '| ' + [
42
69
EC ,
@@ -53,6 +80,7 @@ function getTable(ECs: Array<number>, minWaterGrams: number, maxWatergrams: numb
53
80
return str ;
54
81
}
55
82
83
+
56
84
function formatDate ( date : Date ) {
57
85
var d = new Date ( date ) ,
58
86
month = '' + ( d . getMonth ( ) + 1 ) ,
0 commit comments