This sample library contains suitable functionalities for determining the parking space occupancy of a car park.
Generic Counter
class for counting upwards and downwards.
Class ParkingCounter
counts the filling level of the car park depending on the above described sensor signal sequence.
This class has two input sensors:
- BSensorInside
- BSensorOutside
Depending in which order the signals are occupied, the counter-value will be incremented or decremented.
Example for entering the car park: First will the SensorOutside occupied and then SensorInside. In this case, the counter will be increased by one.
TIA Portal compatible ParkingCounterFB
which acts as wrapper function block
. It uses internally the class ParkingCounter
Maybe a link what a wrapper FB is ? How does a wrapper work? Also link to explanation
Now our traffic light is complete and can be imported in a TIA Portal global library --> How to crate a global library
-
Open a TIA Portal project, which contains any 1500 PLC
-
Open the
TIAPortalGlobalLibrary
-
Select the function block
ParkingCounterWrapper
-
Instantiate the
ParkingCounterWrapper
in e.g. the Main OB
- Namespaces
- Enumeration
- Class & Methods
- Call of private methods (THIS-Operator)
- Definition and implementation of interfaces (INTERFACE/IMPLEMENTS)
- Access modifier (PRIVATE/PUBLIC)
- Test fixture
- Test method
- Assertions