CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Nov 18, 2017 5:28 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Oct 03, 2017 4:13 pm 
Offline

Joined: Thu Feb 23, 2017 5:07 pm
Posts: 54
Good morning,
I have an electric shutter operated with two relays (up & down).
Now I would like to check with a slider in codesys but I do not know if and how it can be done.
I understand that if I move from zero to 100 I have to start a relay but if from 100 back to zero I have to leave the other relay.

Do you have any idea?

Thank you, Alberto


Top
   
PostPosted: Sun Oct 08, 2017 7:56 pm 
Offline

Joined: Tue Jan 26, 2016 2:20 pm
Posts: 20
I assume you want to have shutter positioning using a slider? Do you have end switches, or you can say how much time for your shutters is needed to go up or down fully?


Top
   
PostPosted: Thu Oct 12, 2017 10:19 am 
Offline

Joined: Thu Feb 23, 2017 5:07 pm
Posts: 54
Thanks,
Only time, no have switch


Top
   
PostPosted: Fri Oct 13, 2017 7:12 pm 
Offline

Joined: Tue Jan 26, 2016 2:20 pm
Posts: 20
So you will have to create a state machine first, which calculates current position of shutter by counting running time of the motor. E.g for example you know that it takes 30 seconds for your shutters to fully open from fully closed position.
In your state machine you create a state which is activated only if you have signal "Open" from the relay. In this state you add 1/30*100 to your position variable every second with limitation of 100. So that if you run shutters for 20 seconds, the position value will be 66. This is calculated position of your shutters. Add second state, which is activated if you have command "CLOSE" and which subtracts 1/30*100 from your position variable every second. Limit it at 0.
So using these two simple states you will be able to calculate current position of shutters in real time, using just two signals "OPEN" and "CLOSE" which you use to control the relays.

Now assume that current shutter position is 0(fully closed) and you want it to be 75. No problem. You create a separate logic with comparator saying - if current shutter position is less than slider - issue command "Open". This command will activate up relay and at the same time due to state machine above will start increasing position variable. After it will reach 75, comparator will trigger and "OPEN" command will be deactivated. Same idea with "Close" command - e.g. if slider value is less than current position, "down" command should be activated. That's it. Don't forget about hysteresis, as you shutters might start going up and down in the intermediate position. Also if you want to increase accuracy, you have to decrease cycle time of your state machine to 0,5 or 0,2 seconds.
At fully open or closed positions your system will be self-calibrating, but if you use intermediate positions only it might become inaccurate. But it is enough to open or close shutters fully one time to return it to normal state.

Hope it helps. State machines are easily created using If-then-else or case statements in ST. Use some variable as current state.


Top
   
PostPosted: Sat Oct 14, 2017 9:22 am 
Offline

Joined: Thu Feb 23, 2017 5:07 pm
Posts: 54
Thank you so match Syoma :wink:


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited