Manual

Manual consists of 3 parts:

1. Control Language;  

2. Understanding and configuring the dashboard

3.Download

To edit script or config press button 

 on a dash board.

 

1. Control Language

 

Control Language Introduction.

Control Language BS-88. Based on the ISA S-88 standard. Example Graphic Analog - SFC.

  Control language allows ESP to make decisions about control strategies based on current conditions  and allows the ESP control to be sequenced to follow the needs of an some actions.
   This language has differences from traditional programming languages. The reason is that the language describes actions to control the production process. In accordance with S-88, the manufacturing process consists of operations that can occur simultaneously, for example, heating water and preparing the components of the solution. Operations consist of phases that are performed sequentially. There are only two types statements of control language   

1. Active statements 
2. Transition statements (with or not condition) 

For example, the operation of heating water: 

phase 1: open the water valve;

when the level sensor becomes transition to phase2

phase 2: close the water valve;

turn on the heater;  

when the temperature reaches 60 degrees go to phase 3

phase 3: turn off the heater;

stop;

Suppose a water valve is connected to DO, a water level sensor is connected to D5, a heater is connected to D1, and A0 is a temperature sensor.

The script looks as follows:

1:$D0=1;//phase1 
if($D1=1)trans{2};//wait_for_D5_become_"ON"

2:$D0=0;//phase2
$D2=1;
if($A0>=0.1)trans{3};//wait_for_tempeature

3:$D2=0;
stop;// end_of_script
 

Variables

The following variables are used in BS-88 $ A0, $ D0, $ D1 ...... $ D8 that matching esp8266 pins nodemcu mini - A0, D0, D1 ...... D8

There are variables for information and settings $ S0 - $ S4

This language uses  a spelling of variables like pin's name, but when variables displayed in a panel, variables can have a another name for example: Uakk, Set_Ux, Set_temp.

Replacing names is possible in the configuration editor.  In order access to the editor - click on the gear sign on the panel.

There are also variables for internal calculations or $ X0- $ X9 memory. They do not have their fields for display, but they can be seen when we set their values ​​for the variable

$X9 = $ X9 + 1; // auto increment

$S3 = $X9; // display $X9 in field S3 dashboard. 

Phase structure: 

Label :;
Act 1
Act 2
.......
Act n;
Condition 1 transition label 1 
Condition 2 transition label 2
.........
Condition m transition label m
 

Act operators can turn devices on / off , do intermediate calculations, send emails,  display variables on the panel etc.  Every act statements are executed in phase once, then the transition condition is expected:

if (condition) trans {label};

or just without condition

trans {label}; 

When active commands are executed and the condition is expected, the $timer variable increases its value by a second. So you can do a time relay. Let's turn on $D3 for 45 seconds

. . . . . . . .

7: $D3 = 1;

if ($timer>=45) trans {8};

8: $D3 = 0;

. . . . . . . .

Remember such a structure is not like a regular programming language, where one statement is executed at each step.

Note: if the section does not contain the word "trans", the execution of the prgram is terminated. However, in this case, the AUTO field on the panel will remain ON.

Special Variables (Functions)

We considered one such variable - $timer, but there are others

$ntime - [n]ow [time] - current time; used like float number 13.4 means 13 hours and 40 munutes 

$random - random number [0:1] (used to simulate the living in an empty house)

$ morning - the beginning of the day for mid-latitudes (used for lighting off)

$ evening - sunset time (used for lighting on)

$ retro - the timer value that the timer reached in the previous phase

$temp - temperature sensor ds18b20 connected to D5

$ptime - time in second after start T_scan (periode scanning or data acquisition)

Functions: 

M (); - send mail - including in brekets is processing by substitution but not by calculation

N (); - send  a note to dashboard

Condition in Transition statements 

consist of left and right expressions  in () breackets and 5 signs between ones

=  , > ,  < ,  >= ,  <= ,  <>

Is allowed only one couple () breakets.

Is allowed only one condition in one statement. 

Expressions consist of numbers, functions and  arithmetic sings +,~,*,/.

Note: symbol "~"  using like minus. Symbol "-" only means negativ value.

-2*-3 means (-2)*(-3) = 6;

10~5 means 10-5=5;

For example, turn off the light on D1 an hour before sunrise, turn on 22:00 hour,

send email in accordance to changes.

1:$D1=1;
M(Light_on_at_$ntime); // send mail
if ($ntime >= $morning~1) trans{2};

2:$D1=0;
M(Light_off_at_$ntime); // send mail
if($ntime = 22.00)trans{1};

Note on spelling: $morning ~ 1 ; 22.00 - Special Features of This control language; (usually  $morning 1 ; 22:00)

However, if some error occurs, a translator inform us in a string "last_error" in configuration page.

Verification of the script begins before the start of the script.  The script starts by pressing the AUTO key in the control panel.

The event counter.

Sometimes we need count some events, for exampe. Impulses from Geyger counter. For that a scetch always watches pin D0 and increase variable $X0  for 1 when status D0 change. Scetch using counter next way

1:;
if($ptime=30){2};

2:$S0=$X0;
$X0=0;
trans{1};

My first script

Syncronise S0 with D0 

1:$S0=$D0;
trans{1};

My 2-nd script

$S0 like sum D0,D1,D2
1:$S0=$D0+$D1+$D2;
trans{1};

My 3-td script

S0 like counter from 0 to 5 and back

1:$S0=0;
trans{2};

2:$S0=$S0+1;
if($S0<5){2};
trans{3};

3:$S0=$S0~1;//note:_~_like_minus
if($S0>0)trans{3};
trans{2};

 

Recieving from another sourses. 

Connect your esp8266 to another source. Only simplex serial is possible.  Connect  wire beetwen pin RX esp8266 and TX of anoter sourse. Rate 115200.  Protocol of data XML.  Function   $input ask  a serial buffer, looking for data  for example <2>3.14</2> and send that 3.14 to variable $X2. One bufer may include several data. <0>2001.99</0><7>1939</7><4>2.87</4>. We mast youself convert data from sensors to XML.  

It's simple check this option. Dowlload bortx.ino, call configuration page, input script 

1:$S0=$input;
trans{1};

Save config, return to panel, press button AUTO. Launch terminal. Type <0>123.56</0>[Enter], see this number in field S0.

 

 

2. Understanding and configuring the dashboard

 

Four last field is needed always

Auto - start/stop script

T_scan - periode  of data acquisition 1sec-300sec. 10000 last points can be archivated. So we have history from 3 hours to 50 days.

A Marker shows quality of connection between esp and dashboard. In fact marker is time in seconds since last ping usually 60 sec. If no ping in during 150 sec  an esp restart follows and marker becomes with value 1000 - high impulse, red line on dashboard. So when you watch dashboard you can see moments esp restart.

Time - no comments.

  To change T_scan press button where spelling "T_scan",  this variable becomes active (orange collor), then input nomber in green input field and press Enter button.

Rename fields from standart names to user names and set mode

On a dashboard press button 

 

In configuration page look at table "Names of pins and fields". Type new field name and set mode of field. Look at last two string. Hier you can set linear koefficients, to convert data pin A0 in accordance to expression Y=k*A0+b;

Change a field mode in accordance an options "hide","only read","read/write". 

Note:

D0-D4 are used to control,  D5-D8 are used as sensors.

View and edit an Additional information 

On a dashboard press button 

 

In configuration page look Additional information
 

bortx_id - info about bortx_id 

bortx_pass - if password is  set  that you and only you can call configuration page

email - if you use in script function mail M(), than you mast  fill this field

mission - content of this field you can see in a dashboard

TimeZone - in order use correct values $ntime [NowTime], edit this field

Last Error - illuminates the reason restart ESP. In case you start script - pressing AUTO, but AUTO not becomes to "ON", then error was found in your script and that error is describes in this field.  
 

note:

If email is specified, then every time you run esp you will receive a start message.

And you can also use the function M () in script.

 

3.Download

Method 1

if you can program using the ARDUINO IDE.

Download bortx.ino as a text file. Copy and paste the text into Arduino IDE. Specify the board as

ESP8266 node mcu mini.

Edit the scetch - enter the ssid and password of your Wi-Fi. Upload the sketch to your esp using the Arduino IDE. Look monitor port stasis after post start. You will see output like this

############ ChipId ###############

12345678

Dashboard URL: http://bortx.ru/12345678

############# ChipId ##############

Go to this URL and manage your ESP using the dashboard. Customize the field names, edit and run the script, etc. Example URL http://bortx.ru/12345678

Method 2

If you hane a NodeMcu board but cannot to program (for beginners)

This method allows the SCADA BortX to be placed in a microcontroller with minimal skill. The flasher will do everything for you. You can download the downloader at

http://bortx.ru/bortx_flasher.rar

Unpack this archive. Download the latest version of bortx.bin and place it in the unpacked archive, replacing the outdated version of bortx.bin. Start the _wizard.exe application On the windows warnings about the launch of unknown applications, answer with consent. If the microcontroller is not flashed, then you probably do not have the CH340 driver installed. The driver is already contained in the downloaded archive and you just need to run the CH340SER.EXE file

 

 

Контакты:

Telegram - @citorubot

Email - admin@bortx.ru

+7(903)530-22-40 Whatsapp

Блог - https://bort-x.blogspot.com/2019/03/bortx.html#comment-form

Copyright © 2024 BortX.ru
GS RU