CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Wed Oct 18, 2017 11:11 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Feb 14, 2017 7:50 pm 
Offline

Joined: Sat Feb 11, 2017 9:57 pm
Posts: 4
Hi,
I have a programming problem (CFC) that I can't figure out how to solve.
As a part of the program for my house, I want to integrate pulses from an energy-meter. The energy-meter has two outputs, that I want to connect to to two digital inputs on my Wago 750 PLC to get info about how much Power that's imported or exported from my household.
The meter has a pulse-factor of 100 pulses per kWh. I thought that if I instead of counting pulses over a fixed time-period rather Count the time between pulses I get a much faster and more accurate momentary Power consumption/export monitoring. I later on want to use this to Control a waterheater while I have an over-production of Power on my solar panels.

Then, to my problem:

See the attached Picture, I can't get "momentan_konsumption" and "momentan_produktion" (momentary consumption/pruduction) to stay at the calculated value.
I am trying to calculate the elapsed time from the TON-blocks to a momentary Power-consumption/production by converting time to dword, divide 36 000 000 by the elapsed time in miliseconds and hopefully get a momentary Power-value in watts. With the conditions on the EN-connectors I hoped that the calculation should only be done with an elapsed time anything else than 0 so that the calculation couldn't be resetted right away.


Can you see any obvious faults?


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue Feb 14, 2017 8:29 pm 
Offline

Joined: Sat Feb 11, 2017 9:57 pm
Posts: 4
By the way, the variables connected to the ENO-connectors are not in use. They are only leftovers from a Little experiment.


Top
   
PostPosted: Wed Feb 15, 2017 8:24 pm 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 172
arrange the execution order of the elements of cfc.

Enviat des del meu Aquaris M5.5 usant Tapatalk


Top
   
PostPosted: Wed Feb 15, 2017 9:37 pm 
Offline

Joined: Sat Feb 11, 2017 9:57 pm
Posts: 4
I'm not sure I understand what you mean. In which order should they be executed?


Top
   
PostPosted: Wed Feb 15, 2017 10:13 pm 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 978
jos is talking about a command to change in which sequence all the blocks are calculated.
I am missing more software like a trigger when you receive a pulse, and oke you can use the time between pulses for the actual, however you will also need to store the total pulses.
if you also store the starttime and the actual time you can get a average of power.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


Top
   
PostPosted: Thu Feb 16, 2017 9:17 am 
Offline

Joined: Sat Feb 11, 2017 9:57 pm
Posts: 4
I don't really think I need to store the total pulses. The meter itself keeps track of the total energy-consumption. That's enough for me. Here I just want to see consumption/pruduction for the moment.
The variables "Konsumption" and "Produktion" is the variables for the digital inputs that "listen" for pulses.
I am sorry, but I still don't understand how to change the sequence the blocks are calculated. Can you give an example?


Top
   
PostPosted: Sun Feb 19, 2017 12:12 pm 
Offline
Frequent User
Frequent User

Joined: Thu Jun 14, 2007 9:49 am
Posts: 978
jos is talking about the sequence of the blocks the AND is now 3 and should be 0
this is done automatically check order (after right clicking.

_________________
shooter@home.nl
computer shooter
paul deelen
jacob van wassenaerstraat 29
NL 5224 GG 's-Hertogenbosch
skype shooter paul.deelen
phone +31736139136


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited