Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
model:creating_a_model_in_python [2023/03/12 23:13] optrix |
model:creating_a_model_in_python [2025/02/18 05:02] (current) optrix |
||
---|---|---|---|
Line 6: | Line 6: | ||
< | < | ||
- | import ardimodel | + | import ardimodel |
- | host = ardimodel.ModelHost() | + | host = mdl.ModelHost(5225) #This is the port number that OPC-UA will run on |
# Add Models Here | # Add Models Here | ||
Line 31: | Line 31: | ||
< | < | ||
+ | #My Tank Model | ||
+ | @mdl.part(" | ||
def TankModel(mod): | def TankModel(mod): | ||
pass | pass | ||
</ | </ | ||
- | Once we've created | + | The '@part' decorator marks the function defines a **model**. Inside the function, we can define which specific inputs, outputs, constants and calculations we need. |
- | < | + | The human readable name for our model is 'Online |
- | # Add Models Here | + | |
- | host.Add(ardimode.Create(" | + | |
- | </ | + | |
- | + | ||
- | This defines | + | |
===Filling in the Inputs=== | ===Filling in the Inputs=== | ||
Line 91: | Line 88: | ||
For example, the function here will be... | For example, the function here will be... | ||
- | < | + | < |
- | //Note that the 'num' | + | //Note that data points aren't simple numbers |
==Used Points== | ==Used Points== | ||
Line 125: | Line 122: | ||
< | < | ||
- | import ardimodel | + | import ardimodel |
host = ardimodel.ModelHost() | host = ardimodel.ModelHost() | ||
+ | @mdl.part(" | ||
def TankModel(mod): | def TankModel(mod): | ||
Outflow = mod.AddInput(" | Outflow = mod.AddInput(" | ||
Line 137: | Line 135: | ||
Volume = mod.AddOutput(" | Volume = mod.AddOutput(" | ||
mod.AddOutput(" | mod.AddOutput(" | ||
- | |||
- | # Add Models Here | ||
- | host.Add(ardimodel.Create(" | ||
host.ardiurl = " | host.ardiurl = " |