Controlling a Shutter Using a PLC

To control a shutter with outputs, the Function Block SHUTTER is used. In this small example, the activation via buttons is shown first. The buttons are true when pressed and false when released.

Tip: The program can be downloaded and imported here: example_shutter.antobj

Basics

First, a new peripheral with the type Shutter (found under Actuators Shading) is inserted into the Structure and then clicked on Apply in the Explorer.

After opening the element, click on Edit to begin with the following steps.

  1. Delete the Function Block VISU.
  2. Insert a new Function Block and define it as SHUTTER.
  3. Assign a database. In our example, this is called shutter.
  4. Now we assign the outputs for the motor. These are DO_UP for up and DO_DW for down. At the output DO_UP, we write out.up and at DO_DW, out.down. All other outputs are omitted for now.
  5. For the shutter to move at all, the runtimes must be stored. In our case, we define the input PT_UP with T#10s and PT_DW with T#8s.
  6. Enter a dead time of T#500ms at the input PT_STOP to lock and protect the motor.
  7. Now we expand the shutter with the entire slat runtime. We define this at the input PT_SLAT with T#1s100ms. For this to take effect, the number of steps must be specified, which we enter at the input SLAT_STEPS with 10 steps.
  8. Now we only need to connect the buttons. For this, we write in.Tr1_up at the input TR_UP and in.Tr1_down at the input TR_DW. If multiple buttons need to control the same shutter, they are connected at the inputs with an OR Function Block.
  9. Now you can test the application by clicking on Apply and then on Preview.

Visualization

For the visualization to be able to communicate with the Function Block, the following steps must be performed:

  1. Create a new Function Block VISUVAR at the input MOVETO_POS. The database of this Function Block is called pos here. At the input of the created VISUVAR, you provide the reference using shutter.POS to the SHUTTER Function Block so that the current position is returned to the visualization.
  2. Now repeat the previous step with the input MOVETO_SLAT. The database of the Function Block VISUVAR is called slat. We then route the input of the VISUVAR back to the output shutter.SLAT.
  3. To also be able to control the shutter via buttons on the visualization, you now create three more VISUVAR Function Blocks. The first two are inserted between the buttons and the inputs TR_UP and TR_DW of the Function Block SHUTTER. You insert the third VISUVAR at the input STOP. Select the respective input for this.
  4. The database of the first VISUVAR is called tr_up, the second tr_down, and the one at the input STOP is called tr_stop.
  5. Next, create a new network. Here you insert a Function Block VISUVAR and name the database real_pos. Now write to the input shutter.REAL_POS to transfer the current shutter position to the symbol.
  6. Repeat the previous step with a new network. This time, enter real_slat as the name of the database. Then write to the input shutter.REAL_SLAT.
  7. Now switch to the Visualization tab at the bottom of the editor's register. You now see the symbol of the visualization.
  8. For the symbol, you now set the variables to position on real_pos and slat_angle on real_slat. Additionally, the Double-Click Switch can be set to the value pos.
  9. On the left side, you now select the tab Shutter Blinds. The template contains all elements for controlling the shutter.
  10. Now select the upper slider. This must now be changed. Set the Value to the variable pos. For the lower slider, the Value must point to the variable slat.
  11. Now select the upper button. Change the Value to the variable tr_up.
  12. Repeat the previous step with the button Stop and Down with the variables tr_stop and tr_down.
  13. Finally, click on Apply. Now the shutter can be placed on a floor plan and you see the result.

Note: Note that the slat step on the slider should match the number of steps on the SHUTTER Function Block.