Url and RefreshRate Animations
The Url and RefreshRate properties define the location of the image or remote image and the rate at which it is updated respectively. You can animate these properties so that the image changes and is updated at different rates according to the value of an item in the database.
As an example, we are going to examine a Mimic that uses Url and RefreshRate animations to display one of 3 webcam images and update them at a specified rate.
Three webcams are used to provide security surveillance for various locations at a site. Each webcam is connected to a different server.
- Webcam 1 is connected to a server with IP address 10.0.10.1
- Webcam 2 is connected to a server with IP address 10.0.10.2
- Webcam 3 is connected to a server with IP address 10.0.10.3
The images from each webcam are defined as 'Webcam/Image.jpg'.
A string point is used to represent the servers. Its value is used to correspond to the addresses of the servers. As the value of the string point is included in the expression for the remote image animation, changing the value of the string point causes the definition of the server location to change in the expression.
A remote image is used on a Mimic to show the images from the webcams. It is designed so that it only shows the images from one webcam at a time.
The remote image has the following animation:
- Url—The Url defines the location of the remote image and is animated with this expression:
'http://'+"<location and name of string point>"+'<address of image>'
Where <location and name of string point> is the location and name of the string point. This represents the CurrentValue of the string point. As in other examples, do not enter the angle brackets < >. This expression sets the Url to include the server address as defined by the current value of the string point.
The <address of image> is the location and name of the image. For example, '.Webcam/Image.jpg'.
The Mimic also has three buttons (Area 1, Area 2, and Area 3). Each button is configured to work as a Method type of pick action so that when it is selected it hand controls the value of the string point. Each button hand controls the point so that its value is the IP address of the relevant server:
- When the Area 1 button is selected, the value of the string point is hand controlled to 10.0.10.1 (the IP address of server 1). This animates the Url property of the remote image so that the Mimic shows the image from server 1 (webcam 1).
- When the 'Area 2' button is selected, the value of the string point changes to 10.0.10.2 (the IP address of server 2). This animates the Url property of the remote image so that the Mimic shows the image from server 2 (webcam 2).
- When the 'Area 3' button is selected, the value of the string point changes to 10.0.10.3 (the IP address of server 3). This animates the Url property of the remote image so that the Mimic shows the image from server 3 (webcam 3).
The area that is monitored by webcam 2 is of greater importance than the areas covered by webcam 1 and webcam 3, and so it needs to be updated more frequently. To achieve this, the remote image also has an animation for its RefreshRate property.
The RefreshRate property defines how often the image is updated. To set the image from webcam 2 so that it is updated at faster rate than the other webcams, the following expression is used:
IIF ("<Path and Name of String Point>.CurrentValue"= 10.0.10.2, 1, 5)
Where <Path and name of String Point> is the location and name of the string point that has its value set to correspond with the address of one of the servers. The angle brackets are not included in the expression.
The expression defines that if the current value of the string point is 10.0.10.2 (the address of Server 2), then the remote image is updated every second (defined by the 1). If the current value of the string point is not 10.0.10.2 (i.e is 10.0.10.1 or 10.0.10.3), then the remote image is updated every 5 seconds.