aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--compressor.c34
2 files changed, 35 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 12872be..5fe4011 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
CFLAGS = -std=c99 -Wall -Wextra -pedantic -Wno-deprecated-declarations -D_XOPEN_SOURCE=700L
LDFLAGS = -lSDL2 -lSDL2_ttf -lm
-SRC = main.c microui.c renderer.c widget.c ui.c unit.c engine.c
+SRC = main.c microui.c renderer.c widget.c ui.c unit.c engine.c compressor.c
OBJ = ${SRC:.c=.o}
HDR = microui.h renderer.h widget.h ui.h unit.h engine.h
diff --git a/compressor.c b/compressor.c
new file mode 100644
index 0000000..05aa9fc
--- /dev/null
+++ b/compressor.c
@@ -0,0 +1,34 @@
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <strings.h>
+
+#include <dirent.h>
+
+#include "unit.h"
+
+
+static const char ROOT[] = "compressor_maps/";
+
+
+typedef struct {
+ int x, y;
+} Point;
+
+typedef enum { MASS_FLOW, VOLUME_FLOW } FlowType;
+
+typedef union {
+ MassFlowRate mfr;
+ VolumeFlowRate vfr;
+} Flow;
+
+typedef struct {
+ char brand[NAME_MAX+1]; /* e.g. Borgwarner. */
+ char series[NAME_MAX+1]; /* e.g. Airwerks. */
+ char model[NAME_MAX+1]; /* e.g. S200SX-E. */
+ char imgfile[NAME_MAX+1]; /* name of file containing image of the compressor map. */
+ Point origin, refpt; /* pixel coords of origin and reference point. */
+ double originpr, refpr; /* pressure ratio at origin and reference point. */
+ Flow originflow, refflow; /* flow at origin and reference point. */
+ FlowType flowtype; /* mass-flow or volume-flow (x-axis). */
+} Compressor;