# Presentation: 832700

## CMS Pixel PLC Code Review- Closing Session -

- Christian Veelken
- UC Davis
- 06/26/08

- The CMS Pixel PLC Code

## The revised Pixel PLC Code

**Changes to Pixel PLC Code resulting from Review:**
- Changes in Functionality
- Coding Improvements
- Improvements to Hardware Configuration
- Lifetime of Relays
- Configuration Parameter Checks
**Open Issues**

- The CMS Pixel PLC Code

## Changes in Functionality

- Implemented Diagnostic Interrupt Organization Blocks
- 	OB 80, OB 81, ... OB 88
- 	OB 121, OB 122

**Stefan Lueders**
**Piero Girgio Verdini**

- Added Data-Block for Log-Messages;
- 	filled with Entries whenever one of the Diagnostic OBs gets called

- Adapted from Example Code provided by
**Stefan Lueders**

- The CMS Pixel PLC Code

## Coding Improvements - 1

- Reduced number of Function Blocks
- FC 1110 “isEven” replaced by “MOD 2”
- merged FC 1400 and FC 1401
- merged FC 1411 and FC 1412
- removed FC 1421 “testBit”

**Jim Kowalkowski**
**Kevin Krause**
**Stefan Lueders**

- Replaced all Instances of “Time_of_Day” by “Date_and_Time” Variables; “Date_and_Time”  now consistently used everywhere in the Code

**Jim Kowalkowski**

- FC 1240 “syncSystemDate_and_Time” removed;
- 	replaced by Timer Server

**Stefan Lueders**
**Piero Girgio Verdini**

- The CMS Pixel PLC Code

## Coding Improvements - 2

- Return codes of SFC 20 “BLKMOV” and SFC 21 “FILL” taken into account everywhere in the Code

**Jim Kowalkowski**
**Kevin Krause**
**Stefan Lueders**
**Piero Girgio Verdini**

- Changed Order by which Functions are compiled in Makefile, taking into account Dependencies

**Stefan Lueders**

- Shortened Variable Names
-     No Warnings during Compilation anymore

**Stefan Lueders**
**Piero Girgio Verdini**

- The CMS Pixel PLC Code

## Coding Improvements - 3

- Added Checks for
- 	lower Alarm Threshold < upper Alarm Threshold
- to FC 110 and FC 111

**Stefan Lueders**
**Piero Girgio Verdini**

- Changed Heart-Beat Period from 1.6s to 2min
-     will come back to this later...

- Other (minor) Code Improvements
-     (Details of which sent to respective Reviewer)

**Stefan Lueders**
**Piero Girgio Verdini**

- The CMS Pixel PLC Code

## Improvements to the HW-Config.

- Added IP Address Protection

- Added Password Protection for read/write Access to PLC via Siemens Step7 software

- Enabled Diagnostic Interrupts

**Stefan Lueders**

**Stefan Lueders**

**Stefan Lueders**
**Piero Girgio Verdini**

- The CMS Pixel PLC Code

## Lifetime of Relays

- Relay specified for 1 million Switching Cycles @ 0.5 A, 24V DC
- actually lower Limit, as current significantly smaller in Pixel case
-  Relay might break after 2-3 weeks of operation in case Heart-
-     Beat Signal has Period of 1.6s.
-  Change Heart-Beat period to 2 minutes
-  Lifetime Expectancy for Relay increased to 3-4 years minimum.

**Stefan Lueders**
**Piero Girgio Verdini**

- The CMS Pixel PLC Code

## Configuration Parameter Checks - 1

-  The Change would not reduce the overall Amount of Code
-    (just move it from the PLC to PVSS, where it will not be
-     significantly easier to maintain, we believe).
-  The PLC code would become simpler, but at the same Time the
-    PVSS code would become more complex.

- Stefan Lueders suggested to move the Implementation of Validity Checks performed on the Configuration Parameters uploaded by PVSS from the Pixel PLC Code to PVSS:
-  Decided not to to it
- _Reasons:_

- The CMS Pixel PLC Code

## Configuration Parameter Checks - 2

-  We do actually prefer to perform the Checks in the PLC,
-    so that the entire Chain of Data Transmission can be validated
-    (Concerns about possible Data Corruption by the PVSS native S7
-     Driver have been raised by Piero Giorgio Verdini)
-  The current Implementation of the Configuration Parameters in
-    the Pixel PLC Code has been tested, debugged and verified to
-    work.
-    The effort to move the Code for the Configuration
-    Parameter Checks from Pixel PLC code to PVSS and repeat the
-    Testing, Debugging and Verification of the Code would be
-    significant.

- The CMS Pixel PLC Code

## Open Issues - 1

**CRC-16 Checksums**
- _Different Opinions held by different Reviewers:_
-  Stefan Lueders
-     “I believe this is Overkill”
-  Piero Giorgio Verdini
-     “PVSS data transmission - strange things to happen
-      from Time to Time.
-      Packets need to be broken up on large Transmissions.
-      Sometimes blocks are garbled.”
-     (Minutes of Meeting 04/25/08)

- The CMS Pixel PLC Code

## Open Issues - 2

- All Reviewers pointed out that this would be good to have, but: suitable Tools are lacking !!

-  Gennadiy Lukhanin
-     “It may be useful to store Checksums for DB 1xx
-      in a Data-Base, so that the entire Chain of Data
-      Transmission from the Data-Base to Data-Blocks in the PLC
-      can be validated.”

**Common Issue of CMS Pixel and Silicon Strip Tracker**
**    ****PLC Codes**

**Issue common to PLC Codes of many (if not all) **
**    ****CMS Subdetectors**
** **

- The CMS Pixel PLC Code

## Thank you !!

- The CMS Pixel PLC Code

## Special Acknowledgements

- 	**Piero Giorgio Verdini**
**    **for taking the Time to discuss his Comments
- 	with me
**    ****Stefan Lueders**
** ****	**for providing me with an example Implementation
- 	of the diagnostic Interrupt Organization Blocks
- 	and for taking the Time for many useful Explanations

- The CMS Pixel PLC Code