Local time not correct

So I tested my program using a TON timer for one measurement and the local time for another measurement.

My results where a little bit strange.
Speed with a TON was for example 3km/h
Speed with local time was for example 7km/h which is almost double of that. Sometimes they were very close to eachother but the measurement with local time almost always doubles it. ( All code was in my main)
 
Do you mind sharing the program?

What CPU are you using? I simulated a 1215, it shouldn't matter, but perhaps it does.

We really don't know what you are trying and cannot give much more guidance like this.
 
Why do you use a flip-flop before RD_LOC_T? You want an edge detector not something that stays high all the time until the other contact goes high (effectively counting 0 between them).

You also don't want to copy the nanoseconds portion of the Time variable. As I understand it these are fields, not a conversion of the time.
 
Why do you use a flip-flop before RD_LOC_T? You want an edge detector not something that stays high all the time until the other contact goes high (effectively counting 0 between them).

You also don't want to copy the nanoseconds portion of the Time variable. As I understand it these are fields, not a conversion of the time.

Yeap tested the read local time variable with a SR before it and it didn't work so I removed that.

Also when I get a signal on field sensor 1, the timer starts and the elapsed time is moved but I still get speed measurement even tho I'm not supposed to when I get a signal on my field sensor 2 with a following signal on my goal sensor 2 ( move time field player 1 is supposed to reset)
So basically I get 2 speed measurements everytime in the following events because the move time will not reset:

Field player 1 -> field player 2 ( reset move time player 1 and set move time player 2) -> goal player 2

Field player 2 -> field player 1(reset move time player 2 and set move time player 1) -> goal player 1
 
Let's step back a second as you came in with one problem, we tested it elsewhere and it worked fine and you're now looking at other ways of solving the problem and not really getting anywhere.

Can you start from the beginning with a blank project and do this.

Link input 0.0 to OB40 in the hardware config.
Link input 0.1 to OB41 in the hardware config.
Create a Global DB with the following variables:
TimeIn - DTL
TimeOut - DTL
TimeDiff - Time
TimeInActive - Bool
TimeOutActive - Bool.

In OB40, place the RD_LOC_T instruction without any condition.
Map the RET_VAL to MW100 (not important now).
Map the Output to TimeIn.
Place a Set instruction for the bit TimeInActive.

In OB41, place the RD_LOC_T instruction without any condition.
Map the RET_VAL to MW200 (not important now).
Map the Output to TimeOut.
Place a Set instruction for the bit TimeOutActive.

In OB1, make an AND condition with TimeInActive and TimeOutActive and a T_DIFF block.
In the T_DIFF block, put TimeIn and TimeOut as the inputs and put TimeDiff as the output.
In the next rung place a reset condition for the TimeInActive and TimeOutActive bits. These don't quite matter, but are good for debugging.

This is literally all I did to have this functionality work in my program.
Test this first and worry about the rest or different way of doing it later.
 
Let's step back a second as you came in with one problem, we tested it elsewhere and it worked fine and you're now looking at other ways of solving the problem and not really getting anywhere.

Can you start from the beginning with a blank project and do this.

Link input 0.0 to OB40 in the hardware config.
Link input 0.1 to OB41 in the hardware config.
Create a Global DB with the following variables:
TimeIn - DTL
TimeOut - DTL
TimeDiff - Time
TimeInActive - Bool
TimeOutActive - Bool.

In OB40, place the RD_LOC_T instruction without any condition.
Map the RET_VAL to MW100 (not important now).
Map the Output to TimeIn.
Place a Set instruction for the bit TimeInActive.

In OB41, place the RD_LOC_T instruction without any condition.
Map the RET_VAL to MW200 (not important now).
Map the Output to TimeOut.
Place a Set instruction for the bit TimeOutActive.

In OB1, make an AND condition with TimeInActive and TimeOutActive and a T_DIFF block.
In the T_DIFF block, put TimeIn and TimeOut as the inputs and put TimeDiff as the output.
In the next rung place a reset condition for the TimeInActive and TimeOutActive bits. These don't quite matter, but are good for debugging.

This is literally all I did to have this functionality work in my program.
Test this first and worry about the rest or different way of doing it later.

Okay I'll try that.
Also any advice on how to solve the move time problem? I currently execute my math functions wih a negative edge of my Time_running and I was thinking to replace that variabele with a negative edge of my goal sensor.
 

Similar Topics

Is there a way to add a local message display to Studio 5000 View Designer? If its there, I’m not finding it. I have used them in older versions...
Replies
11
Views
395
Hi, I'm trying to export data from a DataGrid to Excel using VBA, but I'm getting an error "Object doesn't support this property or method". The...
Replies
0
Views
72
So our Powerflex 525's are set up to allow REMOTE operation from PLC through network. But if network is lost we want to be able to run in LOCAL...
Replies
5
Views
558
Migrating v8 FT View SE to v13, had to export tags because after v10 the configuration is no longer supported. Imported tags to new Tag Alarm...
Replies
1
Views
503
Hello, the PLC in question is 1769-L30ER. I have a local 4-20mA Analog Output module (1769-OF4CI), and also a remote ethernet PointIO analog...
Replies
0
Views
396
Back
Top Bottom