OSCAT Forum

oscat.lib => Bestehende Module / Existing Modules => Thema gestartet von: Mc_Franky am 14. Januar 2013, 15:04:58

Titel: Temp_Ext in S7_Building
Beitrag von: Mc_Franky am 14. Januar 2013, 15:04:58
Der Baustein macht bei der Initialisierung Probleme. Und zwar wird bei ungünstiger Situation der Baustein nicht mehr aufgerufen. Ich habe bei mir im Quellcode bei der Initialisierung folgendes mit eingefügt:

IF NOT init THEN
    init := TRUE;
    heat_start := set_Date(year:=1972,month:=month_of_date(heat_period_start),day:=day_of_month(heat_period_start));
    heat_stop := set_Date(year:=1972,month:=month_of_date(heat_period_stop),day:=day_of_month(heat_period_stop));
    cool_start := set_Date(year:=1972,month:=month_of_date(cool_period_start),day:=day_of_month(cool_period_start));
    cool_stop := set_Date(year:=1972,month:=month_of_date(cool_period_stop),day:=day_of_month(cool_period_stop));
    last_run := DINT_TO_TIME(DWORD_TO_DINT(T_PLC_MS())) - cycle_time;
END_IF;

Damit wird beim ersten Aufruf der Baustein einmal durchlaufen und der Last_run richtig initialisiert.

Vielleicht kann das in den Quellcode mit übernommen werden.