Client access / registration
Contact
TECH FASS s.r.o.
Věštínská 1611/19
153 00, Prague
Czech Republic
tel.: +420 257 224 398
tel.: +420 257 224 399
e-mail: techfass@techfass.cz
Programming the controller
The control program for the APS 400 system is to be written in a simple events oriented programming language. The especially designed development tool for this purpose is APS Config. The APS Config Programmers guide contains detail descriptions of the APS 400 system programming.
For a detailed idea about possibilities of the system programming read the macro-language constructions overview.
This page contains examples of the elementary solutions:
- Setting up the output value
- Logical conditions
- Opening the door
- Use of numeric registers
- Timing
- User defined archive marks
- User parametres
- User events
The program control - Events
The program is driven by the events triggered by the system status changes in the APS 400 system. The response of particular event is provided by the short program ("Macro"assigned to the event. Basic types of the events are:
- Input status change (on/off)
- Reading of the ID media (valid/invalid/unknown)
- Command from the superior system (user event)
- Periodical events (1s/10s)
- Tamper contact activation
- Data integrated control panel system status change etc.
Each macro must have the following format:
; the macro body
EventEnd
Keywords Event and EventEnd creates "a box" for the macro body, ModuleIdentificator and EventIdentificator defines the assignment for concrete event.
Assigning a value
The basic command is setting up the value to the logical output, respectively numeric register etc. The following example shows how to copy the status of the logical Input1 of the network module Reader2 to the output Relay1 of the network module Reader1.
Reader1.Relay1=On ; set the relay
EventEnd
Event Reader2.Input1Off
Reader1.Relay1=Off ; reset the relay
EventEnd
Logical conditions
The control algorithm in the real application is generally more complex than setting up the output value following the change of the input status. Usually two (or more) different reactions on the same event are necessary.
The macros in following examples sets the relay Relay1 of the network module Reader1 after setting the Input1 of the network module Reader2. In the first example is the output setting qualified by the status On of one or other input, in the second by the logical conjunction of two inputs and in the third example by theirs logical disjunction.
- Simple logical condition
if Reader4.Input1=On then ; is the Input1 of the network module Reader4 On?
Reader1.Relay1=On ; set the relay
EndIf
EventEnd
- Logical conjunction
if Reader4.Input1=On then ; is the Input1 of the network module Reader4 On?
if Reader4.Input2=On then ; is the Input2 of the network module Reader4 On?
Reader1.Relay1=On ; set the relay
EndIf
EndIf
EventEnd
- Logical disjunction
if Reader4.Input1=On then ; is the Input1 of the network module Reader4 On?
Reader1.Relay1=On ; set the relay
EndIf
if Reader4.Input2=On then ; is the Input2 of the network module Reader4 On?
Reader1.Relay1=On ; set the relay
EndIf
EventEnd
With a help of the conditions it is possible to test the values of the numeric registers, logical inputs status, software timers and other system states, more information can be found in the Macro-language contructions overview.
For the MCA 168 system controller with FW version 228 or higher and for the APS Config version 2.7 or higher it is possible to test the values of two registers.
Opening the door
The standard access control function is started after the valid identification of the cardholder. The valid identification (if the access is granted) starts the event ModuleIdentificator.Valid. It is recommended to activate the buzzer after the valid identification on the module which has read a card and set the relay on the module controlling the door lock. This status will be changed by opening the door or after the consequent time out. Correspondent macros are following:
Beep=On ; set the buzzer
Relay1=On ; set the relay
Delay(5) ; 5s timeout
Beep=Off ; reset the buzzer
Relay1=Off ; reset the relay
EventEnd
Event Reader1.Input1Off ;reset of the input (if the door opens)
Beep=Off ; reset the buzzer
Relay1=Off ; reset the relay
EventEnd
If the reader module is wired standardly, it is not necessery to extend the macros, it is sufficient to use the Door function:
Door(Reader1)
EventEnd
Standard wiring of a reader module
The standard wiring of the reader module means, that the (circuit-opening) door contact is connected to the Input1 of a module. The Door function activates the output (Relay1) of the reader module until the door opens or until the StrikeTime is elapsed. For more information see the standard wiring diagrams and the Programmer's guide).
The standardly programmed reader modules of the APS 400 system perform the standard "Door open" function and generate two important events:
- Forced door
- Door ajar
Numeric registers
When using the numeric registers it is possible to make sophisticated control algorithms, based on the analyses of the status and time dependencies. It is also possible to make simple calculations.
The register is a numeric variable, which value can be set, tested in the logical condition (operators "=" and ">", can be combined with the logical complement "not"), eventually the constant value can be added or subtracted of it. The register value can be from the interval <0;255>.
For the MCA 168 system controller with FW version 228 or higher and for the APS Config version 2.7 or higher it is also possible to use following contructions:
- assignment: register1 = register2
- adding: register1 = register1 + register2
- subtracting: register1 = register1 - register2
The next example of interfacing the ACS and Intrusion Detection System uses one register as a counter of present cardholders (CardholdersCount) and one for timing (PartitionReady). It expects following:
- The cardholder identification is provided by the reader modules Reader3 (exit from the area) and Reader4 (enter to the area)
- The door contact and the door strike are standard wired to the module Reader4
- The IDS ready status output is connected to the input 1 of the controller (MCA168.Input1), on-state = partition is ready
- The IDS control input is connected to the relay 1 of the controller (MCA168.Relay1), on-state = armed
- The partition has to be automatically armed after the last cardholder leaves the area or if the ready status remains longer than 20 minutes
define register PartitionReady ; declare the register
Event Reader3.Valid ; access granted at the Reader1
MCA168.Relay1=Off ; disarm
PartitionReady = 0 ; set the register value
Door(Reader4) ; standard door function
CardholdersCount=CardholdersCount+1 ; ncrease the cardholder's count
EventEnd
Event Reader4.Valid ; access granted on the Reader4
Door() ; standard door function
CardholdersCount=CardholdersCount-1 ; decrease the register value
if CardholdersCount=0 then ; no one is present
if MCA168.Input1=On then ; partition is ready
MCA168.Relay1=On ; arm the partition
endif
endif
EventEnd
Event MCA168.Timer10sec ; event activated with 10s period
if MCA168.Input1=On then ; partition is ready
PartitionReady = PartitionReady + 1 ; increase the register value
else ; partition is not ready
PartitionReady = 0 ; set the register value
endif
if PartitionReady>120 then ; partition is ready longer than 20 minutes
MCA168.Relay1=On ; arm the partition
PartitionReady=120 ; prevent the register value overflow
CardholdersCount=0 ; set the register value
endif
EventEnd
Event MCA168.Input1Off ; the partition goes to the "not ready" status
PartitionReady = 0 ; set the register value
EventEnd
Timing
Timing is a frequently solved problem in the access control system programming. In the simplest instances it is possible to use the Delay(value) command, which suspends the macro for the interval defined by the value. This simple solution is not always suitable. Following examples illustrate other various methods of timing and their use.
- Timing using a register
This example demonstrates how to disable the door open for 10s after the valid identification.
Event Reader3.Valid
if DoorDelay > 0 then ; 10s interval not expired
Signal(3) ; acoustic signal
endif
if DoorDelay=0 then ; 10s interval expired
Door() ; open the door
DoorDelay=10 ; set the register value
endif
EventEnd
Event MCA168.Timer1sec ; periodically called event (every 1s)
DoorDelay=DoorDelay-1 ; decrement the register value
EventEnd
- Timing using a software timer
This example demonstrates use of a software timer for time delayed opening if two door after the valid identification on single reader module.
Event Reader3.Valid
Door() ; open the door
DoorDelay=10 ; set the timer value to 10s
EventEnd
Event MCA168.Timer1sec ; periodically called event
if DoorDelay=0 then ; true after the timer counts down
Reader4.Beep=On ; start the acoustic signalling on the Reader4
Door(Reader4) ; open the door connected to the Reader4
Reader.Beep=Off ; stop the acoustic signalling on the Reader4
endif
EventEnd
The software timer is a special numeric register, which is automatically decremented each second. After the zero value is reached the decrementing is stopped. The test of the timing down is provided by the command if Timer=0 then ... If the timer value is zero, the result of the condition is true and the timer value is set to 255 (the timer is stopped). On the next evaluation the condition will return false. The timer is activated by setting up the value from the interval <1,254>.
Timing longer time periods
Timing of long periods is seldom required but it is possible by implementing corresponding macros.
The following example demonstrates timing of the 15 minutes interval (15 minutes after the valid identification on the module Reader3 is the output Reader3.Relay1 activated for 2 seconds).
define register FifteenMinutesTimer
Event Reader3.Valid
FifteenMinutesTimer=15
OneMinuteTimer=60
EventEnd
Event MCA168.Timer1sec
if FifteenMinutesTimer > 0 then
if OneMinuteTimer = 0 then
FifteenMinutesTimer = FifteenMinutesTimer-1
if FifteenMinutesTimer > 0 then
OneMinuteTimer = 60
endif
if FifteenMinutesTimer = 0then
Reader3.Relay1=On
Delay(2)
Reader3.Relay1=Off
endif
endif
endif
EventEnd
User-defined archive marks
Sometimes it is matching to store the user defined mark into the events archive. For example while tuning the algorithm.
The following example demonstrates the use of user defined archive marks for the denotation of the start and stop of the operating status indicated by toggling the output (its implicit archive marks can be disabled).
define mark ToggleOff=Optical signalling stopped ; definice značky
Event Reader1.Input1On
mark(ToggleOn) ; insert the mark into the events archive
EventEnd
Event Reader1.Input1Off
mark(ToggleOff) ; insert the mark into the events archive
MCA168.Relay1=Off
EventEnd
Event MCA168.Timer1sec ; periodically activated event (every 1s)
if Reader1.Input1=On then
Invert(MCA168.Relay1) ; toggle the output status
endif
EventEnd
User-defined parametres
It can be matching to change the value of the numeric constant by the user in the macros. "Publishing" the constant to the user demonstrates the following example:
Event Reader2.Input1On
Reader1.Beep=On
Delay(Par1) ; using the parameter as the argument of the delay command
Reader1.Beep=Off
EventEnd
Note: The use of parameters is not fully general, it can be used in following design patterns:
- Set the register value (Register=Parameter),
- set the timer value (Timer=Parameter),
- define the argument of the Delay function (Delay(Parameter)).
User events
The hardware inputs can be powerfully replaced by the software buttons, which activates (using the LAN) so called user events in the access control system. The controller can serve up to 64 independent user events.
To active events from the computer the APS Administrator software package is required.
Relay1=On
EventEnd
Event MCA168.UserEvent2
Relay1=Off
EventEnd
Event MCA168.UserEvent3
Relay1=On
Delay(10)
Relay1=Off
EventEnd
APS 400 system
System topology
More information about hardware
Macro-language contructions overview
APS 400 product catalogue