W2D Model Setting up

<< Click to Display Table of Contents >>

Navigation:  Waijung Blockset > Waijung WebPage Designer (W2D) >

W2D Model Setting up

Previous pageReturn to chapter overviewNext page

Setting up Model and Related Blockset

At this point, we will focus only with the hardware configuration part of Waijung WebPage Designer (W2D). We will talk about the main algorithm in model later with each demo.

demo File: web_adc.mdl

w2d_web_adc_detail

Common Blocks

Common Blocks needed for web monitoring and control (both via W2D and Manual Web Code) are grouped inside the Blue Box and W2D Setup Subsystem.

w2d_setup_detail

1.Target Setup for the above three demos we use GNU-ARM as compiler [DM],[SM]

w2d_target_setup

Stack Size 0x2000 (Recommend value)

Heap Size 0x4000 (Recommend value)

Compiler Control String, Assembler Control String -mfloat-abi=hard

(in some case, e.g. using Trigonometric Function, GNU ARM caused problem, you can set -mfloat-abi=soft  to fix that )

-mfloat-abi=hard  ----> Use Hardware Floating Point Calculation

-mfloat-abi=soft  ----> Use Software Floating Point Calculation

2.Webserver Setup [DM],[SM]

This composes of three blocks, Ethernet Link Setup, Ethernet Application Setup and Http Server Setup.

w2d_webserver_setup

Ethernet Link Setup Profile #1 (for STM32F4 Discovery) (Profile #2 for FiO2)

Ethernet Application Setup IP 192.168.1.30 (or as prefer)

Ethernet Application Setup Net Mask 255.255.255.0

Ethernet Application Setup Gateway 192.168.1.1 (As commonly used)

Ethernet Application Setup TCP timer (ms) 10 (the more the number, the more stability you have, the less the speed you get)

Ethernet Application Setup Sample time 0.001 (Recommend Value)

Http Server Setup Http server port 80

Http Server Setup Memory pool size (kBytes) 8 (Recommend Value, smaller the better)

The rest uses default.

3.UART Setup [DM],[SM]

w2d_UART_setup

UART Module 6 (to talk to aMG SQLite Database Server Module)

Baud rate 1000000 or 1e6

Tx C6

Rx C7

Rx Buffer size 2048 (Recommend Value)

Tx Buffer size 1024 (Recommend Value)

4.Volatile Data Storage [DM],[SM]

w2d_volatile_data_storage_setup

Volatile Data Storage are often used to store data for later used on the model. It also help when working with different rate of data. Initial value can also be set within this blocks so that we have  the prefer initial value each time the system is reset. Value stored in this Data Storage can be mapped for web access using the Web CGI varget/varset integration [OPTIONS: ReadOnly, Write/Read with KeyValuePair]

Mapped Variable can be set to ReadOnly or Write/Read. If it is Write/Read, you will be able to set the value using  web browser. Note: Always user With KeyValuePair for W2D

192.168.1.30/varset.cgi?name=switch&value=1

Both ReadOnly and Write/Read allow you to retrieve the values using web browser.

192.168.1.30/varget.cgi?name=switch

192.168.1.30/varget.cgi?name=adc

 

5.Httpserver CGI varset callback [DM],[SM]

Sometime when you want to interact only once per CGI varset from web browser, you use HTTPserver CGI varset callback and Function-call Subsystem. You also need to declare Volatile Data Storage as usual.

w2d_volatile_data_storage_map

6.SQLite Database setup

w2d_SQLite_table_setup

Port UART6 (interface with aMG SQLite Database Server)

Time out (sec) 5

Input/Output Buffer size (bytes) 8192

Reset control Software

Remark: The above blocks are require as minimum for live web monitoring and live web control using direct method (Webserver Volatile Data Mapping)

If you wish to use SQLite database for data storage or logging, Please read below; 

Matlab Variable Types

SQLite Block Valiable Types (For Column Format)

int32

integer

single

real

string

text

6.Reading from SQLite database and Writing to SQLite database [SM]

w2d_read_write_SQLite_db

In W2D, SQLite database can be used as a medium of communication between Web Interface and Webserver System [SM]. You can also use SQLite database to store log data. The combination of the following blocks can be used to query database as you prefer.

w2d_SQLite_read_write

You can input your Columns as prefer. Then you can check the Preview Box and consult with your SQLite Statement manual.  The minimum Sample Time should be set to 0.5 sec (and not lower) because SQLite server module does read and write data to an actual Micro SD card every time the Block is execute which take about 300-500 ms. If you want faster read/write speed, please use Direct Method [DM].