 |
ALPHA-VISION® HowTo: Graphs
|
Graphs
SUMMARY
It is described how to set up graphs.
CONTENTS
- Task formulation
- General information about a graph.
- Defining a graph
- Scaling of the Time-Axis
- Automatic start of the Graph
- Displaying values stored in the Buffer
- Hints & Tips
Task formulation
A continuous sinus (Peak amplitude ±1; period 90 sec) should be recorded.
- The graph should show a 3 minute clipping.
- The time axis (x) of the graph should be scaled with the apposite
time.
- Recording of the measuring point should start on system start.
- It should be possible to stop the running graph.
- It should be possible to move the time axis of the graph in the past;
at least for 10 minutes, by steps of 1 minute.
General information about a graph.
A graph is a rectangular area wherein a sequence of numerical values
displayed as a polygon or a series of dots in dependency of the time.
(y=f(t))
A graph got a buffer (ring-buffer in the memory) of a defined size. The
measuring value is checked every second, but only changes are saved.
Note:
If a value change falls in-between that time-grid (e.g. a spike) it is not
captured !
In the graph the values are displayed in equal time distances of one
second.
A graph may run to the right, left, up or down.
It is possible to position several graphs above each other.
Defining a graph
Size of the graph
Select the item "Graph" via the
AbvEditor pull-down menu Insert.
With the mouse pointer which has changed to a hair-cross pull up the
wanted size for the graph.
Parameterizing of the Graph
Via
AbvEditor_PDM Edit
"Attributes sequential" the following categories have to be defined:
- Variables
Define the function Obj_Value(SINUS) .
(SINUS is the name of the Data Object its value should be shown in the
graph.)
- Format
Select direction "Left" Graph style "Polygon".
(Direction left: Value "moves" to the left, the latest value stays at
the right hand side. (standard for time axis))
(Polygon: The values are shown as consecutive line)
- Scaling
Scaling offset function Y: Usr_Const(-1)
(Since a negative value (-1) should be displayed the base line must be
moved by -1)
(-) minus = moves it up
(+) plus = moves it down
Scaling range function Y: Usr_Const(2)
(Due to the peak values from -1 to +1 the scaling range is 2)
Scaling offset function X: Obj_Value(TSTART)
(The System Object "TSTART" got the value:
'actual time' minus 'scaling range in seconds'. It represents the
oldest point of time displayed in the graph; it is incremented by 1
every second.)
Scaling range function X: Usr_Const(180)
(Defines 180 seconds (3 Minutes) for the scaling range)
Pool size:600
Defines the number of measuring value changes that can be stored.
(If the measuring value changes every second it is possible to store
values for 600 seconds = 10 Minutes.
In case the changes are rarely the period of time values are recorded
for is elongated.)
Scaling of the Time-Axis
Time displays along the X-Axis
Select the item "Digital Meter" via the AbvEditor pull-down menu
Insert .
With the mouse pointer which has changed to a hair-cross pull up the
wanted size for the digital meter.
Parameterizing of the Digital Meter
Via "Attributes sequential" the following categories have to be defined:
- Variables
Obj_Value(TSTART)
(Displayed is the value of the System-Object "TSTART", together with
the defined offset it provides the wanted scale labeling.)
- FORMAT: ho:mi:se
(Defines that the value of "TSTART" is displayed in the time format
"hour:minute:second")
- SCALING:
Offset Funktion: Usr_Const(n)
(Depends on the position of the digital meter along the X-Axis; the
TSTART-Value represents the oldest time value)
- Left Digital Meter:
Shows the oldest point of time -> Offset = 0
- Digital Meter in the middle:
Shows the point of time right in the middle (TSTART-Value + 90 sec) -> Offset = 90
- Right Digital Meter:
Shows the actual point of time (TSTART-Value + 180 sec) -> Offset = 180
Automatic start of the Graph
In the AbvBrowser Pull-down
menu 'File' - item 'Global events' for the System event:
the following actions have to be defined:
Obj_TickOn(TSTART,180);
Obj_SetSts(TSTART,1)
Means:
The System-Object "TSTART" is set to the value of the actual time minus
180 (seconds, the scaling range).
The status of the System-Object "TSTART" is set to 1.
(Status "1" signalizes ‘Graph is running’, "0" signalizes ‘Graph has
stopped’; this information is used to manage the operability of the
control buttons, see next chapter.)
Displaying values stored in the Buffer
The graph area shows the measuring values stored in the buffer for the
past 3 minutes.
To display earlier values stored in the buffer:
- The running graph must be stopped.
- The Time-Object "TSTART" must be set to the wanted Display-Time.
Button 'stop'
(When starting the runtime this is the only button accessible.)
Via
AbvEditor_PDM Edit
"Attributes sequential" the following categories have to be defined:
- Action:
Obj_TickOFF(TSTART) ;
Obj_SetSts(TSTART,0)
The second-wise incrementing of the System-Object is stopped
i.e. the running graph is halted.
Note:
Querying the measuring value and saving changes is not affected, it
can’t be stopped.
The status of the System-Object "TSTART" is set to "0" to signalize
"graph has stopped"
- Enable:
Obj_StsCmp(TSTART,1)
The status is compared with the value "1", on ‘true’ (Graph running)
the value "1" is returned.
Note:
Any value beside "0" enables the button, it is accessible.
Button '<<'
(In runtime only accessible if the graph has stopped.)
Via
Edit
"Attributes sequential" the following categories have to be defined:
- Action:
Obj_DecrData(TSTART,Value,60)
The value of System-Object "TSTART" is decremented by 60.
(With any pressing of the button the Time-Axis of the graph is moved
to the right (into the past) by one minute; the digital meter for
the scale indication are showing the appropriate time, since they
also reverence to the System-Object "TSTART".)
- Enable:
Obj_StsCmp(TSTART,0))
The status is compared with the value "0", on ‘true’ (Graph stopped)
the value "1" is returned - enabled.
Button '>>'
(In runtime only accessible if the graph has stopped.)
Via
Edit
"Attributes sequential" the following categories have to be defined:
Button '>'
(In runtime only accessible if the graph has stopped.)
Via
Edit
"Attributes sequential" the following categories have to be defined:
- Action:
Obj_TickOn(TSTART) ;
Obj_SetSts(TSTART,1)
The second-wise incrementing of the System-Object "TSTART" is
initiated, the graph starts running.
Note:
Incrementing starts with the actual time, the measuring values
saved in the meantime are inserted timely.
The status of the System-Object "TSTART" is set to "1" to signalize
"Graph is running".
- Enable:
Obj_StsCmp(TSTART,0)
Graph stopped? - enabled
Hints & Tips
Different Data-Objects connected to the same graph
It is possible to use the same graph to show the value trend of different
Data-Objects, as far as the defined scalings do fit. The Data-Objects in
question may be referenced statically when creating the project or
dynamically in runtime.
See thereto:
Referencing to Data Objects
A graph connected to Data Objects saved in the Long Term Archive
A Graph usually displays measuring data read from the Short Term Archive
(described above), but it is also possible to supply it with data out of
the Long Term Archive.
See also:
Archiving Data
The definition from which archive the measuring values should be read is
done via the
<ApplyGroup>.
To the category "Action" of the graph an entry for "Apply group" is added.
The Name defined for "Apply group" is arbitrary, it merely relates graph
and archive.
The connection graph to archive type is done via a button with the
following action:
"Grfx_SetVarHist(<ApplyGroup>,n)"
Example:
Grfx_SetVarHist(SINUS,1)
(The graph with the Apply Group "SINUS" is switched to the Long Term Archive)
Grfx_SetVarHist(SINUS,0)
(The graph with the Apply Group "SINUS" is switched to the Short Term Archive)
Bound to a Digital Meter the following function:
"Grfx_GetVarHist(<ApplyGroup>)"
returns information about the archive actually shown in the graph.
- 0 = Short Term Archive
- 1 = Long Term Archive