Forum Replies Created
-
AuthorPosts
-
manjey73
ParticipantJust create your own formula in the script table, in which you can initialize any variables.
I was doing something similar to version 5 to simulate non-volatile variables through files.
In a simple version, it looks like thisbool initVal = false; public double InitValues() { if (!initVal) { SetData(1153, 0, 1); SetData(1154, 0, 1); SetData(1155, 0, 1); SetVal(1031, 0); SetVal(1032, 1); initVal = true; } return Convert.ToDouble(initVal); }
And most importantly, place the channel with the call of this formula at the very first in the channel database.
Moreover, the formulas in the channels themselves can be any.manjey73
ParticipantI checked, there are no errors during compilation, but it seems to me that you are trying to use an internal formula even before the server starts processing formula data. Most likely InitScripts is intended for other things.
manjey73
ParticipantIf you look at CalcEngine.cs, then InitScripts() goes first and only then SetData.
When the server is started, this code is compiled every time.
Using SetData inside Initscripts, do you encounter any errors?manjey73
ParticipantPerhaps InitScripts() is intended for other things. And at this point, formulas like setData may not be valid yet.
manjey73
ParticipantExplain for which types of channels do you want to set the values to 0 when the server starts?
Show the settings of these channels
manjey73
ParticipantCommas are most likely a number separator display format related to the OS regional settings.
manjey73
ParticipantIf this is the input channel from the device, you need to use
Cnl/10
Cnl, CnlVal double Channel value transmitted to Server before the calculation
manjey73
ParticipantI may be wrong, but it seems enough to specify
Val()
in the input formula andSetVal(CnlNum, Cmd)
in the output, and when the Server starts, the channel will be 0.0, and after entering your valueFor Calculated/Output channels
-
This reply was modified 9 months ago by
manjey73.
manjey73
Participant// Set the default setpoint value. // For channels of the Calculated/output type public CnlData GetDefaultData(double val) { return Stat() > 0 ? Data() : NewData(val, 1); } // For a channel with the Integer data type public CnlData GetDefaultDataInt(long val) { return Stat() > 0 ? Data() : NewData(BitConverter.Int64BitsToDouble(val), 1); }
If I understood correctly, you want to initialize some variables.
Here are the formulas that Mikhail once proposed.Formulas are used in the Input.
GetDefaultData(1)
SetVal(CnlNum, Cmd)
is used for the output formulas-
This reply was modified 9 months ago by
manjey73.
manjey73
Participanttranslation of the readme for the module
Extension for launching external applications from RapidScada v.6.2.1.1
ModAbcLogicConfig.xml – a file for configuring the extension.
– AppObject – Settings for launching the application (each application has its own settings).
– – Input Channel – The channel number in Scada. The extension reads the value in the channel (it should be 0 or 1), 0 – does nothing, 1 -launches the application.manjey73
Participantonline translation
You can add Scripts to the table
public double StartProcess() { Process.Start(@"C:\SCADA\1.bat"); Console.WriteLine(DateTime.UtcNow.ToString()); return 1.0; }
and call this function in the output formula of the channel.
Starting an external process is an unsafe action.manjey73
ParticipantThere are always online translators, which we use successfully, I also don’t know English well 🙂
manjey73
ParticipantDecember 31, 2024 at 10:12 am in reply to: What is the difference between the drivers in the opendrivers directory and the #15866manjey73
ParticipantCouldn’t fit in one directory 🙂
manjey73
ParticipantAddressing – start with 0 or 1
It is possible to specify byte permutation for 4 and 8 byte data -
This reply was modified 9 months ago by
-
AuthorPosts