Comments (2)
Thanks for the feedback.
- The NVL-send node expects a javascript object in msg.payload matching the defined structure elements.
- The "coutner" is some old code that still needs to be removed. It doesn't have any functionality.
- When the first message arrives, NVL-send creates an internal structure with default values. For now this is all bits 0, resulting in NaN, 0, "",... I hope to improve that in the future to be able to specify default values in the nvl definition.
- After the initialization msg.payload is merged with the nodes internal memory. This way you don't need to add all variables into the messages each time, only the once who changes.
- For know the best way to initialize all variables, is by sending a messages at startup will all defaults.
You can find an example flow here:
[{"id":"07bb36a5f63c44b5","type":"nvl-receive","z":"7f84c2fbc12875d0","name":"","definition":"TYPE NVL:\nSTRUCT\n MySint: SINT;\n MyUsint: USINT;\n MyInt: INT;\n MyUint: UINT;\n MyDint: DINT;\n MyUdint: UDINT;\n MyByte: BYTE;\n MyWord: WORD;\n MyDword: DWORD;\n MyTime: TIME;\n MyString: STRING;\n //My comment\n MySpecialString: STRING(10);\n MyReal: REAL;\n MyLreal: LREAL;\n MyStruct: ST_MyStruct;\nEND_STRUCT\nEND_TYPE\n\nTYPE ST_MyStruct:\nSTRUCT\n MyLReal: LREAL;\n MyBool: BOOL;\nEND_STRUCT\nEND_TYPE\n","listId":"20","x":490,"y":1120,"wires":[["51c64cb6c9e4726a"]]},{"id":"9deabf4354603d97","type":"nvl-send","z":"7f84c2fbc12875d0","name":"","definition":"TYPE NVL:\nSTRUCT\n MySint: SINT;\n MyUsint: USINT;\n MyInt: INT;\n MyUint: UINT;\n MyDint: DINT;\n MyUdint: UDINT;\n MyByte: BYTE;\n MyWord: WORD;\n MyDword: DWORD;\n MyTime: TIME;\n MyString: STRING;\n //My comment\n MySpecialString: STRING(10);\n MyReal: REAL;\n MyLreal: LREAL;\n MyStruct: ST_MyStruct;\nEND_STRUCT\nEND_TYPE\n\nTYPE ST_MyStruct:\nSTRUCT\n MyLReal: LREAL;\n MyBool: BOOL;\nEND_STRUCT\nEND_TYPE\n","listId":"20","x":320,"y":1120,"wires":[["07bb36a5f63c44b5"]]},{"id":"51c64cb6c9e4726a","type":"debug","z":"7f84c2fbc12875d0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":1120,"wires":[]},{"id":"768ac4c74aad513e","type":"inject","z":"7f84c2fbc12875d0","name":"Partial values","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MyReal\":20.635,\"MyString\":\"sqfo\",\"MyStruct\":{\"MyBool\":true}}","payloadType":"json","x":150,"y":1180,"wires":[["9deabf4354603d97"]]},{"id":"671bc52ea61c6f15","type":"inject","z":"7f84c2fbc12875d0","name":"All INT Pos","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MySint\":2,\"MyInt\":20,\"MyDint\":200}","payloadType":"json","x":180,"y":1240,"wires":[["9deabf4354603d97"]]},{"id":"1e853e60f43e832b","type":"inject","z":"7f84c2fbc12875d0","name":"All INT Neg","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"MySint\":-2,\"MyInt\":-20,\"MyDint\":-200}","payloadType":"json","x":190,"y":1280,"wires":[["9deabf4354603d97"]]},{"id":"9bc57285054d6a2f","type":"inject","z":"7f84c2fbc12875d0","name":"Init","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"0","topic":"","payload":"{\"MySint\":0,\"MyUsint\":0,\"MyInt\":-20,\"MyUint\":0,\"MyDint\":-200,\"MyUdint\":0,\"MyByte\":0,\"MyWord\":0,\"MyDword\":0,\"MyTime\":0,\"MyString\":\"Default\",\"MySpecialString\":\"Default who will be cutted off because it's to long\",\"MyReal\":-3.141592,\"MyLreal\":0.002,\"MyStruct\":{\"MyLReal\":0,\"MyBool\":false}}","payloadType":"json","x":170,"y":1120,"wires":[["9deabf4354603d97"]]}]
from node-red-contrib-nvl.
I made a new release with some minor fixes and examples. You can import the examples by going in node-red to: Import>Examples>node-red-contrib-nvl.
Hope this helps.
from node-red-contrib-nvl.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-nvl.