The "Machine Data" is the set of engineering values that describe the physical machine — roller diameters, gear ratios, motor types, encoder types, speed loop gains, etc. It must be entered once per machine by the commissioning engineer and is then stored inside the Starter project for reuse.
.Code property is a multi-line text string formatted as delimiter-separated values.
The Delimit() function (see below) splits the text by ' characters (row separator)
and then by , characters (column separator).
' Row 1: Header comment (script version) ' SINAMICS Script Machine Data S53b ' Row 2: (reserved / not used) ' Row 3: Machine type, PLC type, machine name (separated by commas) ' 2,2,K5Expert_V24G001 ' Row 4: Supply voltage ' 400 ' Row 5: Max line speed (m/min) ' 1000 ' Row 6: Unwind layarm data (FW speed, FW speed enabled, max tension, max thrust) ' 150,1,250.0,3000 ' Row 7: Rewind layarm data (same layout) ' 150,1,250.0,3000 ' Rows 8 to 20: Per-drive data (one row per drive, drives 1-13) ' Format: GearRatio, Diameter, Speed, Torque, Direction, MotorType, Encoder, Gain, ResetTime, EnableConfig ' 1.0,165,,, 1, -1, 1, 90, 50, 1 ← Drive 1 (Unwind) ' 1.0,194,,, 1, -1, 0, 27, 40, 1 ← Drive 2 (Draw) ' 2.857,700.0,,, 1, -1, 0, 40, 80, 1 ← Drive 3 (Drum) ... ' Row 21: Winder drive type (0=unset, 1=Servo, 2=Vector) ' 1
Delimit("400,1,Test", 2, ",") returns "1"Delimit("' 400" & Chr(13) & "' 480", 2, "'") returns " 480"
Function Delimit(InputString, MatchNumber, Delimiter) DelimitCount=1 Dim DelimitArray DelimitArray = Split(InputString, Delimiter) ' Split the string into an array using the delimiter Delimit = DelimitArray(MatchNumber-1) ' Return the Nth element (1-based → 0-based) End Function ' Note: returns empty string if MatchNumber > number of elements
| Variable | Default Value | Meaning |
|---|---|---|
MachineData_Type | 2 | Machine uses timed E-stop (K5 Vision/Expert) |
MachineData_PlcType | 2 | TIA Portal PLC |
MachineData_Name | "None" | Machine name not set yet |
MachineData_SupplyVoltage | 0 | Not set — must be entered by engineer |
MachineData_LineSpeed | 1000.0 | Default 1000 m/min web speed |
MachineData_GearRatio(1-13) | Varies | Default gear ratios (1:1 for most, 2.857 for drums, blank for layarms) |
MachineData_Gain(1) (Unwind) | 90 (Servo) or 5 (Vector) | Speed loop proportional gain Kp |
MachineData_ResetTime(1) | 50 | Speed loop integral time Ti in ms |
MachineData_WinderDriveType | 0 | Not set — must be selected by engineer |
Sub CheckMachineDataExists GetMachineData ' Try to load existing data. Sets MachineDataExists=True or False. If Not MachineDataExists Then ' No saved data found — set sensible defaults MachineData_Type=2 ' Default: timed E-stop MachineData_PlcType=2 ' Default: TIA Portal MachineData_Name="None" ' No name yet MachineData_SupplyVoltage=0 ' Not set MachineData_Linespeed=1000.0 ' ── Line drives: Unwind(1), Draw(2), DTR2(5), Rewind(6), Draw2(9), Draw3(10), Draw4(13) If (index=1) Or (Index=2) Or (Index=5) ... Then MachineData_GearRatio(Index)="1.0" ' 1:1 gear ratio MachineData_RollDiameter(Index)="" ' Blank — must be filled by engineer MachineData_Direction(Index)=0 ' Not yet set End If ' ── Drums: Drum(3), Drum2(11), Drum3(12) If (Index=3) Or (Index=11) Or (Index=12) Then MachineData_GearRatio(Index)="2.857" ' Drums always use 2.857:1 ratio End If ' ── Layarms / DTR1: DTR1(4), UnwindLayarm(7), RewindLayarm(8) If (Index=4) Or (Index=7) Or (Index=8) Then MachineData_GearRatio(Index)="" ' Will be read from drive schematic End If ' ── Default PID gains (changed based on drive type) MachineData_Gain(1)=90 : MachineData_ResetTime(1)=50 'Unwind Servo default MachineData_Gain(2)=27 : MachineData_ResetTime(2)=40 'Draw MachineData_Gain(3)=40 : MachineData_ResetTime(3)=80 'Drum MachineData_Gain(4)=15 : MachineData_ResetTime(4)=200 'DTR1 MachineData_Gain(5)=20 : MachineData_ResetTime(5)=200 'DTR2 MachineData_Gain(7)=0.8 : MachineData_ResetTime(7)=15 'Unwind Layarm MachineData_Gain(8)=0.8 : MachineData_ResetTime(8)=15 'Rewind Layarm SaveMachineData ' Write the defaults to the Starter script so they persist End If End Sub
Delimit() function to fill all the MachineData_* array variables.
Sub LoadMachineData Dim MachineDataScript ' Will hold the Starter script object named "MachineData" Dim MDText ' Will hold the text content of that script On Error Resume Next Set MachineDataScript = PROJ.Scripts.Item(MachineDataScriptName) If Err.Number<>0 Then MachineDataExists=False ' Script doesn't exist = no data saved yet Else MachineDataExists=True End If If MachineDataExists Then MDText=MachineDataScript.Code ' Read the entire text of the data script ' ── Parse Row 3: Machine type, PLC type, name MachineData_Type = Delimit(Delimit(MDText,3,"'"),1,",") ' Row 3, Column 1 MachineData_PlcType = Delimit(Delimit(MDText,3,"'"),2,",") ' Row 3, Column 2 MachineData_Name = Delimit(Delimit(MDText,3,"'"),3,",") ' Row 3, Column 3 ' ── Parse Row 4: Supply voltage MachineData_SupplyVoltage = Int(Delimit(Delimit(MDText,4,"'"),1,",")) ' ── Parse Row 5: Max line speed MachineData_LineSpeed = Int(Delimit("0"&Delimit(MDText,5,"'"),1,",")) ' ↑ Note the "0" prepended — this prevents a crash if the row is blank (returns 0 instead of error) ' ── Parse Rows 8 to 20: Per-drive data For index=1 To NumDrives ' Loop through all 13 drives ' Row number = index + 7 (drives start at row 8, which is index 1 → row 1+7=8) MachineData_GearRatio(Index) = Delimit(Delimit(MDText,Index+7,"'"),1,",") MachineData_RollDiameter(Index) = Delimit(Delimit(MDText,Index+7,"'"),2,",") MachineData_Speed(Index) = Delimit(Delimit(MDText,Index+7,"'"),3,",") MachineData_Torque(Index) = Delimit(Delimit(MDText,Index+7,"'"),4,",") MachineData_Direction(Index) = Int("0"&Delimit(Delimit(MDText,Index+7,"'"),5,",")) MachineData_MotorType(Index) = Int(Delimit(Delimit(MDText,Index+7,"'"),6,",")) MachineData_Encoder(Index) = Int("0"&Delimit(Delimit(MDText,Index+7,"'"),7,",")) MachineData_Gain(Index) = Delimit(Delimit(MDText,Index+7,"'"),8,",") MachineData_ResetTime(Index) = Delimit(Delimit(MDText,Index+7,"'"),9,",") MachineData_EnableConfig(Index) = Delimit(Delimit(MDText,Index+7,"'"),10,",") Next ' ── Parse Row 6: Unwind layarm data MachineData_UnwindFWSpeed = Delimit(Delimit(MDText,6,"'"),1,",") MachineData_UnwindFWSEnabled= Delimit(Delimit(MDText,6,"'"),2,",") MachineData_ULayarmMaxTension= Delimit(Delimit(MDText,6,"'"),3,",") MachineData_ULayarmMaxThrust = Delimit(Delimit(MDText,6,"'"),4,",") ' ── Parse Row 7: Rewind layarm data MachineData_RewindFWSpeed = Delimit(Delimit(MDText,7,"'"),1,",") MachineData_RewindFWSEnabled = Delimit(Delimit(MDText,7,"'"),2,",") MachineData_RLayarmMaxTension= Delimit(Delimit(MDText,7,"'"),3,",") MachineData_RLayarmMaxThrust = Delimit(Delimit(MDText,7,"'"),4,",") ' ── Parse Row 21: Winder drive type (added in S52a) MachineData_WinderDriveType = Delimit(Delimit(MDText,21,"'"),1,",") End If On Error GoTo 0 End Sub
MachineData_* variables (filled by LoadMachineData)
and pushes them into the HTML form fields so the engineer can see/edit them.
Also:
ConfigMachineType=1, the dropdown is greyed out)Sub DisplayMachineData If MachineDataExists And ShowMachineData Then ' ── Apply forced machine settings ──────────────────────────────────────────── ' If the config hard-codes the machine type, lock the dropdown If ConfigMachineType=1 Or ConfigMachineType=2 Then MachineData_Type=ConfigMachineType MainPage.Document.GetElementbyid("MachineType").Disabled=True ' Grey out the dropdown End If ' ── Fill in header fields ──────────────────────────────────────────────────── MainPage.Document.GetElementbyid("MachineName").Value = MachineData_Name MainPage.Document.GetElementbyid("MachineType").Value = MachineData_Type MainPage.Document.GetElementbyid("MachinePlcType").Value = MachineData_PlcType MainPage.Document.GetElementbyid("SupplyVoltage").Value = MachineData_SupplyVoltage MainPage.Document.GetElementbyid("WinderDriveType").Value = MachineData_WinderDriveType MainPage.Document.GetElementbyid("LineSpeed").Value = MachineData_LineSpeed ' ── Fill in per-drive table ────────────────────────────────────────────────── For index=1 To NumDrives MainPage.Document.GetElementbyid("GearRatio_"&Index).Value = MachineData_GearRatio(Index) MainPage.Document.GetElementbyid("Diameter_"&Index).Value = MachineData_RollDiameter(Index) MainPage.Document.GetElementbyid("Speed_"&Index).Value = MachineData_Speed(Index) MainPage.Document.GetElementbyid("Direction_"&Index).Value = MachineData_Direction(Index) MainPage.Document.GetElementbyid("MotorType_"&Index).Value = MachineData_MotorType(Index) MainPage.Document.GetElementbyid("Torque_"&Index).Value = MachineData_Torque(Index) MainPage.Document.GetElementbyid("Encoder_"&Index).Value = MachineData_Encoder(Index) MainPage.Document.GetElementbyid("Gain_"&Index).Value = MachineData_Gain(Index) MainPage.Document.GetElementbyid("ResetTime_"&Index).Value = MachineData_ResetTime(Index) MainPage.Document.GetElementbyid("Enable_"&Index).Checked = Not (MachineData_EnableConfig(Index)=0) ' ── Override motor type / torque from DriveCliq data if drive is in project ── If DrivePresent Then If DriveTo.Parameters(302,0)>0 Then ' p302 > 0 = DriveCliq motor data identified MachineData_MotorType(Index)=-1 ' -1 = DriveCliq motor (auto-detected) MainPage.Document.GetElementbyid("MotorType_"&Index).Value=-1 MainPage.Document.GetElementbyid("Torque_"&Index).Value=DriveTo.Parameters(333,0) ' p333 = rated torque from nameplate MainPage.Document.GetElementbyid("MotorType_"&Index).Disabled=True ' Lock it ElseIf DriveTo.Parameters(302,0)=0 And DriveTo.Parameters(304,0)>0 Then MachineData_MotorType(Index)=-2 ' -2 = pre-configured (wizard), non-cliq End If End If Next ' ── Fill in layarm fields ──────────────────────────────────────────────────── MainPage.Document.GetElementbyid("MaxSpeed_1").Value = MachineData_UnwindFWSpeed MainPage.Document.GetElementbyid("MaxSpeedEnable_1").Checked = (MachineData_UnwindFWSEnabled=1) MainPage.Document.GetElementbyid("UnwLayarmMaxTensSetpoint").Value = MachineData_ULayarmMaxTension MainPage.Document.GetElementbyid("UnwLayarmMaxThrust").Value = MachineData_ULayarmMaxThrust MainPage.Document.GetElementbyid("MaxSpeed_6").Value = MachineData_RewindFWSpeed MainPage.Document.GetElementbyid("MaxSpeedEnable_6").Checked = (MachineData_RewindFWSEnabled=1) MainPage.Document.GetElementbyid("RewLayarmMaxTensSetpoint").Value = MachineData_RLayarmMaxTension MainPage.Document.GetElementbyid("RewLayarmMaxThrust").Value = MachineData_RLayarmMaxThrust Call MainPage.Document.GetElementbyid("RewLayarmMaxThrust").onblur ' Trigger the onblur event to fire the JS update() function End If End Sub
MachineData_* arrays, then rebuilds the CSV text
and writes it back to the "MachineData" script object in Starter.
Sub SaveMachineData Dim MachineDataScript On Error Resume Next Set MachineDataScript = PROJ.Scripts.Item(MachineDataScriptName) If Err.Number<>0 Then ' Script doesn't exist yet — create it PROJ.Scripts.Add(MachineDataScriptName) Set MachineDataScript = PROJ.Scripts.Item(MachineDataScriptName) End If If ShowMachineData Then ' Only read from the screen if the form is currently visible MachineData_Name = MainPage.Document.GetElementbyid("MachineName").Value MachineData_Type = MainPage.Document.GetElementbyid("MachineType").Value MachineData_PlcType = MainPage.Document.GetElementbyid("MachinePlcType").Value MachineData_SupplyVoltage= MainPage.Document.GetElementbyid("SupplyVoltage").Value MachineData_LineSpeed = MainPage.Document.GetElementbyid("LineSpeed").Value '... (read all 10 fields for each of the 13 drives) End If ' ── Build the CSV text and write it ────────────────────────────────────────── ' Each .Code = ... line appends another row to the script text' MachineDataScript.Code = "' SINAMICS Script Machine Data " & ConfigVersion & vbCrLf MachineDataScript.Code = MachineDataScript.Code & "' " & vbCrLf ' Row 2 (blank) MachineDataScript.Code = MachineDataScript.Code & "' " & MachineData_Type & "," & MachineData_PlcType & "," & MachineData_Name & vbCrLf ' Row 3 MachineDataScript.Code = MachineDataScript.Code & "' " & MachineData_SupplyVoltage & vbCrLf ' Row 4 MachineDataScript.Code = MachineDataScript.Code & "' " & MachineData_LineSpeed & vbCrLf ' Row 5 ' Row 6: Unwind layarm MachineDataScript.Code = MachineDataScript.Code & "' " & MachineData_UnwindFWSpeed & "," & MachineData_UnwindFWSEnabled & "," & MachineData_ULayarmMaxTension & "," & MachineData_ULayarmMaxThrust & vbCrLf ' Row 7: Rewind layarm MachineDataScript.Code = MachineDataScript.Code & "' " & MachineData_RewindFWSpeed & "," & MachineData_RewindFWSEnabled & "," & MachineData_RLayarmMaxTension & "," & MachineData_RLayarmMaxThrust & vbCrLf ' Rows 8-20: Per-drive data For index=1 To NumDrives MachineDataScript.Code = MachineDataScript.Code & "' " & _ MachineData_GearRatio(index) & "," & MachineData_RollDiameter(index) & "," & _ MachineData_Speed(index) & "," & MachineData_Torque(index) & "," & _ MachineData_Direction(index) & "," & MachineData_MotorType(index) & "," & _ MachineData_Encoder(index) & "," & MachineData_Gain(index) & "," & _ MachineData_ResetTime(index) & "," & MachineData_EnableConfig(index) & vbCrLf Next ' ... (winder type goes to row 21) End Sub
| Variable Name | HTML Form ID | Siemens Parameter Written |
|---|---|---|
MachineData_Name | MachineName | Not written to drives (display only) |
MachineData_Type | MachineType | p2126[2] on CU (machine E-stop type) |
MachineData_PlcType | MachinePlcType | p2126[3] on CU (PLC speed word width) |
MachineData_SupplyVoltage | SupplyVoltage | p210 on each infeed and drive |
MachineData_LineSpeed | LineSpeed | Used to calculate p2000 (reference speed) for each drive |
MachineData_GearRatio(n) | GearRatio_n | Used to calculate p2000 and p1082 |
MachineData_RollDiameter(n) | Diameter_n | Used to calculate p2000 and p1082 (mm) |
MachineData_Speed(n) | Speed_n (read-only, calculated) | p2000[0] = reference speed AND p1082 = max speed |
MachineData_Direction(n) | Direction_n | p1821 (CW=0, CCW=1) |
MachineData_MotorType(n) | MotorType_n | Determines which parameters to write for motor characterization |
MachineData_Encoder(n) | Encoder_n | Determines encoder type settings (p400 series) |
MachineData_Torque(n) | Torque_n | p2003 (reference torque in Nm) |
MachineData_Gain(n) | Gain_n | p1460[0] (speed loop proportional gain Kp) |
MachineData_ResetTime(n) | ResetTime_n | p1462[0] (speed loop integral time Ti in ms) |
MachineData_EnableConfig(n) | Enable_n (checkbox) | If 0, skip configuring this drive entirely |
MachineData_WinderDriveType | WinderDriveType | 1=Servo → Kp=90, Ti=50ms; 2=Vector → Kp=5, Ti=50ms |
MachineData_ULayarmMaxThrust | UnwLayarmMaxThrust | p2126[14] on CU (max layarm force in Newtons) |
← You have reached the end of the documentation. Return to README.