Autor Thema: multi counter  (Gelesen 824 mal)

Offline srd

  • Full Member
  • ***
  • Beiträge: 102
multi counter
« am: Mai 21, 2024, 16:41:46 Nachmittag »
not sure we can do this with an easy e4, we have 4 borehole pumps which all have a water meter pulsed output. we need to count the cube of each pump for each month from march to october and retain the monthly totals for each pump until the following year when they then need to be reset. unless anybody knows of another way i tried it but need 36counters one for each pump each month. Anybody got any ideas. I do my programming in LD. Cheers

Offline radar17892

  • Sr. Member
  • ****
  • Beiträge: 720
  • Think easy!
    • mollgruppe
Antw:multi counter
« Antwort #1 am: Mai 22, 2024, 10:03:24 Vormittag »
What is the maximum pulse rate when the pump is running?
Weil Einfach einfach Einfach ist!

Offline srd

  • Full Member
  • ***
  • Beiträge: 102
Antw:multi counter
« Antwort #2 am: Mai 22, 2024, 12:36:39 Nachmittag »
1 pulse every second maximum

Offline radar17892

  • Sr. Member
  • ****
  • Beiträge: 720
  • Think easy!
    • mollgruppe
Antw:multi counter
« Antwort #3 am: Mai 22, 2024, 13:31:47 Nachmittag »
You can use normal counters to count the pulses and make the counters remanent. Using the RTC you can calculate the difference at the end of the month and write the result into a remanent DW or DW shift register.
Weil Einfach einfach Einfach ist!

Offline radar17892

  • Sr. Member
  • ****
  • Beiträge: 720
  • Think easy!
    • mollgruppe
Antw:multi counter
« Antwort #4 am: Mai 22, 2024, 16:20:56 Nachmittag »
this is an example in ST

RC01 (
   EN := true,
   DT => ,
   E1 => ,
   YY => ,
   MM => ,
   DD => ,
   WD => ,
   HR => ,
   MN => ,
   SC => );
//Trigger, if the next month
M02:= (RC01MM<>MB70) and M01;
MB70:= RC01MM;

//Pump 1
C01 (
    EN := true,
    C_ := I01,
    D_ := ,
    SE := ,
    RE := ,
    SH := ,
    SL := ,
    SV := ,
    OF => ,
    FB => ,
    CY => ,
    ZE => ,
    QV =>  );
 //in 1st cycle of the new month calculate the difference to the last
CASE MB70 OF
   1:   IF M02 THEN   MD51:= C01QV - MD50; END_IF;      
   2:   IF M02 THEN   MD40:= C01QV - MD51; END_IF;
   3:   IF M02 THEN   MD41:= C01QV - MD40; END_IF;      
   4:   IF M02 THEN   MD42:= C01QV - MD41; END_IF;
   5:   IF M02 THEN   MD43:= C01QV - MD42; END_IF;
   6:   IF M02 THEN   MD44:= C01QV - MD43; END_IF;      
   7:   IF M02 THEN   MD45:= C01QV - MD44; END_IF;
   8:   IF M02 THEN   MD46:= C01QV - MD45; END_IF;      
   9:   IF M02 THEN   MD47:= C01QV - MD46; END_IF;
   10:   IF M02 THEN   MD48:= C01QV - MD47; END_IF;
   11:   IF M02 THEN   MD49:= C01QV - MD47; END_IF;   
   12:   IF M02 THEN   MD50:= C01QV - MD47; END_IF;               
ELSE
   ;
END_CASE;
//Pump 2
C02 (
   EN := true,
   C_ := I02,
   D_ := ,
   SE := ,
   RE := ,
   SH := ,
   SL := ,
   SV := ,
   OF => ,
   FB => ,
   CY => ,
   ZE => ,
   QV => );
 //in 1st cycle of the new month calculate the difference to the last
CASE MB70 OF
   1:   IF M02 THEN   MD63:= C01QV - MD62; END_IF;      
   2:   IF M02 THEN   MD52:= C01QV - MD63; END_IF;
   3:   IF M02 THEN   MD53:= C01QV - MD52; END_IF;      
   4:   IF M02 THEN   MD54:= C01QV - MD53; END_IF;
   5:   IF M02 THEN   MD55:= C01QV - MD54; END_IF;
   6:   IF M02 THEN   MD56:= C01QV - MD55; END_IF;      
   7:   IF M02 THEN   MD57:= C01QV - MD56; END_IF;
   8:   IF M02 THEN   MD58:= C01QV - MD57; END_IF;      
   9:   IF M02 THEN   MD59:= C01QV - MD58; END_IF;
   10:   IF M02 THEN   MD60:= C01QV - MD59; END_IF;
   11:   IF M02 THEN   MD61:= C01QV - MD60; END_IF;   
   12:   IF M02 THEN   MD62:= C01QV - MD61; END_IF;               
ELSE
   ;
END_CASE;

//end of program
 M01:= true; //false in 1st cycle
Weil Einfach einfach Einfach ist!

Offline radar17892

  • Sr. Member
  • ****
  • Beiträge: 720
  • Think easy!
    • mollgruppe
Antw:multi counter
« Antwort #5 am: Mai 23, 2024, 08:46:38 Vormittag »
You wrote 'we need to count the cube of each pump for each month from march to october'
The other way is with a counter per pump to. Permanent write the actual QV to a DW pointed by month number in a CASE.
8 months for 8 QA's in a UF. It's better you write the ST code, 1 per pump, in a UF and use the UF in your LD Mainprogram.
Reset the counter with the same Trigger:
//Trigger, if the next month
M02:= (RC01MM<>MB70) and M01;
MB70:= RC01MM;
Or positive Trigger coil in LD
Use RC01 and Trigger in the Mainprogram
« Letzte Änderung: Mai 23, 2024, 21:48:58 Nachmittag von radar17892 »
Weil Einfach einfach Einfach ist!

Offline srd

  • Full Member
  • ***
  • Beiträge: 102
Antw:multi counter
« Antwort #6 am: Mai 23, 2024, 09:18:15 Vormittag »
Cheers for that i will give it a try