delta plc day counter help me

issahirbawi

Member
Join Date
Mar 2016
Location
Palestine
Posts
7
hello

am trying to program a plc to work according to days

the idea is like this

for example lats say it is about heat control
each day or few days have different heat values
like this :
day 1 it should be 20 c
day 2 it should be 30 c
day 3 it should be 33 c
day 4 it should be 32 c
day 5 it should be 26 c
day 6 it should be 35 c
day 9 it should be 28 c

the problem is how to make an accurate day counter
and it should still count even when the plc is off
as the days values
am in day 2 the heat set should be 30 c
for some reason the i lose electricity for 3 days
when it comes back and the plc turns on
it should know that we r in the day 5 and the heat set should be 26 c

so plz if any one can help
tell me what to do

am using dopsoft and WPLSoft 2.41
with thanks
 
Sorry i have no experience with that software but:

Search the help files in the programming software to see if you can get the system time/date, if you can you could use that?

Probably the most reliable way would be to use the time & date set from the HMI as that will most likely retain the date if power was lost. Set up a tag that transfers the day from the HMI to the PLC tag

Example from Factory Talk Macro that runs at midnight:
Code:
&Set General_PLC\YP_Scada_Year {system\Year}
&Set General_PLC\YP_Scada_Date {system\Dayofmonth}
&Set General_PLC\YP_Scada_Month {system\Month}

Ash
 
Delta PLC RTC

API 166 TRD Calendar Data Read
--------------------------------------------------------------------------------

D : The device stores the current time of calendar (occupies 7 continuous devices)

Operand: Device Range D : T, C, D


Explanations:

The built-in RTC in PLC MPU offers 7 data (year, week, month, day, hour, minute, second) stored in D1319 ~ D1313. TRD instruction is for program designers to read the current data of the RTC to the assigned 7 registers.

Please check if your PLC has battery backed RTC .
Or else use RTC in your DOP HMI .
 
thanks for ur replays AshleyParr and shrirampendse

now i thought about what u said
but the problem is some months have 30 days others have 31 and 29
if i told it to use the date in the RTC
how could i explain it to the plc

for example in 28\2\2016
i lost the power
and i was in the 4th day of the cycle
i restore the power in 03/03/2016
so it should be the the 10th day
but the plc will count it as the 11th day because for it only 5 days past when i lost power
so i lose one day cause for the plc there is 30 days in the month

i need an accurate way to count the days even when i lose power
i hope u can help me with that
with thanks
 
The way I've done this is to have two "notepad" registers. One for a Month calculation, and another for a year calculation.
Lets call the "Month" calculation "WorkspaceM" and the year calculation "WorkspaceY"
if you compute off the RTC, then:
"WorkspaceM"= ([RTC_Month]+9)MOD 12
"WorkspaceY"= ([RTC_Year]-("WorkspaceM"/10)

Then the algorithm for calculating sequential days, for calculating between two dates would be:

(365*"WorkspaceY"+("WorkspaceM"/4)-("WorkspaceY"/100)+("WorkspaceY"/400)+(("WorkspaceM"*306+5)/10)+[RTC_Day])

This works for most years unless you go waaay back in years.
So by calculating difference between two dates.
If you were to substitute RTC for a known date, then you could find days passed between RTC and date entered, from two separate computations.

Also, so could enter an offset, with a MOD function behind the RTC computation to make a cyclic day counter. Such as:

(365*"WorkspaceY"+("WorkspaceM"/4)-("WorkspaceY"/100)+("WorkspaceY"/400)+(("WorkspaceM"*306+5)/10)+[RTC_Day])MOD9

---will create a 9 day cyclic counter of days 0-8.
 
Last edited:
Here is a small spreadsheet that illustrates the calculation. Remember that values have to be an integer, and division is handled as integers. Thus 24/5=4. Only the quotient is maintained in the calculations. You'll notice a truncated calculation to get that result within Excel.
 
I noticed I incorrectly entered the formula on previos posts. Oops!

"WorkspaceM"= ([RTC_Month]+9)MOD 12
"WorkspaceY"= ([RTC_Year]-("WorkspaceM"/10)

(365*"WorkspaceY"+("WorkspaceY"/4)-("WorkspaceY"/100)+("WorkspaceY"/400)+(("WorkspaceM"*306+5)/10)+[RTC_Day]-1)
 

Similar Topics

How i Can connect Delta plc, with Beckoff remote IO cards?
Replies
1
Views
55
Hi Everyone, I am currently trying to communicate ControlLogix PLCs via EtherNet/IP with Delta V DCS. There is a VIM2 card configured for...
Replies
1
Views
181
Does anyone know videos in English with trains for Delta PLC
Replies
1
Views
139
I have a SX2 plc and i'm getting 0-10v analog signal,but i need 10bar analog output in 0v can someone explain how its done
Replies
2
Views
508
Hey guys, I've a requirement that a two different PLC program should work in same system depending upon user input. Consider Program A is used...
Replies
11
Views
1,785
Back
Top Bottom