Here you will find hints and other useful informations on PVSS. This includes howTo's and assessments.
Documented Software Hints
Using FW_trend without PVSS archiving
It is not possible to use the FW_trend without enabled PVSS archiving. You can create an archive on the fly, but there are various stability issuses when creating a predated PVSS archive. It is not recommended to do that.
For further informations see here.
Creating predated archives within PVSS
It is not possible to store data in PVSS archives which is older than the archive itself. There is a possibiliy to predate an archive. However, this procedure makes the project unstable and it has to be restarted afterwards. If you still want to use it,
a rudimentary description can be found here.
Some Informations about fw_trending constants and parameters
While trying to use the fw_trending tool without archiving, a few informations about fw_trending constants and parameters have been collected.
See here.
Start and Stop PVSS manager from a script
A short howTo and the
necessary code can be found here.
Start a Windows/Linux program from within PVSS
This is possible using the system command. A description can be found in the help.
A pdf of this help topic is available here.
Basics
Run a UI manager from command line
Syntax:
PVSSui.exe -p <panelname> -proj <projectname>
Run control script in PVSS
Append a new control manager. Command parameters :
<scriptname>
Run a panel in PVSS
Append a new UI manager (PVSSui). Command parameters:
-p <panelname>
To hide the icon bar and the menu bar, use these additional parameters:
-iconBar -menuBar
Run para / gedi in PVSS
Append a new UI manager (PVSSui). Command parameters:
-m gedi
or
-m para
Distributed projects
You need to create a distributed project. Not a standard one. The system numbers have to be unique. In the config file, add the following:
[dist]
distPeer = "<pcName>" <SystemNumber>
if you are not using default ports, use
<pcName:PortNumber>
Example:
[dist]
distPeer = "pcphatm13" 2
Common [dist] section
You can generate a common [dist] section in your config file that can be read by all systems. You can indicate that specific lines apply to specific systems. Lines in the [dist] section can take the form:
(hostname1) distPeer = "hostname2" systemNumber
where
- hostname1 is the network name of the computer for whom this line is intended.
- hostname2 is the network name of the computer that hostname1 wishes to connect to.
- systemNumber is a number that specifies the (cluster-wide unique!) number of the target PVSS system running in hostname2.
Example:
[dist]
(pccern03) distPeer = "pccern01" 1
(pccern04) distPeer = "pccern03" 3
The line beginning (pccern03) is only interpreted by a(ny) PVSS system running on pccern03. This line is ignored by all other PVSS systems running on all other computers. Note that PVSS is tolerant in that if (system 1 connects to system 5) AND (system 5 connects to system 1) then it continues to work just fine.
Load Library when project starts
If you want the library only for the Ui managers, goto the config file and add in the ui section:
[ui]
LoadCtrlLibs = "<libraryname.ctl>"
If you do want it available for the control manager as well, add it in the ctrl section:
[ctrl]
LoadCtrlLibs = ""<libraryname.ctl>"
If you need the library in the event manager, e.g. for the use of dpFunctions, add it in the event section. CAUTION! Doing so, means your code will be executed within the event manager. Use with care:
[event]
LoadCtrlLibs = ""<libraryname.ctl>"
Start Stop manager using CTRL commands
Managers can be started and stopped using CTRL commands. This commands are documented in the pmon.ctl library which is located in
/scripts/libs/pmon.ctl These functions do not work in a control manager. They are designed to work only within panels.
A smal script that starts/stops a specific manager might look like the following:
main()
{
int index,number,state,port,fd;
bool err;
string host;
index=findManager("PVSS00ctrl","mdtdcsmtmDbUpdate.ctl");
if (index<0)
{
DebugTN("Manager not found: ");
return;
}
state=pmonGetState(index);
//state=0 stopped, state=1 starting state =2 running
if (state!=2)
{
//get projects hostname and port number
paGetProjHostPort(paGetProjName(),host,port);
//need to open tcp connection manually,
//not done by pmonStartManager/pmonStopManager
fd=tcpOpen(host,port);
if (dynlen(getLastError())>=1)
{
if (fd!=-1) tcpClose(fd);
DebugTN("ERROR: Unable to open TCP connection to PMON, aborting");
return;
}
pmonStartManager(err, paGetProjName(),index, "","");
//pmonStopManager(err, paGetProjName(),index, "","");
}
return;
}
//------------------------------------------------------------
//find a manager by name and options
//managerName:"PVSS00ctrl"
//options:"mdtdcsmtmDbUpdate.ctl"
int findManager(string managerName,string options)
{
int i;
int number=pmonGetCount();
for(i=0;i<=number;i++)
if(managerName==pmonGetName(i) && options==pmonGetOptions(i)) return(i);
//this return should only be given when nothing matching the parameters was found
return(-1);
}
Use of dpGet in distributed systems
dpGet does not check whether a distributed system is connected or not. Normally if a dpGet fails a return value of -1 is issued.
In case of a distributed system which has lot connection to the target system, dpGet returns 0. In such a case, dpGet returns a value of the correct datapoint, which has nothing to do with the correct value. Only by using getLastError() you will see that something failed.
In order to avoid such calls in the first place, one should use unDistributedControl_isConnected(). This function is in one of the libraries which come with the framework installation. It checks if the system is currently connected.
void unDistributedControl_isConnected(bool isConnected,string systemName);
Small Tipps And Questions
Which is the Order of initialization/execution of objects?
According to ETM, the first command in the panel initialization is executed first. After that, all other initialization scripts are executed. There is no way to find out the order of execution nor define it.
How to draw in PVSS during runtime?
It is not possible to draw something (e.g. a line) during runtime. However, the addSymbol command is pretty powerful. You have to create a reference panel which contains the graphic object you want to draw. Using addSymbol you can than add this panel (graphic object) to the panel, postion, resize, turn it. This way almost all shapes should be possible to be drawn.
Can I call a function situated within a reference panel from outside?
PVSS is not object orientated. It is therefore not possible to do this.
Are there integrity checks on alarms when entered using a script?
The integrity is checked when you activate the alarm. This functions the same if you use fw alert handling.
What happens, if you change the alert range/definition when the alarm is triggered?
You will need to deactivate the alarm first. The triggered alarm will stay until it is acknowledged.
How to check if an fw alarm configured by script is set up correctly?
Normally, fw alarm settings are checked when the alarm settings are activated. Sometimes this might not be adequate. In such cases you can use
_fwAlertConfig_checkLimits
_fwAlertConfig_checkClassPriorities
Please note that this functions are considered framework internal (as suggested by the leading underscore). It is therefore possible that they might change. O. Holme has assured me that this will not happen, but it is a point to be considered.
How to call a function/script at certain times?
Use timedFunc. Does only work within control scripts. More details can be found in the PVSS help.
How do I trigger a dpConnect when something (any element) is changed within a data point, using only one dpConnect?
Do a dpConnect to
DpName.:_online.._stime
Stime is updated everytime something happens within the data point.
Check whether a data point type exists
Use dpTypes("dptName") dptName stands for the data point type. If the data point type does exist, the name of the data point type is returned(dyn_string). If it does not exist, the dyn_string has length zero.
Convert seconds elapsed since 1970
Use setPeriod. Details can be found in the PVSS help.
Change the text/number formatting in PVSS tables
There is no function which allqows you to do this. However, there is a workaround. Use sprintf to convert your numbers into a string with a given format (e.g. certain precision). Afterwards you can send this string to the table, or convert it back to a number first.
Adda picture to a PVSS panel
First you have to add a rectangle. In the property editor, klick "filling". Select "Pattern". When you press the button "Load" you can select the picture you want to display on the rectangle. The picture has to be located within the projects pictures folder.
Detect if a thread has completed
When you start a function using startThread() there is no direct way to determine wheter this thread is still active or has been terminated.
IT suggested the following:
Create a global variable and write the thread Id into it, which is returned by startThread(). At the end of the thread, that means in the code called by startThread, set this global variable to -1.
In the sequntial code outside the startThread(), you can then query this global variable to determine wheter the thread has completed or not. You can even implement a loop. If you use a delay of around 100 miliseconds it will not cause any performance issues.
FSM
Slow FSM command - getState
fwCU_getState(string node,string &state) The function fwCU_getState to retrieve the state of a given node is very slow. 20 calls take about 2 seconds.
Use fwUi_getCurrentState(string domain, string node,strint &state) instead. The function fwUi_getCurrentState does the same and is extremely fast. Virtually no delay can be observed.
FSM documentation
FSM documentation can be found here.
URLs to the files mentioned above
IT CO BE pages