Beiträge anzeigen

Diese Sektion erlaubt es ihnen alle Beiträge dieses Mitglieds zu sehen. Beachten sie, dass sie nur solche Beiträge sehen können, zu denen sie auch Zugriffsrechte haben.


Themen - dawrut

Seiten: [1]
1
SPS-Programmierung / Save blind position in case of power failure
« am: 28. April 2021, 22:44:27 »
How are you saving the position of the blind in case of a power failure?

Function BLIND_CONTROL_S has built-in automatic calibration which is needed to know the position of the blind in case of power failure or PLC restart. In such a case, the blind goes up. Is there a way to store the current position so that after the power failure the blind won't go up?
I was trying to add the whole BLIND_CONTROL_S  function block to the VAR RETAIN PERSISTENT memory area but this didn't help. I was also trying to store the POS output of the BLIND_CONTROL_S (which is the input for the POS of the BLIND_INPUT) but this also doesn't stop blinds to go up in case of power failure.

Any ideas?

2
SPS-Programmierung / BLIND_NIGHT doesn't work
« am: 08. April 2021, 07:37:45 »
I've problems with BLIND_NIGHT. This function block seems not to be working in my case. I've been connected to the PLC when the sunset comes and nothing happened
My code looks like this:

FUNCTION_BLOCK Blind
VAR_INPUT
   xBlindDown: BOOL;
   xBlindUp: BOOL;
   xAutoSunset: BOOL := FALSE;
   xAutoSunrise: BOOL := FALSE;
   tSunsetOffset: TIME;
   tSunriseOffset: TIME;
END_VAR
VAR_OUTPUT
   xBlindControlUp: BOOL;
   xBlindControlDown: BOOL;
END_VAR
VAR
   BlindInput: OSCAT_BUILDING.BLIND_INPUT := (SINGLE_SWITCH := FALSE, MAX_RUNTIME := T#25S, MANUAL_TIMEOUT := T#60M, MASTER_MODE := TRUE, IN := TRUE);
   BlindControl: OSCAT_BUILDING.BLIND_CONTROL_S := (T_UP:=T#20S, T_DN:=T#18S);
   BlindNight: OSCAT_BUILDING.BLIND_NIGHT;
   BlindSecurity: OSCAT_BUILDING.BLIND_SECURITY;
   
   SunTime: OSCAT_BASIC.SUN_TIME := (LATITUDE := rLatitude, LONGITUDE := rLongitude);
   CurrentDateTimeUTC: DATE_AND_TIME;
   CurrentDateUTC: DATE;   
END_VAR


And here is the code:

CurrentDateTimeUTC := FuGetDateAndTime();
CurrentDateUTC := TO_DATE(CurrentDateTimeUTC);

SunTime(UTC := CurrentDateUTC);

BlindInput(
   POS:= BlindControl.POS,
   S1:= xBlindUp,
   S2:= xBlindDown,
);

//GVL.xInit is a global variable which is set to true after first PLC cycle
//this switch of IN state is required to stop moving of blinds after a power failure of PLC update
IF (GVL.xInit = TRUE) THEN
   BlindInput.IN := FALSE;
END_IF

BlindNight(
   UP := BlindInput.QU,
   DN := BlindInput.QD,
   S_IN := BlindInput.STATUS,
   PI := BlindInput.PO,
   DTIN := CurrentDateTimeUTC,
   SUNRISE := SunTime.SUN_RISE,
   SUNRISE_OFFSET := tSunriseOffset,
   SUNSET := SunTime.SUN_SET,
   SUNSET_OFFSET := tSunsetOffset,
   E_NIGHT := xAutoSunset,
   E_DAY := xAutoSunrise
);

BlindSecurity(
   UP := BlindNight.QU,
   DN := BlindNight.QD,
   S_IN := BlindNight.STATUS,
   PI := BlindNight.PO
);

// in order to stop moving blinds after a power failure or PLC update we need to check if PLC has been initialized
BlindControl(
   UP := BlindSecurity.QU AND GVL.xInit,
   DN := BlindSecurity.QD AND GVL.xInit,
   S_IN := BlindSecurity.STATUS,
   PI := BlindSecurity.PO
);

xBlindControlDown := BlindControl.MD;
xBlindControlUp := BlindControl.MU;


I also had a problem with the fact that after the power failure the blinds are going automatically up - I didn't want that is why I introduced the xInit global variable which is false by default and is set to true after the first PLC cycle. Thanks to this restart of the PLC is not moving the blinds up.
I was testing the whole code with IN := FALSE for BLIND_INPUT but it also didn't help, the BLIND_NIGHT was not working.

Do you see any obvious problems here?

3
oscat.lib fuer CoDeSys 3 / OSCAT blinds and automatic calibration
« am: 26. März 2021, 11:59:58 »
I'm using OSCAT library to control blinds. My PLC is PFC200 from Wago and I'm using e!Cockpit. Everything works fine but I would like to get rid of automatic calibration after power failure built in the BLIND_CONTROL_S function block.

As it is written in the last sentence the "The automatic calibration however can be prevented if both inputs UP and DN are FALSE". And it actually stops the blinds to be calibrated (basically moving up and then down) but afterwards I can't control the blinds any more - UP and DOWN buttons are not working.

I was trying almost everything with no luck. With such an approach buttons works fine:

BlindControl(
    UP := BlindSecurity.QU,
    DN := BlindSecurity.QD,
    S_IN := BlindSecurity.STATUS,
    PI := BlindSecurity.PO
);


But in this case, there is an automatic calibration which I don't like. All blinds are going up and then down. I'm going to move into a new house within a week, I will be modifying my program a lot a the beginning, I don't want the blinds to move with each download.

Witch such approach the calibration is turned off (as suggested in the last sentence of the documentation):

BlindControl(
    UP := FALSE,
    DN := FALSE,
    S_IN := BlindSecurity.STATUS,
    PI := BlindSecurity.PO
);

BlindControl.UP := BlindSecurity.QU;
BlindControl.DN := BlindSecurity.QD;


But then buttons don't work any more.

Maybe I'm using outdated libraries. Where I could find the latest OSCAT Basic and OSCAT Building libraries for Wago e!Cockpit? Were there any updates in the last few years?

I don't speak German at all...

Seiten: [1]