Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit da868b1

Browse files
committed
Process Cooling, first draft / implementation
1 parent 1520832 commit da868b1

File tree

9 files changed

+2337
-23
lines changed

9 files changed

+2337
-23
lines changed

bindings-wasm/processCooling.cpp

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#include "chillers/ProcessCooling.h"
2+
#include <emscripten/bind.h>
3+
4+
using namespace std;
5+
using namespace emscripten;
6+
7+
EMSCRIPTEN_BINDINGS(processCooling_class)
8+
{
9+
enum_<ProcessCooling::RefrigerantType>("RefrigerantType")
10+
.value("R_11", ProcessCooling::RefrigerantType::R_11)
11+
.value("R_123", ProcessCooling::RefrigerantType::R_123)
12+
.value("R_12", ProcessCooling::RefrigerantType::R_12)
13+
.value("R_134a", ProcessCooling::RefrigerantType::R_134a)
14+
.value("R_22", ProcessCooling::RefrigerantType::R_22)
15+
.value("R_717", ProcessCooling::RefrigerantType::R_717);
16+
17+
enum_<ProcessCooling::ACSourceLocation>("ACSourceLocation")
18+
.value("Inside", ProcessCooling::ACSourceLocation::Inside)
19+
.value("Outside", ProcessCooling::ACSourceLocation::Outside);
20+
21+
enum_<ProcessCooling::CoolingSystemType>("CoolingSystemType")
22+
.value("Water", ProcessCooling::CoolingSystemType::Water)
23+
.value("Air", ProcessCooling::CoolingSystemType::Air);
24+
25+
enum_<ProcessCooling::CellFanType>("CellFanType")
26+
.value("AxialFan", ProcessCooling::CellFanType::AxialFan)
27+
.value("CentrifugalFan", ProcessCooling::CellFanType::CentrifugalFan);
28+
29+
enum_<ProcessCooling::TowerSizedBy>("TowerSizedBy")
30+
.value("Tonnage", ProcessCooling::TowerSizedBy::Tonnage)
31+
.value("Fan_HP", ProcessCooling::TowerSizedBy::Fan_HP);
32+
33+
enum_<ProcessCooling::ChillerCompressorType>("ChillerCompressorType")
34+
.value("Centrifugal", ProcessCooling::ChillerCompressorType::Centrifugal)
35+
.value("Screw", ProcessCooling::ChillerCompressorType::Screw)
36+
.value("Reciprocating", ProcessCooling::ChillerCompressorType::Reciprocating);
37+
38+
enum_<ProcessCooling::FanMotorSpeedType>("FanMotorSpeedType")
39+
.value("One", ProcessCooling::FanMotorSpeedType::One)
40+
.value("Two", ProcessCooling::FanMotorSpeedType::Two)
41+
.value("Variable", ProcessCooling::FanMotorSpeedType::Variable);
42+
43+
class_<ProcessCooling::WaterCooledSystemInput>("WaterCooledSystemInput")
44+
.constructor<double, bool, double, bool, double, bool, double, double>();
45+
46+
class_<ProcessCooling::AirCooledSystemInput>("AirCooledSystemInput")
47+
.constructor<double, double, ProcessCooling::ACSourceLocation, double, double>();
48+
49+
50+
class_<ProcessCooling::ChillerOutput>("ChillerOutput")
51+
.property("efficiency", &ProcessCooling::ChillerOutput::efficiency)
52+
.property("hours", &ProcessCooling::ChillerOutput::hours)
53+
.property("power", &ProcessCooling::ChillerOutput::power)
54+
.property("energy", &ProcessCooling::ChillerOutput::energy);
55+
56+
class_<ProcessCooling::ChillerPumpingEnergyOutput>("ChillerPumpingEnergyOutput")
57+
.property("chillerPumpingEnergy", &ProcessCooling::ChillerPumpingEnergyOutput::chillerPumpingEnergy);
58+
59+
class_<ProcessCooling::TowerOutput>("TowerOutput")
60+
.property("efficiency", &ProcessCooling::TowerOutput::tempBins)
61+
.property("hours", &ProcessCooling::TowerOutput::hours)
62+
.property("energy", &ProcessCooling::TowerOutput::energy);
63+
64+
65+
class_<ProcessCooling::PumpInput>("PumpInput")
66+
.constructor<bool, double, double, double, double>();
67+
68+
class_<ProcessCooling::TowerInput>("TowerInput")
69+
.constructor<int, int, ProcessCooling::FanMotorSpeedType, ProcessCooling::TowerSizedBy, ProcessCooling::CellFanType, double, double>();
70+
71+
class_<ProcessCooling::ChillerInput>("ChillerInput")
72+
.constructor<ProcessCooling::ChillerCompressorType, double, bool, double, double, bool, bool, vector<vector<double>>>()
73+
.constructor<ProcessCooling::ChillerCompressorType, double, bool, double, double, bool, bool, vector<vector<double>>, bool, ProcessCooling::RefrigerantType, ProcessCooling::RefrigerantType>()
74+
.constructor<ProcessCooling::ChillerCompressorType, double, bool, double, double, bool, bool, vector<vector<double>>, vector<double>, vector<double>>()
75+
.constructor<ProcessCooling::ChillerCompressorType, double, bool, double, double, bool, bool, vector<vector<double>>, vector<double>, vector<double>, ProcessCooling::RefrigerantType, ProcessCooling::RefrigerantType>();
76+
77+
78+
class_<ProcessCooling>("ProcessCooling")
79+
.constructor<const vector<int>&, const vector<double>&, const vector<double>&, const vector<ProcessCooling::ChillerInput>&, ProcessCooling::TowerInput, ProcessCooling::WaterCooledSystemInput>()
80+
.constructor<const vector<int>&, const vector<double>&, const vector<double>&, const vector<ProcessCooling::ChillerInput>&, ProcessCooling::AirCooledSystemInput>()
81+
.function("calculateTowerEnergy", &ProcessCooling::calculateTowerEnergy)
82+
.function("calculateChillerEnergy", &ProcessCooling::calculateChillerEnergy)
83+
.function("calculatePumpEnergy", &ProcessCooling::calculatePumpEnergy);
84+
85+
register_vector<int>("IntVector");
86+
register_vector<ProcessCooling::ChillerInput>("ChillerInputV");
87+
}

0 commit comments

Comments
 (0)