Closed jmuguruza closed 2 years ago
Hi @jmuguruza,
return "<p style='font-size:50px'>" + "100" + "</p>";
in json:
"script":"return \"<p style='font-size:25px'>\" + \"100\" + \"<\/p>\";"
All right. Thank you for your help @Limraj !!!
@jmuguruza No problem, do you have any other questions? Or maybe in this context you would like to ask something else?
@jmuguruza Can I close this topic?
Yes, by the moment everything is ok. Thanks!
El lun., 10 ene. 2022 17:58, Kamil Jarmusik @.***> escribió:
@jmuguruza https://github.com/jmuguruza Can I close this topic?
— Reply to this email directly, view it on GitHub https://github.com/SCADA-LTS/Scada-LTS/issues/2034#issuecomment-1009129236, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASVR2LUYMBOB2X3BTBWAHZDUVMF4BANCNFSM5LQPLX2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
Now I want to show the variable "Caudal de Purga" at the input box; this variable come from OpenPLC. I defined it as an integer in OpenPLC Editor, initialized with value 95145. So I would like to see that number at the Scada graphical views. I used this instruction at the .json file when defining the script:
"script":"return(\"
\" + parseFloat(this.value).toFixed(0) + \"<\/p>\") "
Is there anything wrong or I might have made another mistake?
hello @jmuguruza,
The problem in your definition is that the whole property "script" is one string, the problem is with it + and using ", lower level denoted by \"
(nesting), try:
"script":"return(parseFloat(this.value).toFixed(0) + \"<\/p>\");",
I still got the same result; a 0.
@jmuguruza Could you please send me the entire system configuration by e-mail: kamil.jarmusik@softq.pl? (To do this, go to 'Import / Export' -> 'Export Project (Download)' section -> 'Export Project' button
return this.value
there, although it will probably be 0. Another possible cause is something wrong with the connection. If you send me the configuration, it will be easier for me to help. You can also describe exactly in the email what you set up in OpenPLC Editor.Ok, I will send it now.
My situation now is the following:
1- I have created an .st file, with memory addressing that I did not do before and the monitor shows the following:
2- I changed a little bit the .json file, 'pointLocator' arguments at the 'dataPoints' part. These arguments are 'range', 'modbusDataType' and 'slaveID'.
3- I import the .json file at the 'Import/Export' menu and get this values:
Hello @jmuguruza
I think it's a matter of configuring the correct registers, addresses, and types, in Scada you change the address using the offset parameter (0-65535), then you have 4 types of registers: 1) Coils status - read/write 1 bit register (Coils - name from documentation) 2) Inputs status - read 1 bit register (Discretes Input) 3) Holding register - read/write 16 bit register (Holding Registers) 4) Input register - read 16 bit register (Input Registers)
and what you changed modbusDataType to test yourself and determine these settings, type, register and addresses, you can use the section to test the connection:
Modbus documentation https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf
Greetings, Kamil Jarmusik
Hi @Limraj
I defined the 7 inputs as Input Registers (read) in the .json file and the 2 outputs as Holding Registers (read/write).
Now I don't know how to deal with the offset. How should I configure that parameter?
Hey @jmuguruza , register has the addresses 0-65535. See yourself for documentation, I also showed you how to test it in the Scada, you have to look into the program in which you configure points and look for something that may be responsible for it, in my opinion you can try extreme addresses, probably by default either addresses from 0-65535 (try 0, 1, 2, 3...) or 65535-0 (65535, 65534...), maybe it has to do with "location" or that .st file that you defined.
Greetings, Kamil Jarmusik
Fine, I think that I solved this problem.
Thank you once again @Limraj.
Hi @Limraj, one last thing. I achieved this in Scada-LTS:
I am able to see all the values in the graphical views, but can not receive those two output variables in OpenPLC. They are defined this way:
Then the data points are defined as 2 Byte int signed holding registers and I get this in OpenPLC:
Hi, I don't quite understand, because in these scripts you return the constant values 100 and 57087? If you want a value from that point then you have to change it to this.value, but we've already talked about that ... I'm glad you managed to configure it.
Greetings, Kamil Jarmusik
The input variables come from OpenPLC and I use this.value and get those values, but now I am writing myself that output value of 100 and want to send it to OpenPLC. That is what I do not manage to do.
To enable the value to be changed: 1) The first shorter solution, you need to set the point as settable, read / write register, and create a 'simple point' component on the view with this point, and select the "Display controls" parameter in it. Then, after hovering over the point, you should be able to change the value. This solution is rather recommended in case there is a problem, let me know. change value:
2) Another solution that requires more steps but uses scripts:
a) create datasource as ds_1 (virtual) and datapoint (numeric, settable, no change) as dp_to_read;
b) create script as script_write in the scripts tab, adding datapoint dp_to_read as val_read to the context and using a special function there
val_2.writeDataPoint ('DP_OPENPLC_XID', val_read.value);
c) then creating two components on the view for setting values, 'simple point' and setting dp_to_read in it, and component 'Button (script)' with script_write script to change the value.
Greetings, Kamil Jarmusik
If I select one of the two output values and click on "Point details" then I can set a value manually and get it in the OpenPLC monitoring. It works with a value of 100, but when writing 57087 it does not work (both are defined as integers).
Everything I have told you so far should enable you to solve these types of problems. The other thing is that you don't listen to the instructions, so act your way. I can't help you any more. Greetings.
Hey @jmuguruza, did you deal with the problem?
For the last output variable (57087) no, the program did not let me set a value like that one. But it was part of my final degree project, that I finished some days algo, so do not worry. Thank you for your help this weeks :-)
I have created a .json file and a background image in order to preview one part of a project. I defined 9 different HTML data points and 9 scripts. Now I want to show an output value (arbitrary value of 100 decided by me) at the output box after "Caudal de Aire:". This integer value comes from one of the nine scripts defined at the .json file. I am not able to see that value in graphical views; the script declaration at the file must be wrong.
Does anyone know how to define it in the .json file?
Thanks in advance