Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Electric shutter with slider control

alverman
2017-10-03
2017-10-14
  • alverman - 2017-10-03

    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

     
  • syoma - 2017-10-08

    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?

     
  • alverman - 2017-10-12

    Thanks,
    Only time, no have switch

     
  • syoma - 2017-10-13

    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/30100 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/30100 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.

     
  • alverman - 2017-10-14

    Thank you so match Syoma

     

Log in to post a comment.