-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.js
198 lines (152 loc) · 5.63 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//http redirect port was not able to be changed dynamically so if the port is changed for the https server will need to be changed in the code as listed below
const http = require('http'); // for redirect only
const https = require('https');
const fs = require('fs');
const options ={
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var forceSSL = require('express-force-ssl');
var express = require('express');
var app = express();
var port = process.env.port || 8080;
var httpPort = process.env.httpPort || 80
var server = http.createServer(app);
app.set('forceSSLOptions', {
enable301Redirects: true,
trustXFPHeader: false,
httpsPort: 8080,//requires a change if the port run is not 8080
sslRequiredMessage: 'SSL Required.'
});
var unsecureServer = http.createServer(app);
var secureServer = https.createServer(options, app);
var psat = require("./node_modules/amo-tools-suite/build/Release/psat.node");
var phast = require("./node_modules/amo-tools-suite/build/Release/phast.node");
var pumpheadtool = require('./src/pump/pumpheadtool.js');
var pump = require('./src/pump/pump.js');
var flowAndEnergyUsed = require('./src/processHeating/flowAndEnergyUsed.js');
var o2Enrichment = require('./src/processHeating/O2Enrichment.js');
var pumpachievableefficiency = require("./src/pump/pumpachievableefficiency.js");
var energyElectric = require('./src/processHeating/energyEquivalencyElectric.js');
var humidityRatio = require('./src/processHeating/humidityRatio.js');
var efficiencyImprovement = require('./src/processHeating/efficiencyImprovement.js');
var auxiliaryPowerLoss=require('./src/processHeating/auxiliaryPowerLoss.js');
var energyInputEAF=require('./src/processHeating/energyInputEAF.js');
var fan = require("./src/fan/fan.js");
var fan203 = require('./src/fan/fan203.js');
var atmosphere = require("./src/processHeating/atmosphere.js");
var gasCoolingLosses = require('./src/processHeating/gasCoolingLosses.js');
var leakageLosses = require('./src/processHeating/leakageLosses.js');
var liquidCoolingLosses = require('./src/processHeating/liquidCoolingLosses.js');
var waterCoolingLosses=require('./src/processHeating/waterCoolingLosses.js');
var router = express.Router();
var steam = require('./src/steam/SteamAssessment.js')
var motor = require('./src/motor/motorPerformance.js');
var motorNEMA = require('./src/motor/motorNEMA.js')
var motorEstFLA = require('./src/motor/motorEstFLA.js');
var processHeating = require('./src/processHeating/processHeatingAssessment.js')
router.get('/processHeating/atmosphere', function(req, res)
{
atmosphere.CalculateAtmosphere(req, res);
});
router.get('/processHeating/gasCoolingLosses', function(req, res)
{
gasCoolingLosses.CalculateGasCoolingLosses(req, res);
});
router.get('/processHeating/leakageLosses', function(req, res)
{
leakageLosses.CalculateLeakageLosses(req, res);
});
router.get('/processHeating/liquidCoolingLosses', function(req, res)
{
liquidCoolingLosses.CalculateLiquidCoolingLosses(req, res);
});
router.get('/processHeating/waterCoolingLosses', function(req, res)
{
waterCoolingLosses.CalculateWaterCoolingLosses(req, res);
});
router.get('/processHeating/energyInputEAF', function(req, res)
{
energyInputEAF.CalculateEnergyInputEAF(req, res);
});
router.get('/processHeating/auxiliaryPowerLoss', function(req, res)
{
auxiliaryPowerLoss.CalculateAuxiliaryPowerLoss(req, res);
});
router.get('/motor/motorEstFLA', function(req, res)
{
motorEstFLA.CalculateMotorEstFLA(req, res);
});
router.get('/steam/SteamAssessment', function(req, res)
{
steam.SteamBaseline(req, res);
});
router.get('/processHeating/assessment', function(req, res)
{
processHeating.BaseLineAssessment(req, res);
});
router.get('/processHeating/flowAndEnergyUsed', function(req, res)
{
flowAndEnergyUsed.CalculateFlowAndEnergyUsed(req, res);
});
router.get('/motor/motorNEMA', function(req, res)
{
motorNEMA.CalculateMotorNEMA(req, res);
});
router.get('/processHeating/efficiencyImprovement', function(req, res)
{
efficiencyImprovement.CalculateEfficiencyImprovement(req, res);
});
router.get('/processHeating/humidityRatio', function(req, res)
{
humidityRatio.CalculateHumidityRatio(req, res);
});
router.get('/processHeating/o2Enrichment', function(req, res)
{
o2Enrichment.Calculateo2Enrichment(req, res);
});
router.get('/energyEquivalencyElectric/energyEquivalencyElectric', function(req, res)
{
energyElectric.CalculateEnergyEquivalencyElectric(req, res);
});
router.get('/motor/motorPerformance', function(req, res)
{
motor.CalculateMotorPerformance(req, res);
});
router.get('/pumpheadtool/suctionGaugeElevation', function(req, res)
{
pumpheadtool.CalculateSuctionGaugeElevation(req, res);
});
router.get('/pumpachievableefficiency/pumpefficiency',function(req,res)
{
pumpachievableefficiency.CalculatePumpEfficiency(req,res);
});
router.get('/pumpheadtool/suctionTankElevation', function(req, res)
{
pumpheadtool.CalculateSuctionTankElevation(req, res);
});
router.get('/pump/assessment', function(req, res)
{
pump.CalculateCurrentPumpEfficiency(req, res);
});
router.get('/pump/modifiedAssessment', function(req, res)
{
pump.CalculateModifiedPumpEfficiency(req, res);
});
router.get('/fan/assessment',function(req,res)
{
fan.CalculateFanExisting(req,res);
});
router.get('/fan/modifiedAssessment',function(req,res)
{
fan.CalculateFanModified(req,res);
});
router.get('/fan/CalculateFanTraverseAnalysis', function(req, res)
{
fan203.CalculateFanTraverseAnalysis(req,res);
});
app.use(forceSSL);
secureServer.listen(port);
server.listen(httpPort);
app.use('/', router);
console.log("Listening on port number: " + port +" for the https server and listening to " + httpPort+ " for the HTTP redirect server");