Developing Safety Critical Software

April 23, 2006 at 3:13 pm (Uncategorized)

I attended a sharing session by a colleague who worked on a project which is of safety critical level. It was an enriching session and I was suddenly reminded of all the Software Testing techniques taught in University. How I wish I get to work in their team…

Anyway, here’s some of the stuff which I want to share with you.

Steps Taken
===========

1. System Safety Analysis -> identify the components which may cause hazards
2. Fault Tree Analysis (FTA) -> Identify the factors which caused the hazards
3. Analysis of System Functional Processes
4. Analysis of Software Capabilities Requirement
5. Software Top Level Design
6. Design & Coding
7. Software Testing (which includes everything from unit, integration to system testing)

Critical or not?
================
The critical level of the software is determined by a formal analysis based on the system requirement, safety mechanism (redundancy and precaution), hazard list and use case document. For example, the critical level of a software component decreased if you have taken precaution and implement another background plan for failure. The hazard list will give you the mishap severity level (risk index). Depending on the risk index, different testing efforts are required. For functions with high critical level, unit testing with 100% coverage is required.

Testing methods
===============
Code Review – conducted by the whole team of developers, domain experts and Software Quality Assurant (SQA). They even go down into the details of removing unnecessary initialisation of variables. For embedded systems, it will be a waste of processing time.
Static Testing – Conducted using PC-Lint. It will generate a list of warning whether you code contains variables not initialised or not used at all etc.
Unit Testing – Performed using IBM Rational Test Real-Time. It helps to ensure 100% coverage.

As for integration and system testing, the presenter did not cover that as their project is still ongoing. Hope they will have another sharing session after their project closure.

P.S: Just a guideline for project managers, a 9.5K code requires around 5 man months to code and test it.

Permalink 1 Comment

HOWTO: Java Swing Custom TableCellRenderer.

April 14, 2006 at 1:31 am (Uncategorized)

Great apologies to everyone (or anyone at all ;op) who had long awaited for my first tech entry. More importantly, apologies to my co-contributor of this blog. She has done much more for this blog than me! Thanks! ;o>

The first entry is always difficult. I am not sure whether the topic is too basic. However, I will try to keep my entries short and simple, as I think whoever finds it useful like the important points to be clearly presented. The first topic I am going to cover is a common Swing component, JTable.

Typically, JTables are used to display data. The Sun Java Tutorial is a great source of information on how to accomplish some common table-related tasks. One of the key feature of JTable is the default cell renderer. There is an automatic mapping between the column class type and the predefined cell renderer used. For example, a Boolean class type data will be displayed as a JCheckBox, which is more intuitive than displaying the words “true” or “false”. All you need is to do is to override the getColumnClass in your TableModel class. The code snip below shows an example of the overridden class.

Below is a simple table from the Java Tutorial that is implemented using the default renderer. The Boolean “vegetarian” column is rendered as a JCheckBox. However, if you noticed, the columns are all of same size and text aligned to the left.

In order to fix this problem, you’ll need to use a custom table cell renderer in which you can specify the horizontal alignment. You’ll probably use the DefaultTableCellRenderer to do the job. The following code snip shows how,

Be sure to set the default renderer to your custom renderer or turn off the auto-create-column option. Otherwise, you’ll have twice the number of columns, one by the default renderer and one by your custom renderer.

This works fine for String columns, but you’ll realise the predefined renderers are not used. A Boolean column will be displayed as “true” or “false”, instead of a JCheckBox. This is because the “default cell renderer” is not “DefaultTableCellRenderer”. Therefore you’ll actually need to write your own custom renderer to display the cells the way you want.

The trick to writing a custom renderer class is to either extend from the DefaultTableCellRenderer or extend the component class you want to render and implement the TableCellRenderer class, then override the getTableCellRendererComponent method. Using the same method, you can also define color to render the cell.

Below are some useful resources you need to construct your perfect JTable,

IBM Developer Article: Rendering cells in Swing’s JTable component
Javadoc: JTable
Java Tutorial: How to Use Tables
Sample Code from CSUN: TableDemo with Custom TableCellRenderers

Hope that you find this entry useful! :o>

Permalink Leave a Comment

The ‘IN’ radio technology – Ultra Wide Band.

March 29, 2006 at 5:36 pm (Uncategorized)

Today’s Straits Time:

” The Bluetooth wireless standard used in cell phones and other small devices will take a leap in transmission speed, broadening its scope to enable high-definition video and files for digital music players like the iPod.

The industry group behind Bluetooth said Tuesday that it would boost transfer speeds in the next few years by incorporating a new radio technology, known as ultra-wideband, or UWB.

Currently, Bluetooth works only for low-speed uses like headsets and wireless keyboards. UWB, which has yet to appear in consumer devices, enables wireless transmissions at speeds equivalent to USB or FireWire cables at distances up to 10 feet. ”

So I did a research on what exactly is UWB and found this site by Intel. (http://www.intel.com/technology/comms/uwb/index.htm)

In summary,

UWB is defined as any radio technology having a spectrum that occupies a bandwidth greater than 20 percent of the center frequency, or a bandwidth of at least 500 MHz. Modern UWB systems use other modulation techniques, such as Orthogonal Frequency Division Multiplexing (OFDM), to occupy these extremely wide bandwidths. UWB’s combination of broader spectrum and lower power improves speed and reduces interference with other wireless spectra.

UWB could eliminate those wires connecting electronic devices, allowing people to “unwire” their lives in new and unexpected ways. Intel listed a few examples of what we can achieve through UWB and here is one of my favourite one.

* An office worker could put a mobile PC on a desk and instantly be connected to a printer, scanner and Voice over IP (VoIP) headset. (I really like this cos behind my computer table is whole bunch of wires!)

Permalink Leave a Comment

Reminder: What #define really means.

March 23, 2006 at 8:11 pm (Uncategorized)

I found a very stupid bug in my code today. I think most programmers are aware of this fact, but may simply overlook sometimes.

Here’s an extract of the code.

The value for num_int_read is supposed to be 56/4=14. However, I realised it is actually 59 when I
printed out its value during debugging.

Find the bug!

#define symbols 480
#define num_bytes_read symbols/8 -4 //calculated result is 56

void function ()
{
int num_int_read = num_bytes_read/4; //since integer is 4*1 byte
//num_int_read is used in this function
}

Found the bug?

Now for the explaination to why num_int_read turned up to 59…

The compiler does not compute the value and substitute into the “num_int_read = num_bytes_read/4” expression. It replaces the ‘num_bytes_read’ with its definition. Hence the
expression becomes “num_int_read = symbols/8 -4/4” which is equals to 60-1.

Yeah. Nice bug heh.

Permalink Leave a Comment

MIMO.

March 20, 2006 at 4:08 pm (Uncategorized)

Recently I am involved in some MIMO waveform implementation. I am in charge of the application layer and integration. So naturally I did some research on what is MIMO and decide to share with you.

Below is some background on MIMO systems in communication terms.

In communication theory, MIMO refers to radio links with multiple antennas at the transmitter and the receiver side. Given multiple antennas, the spatial dimension can be exploited to improve the performance of the wireless link. The performance is often measured as the average bit rate (bit/s) the wireless link can provide or as the average bit error rate (BER). Which one has most importance depends on the application.

Multiple-Input Multiple-Output (MIMO) wireless systems represent an economical way to increase user capacity in a variety of environments. The use of antennas at both transmitter and receiver allows

* Multiplicative increase in capacity and spectral efficiency
* Dramatic reductions of fading thanks to diversity
* Increased system capacity (number of users)
* Lower probability of detection
* Improved resistance to interference

MIMO can also be used in conjunction with OFDM, and it will be part of the IEEE 802.11n High-Throughput standard, which is expected to be finalized in mid 2006.

MIMO and information theory

It has been shown that the channel capacity (a theoretical upper bound on system throughput) for a MIMO system is increased as the number of antennas is increased, proportional to the minimum number of transmit and receive antennas. This basic result in information theory is what led to a spur of research in this area.

Permalink Leave a Comment

A Brand New Skin.

March 18, 2006 at 10:36 pm (Uncategorized)

I have not got time to post my first technical entry yet. Did some quick customization using a blog skin from Blogger-Template, and made some tinny-winny changes. Although I am not very satisfied with it (there’s no room for links, profile and stuffs), but it’ll stay for awhile till I find a better one. Anyway I like the theme so far – “An eye-opener for both of us as who seek for knowledge to fill our potholes of ignorance”. Just in case I decided to change the skin, below is a picture of how it looks like at the time of this post.

Permalink Leave a Comment

C++ fioread vs read.

March 13, 2006 at 6:01 pm (Uncategorized)

int fioRead
(
int    fd,      /* file descriptor of file to read */
char * buffer,  /* buffer to receive input */
int    maxbytes /* maximum number of bytes to read */
)

DESCRIPTION

This routine repeatedly calls the routine read( ) until maxbytes have been read into buffer. If EOF is reached, the number of bytes read will be less than maxbytes.

Normally fioread is used when receiving data from sockets, when the data is coming from an unreliable source. But it may post a problem if you do not know the maximum number of bytes to read. It will wait forever.

Permalink Leave a Comment

Let the Ball Roll.

March 9, 2006 at 10:47 pm (Uncategorized)

First of all, before I start a quick entry of the background (my side of the story), I want to thank my girlfriend, carine~swan, for starting this little space. In fact, after reading several tech blogs in the past few months, I had wanted to start one for my project team, in which we can share the lil’ tips we pick up during the course of our work. However, the official idea was put down as my manager thought it wasn’t the right time for such a blog yet (we have occasional sharing sessions). I thought why not just deploy one on my own machine, get some interest and let the idea grow among my colleagues. Alas, I was either too busy or lazy (???) and procastinated. So it is great to start off with this space now!

Despite focusing on different aspects of technology in our jobs, I feel that we still speak the same language, the CE-Language, the hardware-software-combo. =p

And now, for my side of the story… basically what I will be posting in this space little tips and knowledge that I want to share. I am no expert, so there will be nothing in depth, but basic tips which will be useful to beginners, and which we may often overlook. As I do Java in my daily work, so you’ll probably see many “Java Best Practices”. The main motivation of sharing is not to “showoff” (anyway, there’s nothing to), but hopefully to help java programming beginners code better, and remind myself what I learnt. It is not meant to replace any books but to create more fun for the readers and myself. Tech books are still one of the best resource to learn.

And if you are reading this blog, and thinking “hey this is chicken feet lah, you don’t know all these meh?”, I guess the content is too low-level for you. But if you think it helps you, or you find any mistakes in the posts, please feel free to comment!

Hope to update the site design, and post the first very soon (once I get a bit of time off work)! Meantime, you can visit my regular blog. =)

Oh yah, one more thing, I like the name of this space. Creative and well-thought! Do you think so too? Cheers!

Permalink Leave a Comment

Knowledge Seeders.

March 9, 2006 at 12:01 pm (Uncategorized)

This site is started off to serve as a pool for me and my friends to dump our technical knowledge into it.

The background (from the swan side of the story)
===============================================
I was striken by egeus, who is also my boyfriend, last night over a telephone conversation when he told me about the growing trend of developers sharing technical ideas and knowledge over the internet by blogging. Then he began to tell me the many tips which he learnt from other people by reading their blogs. So I think back and felt really sad. “What have I learnt over these 9 months in my job as a software engineer?”

So in order not to face this problem again in future, and also to constantly remind myself that I’ve learnt SOMETHING afterall, this blog is created.

Another important reason is to broaden my knowledge. I want to gain knowledge outside my field of work. Although we graduated with the same degree, ending up in different jobs very much shape how we think now. For example, egeus is such a Java person now. Constantly talking about good programming practices, “.jar”, “OO” and “beans” etc. On the other hand, I am still a C++ programmer, dealing with communication architecture and data routing here and there from one dsp or fpga to another. Each and every one of us are gaining very different knowledge everyday. There may be a point when I can no longer understand what my boyfriend is talking about when he is happily telling me how he solved a bug. I don’t want that day to come!

Permalink Leave a Comment