Skip to content

Commit

Permalink
Merge pull request #192 from json-scada/master
Browse files Browse the repository at this point in the history
Version 0.44-alpha
  • Loading branch information
riclolsen authored Dec 22, 2024
2 parents a3cbb3a + 7392590 commit 06bf08c
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 54 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To provide an easy to use, fully-featured, scalable, and portable SCADA/IIoT-I4.
- MongoDB as the real-time core database, persistence layer, config store, SOE historian.
- Event-based realtime async data processing with MongoDB Change Streams.
- Portability and modular interoperability over Linux, Windows, Mac OSX, x86/64, ARM.
- Windows installer available in the [releases section](https://github.com/riclolsen/json-scada/releases/tag/V0.43-alpha).
- Windows installer available in the [releases section](https://github.com/riclolsen/json-scada/releases/tag/V0.44-alpha).
- Unlimited tags, servers, and users.
- Horizontal scalability, from a single computer to big clusters (MongoDB-sharding), Docker containers, VMs, Kubernetes, cloud, or hybrid deployments.
- Modular distributed architecture. Lightweight redundant data acquisition nodes can connect securely over TLS to the database server. E.g. a Raspberry PI can be a data acquisition node.
Expand Down Expand Up @@ -90,7 +90,7 @@ To provide an easy to use, fully-featured, scalable, and portable SCADA/IIoT-I4.
## Documentation

- [Generic Install Guide](https://github.com/riclolsen/json-scada/blob/master/docs/install.md)
- [Windows Installer](https://github.com/riclolsen/json-scada/releases/tag/V0.43-alpha)
- [Windows Installer](https://github.com/riclolsen/json-scada/releases/tag/V0.44-alpha)
- [RedHat/Rocky Linux Installer](https://github.com/riclolsen/json-scada/blob/master/docs/install.md#rhel94-and-compatible-systems-automated-installation)
- [Docker Demo](https://github.com/riclolsen/json-scada/blob/master/demo-docker/README.md)
- [Schema Documentation](https://github.com/riclolsen/json-scada/blob/master/docs/schema.md)
Expand Down
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To provide an easy to use, fully-featured, scalable, and portable SCADA/IIoT-I4.
- MongoDB as the real-time core database, persistence layer, config store, SOE historian.
- Event-based realtime async data processing with MongoDB Change Streams.
- Portability and modular interoperability over Linux, Windows, Mac OSX, x86/64, ARM.
- Windows installer available in the [releases section](https://github.com/riclolsen/json-scada/releases/tag/V0.43-alpha).
- Windows installer available in the [releases section](https://github.com/riclolsen/json-scada/releases/tag/V0.44-alpha).
- Unlimited tags, servers, and users.
- Horizontal scalability, from a single computer to big clusters (MongoDB-sharding), Docker containers, VMs, Kubernetes, cloud, or hybrid deployments.
- Modular distributed architecture. Lightweight redundant data acquisition nodes can connect securely over TLS to the database server. E.g. a Raspberry PI can be a data acquisition node.
Expand Down Expand Up @@ -90,7 +90,7 @@ To provide an easy to use, fully-featured, scalable, and portable SCADA/IIoT-I4.
## Documentation

- [Generic Install Guide](docs/install.md)
- [Windows Installer](https://github.com/riclolsen/json-scada/releases/tag/V0.43-alpha)
- [Windows Installer](https://github.com/riclolsen/json-scada/releases/tag/V0.44-alpha)
- [RedHat/Rocky Linux Installer](docs/install.md#rhel94-and-compatible-systems-automated-installation)
- [Install Guide](docs/install.md)
- [Docker Demo](demo-docker/README.md)
Expand Down
12 changes: 6 additions & 6 deletions platform-windows/create_services.bat
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ nssm set JSON_SCADA_mqttsparkplugclient AppRotateOnline 1
nssm set JSON_SCADA_mqttsparkplugclient AppRotateBytes 10000000
nssm set JSON_SCADA_mqttsparkplugclient Start SERVICE_DELAYED_AUTO_START

nssm install JSON_SCADA_iec104client "C:\json-scada\bin\iec104client.exe" 1 2
nssm install JSON_SCADA_iec104client "C:\json-scada\bin\iec104client.exe" 1 1
nssm set JSON_SCADA_iec104client AppStdout C:\json-scada\log\iec104client.log
nssm set JSON_SCADA_iec104client AppRotateOnline 1
nssm set JSON_SCADA_iec104client AppRotateBytes 10000000
Expand Down Expand Up @@ -170,25 +170,25 @@ rem nssm set JSON_SCADA_iccpserver AppRotateOnline 1
rem nssm set JSON_SCADA_iccpserver AppRotateBytes 10000000
rem nssm set JSON_SCADA_iccpserver Start SERVICE_DEMAND_START

nssm install JSON_SCADA_dnp3client "C:\json-scada\bin\Dnp3Client.exe" 1 2
nssm install JSON_SCADA_dnp3client "C:\json-scada\bin\Dnp3Client.exe" 1 1
nssm set JSON_SCADA_dnp3client AppStdout C:\json-scada\log\dnp3client.log
nssm set JSON_SCADA_dnp3client AppRotateOnline 1
nssm set JSON_SCADA_dnp3client AppRotateBytes 10000000
nssm set JSON_SCADA_dnp3client Start SERVICE_DEMAND_START

nssm install JSON_SCADA_opcuaclient "C:\json-scada\bin\OPC-UA-Client.exe" 1 2
nssm install JSON_SCADA_opcuaclient "C:\json-scada\bin\OPC-UA-Client.exe" 1 1
nssm set JSON_SCADA_opcuaclient AppStdout C:\json-scada\log\opcuaclient.log
nssm set JSON_SCADA_opcuaclient AppRotateOnline 1
nssm set JSON_SCADA_opcuaclient AppRotateBytes 10000000
nssm set JSON_SCADA_opcuaclient Start SERVICE_DEMAND_START
nssm set JSON_SCADA_opcuaclient Start SERVICE_DELAYED_AUTO_START

nssm install JSON_SCADA_opcdaclient "C:\json-scada\bin\OPC-DA-Client.exe" 1 2
nssm install JSON_SCADA_opcdaclient "C:\json-scada\bin\OPC-DA-Client.exe" 1 1
nssm set JSON_SCADA_opcdaclient AppStdout C:\json-scada\log\opcdaclient.log
nssm set JSON_SCADA_opcdaclient AppRotateOnline 1
nssm set JSON_SCADA_opcdaclient AppRotateBytes 10000000
nssm set JSON_SCADA_opcdaclient Start SERVICE_DEMAND_START

nssm install JSON_SCADA_iec61850client "C:\json-scada\bin\iec61850_client.exe" 1 2
nssm install JSON_SCADA_iec61850client "C:\json-scada\bin\iec61850_client.exe" 1 1
nssm set JSON_SCADA_iec61850client AppStdout C:\json-scada\log\iec61850client.log
nssm set JSON_SCADA_iec61850client AppRotateOnline 1
nssm set JSON_SCADA_iec61850client AppRotateBytes 10000000
Expand Down
5 changes: 3 additions & 2 deletions platform-windows/initial_setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ call create_services.bat
ping -n 10 127.0.0.1
call mongodb-start.bat
ping -n 12 127.0.0.1
mongodb-runtime\bin\mongo json_scada < ..\mongo_seed_demo\a_rs-init.js
mongodb-runtime\bin\mongo json_scada < ..\mongo_seed_demo\b_create-db.js
mongodb-runtime\bin\mongo json_scada < ..\mongo_seed\a_rs-init.js
ping -n 2 127.0.0.1
mongodb-runtime\bin\mongo json_scada < ..\mongo_seed\b_create-db.js
mongodb-runtime\bin\mongoimport --db json_scada --collection protocolDriverInstances --type json --file ..\mongo_seed_demo\demo_instances.json
mongodb-runtime\bin\mongoimport --db json_scada --collection protocolConnections --type json --file ..\mongo_seed_demo\demo_connections.json
mongodb-runtime\bin\mongoimport --db json_scada --collection realtimeData --type json --file ..\mongo_seed_demo\demo_data.json
Expand Down
15 changes: 9 additions & 6 deletions platform-windows/json-scada.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

; NSIS (Nullsoft Scriptable Install System) - http://nsis.sourceforge.net/Main_Page

SetCompressor LZMA
SetCompress Auto
SetCompressor lzma
SetCompressorDictSize 32
SetDatablockOptimize Off

Unicode True
; RequestExecutionLevel user
Expand All @@ -17,13 +20,13 @@ RequestExecutionLevel admin

;--------------------------------

!define VERSION "v.0.43"
!define VERSION_ "0.43.0.0"
!define VERSION "v.0.44"
!define VERSION_ "0.44.0.0"

Function .onInit
System::Call 'keexrnel32::CreateMutexA(i 0, i 0, t "MutexJsonScadaInstall") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
System::Call 'keexrnel32::CreateMutexA(p0, i1, t "MutexJsonScadaInstall")?e'
Pop $0
IntCmpU $0 183 0 +3 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "Installer already executing!"
Abort
FunctionEnd
Expand Down
19 changes: 19 additions & 0 deletions platform-windows/release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ Inkscape+SAGE:

-------------------------------------------------------------------

Notes for version 0.44:

* Default login credentials: username=admin password=jsonscada.
* Metabase credentials: [email protected] password=jsonscada123.
* Fixed MongoDB indexes creation by the Windows installer.
* Fixed memory leak and performance problems in the OPC-UA Client driver.

Requirements and recommendations:

* Windows 10/11 64 bits or Server >=2019, Windows PowerShell. At least 20GB of free space in the "C:" drive.
* Administrative rights. Corporate Windows policies may cause problems with the creation of services and the opening of TCP ports.
* Free TCP ports 6688, 6689, 27017, 5432, 80, 8080, 3000, 3001, 9000. Other ports may be required for optional services and protocols.
* If the server already has MongoDB, PostgreSQL, Grafana, Metabase, Nginx or another webserver, please uninstall, disable or watch out for possible conflicts.
* Do not update previously installed JSON-SCADA. Please uninstall previous JSON-SCADA versions before installing a new version.
* If using VirtualBox configure "paravirtualization interface"=KVM, otherwise Nodejs errors may occur.
* MongoDB requires AVX instructions on x86 CPU.

-------------------------------------------------------------------

Notes for version 0.43:

* ATTENTION: The default SVG folder has been moved to "c:\json-scada\svg\".
Expand Down
2 changes: 1 addition & 1 deletion src/AdminUI/public/i18n/messages_i18n-en_us.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var Msg =
{
NomeProduto: '{json:scada}',
VersaoProduto: '0.43',
VersaoProduto: '0.44',

NomeVisorTelas: 'Display Viewer',
NomeVisorEventos: 'Events Viewer',
Expand Down
2 changes: 1 addition & 1 deletion src/AdminUI/public/i18n/messages_i18n-pt_br.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var Msg =
{
NomeProduto: '{json:scada}',
VersaoProduto: '0.43',
VersaoProduto: '0.44',

NomeVisorTelas: 'Visor de Telas',
NomeVisorEventos: 'Visor de Eventos',
Expand Down
2 changes: 1 addition & 1 deletion src/AdminUI/public/i18n/messages_i18n-uk_ua.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var Msg =
{
NomeProduto: '{json:scada}',
VersaoProduto: '0.43',
VersaoProduto: '0.44',

NomeVisorTelas: 'Перегляд ',
NomeVisorEventos: 'Події',
Expand Down
2 changes: 1 addition & 1 deletion src/AdminUI/public/i18n/messages_i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var Msg =
{
NomeProduto: '{json:scada}',
VersaoProduto: '0.43',
VersaoProduto: '0.44',

NomeVisorTelas: 'Display Viewer',
NomeVisorEventos: 'Events Viewer',
Expand Down
19 changes: 19 additions & 0 deletions src/AdminUI/public/release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ Inkscape+SAGE:

-------------------------------------------------------------------

Notes for version 0.44:

* Default login credentials: username=admin password=jsonscada.
* Metabase credentials: [email protected] password=jsonscada123.
* Fixed MongoDB indexes creation by the Windows installer.
* Fixed memory leak and performance problems in the OPC-UA Client driver.

Requirements and recommendations:

* Windows 10/11 64 bits or Server >=2019, Windows PowerShell. At least 20GB of free space in the "C:" drive.
* Administrative rights. Corporate Windows policies may cause problems with the creation of services and the opening of TCP ports.
* Free TCP ports 6688, 6689, 27017, 5432, 80, 8080, 3000, 3001, 9000. Other ports may be required for optional services and protocols.
* If the server already has MongoDB, PostgreSQL, Grafana, Metabase, Nginx or another webserver, please uninstall, disable or watch out for possible conflicts.
* Do not update previously installed JSON-SCADA. Please uninstall previous JSON-SCADA versions before installing a new version.
* If using VirtualBox configure "paravirtualization interface"=KVM, otherwise Nodejs errors may occur.
* MongoDB requires AVX instructions on x86 CPU.

-------------------------------------------------------------------

Notes for version 0.43:

* ATTENTION: The default SVG folder has been moved to "c:\json-scada\svg\".
Expand Down
2 changes: 1 addition & 1 deletion src/AdminUI/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
import { useRouter } from 'vue-router'
import { STORAGE_KEY } from './i18n'
const version = ref('v0.43-alpha')
const version = ref('v0.44-alpha')
const router = useRouter()
const theme = ref('dark')
const vuetifyTheme = useTheme()
Expand Down
74 changes: 67 additions & 7 deletions src/OPC-UA-Client/AsduReceiveHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ private async Task ConsoleClient()
return;
}

Log(conn_name + " - " + "Browsing the OPC UA server namespace.");
exitCode = ExitCode.ErrorBrowseNamespace;

if (OPCUA_conn.autoCreateTags)
{
Log(conn_name + " - " + "Browsing the OPC UA server namespace.");
exitCode = ExitCode.ErrorBrowseNamespace;

await FindObjects(session, ObjectIds.ObjectsFolder);

await Task.Delay(50);
Expand All @@ -223,7 +223,7 @@ private async Task ConsoleClient()
ListMon.ForEach(i => i.QueueSize = System.Convert.ToUInt32(System.Convert.ToDouble(OPCUA_conn.autoCreateTagQueueSize)));
Log(conn_name + " - " + ListMon.Count + " Objects found");

Log(conn_name + " - " + "Create a subscription with publishing interval of " + System.Convert.ToDouble(OPCUA_conn.autoCreateTagPublishingInterval) + "seconds");
Log(conn_name + " - " + "Create a subscription with publishing interval of " + System.Convert.ToDouble(OPCUA_conn.autoCreateTagPublishingInterval) + " seconds");
exitCode = ExitCode.ErrorCreateSubscription;
var subscription =
new Subscription(session.DefaultSubscription)
Expand All @@ -242,10 +242,70 @@ private async Task ConsoleClient()
Log(conn_name + " - " + "Add the subscription to the session.");
Log(conn_name + " - " + subscription.MonitoredItemCount + " Monitored items");
exitCode = ExitCode.ErrorAddSubscription;
session.AddSubscription(subscription);
subscription.Create();
try
{
session.AddSubscription(subscription);
subscription.Create();
subscription.ApplyChanges();
}
catch (Exception e)
{
Log(conn_name + " - Error creating subscription: " + e.Message);
}
}
else
{
Log(conn_name + " - " + "Create subscription for inserted tags.");
exitCode = ExitCode.ErrorBrowseNamespace;

subscription.ApplyChanges();
foreach (var sub in OPCUA_conn.OpcSubscriptions)
{
List<MonitoredItem> lm = new List<MonitoredItem>();
foreach (var tm in sub.Value)
{
lm.Add(new MonitoredItem()
{
DisplayName = tm.ungroupedDescription,
StartNodeId = tm.protocolSourceObjectAddress,
SamplingInterval = (int)(tm.protocolSourceSamplingInterval * 1000),
QueueSize = (uint)OPCUA_conn.autoCreateTagQueueSize,
MonitoringMode = MonitoringMode.Reporting,
DiscardOldest = true,
AttributeId = Attributes.Value,
});
}
lm.ForEach(i => i.Notification += OnNotification);

Log(conn_name + " - " + "Create a subscription with publishing interval of " + sub.Key + " seconds");
exitCode = ExitCode.ErrorCreateSubscription;
var subscription =
new Subscription(session.DefaultSubscription)
{
PublishingInterval = (int)(sub.Key * 1000),
PublishingEnabled = true,
TimestampsToReturn = TimestampsToReturn.Both,
// MaxNotificationsPerPublish = 1,
SequentialPublishing = false,
};

await Task.Delay(50);
subscription.AddItems(lm);

await Task.Delay(50);
Log(conn_name + " - " + "Add the subscription to the session.");
Log(conn_name + " - " + subscription.MonitoredItemCount + " Monitored items");
exitCode = ExitCode.ErrorAddSubscription;
try
{
session.AddSubscription(subscription);
subscription.Create();
subscription.ApplyChanges();
}
catch (Exception e)
{
Log(conn_name + " - Error creating subscription: " + e.Message);
}
}
}

Log(conn_name + " - " + "Running...");
Expand Down
9 changes: 9 additions & 0 deletions src/OPC-UA-Client/Common_srv_cli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class
public SortedSet<string> InsertedTags = new SortedSet<string>();
public OPCUAClient connection;
public Thread thrOPCStack;
public Dictionary<double, List<rtMonitTag>> OpcSubscriptions = new Dictionary<double, List<rtMonitTag>>();
}
[BsonIgnoreExtraElements]
public class protocolDriverInstancesClass
Expand Down Expand Up @@ -142,6 +143,14 @@ public class OPC_Value
public string common_address;
public string display_name;
}
public class rtMonitTag
{
public string protocolSourceObjectAddress;
public string tag;
public string ungroupedDescription;
public double protocolSourceSamplingInterval;
public double protocolSourceQueueSize;
}
public class rtFilt
{
public int protocolSourceConnectionNumber;
Expand Down
8 changes: 4 additions & 4 deletions src/OPC-UA-Client/MongoCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ partial class MainClass
{
// This process watches (via change stream) for commands inserted to a commands collection
// When the command is considered valid it is forwarded to the RTU
static async void ProcessMongoCmd(JSONSCADAConfig jsConfig)
static async void ProcessMongoCmd()
{
do
{
try
{
var Client = ConnectMongoClient(jsConfig);
var DB = Client.GetDatabase(jsConfig.mongoDatabaseName);
var Client = ConnectMongoClient(JSConfig);
var DB = Client.GetDatabase(JSConfig.mongoDatabaseName);
var collection =
DB
.GetCollection
Expand All @@ -46,7 +46,7 @@ static async void ProcessMongoCmd(JSONSCADAConfig jsConfig)
.RunCommandAsync((Command<BsonDocument>)"{ping:1}")
.Wait(1000);
if (!isMongoLive)
throw new Exception("Error on connection " + jsConfig.mongoConnectionString);
throw new Exception("Error on connection " + JSConfig.mongoConnectionString);

Log("MongoDB CMD CS - Start listening for commands via changestream...");
var filter = "{ operationType: 'insert' }";
Expand Down
8 changes: 4 additions & 4 deletions src/OPC-UA-Client/MongoUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ partial class MainClass
static public int AutoKeyMultiplier = 1000000; // maximum number of points on each connection self-published (auto numbered points)

// This process updates acquired values in the mongodb collection for realtime data
static public async void ProcessMongo(JSONSCADAConfig jsConfig)
static public async void ProcessMongo()
{
do
{
try
{
var serializer = new BsonValueSerializer();
var Client = ConnectMongoClient(jsConfig);
var DB = Client.GetDatabase(jsConfig.mongoDatabaseName);
var Client = ConnectMongoClient(JSConfig);
var DB = Client.GetDatabase(JSConfig.mongoDatabaseName);
var collection =
DB.GetCollection<rtData>(RealtimeDataCollectionName);
var collectionId =
Expand Down Expand Up @@ -150,7 +150,7 @@ static public async void ProcessMongo(JSONSCADAConfig jsConfig)
// will imediatelly be followed by an update below (to the same tag)
}
}

// update one existing document with received tag value (realtimeData)
var update =
new BsonDocument {
Expand Down
Loading

0 comments on commit 06bf08c

Please sign in to comment.