Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Adding Y value on different X position (time)

Status
Not open for further replies.

north2012

Member level 3
Member level 3
Joined
Apr 1, 2013
Messages
63
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
1,813
Hello,

I am working with small WSN with coordinator and 3 nodes. Coordinator ("Hall") collects all data (measured temperature, relative humidity and light intensity) from nodes ("Bedroom", "Lounge", "Bathroom") and through serial interface send it to PC where I have PC application for data acquisition and presentation.

First step:
Code:
chart1.Series["Hall"].ChartType = SeriesChartType.FastLine;
chart1.Series["Hall"].Color = Color.Red;
chart1.Series["Bedroom"].ChartType = SeriesChartType.FastLine;
chart1.Series["Bedroom"].Color = Color.Blue;
chart1.Series["Lounge"].ChartType = SeriesChartType.FastLine;
chart1.Series["Lounge"].Color = Color.Brown;
chart1.Series["Bathroom"].ChartType = SeriesChartType.FastLine;
chart1.Series["Bathroom"].Color = Color.Green;
chart1.Legends["Legend1"].Docking = Docking.Top;

After package is received and parsing one of charts is updated
Code:
DateTime now = DateTime.Now;
date = now.ToString("dd/MM/yy");

chart1.Series["Hall"].Points.AddXY(time, halltemperature);
chart1.Series["Bedroom"].Points.AddXY(time, bedroomtemperature);
chart1.Series["Lounge"].Points.AddXY(time, loungetemperature);
chart1.Series["Bathroom"].Points.AddXY(time, bathroomtemperature);

The problem is that nodes can join in network in different moments, but new graph is always started from zero position even it is different time.

"Hall" joins first and that graph is started. For example, after 4-5 seconds new node is added but that graph starts from zero and so on... How to add offset to X value to?
 

I have global time, variable DateTime now = DateTime.Now; is global and it is updated on every new results.

I will try to explain my problem:

1. I have only the coordinator in network. It has own temperature, RH and light sensor so graphs are started.
2. For example, 5 seconds later the second node ("Bedroom") joined the network. It has own temperature, RH and light sensor so graphs are started for this node as well.
3. On the mutual graph, I have 5 samples of "Hall" temperature and 1 sample of "Bedroom" temperature. Graphs are plotted versus time and 19:47:52 is zero x-axis value for "Bedroom" and the fifth x-axis value for "Hall". I would like to make that "Bedroom" graph starts with offset of five, before that it should be clear. So, measured values for both temperatures ("Hall" and "Bedroom") on 19:47:53 will be plotted as the sixth x-axis value. Is this possible?

Thanks.
 

still not sure what the problem is
the C# program bleow plots a sine wave (one degree/second) on a Chart component and when the Start Cosine button is pressed also plots the cosine - it can be seen cosine starts plotting after about 300degrees (it is clear before that)
sine.jpg

could you upload a sample of your chart to show the problem
 

Hello,

Sorry for late response.

Here are my graphs.



As you can see, even both values have the same time, they are not placed on the same time position on x-axis...

Line for adding new value on graphs is

Code:
chart1.Series["Hall"].Points.AddXY(time, halltemperature);

or

Code:
chart1.Series["Bedroom"].Points.AddXY(time, bedroomtemperature);

These are called in function update_values

Code:
private void update_values(string update)
{
       DateTime now = DateTime.Now;
       date = now.ToString("dd/MM/yy");
        time = now.ToString("HH:mm:ss");
........
//parse of "update" string
......

//one of upper lines
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top