Sunday, June 1, 2008

Two new components were added in FactoryPMI 3.2.0

Two new components were added in FactoryPMI 3.2.0

The Sound Player component and the Scriptable Canvas component
SACRAMENTO, CA JUNE 18, 2008 - Two new components were added in FactoryPMI 3.2.0: The Sound Player component and the Scriptable Canvas component. The Sound Player component brings first-class audio support to FactoryPMI, enabling auditory alerts with no scripting required. The Scriptable Canvas component is an advanced component that allows a designer to programmatically control how the component is drawn on the screen using vector graphics. This short guide will bring existing users up to speed on the use of these two new components.


Sound Player Component

The Sound Player component is a simple invisible component that can be found on the Misc palette. During design time, the component looks like a small speaker icon on your window, but at runtime the component will not be visible. To use the sound player component, first you need a sound clip to play. The sound player component will play any *.wav file. To add your wav file to the Sound Player component, simply browse for the file by setting the component's Sound Data property. The wav file will then be embedded into the component itself, meaning that any launched clients do not need file access to the original sound file.

Once your wav file is embedded in the Sound Player component, the only thing left to do is to configure the component by telling it when to play the sound! The Sound Player component has two modes:
On Trigger  Sound will be played when the component's Trigger property is true.
Manual  Sound will be played when its play() function is invoked via a script.

When the sound is prompted to play, either manually or by trigger, it can play in one of three loop modes:

Play Once  The sound clip will be played once when prompted.
Loop Forever  The sound clip will loop forever when triggered, or until the stop() function is called via a script.
Loop N Times  The sound clip will loop for N iterations when prompted, where N is the value of the component's Loop Count property.

In most cases, it will be easiest to use the component in On Trigger mode. Suppose you have a SQLTag that represents an alarm condition. Simply drag that tag onto the Sound Player's Trigger property, and then choose if you want the alert to play once or loop. That's all there is to adding audio alerts to a FactoryPMI screen!


Paintable Canvas Component
The Paintable Panvas component was introduced by popular demand from some of our more advanced users. The component is intended for use by users who are very comfortable with FactoryPMI's embedded Python scripting engine. The component allows a designer to write programmatic commands that control with exacting detail how the Paintable Canvas appears, functions, and responds to user input during runtime. In theory, any kind of desired component could be created from this component

The component works by responding to a special scripting event called the repaint event. This repaint event will be invoked every time that the component needs to paint itself onto the screen. The event object for this event contains some special properties only found on this event type: graphics, width, and height. The event.graphics object is an instance of a Java 2D graphics context, or more precisely, a java.awt.Graphics2D. (we warned you that this was for advanced users, didn't we?) This graphics object, can then be drawn on from the (0,0) coordinate to the (event.width, event.height) coordinate using any Java2D drawing mechanism. When you first drop a Paintable Canvas component onto a window, you'll notice that there is a bunch of code already in the repaint event. This is example code that should help users get a feel for how Java2D works. Happy scripting!

Inductive Automation
Inductive Automation pioneered the first full-featured web-launched HMI/SCADA system in the world. Its standards based, database-centric architecture receives accolades from plant managers, IT managers, and system integrators worldwide. With a commitment to software quality and technical support second to none, Inductive Automation is at the forefront of industrial software.

0 comments: