Subversion Repositories heating

Rev

Rev 52 | Rev 54 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52 Rev 53
Line 209... Line 209...
209
		}
209
		}
210
 
210
 
211
		while (akt)
211
		while (akt)
212
		{
212
		{
213
			/// Set the mode for every room.
213
			/// Set the mode for every room.
-
 
214
			if (!onoff)
-
 
215
			{
214
			if (loctime >= akt->start && loctime <= akt->end)
216
				if (loctime >= akt->start && loctime <= akt->end)
215
				akt->status = NORMAL;
217
					akt->status = NORMAL;
-
 
218
				else
-
 
219
					akt->status = NIGHT;
-
 
220
			}
216
			else
221
			else
217
				akt->status = NIGHT;
222
				akt->status = OFF;
218
 
223
 
219
			tmp = getTemp(akt->tempsensor);
224
			tmp = getTemp(akt->tempsensor);
220
 
225
 
221
			if (tmp < 99.0 && tmp > -99.0)
226
			if (tmp < 99.0 && tmp > -99.0)
222
				akt->ist = tmp;
227
				akt->ist = tmp;
Line 1171... Line 1176...
1171
	loctime = getTime();
1176
	loctime = getTime();
1172
 
1177
 
1173
	switch(akt->status)
1178
	switch(akt->status)
1174
	{
1179
	{
1175
		case NORMAL:
1180
		case NORMAL:
1176
			if (loctime >= akt->wstart && loctime <= akt->wend)
1181
			if (akt->wstart && akt->wstart < akt->wend && loctime >= akt->wstart && loctime <= akt->wend)
1177
				soll = akt->night;
1182
				soll = akt->night;
1178
			else if ((loctime >= akt->start && loctime <= akt->wstart) ||
1183
			else if ((loctime >= akt->start && loctime <= akt->wstart) ||
1179
				(loctime >= akt->wend && loctime <= akt->end)) 
1184
				(loctime >= akt->wend && loctime <= akt->end)) 
1180
				soll = akt->soll;
1185
				soll = akt->soll;
1181
 
-
 
1182
			
1186
			
1183
			diffOut = trunc(soll - getOutside());
1187
			diffOut = trunc(soll - getOutside());
1184
			diffIn = trunc(soll - temp);
1188
			diffIn = trunc(soll - temp);
1185
		break;
1189
		break;
1186
 
1190
 
Line 1239... Line 1243...
1239
				break;
1243
				break;
1240
		}
1244
		}
1241
 
1245
 
1242
		if (tb && tb->start)
1246
		if (tb && tb->start)
1243
		{
1247
		{
1244
			time_t t = getTime();
-
 
1245
 
-
 
1246
			if (t > tb->start)
1248
			if (loctime > tb->start)
1247
				tb->heat = t - tb->start;
1249
				tb->heat = loctime - tb->start;
1248
			else
1250
			else
1249
				tb->heat = (86400 + t) - tb->start;
1251
				tb->heat = (86400 + loctime) - tb->start;
1250
 
1252
 
1251
			tb->start = 0;
1253
			tb->start = 0;
1252
		}
1254
		}
1253
 
1255
 
1254
		return false;
1256
		return false;
1255
	}
1257
	}
1256
	else if (!akt->valve && temp <= (soll - 0.5))		// If temperature is beyond soll, start immediately
1258
	else if (!akt->valve && temp <= (soll - 0.5))		// If temperature is beyond soll, start immediately
-
 
1259
	{
-
 
1260
		HTABLE *tb = akt->hTable;
-
 
1261
		// Find out whether we've already a correct time in the table or not.
-
 
1262
		while (tb)
-
 
1263
		{
-
 
1264
			if (tb->tempDifferOut == diffOut && tb->tempDifferIn == diffIn)
-
 
1265
				break;
-
 
1266
 
-
 
1267
			tb = tb->next;
-
 
1268
		}
-
 
1269
 
-
 
1270
		if (!tb)
-
 
1271
		{
-
 
1272
			tb = appendHTable(akt);
-
 
1273
			tb->tempDifferOut = diffOut;
-
 
1274
			tb->tempDifferIn = diffIn;
-
 
1275
			tb->start = loctime;
-
 
1276
		}
-
 
1277
 
1257
		return true;
1278
		return true;
-
 
1279
	}
1258
	else
1280
	else
1259
	{
1281
	{
1260
		HTABLE *tb = akt->hTable;
1282
		HTABLE *tb = akt->hTable;
1261
		time_t t = getTime();
1283
		time_t t = getTime();
1262
		// Check the current time and look in learned table whether we should
1284
		// Check the current time and look in learned table whether we should
Line 1337... Line 1359...
1337
		}
1359
		}
1338
	}
1360
	}
1339
 
1361
 
1340
	return false;
1362
	return false;
1341
}
1363
}
-
 
1364
 
-
 
1365
time_t heating::calcTime(double soll, double ist)
-
 
1366
{
-
 
1367
double pwm, len;
-
 
1368
double correct= 100;
-
 
1369
double parallel = 110;
-
 
1370
 
-
 
1371
	pwm = (log((soll - ist) + correct * 0.001) + parallel * 0.01) * 100.0;
-
 
1372
	len = (10 * 60) * pwm / 100.0;
-
 
1373
	return time_t(len * 10.0);
-
 
1374
}
-
 
1375