thermferm/thermferm.h

changeset 259
b7c967359771
parent 248
870d0be6880d
child 262
d0014ccec615
--- a/thermferm/thermferm.h	Wed Aug 20 22:15:12 2014 +0200
+++ b/thermferm/thermferm.h	Fri Aug 22 17:12:42 2014 +0200
@@ -201,6 +201,9 @@
 #define	DEVTYPE_DHT		4		/* DHT type device on GPIO	*/
 #define	DEVTYPE_I2C		5		/* I2C bus device		*/
 #define	DEVTYPE_SPI		6		/* SPI bus device		*/
+#ifdef USE_SIMULATOR
+#define DEVTYPE_SIM		7		/* Simulated device		*/
+#endif
 
 #define	DEVPRESENT_UNDEF	0		/* Precence not testable	*/
 #define	DEVPRESENT_NO		1		/* Device is missing		*/
@@ -215,6 +218,46 @@
 #define	DEVDIR_OUT_PWM		5		/* PWM outout			*/
 #define	DEVDIR_INTERN		6		/* Internal function		*/
 
+#ifdef USE_SIMULATOR
+
+/*
+ * The frigo is a simulation of a fridge with a heating device. 
+ * It has a volume air, a volume of your beer. There is a simulated
+ * thermal sensor that measures the air and one that measures the beer.
+ * It looks like a normal live setup.
+ */
+typedef struct _simulator {
+    struct _simulator	*next;
+    int			version;		/* Version of this record	*/
+    char		*uuid;			/* Simulator uuid		*/
+    char		*name;			/* Simulator name		*/
+    int			volume_air;		/* Volume air of the frigo	*/
+    int			volume_beer;		/* Volume beer inside frigo	*/
+    float		room_temperature;	/* Temp outside frigo		*/
+    float		air_temperature;	/* Simulated air temperature	*/
+    float		beer_temperature;	/* Simulated beer temperature	*/
+    float		cooler_temp;		/* Lowest cooler temperature	*/
+    int			cooler_time;		/* Time to reach temperature	*/
+    float		cooler_size;		/* Size of cooler in square mtr	*/
+    float		heater_temp;		/* Highest heater temperature	*/
+    int			heater_time;		/* Time to reach temperature	*/
+    float		heater_size;		/* Size of heater in square mtr	*/
+    int			heater_state;		/* Heater status		*/
+    int			cooler_state;		/* Cooler status		*/
+    float		frigo_isolation;	/* Frigo isolation value	*/
+    /*
+     * Status values, maintained by the simulator but stored
+     * here so they don't get lost over program restarts.
+     */
+    float		s_yeast_heat;		/* Heat generated by yeast	*/
+    time_t		s_yeast_started;	/* Start date/time fermentation	*/
+    float		s_cool_temp;		/* Temp cooler			*/
+    float		s_heat_temp;		/* Temp heater			*/
+    time_t		s_cool_changed;		/* Start date/time cooler	*/
+    time_t		s_heat_changed;		/* Start date/time heater	*/
+} simulator_list;
+
+#endif
 
 typedef struct _sys_config {
     char		*name;			/* Configuration name		*/
@@ -234,6 +277,9 @@
     units_list		*units;			/* Fermenter units		*/
     profiles_list	*profiles;		/* Ferment profiles		*/
     devices_list	*devices;		/* Sensors and switches		*/
+#ifdef USE_SIMULATOR
+    simulator_list	*simulators;		/* Simulators			*/
+#endif
 } sys_config;
 
 

mercurial