@stepan-ozana Regarding "Update - second part of the problem": In the meantime, I conducted a simple test of my idea using CallExt(".Taskname.blockname"), and it seems to work. If anyone is interested, I can share the test results here.
Posts made by stepan.ozana
-
RE: Exchanging data between tasks
-
RE: Exchanging data between tasks
Update - second part of the problem : I am also wondering if slower task can be run "on-demand" - asynchrounously, from the faster task. Is there any similar mechanism like for the general blocks inside some tasks that can be halted (marked as red-crossed blocks) and run at specific times using REXLANG with CallExt(".blockname"). Or is it possible to use the entire connection string in CallExt? Such as
CallExt(".Taskname.blockname")? -
Exchanging data between tasks
Hi,
I’m wondering if there’s a way to exchange data asynchronously between tasks. Specifically, I have two tasks: one running faster and another running significantly slower. The slower task performs a computational process that varies in execution time within known rough limits, which is why I’ve set its period slightly oversized.
My goal is to pass the results from the slower task back to the faster task as soon as the computation is complete, rather than waiting for the next cycle of the slower task.
Is there a recommended approach for achieving this?
Thanks,
Stepan -
RE: EPC timing, elapsed time
@stepan-ozana Little update: Under Linux, using RPi, it behaves much better. BUSY signal stays ON for 2 task periods.
-
EPC timing, elapsed time
Hi, I have a question related to the EPC block.
Let's suppose I have an external program to be called and executed by EPC block. I used example "\0202-11_EPC_Generic_Linux_Script" , made some modifications and made it run under windows, using epc_script.bat where windows syntax is given to run particular external program (*.EXE file).
I was wondering how much time is spent on execution so I concentrated on analysis of BUSY output of EPC block.
It seems like BUSY signal is ON for quite a long time.
Then I made a special extreme variant where epc_script.bat is completely empty so that it does not do anything when launched.
In my executive I used tick=0.01, ntick0=2. However, BUSY signal stays ON for 250-300 miliseconds each time EPC runs the script which does nothing (also, ifns and ofns are empty).
Is it OK? Which activities occure during this time? -
RE: Modbus Tcp/IP communication Rpi(Rexygen)<->PC(Matlab)
@Jan-Reitinger I share my solution if anyone is interested. It shows writing and reading uint16 and double values over the Modbus TcpIP between some REXYGEN target hosting the Modbus server on the client (slave) side and Matlab running on PC.
example_ModbusTcpIP_Comm_RpiToPC.zip -
RE: Modbus Tcp/IP communication Rpi(Rexygen)<->PC(Matlab)
@Jan-Reitinger UPDATE:
Now I'm able to read and write uint16 numbers, and I will focus on doubles.
I still have some doubts about this solution, for example where the modbus server is actually running or by which machine is the modbus server created (Matlab's modbus command seems to connect somee server and not to create any, and RPi hosts the slave part). -
RE: REST API communication example
@Jan-Reitinger Thanks for your assistance. I confirm that this modified script works fine.
-
RE: Modbus Tcp/IP communication Rpi(Rexygen)<->PC(Matlab)
@Jan-Reitinger Thanks for your assistance. Having followed your advice
m = modbus('tcpip', '192.168.111.2',502)
I get the following result:
m =Modbus TCPIP with properties:
DeviceAddress: '192.168.111.2'
Port: 502
Status: 'Connected'
I will now focus on how to read and write the data, because so far I have no success after playing with this for two hours.It seems that my bad was using RPi as master instead of slave.
However, there are two things that made me confused and did not ring a bell in order to make me try to switch the roles:
-documentation for the modbus command does not explicitely declares if it creates master or slave, it says it "constructs a Modbus object"
-moreover, the documentation of the modbus function declares that when using
m = modbus(Transport,DeviceAddress)
"DeviceAddress is the IP address or host name of the Modbus server"If it's not a mistake, it's very confusing then.
-
Modbus Tcp/IP communication Rpi(Rexygen)<->PC(Matlab)
Hi,
I have a question related to example
\0402_Modbus_TCP\0402-04_Modbus_TCP_PID_Loop
I want to communicate between Rpi and PC, while Rpi will represent the master and PC will serve as the slave.
If I run your example as it is, everything works just fine. THe master part goes to Rpi and slave part to PC, both using REXYGEN.
However, I need to create some testing utility that would use the master part as it is, but the client would be implemented in some other environment than REXYGEN. I downloaded master part to Rpi and then used the following syntax in Matlab:
m = modbus('tcpip', '192.168.111.2', 1,502)
I double checked all IP addresses and ports. I get the below mentioned error. It's the same if I use Python or some external dedicated utility to analyze modbus communication.
Does the slave part in your example do anything special? What else should I check to be able to establish the connection?
Thanks, Stepanm = modbus('tcpip', '192.168.111.2', 1,502)
Error using modbus (line 96)
Requested transport resource is either in use or does not exist. Cannot create a communication link with the remote server. Please check the input arguments(ADDRESS and PORT) and make sure the server is running. Additional Information: Pokus o připojení selhal, protože připojená strana v časovém intervalu řádně neodpověděla, nebo vytvořené připojení selhalo, protože neodpověděl připojený hostitel. -
RE: REST API communication example
@stepan-ozana It seems like it behaves the same even if I set some password for admin user. Can you please double check if this example works for you?
-
REST API communication example
Hi,
I have a question related to example \0302_IoT_Integrations\0302-03_REST_API_Python_Bash_etc
and Matlab REST API communication.
If I run this example with the default admin credentials
(admin and empty password), using
options.Password = ''; in getdata.m ,
I get the following error:The content reader issued the error message: "Unable to parse the JSON data while reading the content downloaded from URL 'http://127.0.0.1:8008/login?u=api/login'
I think it reads the html content of the initial webpage and it does not overcome the issue related to the empty password.I can of course set some non-empty password, or I can implement some workaround such as setting
auth.enabled=0 in rexcore.cfg.But still I'd like to ask if there's a way how to run this example
with blank password without modifying rexcore.cfg.
Thanks, Stepan -
RE: Calling REXYGEN block from PYTHON
@cechurat Thanks for info. As my model of the plant is created in external program in the form of FMU, I found that I could run fast parallel simulations in order to compute my cost function over future prediction horizon using https://github.com/CATIA-Systems/FMPy which can be called from the PYTHON block within the REXYGEN project
-
Calling REXYGEN block from PYTHON
Hi, I wonder if it's possible to call some standard REXYGEN block from python code embedded inside PYTHON block.
Let's say I use PYTHON block and its main() function needs to solve some optimization task using python solver for predicitive control . To do so, I need to compute cost function, therefore I need to call parallel simulations to predict the states over some prediction horizon. Currently I can run such parallel simulation (time-scaled, faster) using REXLANG and its CallExt functions such as CallExt(".STATESAVE"), CallExt(".STATELOAD"); and CallExt(".SubModel") inside FOR loop inside main(void) of the REXLANG. Now I'd like to create similar solution using python code but I see no way how to call REXYGEN blocks from python. Any help appreciated. Thanks Stepan -
RE: Overtime info in REXYGEN Diagnostics
@Jan-Reitinger Thank you so much for efficient help. Now it works exactly as I wish.
-
RE: Exchanging data between tasks
@Jan-Reitinger Thank you so much for efficient help. So far I have used Inport and Outport blocks for working with subsystems. Now I am able to use them to exchange data between tasks.
-
RE: Animation object leaving a trail
@ondrej_severa Thank you so much for efficient help.
-
Overtime info in REXYGEN Diagnostics
Hi, I'd use some explanation on diagnostics related to overtime. Are Aaverage time, Overtime and Max overtime related to basic tick or to the period of the task? I am asking that question because it's not clear to me. Let's suppose I have two tasks, Qtask ("task_speed_loop", tick=2ms) and Level0 ("task" , 5*2ms=10ms). Looking at diagnostics I get overtime. It's caused by customized Python block containing complex operations. This Python block needs appx 5ms to perform all operations. However, the task is launched every 10 ms so it should be computed in time. It seems like the overtime info is related to basic tick 2 ms. Is this correct or am I wrong? Thanks a lot, Stepan.
-
Exchanging data between tasks
Hi, is is possible to exchange data between two tasks connected to Level0 and Level1? Something similar to From and Goto?
-
Animation object leaving a trail
Hi, is there a way how to animate an object in HMI web visualization so that it would leave a trail behind during movement? I'd like to animate a simple path in 2d and to see the current movement and the history path in the form of a trace, maybe represented by a point. For example, 2D moving a rectangle whose center point would leave a trail. Or, as shown in the attachment, animating end points of inverted pendulum's links. Thanks, Stepan