Sunteți pe pagina 1din 6

AVEVA PDMS/MARINE

Step-By-Step Tutorial
AUTOMATIC NIGHT PROCEDURES OF ADMINISTRATION

PREAMBLE
Administrator of AVEVA PDMS/Marine systems should maintain project performing some tasks which usually done
on periodical basis. Some of them are databases integrity check, sessions merging, creation of Review file (RVM),
Inter-DB macro run, piping consistency check, clashes check etc. Many of these procedures could be done in auto
mode running with the scheduler for example at nights. In next several examples, we will review some of the
procedures

The result of some following actions is a log-file where administrator can check if there are any problems found. It
is also possible automatically send any logs to email some PML code should be added (not done here).

Although it is possible to try to fix the problems in automode, we highly recommend to do it manually under
control of Administrator after reading the log visually.

All the following procedures written on PML and checked on SAM project supplied with AVEVA PDMS. For any
other projects it should modified by Administrator of this project therefore prerequisites for those who wants to
use it and modify are PML and Admin knowledge.

To run it you need to do following:
1.Copy all needed PML from following blocks into one file and call it for example night-process-run.pmlmac
2.Create a copy of your projects run bat-file shortcut and add folling to shortcut properties:
..\pdms.bat TTY SAM SYSTEM/XXXXXX /SAMPLE $M/\\yourserverpath\night-process-run.pmlmac
where
TTY - terminal mode of PDMS run (non-graphics)
SAM project name
SYSTEM/XXXXXX username and password (must be a system user)
/SAMPLE MDB
And as a last parameter call for night macro
You dont need to point any module here as far as PML macro will manage them automatically
3.Create a schedule with using for example Windows scheduler and point ot this shortcut

BEFORE DO ANY ACTION YOU MUST BE SURE THAT YOUR PROJECT IS BACKUPED

PART 1. Initial setup preparing folders to store log-files and users expunge

--first file database check log-file folder
--second file piping consistency check log-file folder
--third file - AVEVA Review file folder
--if folders do not exist then create it with CMD MKDIR command
!folders[1] = 'C:\temp\NIGHT-WORK\DatabaseCheck\'
!folders[2] = 'C:\temp\NIGHT-WORK\PipingCheck\'
!folders[3] = 'C:\temp\NIGHT-WORK\Review\'
do !x from 1 to !folders.Size()

!fo = object file('$!folders[$!x]')
if (!fo.Exists().Not()) then
!comm = |SYSCOM 'MKDIR $!folders[$!x]'|
$!comm
endif
Enddo

--Block 1. EXPUNGE ALL CLAMILISTS/USERS BEFORE
--Goto Admin module
ADMIN
--doing users expunge
EXPUNGE
--run thru all databases and expunge from claimlists
VAR !DBS COLLECT ALL DB
do!x from 1 to !DBS.Size()
!DBNA = !DBS[!X].Dbref().Name.After('/*')
EXPUNGE DB $!DBNA
HANDLE (1,271)(1,273)
--if database is UPDATE or is FOREIGN
ENDHANDLE
AVEVA PDMS/MARINE
Step-By-Step Tutorial
ENDDO
--end of Block 1


PART 2. Databases check

--Block 2. CHECK DATABASES
--collect databases, check and form the log-file with name !TotalLOG-DB.log
VAR !DBS COLL ALL DB
!outputLOG = object array()
!outputLOGFILE = object file('$!folders[1]' + '!TotalLOG-DB.log')
VAR !mdbn MDB
--check options
CHECKOPTION EXT CHECK PREF $!mdbn

do !x from 1 to !DBS.Size()
--skip if Foreign
skip if (!DBS[!x].DbRef().Fore EQ 'FOREIGN')
!dbName = !DBS[!x].DbRef().Name
--replacing not allowable symbols in file name
!nfile = '$!folders[1]' & !DBS[!x].DbRef().Name.After('/*').Replace('/','!') & '.txt'

ALPHA LOG/$!nfile OVER
!dbN = !DBS[!x].DbRef().Name.After('/*')
--run check for each db in collection
CHECK DB $!dbN
ALPHA LOG END

--check log file for any errors or inconsistencies
!logfile = object file(!nfile)
!logfileRead = !logfile.ReadFile()
if (!logfileRead[!logfileRead.Size() - 1].Matchwild('*Database has no structural errors*').Not()) then
!outputLOG.Append('DBS $!dbName : inconsistencies found.. Manual check needed...')
endif
do !y from 1 to !logfileRead.Size()
if (!logfileRead[!y].Matchwild('*invalid*') OR !logfileRead[!y].Matchwild('*unknown*')) then
!outputLOG.Append('DBS $!dbName : inconsistencies found.. Manual check needed...')
SKIP
endif
enddo
enddo
--output results of checking into final log-file
!outputLOGFILE.WriteFile('OVERWRITE',!outputLOG)
--end of Block 2


PART 3. Run Inter-DB macroses

--Block 3. Run any inter-db Macroses if found
--read folder proj_idMAC
VAR !PROJCODE PROJ CODE
!TOEVAL = |VAR !MACFOLDER EVAR '$!PROJCODE| & |MAC'|
$!TOEVAL
!MacroFolder = object file(!MACFOLDER)
--enter to Design
DESIGN
!files = !MacroFolder.Files()
if (!files.Size() NEQ 0) then
--run each macro
do !x from 1 to !files.Size()
!path = !files[!x].String()
$M/$!path
enddo
--back to Monitor
MONITOR
do !x from 1 to !files.Size()
--delete processed macroses
DELETE MAC $!x
enddo
AVEVA PDMS/MARINE
Step-By-Step Tutorial
endif
--End of Block 3


PART 4. Spatial map update

--Block 4. Spatial map update
DESIGN
MAP BUILD MDB
HANDLE (69,97)
--if Read-Only DB
ENDHANDLE
--End of Block 4


PART 5. Piping check

--Block 5. Check pipe (using SAM project as example)
--goto Zone with Piping
ZONE /PIPES
--collect pipes
!pipes = !!CollectAllFor('PIPE',||,CE)
--creating log-file with name !TotalLOG-PIPES.log
!outputLOG = object array()
!outputLOGFILE = object file('$!folders[2]' + '!TotalLOG-PIPES.log')
--run do..loop, forming data output to temp log-file
do !x from 1 to !pipes.Size()
!nfile = '$!folders[2]' & !pipes[!x].Name.Replace('/','!') & '.txt'
ALPHA LOG/$!nfile OVER
$!pipes[$!x]
VAR !userm USERM
VAR !lastm LASTM
!user = 'Modified by user: $!userm , $!lastm'
$P $!user
CHECK CE
ALPHA LOG END
--check temp log-file and if inconsistencies found output then to final log
!logfile = object file(!nfile)
!logfileRead = !logfile.ReadFile()
if (!logfileRead[!logfileRead.Size()].Matchwild('*NO DATA INCONSISTENCIES*').Not()) then
!outputLOG.Append('PIPE $!!CE.Name : inconsistencies found... Manual check needed')
endif
enddo

!outputLOGFILE.WriteFile('OVERWRITE',!outputLOG)
--End of Block 5


PART 6. Review file creation

--Block 6. Create RVM file (using SAM project as example)
--goto SITE
SITE /STABILIZER
!CEName = !!CE.Name
--create RVM file
VAR !projcode PROJ CODE
!revFile = object file('$!folders[3]' + '$!projcode' + '_model.rvm')

--run export command
EXPORT FILE/$!revFile OVER
EXPORT ENCODING UTFE

EXPORT ALL PIPE FOR CE COLOUR 10

EXPORT ALL PIPE WITH (NAME OF ZONE EQ '/CABLETRAY') FOR CE COLOUR 11

EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*A*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 2
EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*B*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 3
EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*C*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 6
AVEVA PDMS/MARINE
Step-By-Step Tutorial

EXPORT ALL PIPE WITH (NAME OF ZONE EQ '/HEATING-VENTS') FOR CE COLOUR 12

EXPORT ALL EQUI FOR CE COLOUR 4

EXPORT ALL STRU FOR CE COLOUR 8
EXPORT ALL STRU WITH (NAME OF ZONE EQ '/STEEL' OR NAME OF ZONE EQ '/RACKPIPES') FOR CE COLOUR 7


EXPORT FINISH
--End of Block 6


PART 7. Session merging
This part should not be used on global projects or if you use any tools for history checking

--Block 7. Session merging (optional)
--goto Admin
ADMIN
VAR !DBS COLL ALL DB
do !x from 1 to !DBS.Size()
--skip on Foreign DBs
skip if (!DBS[!x].DbRef().Fore EQ 'FOREIGN')
!mergewhere = !DBS[!x].DbRef().Name.After('/*')
--run merge
MERGE CHAN $!mergewhere
HANDLE (1,18)(1,293)
--handle if Foreign DB
ENDHANDLE
enddo
--End of Block 7


And many more like Clashes check, sending emails etc


































AVEVA PDMS/MARINE
Step-By-Step Tutorial




Appendix A. Complete code consists of all above parts

--PART1
!folders[1] = 'C:\temp\NIGHT-WORK\DatabaseCheck\'
!folders[2] = 'C:\temp\NIGHT-WORK\PipingCheck\'
!folders[3] = 'C:\temp\NIGHT-WORK\Review\'
do !x from 1 to !folders.Size()

!fo = object file('$!folders[$!x]')
if (!fo.Exists().Not()) then
!comm = |SYSCOM 'MKDIR $!folders[$!x]'|
$!comm
endif
Enddo

ADMIN
EXPUNGE
VAR !DBS COLLECT ALL DB
do!x from 1 to !DBS.Size()
!DBNA = !DBS[!X].Dbref().Name.After('/*')
EXPUNGE DB $!DBNA
HANDLE (1,271)(1,273)
ENDHANDLE
ENDDO

--PART2
VAR !DBS COLL ALL DB
!outputLOG = object array()
!outputLOGFILE = object file('$!folders[1]' + '!TotalLOG-DB.log')
VAR !mdbn MDB
CHECKOPTION EXT CHECK PREF $!mdbn

do !x from 1 to !DBS.Size()
skip if (!DBS[!x].DbRef().Fore EQ 'FOREIGN')
!dbName = !DBS[!x].DbRef().Name
!nfile = '$!folders[1]' & !DBS[!x].DbRef().Name.After('/*').Replace('/','!') & '.txt'

ALPHA LOG/$!nfile OVER
!dbN = !DBS[!x].DbRef().Name.After('/*')
CHECK DB $!dbN
ALPHA LOG END

!logfile = object file(!nfile)
!logfileRead = !logfile.ReadFile()
if (!logfileRead[!logfileRead.Size() - 1].Matchwild('*Database has no structural errors*').Not()) then
!outputLOG.Append('DBS $!dbName : inconsistencies found.. Manual check needed...')
endif
do !y from 1 to !logfileRead.Size()
if (!logfileRead[!y].Matchwild('*invalid*') OR !logfileRead[!y].Matchwild('*unknown*')) then
!outputLOG.Append('DBS $!dbName : inconsistencies found.. Manual check needed...')
SKIP
endif
enddo
Enddo
!outputLOGFILE.WriteFile('OVERWRITE',!outputLOG)

--PART 3
VAR !PROJCODE PROJ CODE
!TOEVAL = |VAR !MACFOLDER EVAR '$!PROJCODE| & |MAC'|
$!TOEVAL
!MacroFolder = object file(!MACFOLDER)
DESIGN
!files = !MacroFolder.Files()
if (!files.Size() NEQ 0) then
do !x from 1 to !files.Size()
!path = !files[!x].String()
$M/$!path
enddo
AVEVA PDMS/MARINE
Step-By-Step Tutorial
MONITOR
do !x from 1 to !files.Size()
DELETE MAC $!x
enddo
endif

--PART 4
DESIGN
MAP BUILD MDB
HANDLE (69,97)
ENDHANDLE

--PART 5
ZONE /PIPES
!pipes = !!CollectAllFor('PIPE',||,CE)
!outputLOG = object array()
!outputLOGFILE = object file('$!folders[2]' + '!TotalLOG-PIPES.log')
do !x from 1 to !pipes.Size()
!nfile = '$!folders[2]' & !pipes[!x].Name.Replace('/','!') & '.txt'
ALPHA LOG/$!nfile OVER
$!pipes[$!x]
VAR !userm USERM
VAR !lastm LASTM
!user = 'Modified by user: $!userm , $!lastm'
$P $!user
CHECK CE
ALPHA LOG END
!logfile = object file(!nfile)
!logfileRead = !logfile.ReadFile()
if (!logfileRead[!logfileRead.Size()].Matchwild('*NO DATA INCONSISTENCIES*').Not()) then
!outputLOG.Append('PIPE $!!CE.Name : inconsistencies found... Manual check needed')
endif
enddo

!outputLOGFILE.WriteFile('OVERWRITE',!outputLOG)

--PART 6
SITE /STABILIZER
!CEName = !!CE.Name
VAR !projcode PROJ CODE
!revFile = object file('$!folders[3]' + '$!projcode' + '_model.rvm')

EXPORT FILE/$!revFile OVER
EXPORT ENCODING UTFE

EXPORT ALL PIPE FOR CE COLOUR 10
EXPORT ALL PIPE WITH (NAME OF ZONE EQ '/CABLETRAY') FOR CE COLOUR 11
EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*A*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 2
EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*B*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 3
EXPORT ALL PIPE WITH (MATCHWILD(NAME,'*C*') AND NAME OF ZONE EQ '/PIPES') FOR CE COLOUR 6
EXPORT ALL PIPE WITH (NAME OF ZONE EQ '/HEATING-VENTS') FOR CE COLOUR 12
EXPORT ALL EQUI FOR CE COLOUR 4
EXPORT ALL STRU FOR CE COLOUR 8
EXPORT ALL STRU WITH (NAME OF ZONE EQ '/STEEL' OR NAME OF ZONE EQ '/RACKPIPES') FOR CE COLOUR 7

EXPORT FINISH

--PART 7
ADMIN
VAR !DBS COLL ALL DB
do !x from 1 to !DBS.Size()
skip if (!DBS[!x].DbRef().Fore EQ 'FOREIGN')
!mergewhere = !DBS[!x].DbRef().Name.After('/*')
MERGE CHAN $!mergewhere
HANDLE (1,18)(1,293)
ENDHANDLE
enddo

S-ar putea să vă placă și