preface
  

Driven by the new era of industry 4.0, it not only ushered in the development of industrial Internet, but also opened a new dimension in the 5G era. With the improvement of bandwidth and the rapid development of network information, energy control and real-time warning also play a pivotal role in the industrial Internet. In terms of the development of blast furnace ironmaking, the digitalization and intelligent implementation of 260 blast furnaces in China has been completed. It also promotes the application of big data platform for iron making in steel enterprises in Russia, Vietnam, Iran, Indonesia and other “Belt and Road” countries, which fully reflects the emergence of the intelligent large screen industry of blast furnace. We will use the Web configuration of Hightopo’s HT for Web product to introduce the visual system of blast furnace and ironmaking plant built by 2/3D fusion.

HT can quickly implement rich
The configuration of 2 dand
The configuration of 3 dEffect, according to the demand to play their own imagination, play a lot of novel functions, and through complementary advantages, improve a complete set of visual system solutions. Therefore, in the realization of the visualization system, THE 3D scene is adopted
HT Lightweight HTML5/WebGL modeling solution, to achieve rapid modeling, runtime lightweight to even mobile terminal browser can 3D visualization operation and maintenance of good effects; In the corresponding 2D drawings, the use of special vector, in a variety of proportions without distortion, coupled with the layout mechanism, to solve the display problem of different screen proportions.


This article will share with you from the following three aspects of the blast furnace ironmaking plant in the large screen display:

1.
Page set up: Introduced the project construction of the fusion of basic 2D drawings and 3D scenes;
2,
Data docking: Display panel data docking;
3,
Animation to achieve: The realization of hot metal tank truck transportation, conveyor belt transportation and scene roaming;


Interface introduction and effect preview

On the 2D panel of the visualization system of the whole blast furnace ironmaking plant, some important warning data of yesterday’s history and today’s real-time are presented, which can play a role of real-time monitoring and control, and can also be compared with the historical data, so as to achieve the expected warning effect of production and safety. Secondly, the 3D scene presents the basic operation process of a blast furnace ironmaking plant and the animation of iron and steel transported by hot metal tank truck through the lightweight model, and the roaming effect around plays an all-round real-time monitoring of state changes.


Code implementation

First, page building
In terms of content realization, THE HT lightweight model and Web configuration are adopted, and the complete presentation of 2D drawings and 3D scenes is obtained through JSON deserialization in the way of 2/3D combination. The first thing you do is create
ht.graph.GraphView
ht.graph3d.Graph3dViewTo render 2D and 3D content. The 2D view component and 3D view component deserialize() deserialize the corresponding url stored json to present the content of the scene and drawing. Both of them set labels on the sub-elements of the DataModel DataModel to carry out data binding and achieve functional display.
// 3d topology view
let g2d = new ht.graph.GraphView();
let g3dDm = g2d.dm();
// 3d topology view
let g3d = new ht.graph3d.Graph3dView();
let g3dDm = g3d.dm(); 
// Deserialize the 2D view component and 3D view component
g2d.deserialize('displays/index.json');
g3d.deserialize('scenes/index.json');Copy the code

In terms of content presentation, components also need to be added under the body. Generally, 2D components will be added under the root div of 3D components in 2/3D combined projects, and then the 3D components will be added under the body to realize the loading of panels and scenes.

// Add the 3D component under the body
g3d.addToDOM();
// Add the 2D component to the root div of the 3D component and parent-child DOM events will bubble up so that the INTERACTION of the 3D scene will not be affected
g2d.addToDOM(g3d.getView());Copy the code

At the same time, some implementation methods of interaction and presentation have been changed. For example, the interaction mode of left and right keys was modified, and the scene movement mode was set to rotate 3D scene by left click and pan capture by right click. Secondly, we hope that 3D interaction will not be triggered when 2D is clicked to the pixel. For example, when scrolling on 2D panel table, 3D scene scaling will be triggered. This is controlled by monitoring moudedown, TouchStart and wheel interactions. For the listening mode of wheel, to ensure compatibility, a getWheelEventName() method is encapsulated to get the event name.

// Change the left and right keys interaction modeletmapInteractor = new ht.graph3d.MapInteractor(this.g3d); g3d.setInteractors([mapInteractor]); Mapinteractor. maxPhi = math.pi / 2; // Avoid overlap between 2D and 3D interactionslet div2d = g2d.getView();
const handler = e => {
    if(g2d.getDataAt(e)) { e.stopPropagation(); }}; div2d.addEventListener('mousedown', handler);
div2d.addEventListener('touchstart', handler); div2d.addEventListener(getWheelEventName(div2d), handler); // On an HTMLElement, one or two of the following three events may be supported, but only one event will be called back. Standard events will be called back first, and compatibility events will not be triggered after standard events are triggeredfunction getWheelEventName(element) {
    if ('onwheel' inElement) {// Standard eventreturn 'wheel';
    } else if(document.onmousewheel ! == undefined) {// Generic old version of the eventreturn 'mousewheel';
    } else{// Old Firefox eventsreturn 'DOMMouseScroll'; }}Copy the code



2. Data docking

In 2D panel presentation, there will be a lot of chart data information, we can access the background data interface to get the data, and then obtain the corresponding dataModel dataModel on 2D or 3D corresponding components, and set the unique identification tag in the dataModel to connect the data. For example, if we want to bind the data of the 2D panel, we only need to get the data model through the G2D component, and we can get the tag node with the unique identifier through g2d.dm().getDatabyTag (tag) to connect the data or set the state display.
For data interface acquisition, you can use the mainstream jQuery framework
ajax, based on the PROMISE HTTP library
axios Get data in real time through polling call interfaces or use a protocol provided by HTML5 for full-duplex communication over a single TCP connection
WebSocket, can be two-way data transmission, in the choice of application can match their own implementation requirements, and this system is through the USE of AXIOS call interface to obtain real-time data.
// 昨日利用系数数据对接
axios.get('/yesterdayUse').then(res => {
    setBindingDatasWithAnim(dm, res, undefined, v => v.toFixed(2)); }); // Yesterday fuel ratio data is connected to axios.get('/yesterdayFuel').then(res => {
    setBindingDatasWithAnim(dm, res, undefined, v => v.toFixed(2)); }); // Connect yesterday's furnace grade data to AXIos.get ('/yesterdayIn').then(res => {
    setBindingDatasWithAnim(dm, res, undefined, v => v.toFixed(2)); }); // Connect yesterday gas utilization data to axios.get('/yesterdayCoal').then(res => {
    setBindingDatasWithAnim(dm, res, undefined, v => v.toFixed(2)); }); // Real-time alert information panel table polling load data to scroll playback this.addTablerow ();setInterval(() => {
    this.addTableRow();
}, 5000);Copy the code

Real-time access to safety index and real-time data information (air volume, air temperature and oxygen content) through axiOS polling call interface:
requestData() {
    letdm = this.view.dm(); // Safety index data is connected and loaded into the ring animation axios.get('/levelData').then(res => {
        setBindingDatasWithAnim(dm, res, 800, v => Math.round(v)); }); // Real time data (air volume, air temperature and oxygen content) is connected and loaded into the progress bar animation axios.post('/nature'['windNumber'.'windTemp'.'oxygenNumber'
    ]).then(res => {
        setBindingDatasWithAnim(dm, res, 800, v => parseFloat(v.toFixed(1)));
    });
}Copy the code

After data docking, animation of increasing or reducing the value of some rings or progress bars is realized. Essentially, animation function HT.default.startanim () is used to set the range animation of the difference between the new value and the old value after judging the properties of data binding. The user defined function easing is then used to control how fast the animation moves through mathematical formulas, such as uniform change, slow first and then fast.

Here we encapsulate the animation effect of a difference value with the following parameters:

  • Node: a node for animation processing;
  • Name: name of the data binding;
  • Value: data binding value.
  • Format: Format specification for binding data values;
  • Accesstype: Attribute dependency of data binding;
  • Duration: animation time;
setValueWithAnimation (node, name, value, format, accesstype = 's', duration = 300) {
    letoldValue; // Determine if the data binding is a custom attribute attr and fetch the old value according to the binding nameif (accesstype === 'a') { oldValue = node.a(name); } // Determine that the data binding is a style property and fetch the old value based on the binding nameelse if (accesstype === 's') { oldValue = node.s(name); } // Get the value of the data binding by default through the getterelse{ oldValue = node[ht.Default.getter(name)](); } // Set the difference between the old and new valuesletrange = value - oldValue; // Execute animation ht.default. startAnim({duration: duration, easing:function (t) { return1 - (--t) * t * t * t; }, action: (v, t) => {// The new value increases the animation rangeletnewValue = oldValue + range * v; // Determine the format of the dataif(format) { newValue = format(newValue); } // Determine that the data binding is a custom attribute attr and set the new valueif (accesstype === 'a') { node.a(name, newValue); } // Determine that the data binding is the style property and set the new valueelse if (accesstype === 's') { node.s(name, newValue); } // The new value of the data binding is set by default via the setter of the value storeelse{ node[ht.Default.setter(name)]()(node, newValue); }}}); }Copy the code

We often see rolling data information in rotation in public warning occasions or publicity occasions. This method will not omit any data information during publicity. If it is combined with some cut-scene effects such as fading in and out, it will attract more attention. As for the realization of the panel table of real-time alarm information, it also realized a transitional sense of immersion in UI interaction when adding new data. It mainly used the animation function HT.default.startanim () that came with HT, and the data transparency emerged slowly by scrolling 100 widths horizontally. Add new alert information vertically by downshifting one row of table row height by 54.
addTableRow() {// Get the table nodelettable = this.right3; // Request interface data axios.get('getEvent').then(res => {// Get the data binding of the rolling information of the table nodelet tableData = table.a('dataSource'); // Add one or more elements to the beginning of the scrolling information array by calling unshift(); // Initialize the vertical offset of the table table.a('ty', - 54); Ht.default. startAnim({duration: 600, action action: (v, t) => {table.a({// Scroll 100 after adding data'firstRowTx': 100 * (1-v), // The opacity gradient appears on the first line'firstRowOpacity': v, // Longitudinal offset 54 height'ty': (v - 1) * 54 }); }}); }); }Copy the code



Three, animation implementation

In static scenes and panels, it is difficult to intuitively demonstrate the advantages of a 2/3D chimeric system. Animation is endowed with life of the soul, a proper UI animation design can make the panel interaction experience to life, and in 3 d scenes, through a set of simple image of molten iron tank car transportation and conveyor belt can make people clearly understand the production process of transportation, for model building controls, make good use of perspective, We can set up a full range of immersive Tours. To sum up, a flexible production early warning system of blast furnace and ironmaking plant can be presented through the superposition of the advantages of lightweight model scene and vector component panel.
In the roaming tour, in order to reflect the scene in a more all-round way, we show and hide the panel data on both sides by cropping. The following takes the cropping animation of hidden panel as an example:
hidePanel() {// Store the clipped child elements of the left data binding into an arraylet leftStartClipIndexs = (() => {
        let arr = [];
        for (let i = 1; i <= 4; i++) arr.push(this['left' + i].s('clip.percentage'));
        returnarr; }) (); // Store the clipped child element of the right data binding into an arraylet rightStartClipIndexs = (() => {
        let arr = [];
        for (let i = 1; i <= 3; i++) arr.push(this['right' + i].s('clip.percentage'));
        returnarr; }) (); // Set the delay time for panel clipping to make the visual more layeredletdelayArrays = [400, 800, 1200, 1600]; // Animation executes the functionlet action = (index) => {
        ht.Default.startAnim({
            duration: 700,
            easing: Easing.swing,
            action: (v, t) => {
                this['left' + index].s('clip.percentage', leftStartClipIndexs[index - 1] + (0 - leftStartClipIndexs[index - 1]) * v);
                this['right' + index].s('clip.percentage', rightStartClipIndexs[index - 1] + (0 - rightStartClipIndexs[index - 1]) * v); }}); }; // Call back the action animation by determining the length of the delay time arrayfor (leti = 0, l = delayArrays.length; i < l; i++) { ht.Default.callLater(action, this, [i + 1], delayArrays.shift()); }}Copy the code

Data. s(‘clip.percentage’) is a style attribute of the HT node. It essentially means that the entire vector icon can be clipped in a specified direction:

A film can present different narrative effects through the switching of various shots. The rapid switching of blood running under the sunset in Japanese dramas or the fading of panic in and out of dark corners are all narrative processing methods. There are also many narrative techniques in 3D scenes set by HT. The most basic setting is to match various animations with subjective eye and scene center, which can be modified by method functions of their own setting values, or handled by method functions encapsulated by HT itself. For example, flyTo() and moveCamera() are the most basic camera animations, if you are interested in them, you can try to match them by yourself, which will definitely give full play to the advantages of 3D scenes.

Roaming animation is to better patrol the scene from different perspectives, just by setting up several sets of eye perspectives, using
HT
moveCamera()The animation of camera Angle movement can automatically switch the scene effect under different Angle of view by corresponding to the eye Angle in turn.
Const ROAM_EYES = [[1683.6555274005063, 939.999999999999993, 742.655414747474625], [1717.1004359371925, 512.9256996098727, -1223.5575465999652], [-181.41773461002046, 245.58303266170844, -2043.6755074222654], [-1695.7113902533574, 790.0214102589537, -877.645744191523], [-1848.1700283399357, 1105.522705042774, [-108, 940, 1837]]; // Enable camera roaming animationplayRoam() {// Set the scene eye Angleleteye = ROAM_EYES[this.roamIndex]; MoveCamera this._roamanim = this.viewer.movecamera (eye, [0, 0, 0], {duration: this.roamIndex? 3000 : 4000, easing: Easing.easeOut, finishFunc: () => { this.roamIndex ++;letnextEye = ROAM_EYES[this.roamIndex]; // Determine if there is a next set of eye angles, if there is, continue the camera Angle movement animation, if not, reset the roaming animationif (nextEye) {
                this.playRoam();
            }
            elseEvent.fire (EVENT_SHOW_PANEL); this.resetRoam(); }}}); }Copy the code

If the scene view roaming is a reflection of the overall situation, then the loading and transportation of the hot metal tank car and the transportation of the conveyor belt is a puzzle of the blast furnace ironmaking process. Through a series of animation flow, you can clearly see that the specific 3D scene of the explanation has a complete story.

The following is the animation process of loading and transportation of hot metal tank truck:

In the 3D scene, x, Y and Z are used to represent the three axes respectively, and the displacement effect can be achieved by constantly modifying the 3D coordinates of the nodes. Car.setposition3d (x, Y, z), while the loading label on the hot metal tank car uses the function of adsorption. Make its adsorption on the molten iron tank car can move along, and then on the space of the specified coordinates by car. The s (‘ 3 d. Visible, true | false) to control the appearance of the molten iron tank car with a hidden effect.

As for the indication of the transmission of coal and iron ore on the conveyor belt and the flow of gas in the pipeline, it will be much more convenient to use the offset of the UV texture map to achieve it. Let’s take a look at the effect:

For 3d models, there are two important coordinate systems, namely the position coordinates of vertices (X, Y, Z) and UV coordinates. Figuratively speaking, UV is the basis for mapping the surface of the model. U and V are the coordinates of the image in the horizontal and vertical directions of the display, respectively. The values are generally 0~1. HT model node has its own style attribute of UV value. We only need to constantly control its shift change to achieve the effect of transmission:

// Set the initial offsetletoffset1 = 0, trackOffset = 0; // Always call set offsetsetInterval(() => {
    flows.each(node => {
        node.s({
            'top.uv.offset': [-offset1, 0],
            'front.uv.offset': [-offset1, 0],
        });
    });
    track.s('shape3d.uv.offset', [0, -trackOffset]); // Increase offset1 += 0.1; TrackOffset + = 0.03; }, 100);Copy the code

conclusion

digitaland
intelligentLarge screen control is
Industrial InternetIn the era of rapid information transmission, the combination of big data visualization and intelligent control will deduce many amazing effects and collisions. Under the supervision of real-time data, early warning information is also very important, to ensure orderly production at the same time, we should also pay attention to safety issues, so many content presented on the large screen, are extremely representative of the industry to keep up with the pace of the industrial Internet.


2019 we also updated the hundreds of industrial Internet 2 d / 3 d visualization case set, here you can find many novel instance, can also find different industrial Internet: mp.weixin.qq.com/s/ZbhB6LO2k…
At the same time, you can also see more cases and results: https://www.hightopo.com/demos/index.html