Comments (6)
Hey,
first of all the transmission should be fast enough to wait for the response, but technically it would be possible to add an argument for a non-blocking transmission.
How many commands do you want to send per second?
Maybe there is an undesired locking problem.
Does the problem occur only by sending the same point multiple times or also by sending different points at the same time?
Your code does not show how send_point(...) is called.
But your thread calls transmit in a loop without any sleep.. you are bombing your RTU with command messages, which is not an to be expected behavior unless you want to attack a system. Is that the case?
By the way.. the callbacks you define (cl_pt_on_receive_point, cl_on_new_station cl_on_new_point) reproduce exactly the default behavior in case the callback is not set, so you could remove them unless you want to add additional logic.
from iec104-python.
Hi,
Thanks for the reply!
No my goal is not to attack a system haha... Yet !
Ideally, I would like to be able to send 1 command every second.
Right now I am working on a single point, so yes, the problem seems to occur only by sending the same point multiple times.
I am using it in a fastApi router:
@router.post("/send-iec-point")
async def send_iec_point(, ioa: int, filename: str):
value = self.csv_handler.read_next_line_from_csv(filename, ioa)
iec_master_client.send_point(ioa=ioa, value=float(value))
return value
If the endpoint is called more than once every 3 seconds, my app breaks.
I may be missing something...
from iec104-python.
I was also playing with this beautiful library and ended up at a similar point:
I am also receiving False
as a response to transmit
, though I implemented the on_receive
callback and always return c104.ResponseState.SUCCESS
.
The transmit
call always runs into the command_timeout
in this case - no idea why.
Sounds pretty much, like the same issue.
from iec104-python.
Ok, I found the root cause for me:
I was calling transmit(cause=c104.Cot.SPONTANEOUS)
. If I change the call to transmit(cause=c104.Cot.ACTIVATION)
it works as expected.
Nevermind.
from iec104-python.
I am also receiving False as a response to transmit, though I implemented the on_receive callback and always return c104.ResponseState.SUCCESS.
This is the default behavior, you do not have to implement the callback to always simply return c104.ResponseState.SUCCESS.
Ok, I found the root cause for me:
I was calling
transmit(cause=c104.Cot.SPONTANEOUS)
. If I change the call totransmit(cause=c104.Cot.ACTIVATION)
it works as expected.Nevermind.
Yes SPONTANEOUS should be used in monitoring direction only and ACTIVATION is the right choice here AFAIK.
from iec104-python.
@jeremykalvar could you please generate some logging information? A command+confirmation should consume milliseconds not seconds..
c104.set_debug_mode(mode=c104.Debug.Client|c104.Debug.Connection)
def con_receive_raw(connection: c104.Connection, data: bytes) -> None:
print("RECV] {1} [{0}] | CONN OA {2}".format(data.hex(), c104.explain_bytes_dict(apdu=data), connection.originator_address))
def con_send_raw(connection: c104.Connection, data: bytes) -> None:
print("SEND] <--| {1} [{0}] | CONN OA {2}".format(data.hex(), c104.explain_bytes_dict(apdu=data), connection.originator_address))
class IECClient:
def __init__(...):
# [...]
# append the following to your __init__
self.connection.on_receive_raw(callable=con_receive_raw)
self.connection.on_send_raw(callable=con_send_raw)
from iec104-python.
Related Issues (19)
- Unable to install c104 package HOT 4
- Wheel problem HOT 17
- Short pulse, Long Pulse and Persistent command not implemented HOT 4
- Sending timestamps not in UTC HOT 5
- server on_receive callback: message.raw cannot be accessed HOT 4
- Implementation of Event Driven COT's send from 104 Server HOT 5
- Python Script stops when the client is stopped without a connection HOT 11
- Feature Request: Support for Transmitting Single Event of Protection Messages
- Setting the quality value at the default Point HOT 2
- Add option to use Select or Execute in Qualifier of Command HOT 16
- c104 Type does not match with client request HOT 6
- Simple client example with AttributeError HOT 2
- Fatal error: terminate called after throwing an instance of 'std::bad_weak_ptr' HOT 6
- Invalid information object address 0 HOT 10
- Error on raspbian ARMv7 HOT 6
- iec104-python documentation site not working properly HOT 3
- TLS Connection Handshake failes HOT 3
- Keep Client Open HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iec104-python.