initial commit lets start
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"plcopenxmlbuilder/facades"
|
||||
"schema"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreatePLCOpenXML(t *testing.T) {
|
||||
builder, err := facades.NewBuilder("twincat3", facades.PLC)
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
proj := schema.Project{
|
||||
ProjectName: "CH_BE_STEFFISBURG_SCHOENAU_SPORTANLAGE_TA03",
|
||||
Information: schema.Information{
|
||||
CompanyName: "Buehler & Scherler",
|
||||
ProductName: "PLCopenXML Builder",
|
||||
Version: "0.0.1",
|
||||
},
|
||||
Devices: []*schema.Device{{
|
||||
Name: "SPS001",
|
||||
Tasks: []*schema.Task{
|
||||
{
|
||||
Name: "Main",
|
||||
KindOfTask: "Cyclic",
|
||||
IntervalUnit: "ms",
|
||||
Interval: 100,
|
||||
Priority: 10,
|
||||
Programs: []*schema.Program{
|
||||
{
|
||||
Name: "Main",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
xmlBytes, err := builder.Marshal(&proj)
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
t.Log(string(xmlBytes))
|
||||
}
|
||||
Reference in New Issue
Block a user