Welcome, Guest
Username: Password: Remember me

TOPIC: Speed Measurement from Modbus Fast Counter.

Speed Measurement from Modbus Fast Counter. 3 years 7 months ago #1133

  • joseagarciac
  • joseagarciac's Avatar
I have a query, I have a Modbus TCP I/O module with a fast count input, and I want to measure the speed of a motor with that fast signal given by a magnetic pickup.

The count is stored in the holding register "DIN1 Pulse Counter 32 Bit unsigned ABCD"

If we want to calculate the speed from script, can we use the multivibrator to do a period of 1 second and calculate the RPM with mathematical operations? Or is there a way that you know more efficient and effective?

Can you help us perform this speed calculation that is important for the project?
The administrator has disabled public write access.

Speed Measurement from Modbus Fast Counter. 3 years 7 months ago #1134

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 826
  • Thank you received: 123
  • Karma: -107
Dear Jose,

Yes it’s possible to use multivibrator script object for your purpose. But I’m not sure it will be very accurate. Writing to Modbus register happens every poll interval. By default it’s 1000 ms. Interval of multivibrator and poll interval might not match.
SCADA system is not real time system. Usually for such calculations used hardware devices PLC or others.

Best regards,
Ruslan
The administrator has disabled public write access.

Speed Measurement from Modbus Fast Counter. 3 years 7 months ago #1135

  • joseagarciac
  • joseagarciac's Avatar
I have in mind to use the same time base of the modbus polling, if I place a polling of 1000ms I will have the number of pulses measured per second each time I make the query.

what I require is to place the previous value in an auxiliary tag to be subtracted from the current value and obtain the number of pulses in that period of time.

I'm not sure how scada works in execution lines and how to save that previous value and use in the subtraction with the current value.

Have you had any similar application? that you can help me to perform this speed measurement.

I would be very grateful.
The administrator has disabled public write access.

Speed Measurement from Modbus Fast Counter. 3 years 7 months ago #1136

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 826
  • Thank you received: 123
  • Karma: -107
Jose,

You can try to test this possibility. Maybe you also no need a multivibrator for your purposes. We don’t have working example for your task.
You have to create to tags:
Speed - it’s a tag that will read a counter’s value from Modbus register.
PreviousSpeed - it’s a local tag that will hold previous value.
Count - it’s a local tag that will hold number of count between to cycles.

You have to create general ST script and check “every cycle”. In this case this script will be run every “Update interval” of the project. You can find this value in Project properties in General tab.
In the script you have to have this functions:
Tags.Count = Tags.Speed - Tags.PreviousSpeed;
Tags.PreviousSpeed = Tags.Speed;


Then Run to compile this script. And then use tag Count to count your speed value. It will contain number of counts per update interval in ideal. But really it could not match because timers that update script and read value from Modbus device are not the same.

Best regards,
Ruslan
The administrator has disabled public write access.
Go to top