You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old March 29th, 2016, 11:45 AM   #1
issahirbawi
Member
Palestine

issahirbawi is offline
 
Join Date: Mar 2016
Location: Palestine
Posts: 3
delta plc day counter help me

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
  Reply With Quote
Old March 30th, 2016, 05:53 AM   #2
issahirbawi
Member
Palestine

issahirbawi is offline
 
Join Date: Mar 2016
Location: Palestine
Posts: 3
any one?
or at least how to make real time calendar ?
  Reply With Quote
Old March 30th, 2016, 06:04 AM   #3
AshleyParr
Member
United Kingdom

AshleyParr is offline
 
AshleyParr's Avatar
 
Join Date: Dec 2008
Location: Midlands, UK
Posts: 176
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
  Reply With Quote
Old March 30th, 2016, 07:02 AM   #4
shrirampendse
Member
India

shrirampendse is offline
 
shrirampendse's Avatar
 
Join Date: Dec 2006
Location: Pune, India
Posts: 157
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 .
  Reply With Quote
Old March 30th, 2016, 08:44 AM   #5
issahirbawi
Member
Palestine

issahirbawi is offline
 
Join Date: Mar 2016
Location: Palestine
Posts: 3
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
  Reply With Quote
Old March 30th, 2016, 09:15 AM   #6
dburnum
Member
United States

dburnum is offline
 
dburnum's Avatar
 
Join Date: Oct 2008
Location: SW Kansas
Posts: 148
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 by dburnum; March 30th, 2016 at 09:31 AM.
  Reply With Quote
Old March 30th, 2016, 06:27 PM   #7
dburnum
Member
United States

dburnum is offline
 
dburnum's Avatar
 
Join Date: Oct 2008
Location: SW Kansas
Posts: 148
Based upon;
http://alcor.concordia.ca/~gpkatch/gdate-algorithm.html
  Reply With Quote
Old March 31st, 2016, 11:46 AM   #8
dburnum
Member
United States

dburnum is offline
 
dburnum's Avatar
 
Join Date: Oct 2008
Location: SW Kansas
Posts: 148
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.
Attached Files
File Type: xls Calculated Days.xls (64.0 KB, 4 views)
  Reply With Quote
Old March 31st, 2016, 02:14 PM   #9
dburnum
Member
United States

dburnum is offline
 
dburnum's Avatar
 
Join Date: Oct 2008
Location: SW Kansas
Posts: 148
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)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Want to replace Mitsubishi PLC with Delta PLC bharatmasterdc@gmail LIVE PLC Questions And Answers 0 February 3rd, 2015 01:44 PM
How to send and recive data to Delta PLC in .net? pare-es LIVE PLC Questions And Answers 4 January 1st, 2015 12:30 AM
Rs logix 5000 varunmahendran91 LIVE PLC Questions And Answers 4 October 6th, 2014 01:26 PM
PID program for delta PLC azadplc LIVE PLC Questions And Answers 0 May 7th, 2014 05:37 AM
Plc suggestion aec LIVE PLC Questions And Answers 36 January 2nd, 2012 01:56 AM


All times are GMT -5. The time now is 05:58 AM.


.