Pages

Tuesday, December 11, 2018

MS SQL 2017 CLR with Oxygene


Integration of programmer's code with SQL perhaps is one of dilemmas for many years. You have tons of legacy specific code written in Delphi/Object Pascal and you are unable to port it all into Transact SQL - that is true. But .NET was developed in mind to let your code run everywhere. Microsoft did a great job allowing CLR to be a essential part of SQL.

Good news! Today Oxygene can be used to produce SQL CLR projects e.g. user defined functions, stored procedures etc…

Let us create create .NET assembly with a User Defined Function for MS SQL.




We will call our assembly SqlClrOxygene.dll.

And some basic global function in Oxygene that will return us hardcoded string.


Now we are ready to build our SqlClrOxygene.dll which is as tiny as 5kb in size. But to get use of it 
we must register the dll in MS-SQL2017 as Assembly. 
Go to Your Database->Programmability->Assemblies and add New Assembly.. in pop-up menu.



After that we should register new Scalar-valued Function in assembly with SQL engine.

Ready to Go?


Thank you RemObject guys who move us into .NET. Vivat! Vivat! Vivat!



Monday, November 12, 2018

Virtual Box automation with C#. Part1

Test Automation and Seamless Software Integration.

On Windows hosts, one can control some of the VirtualBox Main API functionality from C# code, for system integration purpose. There are many applications where VirtualBox comes in need for software Test Automation and Seamless Software Integration. In this example let us consider stable 5.2.22 VirtualBox release.

Step1

Create Visual C# new project (in this example Console Application) and VirtualBox reference. VirtualBox is VBoxC.dll
(normally located in C:\Program Files\Oracle\VirtualBox). It is a COM dll and Virtual Box API available throughout .Net COM Interop technology.


Step2

Access to VBox COM server is managed by means of IVirtualBox interface. IMachine is a particular machine properties interface. The following C# code will iterate over all available virtual machines. 



please note to set Embed Interop Types property of Interop.VirtualBox reference to false, otherwise proxy Interop.VirtualBox.dll will not be able to load.



Result

Now we have list of virtual machines registered on the host. Hopefully .Net CTS will give you more information about virtual machines properties and methods.  


Wednesday, November 7, 2018

Delphi and C# integration


Goodbye Delphi

Its time to say goodbye to Delphi. It is important for your company to jump into this century and experience benefits such as .Net C#

Thanks to innovation initiative of RemObjects, it becomes possible to move lots of legacy code implemented in Delphi into .Net platform.

Oxygene is a language that is decidedly Object Pascal, and will make you feel immediately at home if you come from a Delphi or Object Pascal background, but at the same time is a modern language for the 21st century, with many, many advanced language features that take your productivity to the next level.

Let us jump into migration your VCL Delphi forms into .NET assembly for C#.

Step1 - build Delphi-WPF.dll which is part of DelphiRTL project

Step2 - build MyOxygeneForms.dll which is Oxygene-Delphi resource assembly with your Delphi VCL forms. With a little efforts existing *.pas/*.dfm Delphi files can be ported into Oxygene language and included into elements assembly. You can edit *.pas/*.dfm in RAD Studio Delphi and then attach them to MyOxygeneForms.dll assembly. This allows you to move tons of your existing Delphi code into .Net and manage VCL objects from other .NET languages.





Step3 - build Visual C# WPF application and start to use MyOxygeneForms.dll(or YourOxygeneForms.dll  😊 )

VCL form components are now available for use in C#


Enjoy your Delphi code on .Net platform and be prepared to move there.



Source code of the Delphi-C# integration example is available for download here

Monday, July 23, 2018

Visual programming for CONTROLLINO

Visuino is a visual graphical development environment for CONTROLLINO. It allows you to create complex industrial automation systems and IoT (Internet of Things) solutions, simply moving and connecting several graphic blocks. Visuino will automatically generate the necessary CONTROLLINO code. Visuino also has built-in visualization of Scope and Gauges data, which makes it easy to connect and monitor the data sent to CONTROLLINO.

Programming with Visuino is easy: select the components (modules) from the Components Panel, move them to the Visual Design Area, connect them and configure the properties using the Object Inspector. The overview provides easy navigation for large projects. Visuino includes a built-in Communication Terminal, Scope, Gauges and other visual tools for monitoring and displaying data sent to CONTROLLINO. After your project is ready, pressing one button, Visuino will create all the necessary codes for Arduino and open the Arduino IDE (the Arduino development environment), where you can compile and load the code into CONTROLLINO.



Visuino contains a large set of components for: Mathematical functions / Comparators - Analog, Digital, Date / Time and Color / Logic functions - OR, AND, Exclusive OR, NOT / Flip Flops - T, RS, D, JK / Switches) - Analog, Digital, Date / Time and Color / Generators - Clock, Pulse, Sine wave, Triangle wave, Rectangle, Random / Timers - periodic or single pulses / Counters - Up and Down and Directional / Motors - Stepper motors, Permanent current or Servo (Servo) / Displays - LCD display, 7 segment, touch screens, matrices, Smart Pixels and TV outlets / Sensors - Temperature, Pressure, Weights, Distances, Compass, Accelerometer, Corner Coders / Remote Controls - Servo or PS2 compatible (PS-power source) / PID- Controllers (Controllers) / Connections - Serial, RS 485, Wired and Wireless Wi-Fi Ethernet or GSM / and much more.

Once CONTROLLINO is programmed, Visuino offers an easy way to connect to it via the Serial Port, RS 485, Ethernet, Wi-Fi or GSM and monitoring multiple data channels in the Terminal, Scope or Visual Tools. Do not let programming (coding) stand in the way of obtaining the decisions you need to monitor the industrial process. Visuino will program for you!




Wednesday, July 4, 2018

SCADA development with Delphi


I can mention at least three reasons in support custom SCADA development in Delphi.
Firstly, you have greater flexibility and customisation. You have more control over your automation project. Some parts of you hardware can be replaced by cheaper parts with the same functionality.
Cheap controllers like Arduino are becoming more competitive on today's market. Some hardware parts of your automation have different software interfaces and standards. For this reason using Delphi has more flexibility for integration of hardware from different vendors. Secondly, you can produce ready to use executables. Delphi is foremost known for its RAD features and royalties you obtaining when you build your own software. Thirdly, you can do it cross platform. FMX version of components allows to deploy your solution on Linux, Max and Windows.
Integrating PLC variables into your high level software often achievable with OPC technology.
OPC = OLE for Process Control. 
OPC is a software interface standard that allows Windows programs to communicate with industrial hardware devices. OPC is implemented in server/client pairs. The OPC server is a software program that converts the hardware communication protocol used by a PLC into the OPCprotocol. 

The value of OPC is that it is an open standard, which means lower costs for manufacturers and more options for users. Hardware manufacturers need only provide a single OPC server for their devices to communicate with any OPC client. Software vendors simply include OPC client capabilities in their products and they become instantly compatible with thousands of hardware devices. Users can choose any OPC client software they need, resting assured that it will communicate seamlessly with their OPC-enabled hardware, and vice-versa.

Usage of OPC servers from industry advanced vendors in your custom Delphi application is now available with Mitov's ControlLab components. There are two components for work with OPC server available: TCLOPCRemoteServer and TCLOPCClientGroup.





In order to display data acquisition points you'll need to register OPC server on your PC. After that you get access to Integer, Int64, Float, Boolean etc data points.