protected InstructionLDParallel(IEditorItem parent, NodeInstruction instruction) : base(parent, m_InstructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); newInstruction = newInstruction.NodeInstructionChildren.Append( InstructionLDSeries.EmptyRung()); newInstruction = newInstruction.NodeInstructionChildren.Append( InstructionLDSeries.EmptyRung()); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate InstructionLDParallel but passed a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
protected InstructionLDAbstractEdge(IEditorItem parent, NodeInstruction instruction, FieldInstructionType instructionType) : base(parent, instructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Output signal: Named boolean - memory of last rung in newInstruction = newInstruction.NodeSignalChildren.Append( NodeSignal.BuildWith( new FieldSignalName(InstructionName), new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), // not forced FieldConstant.Constants.BOOL.LOW) ); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate an edge but passed a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
private InstructionLDCoil(IEditorItem parent, NodeInstruction instruction) : base(parent, m_InstructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Output signal: Named boolean - the coil signal newInstruction = newInstruction.NodeSignalChildren.Append( NodeSignal.BuildWith( new FieldSignalName(Resources.Strings.LD_Snap_Coil_DefaultCoilName), new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), FieldConstant.Constants.BOOL.LOW) // not forced ); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate InstructionLDCoil but passed a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
protected InstructionLDAbstractCounter(IEditorItem parent, NodeInstruction instruction, FieldInstructionType instructionType) : base(parent, instructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Output signal: Named boolean - the counter done signal newInstruction = newInstruction.NodeSignalChildren.Append( NodeSignal.BuildWith( new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName), new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), // not forced FieldConstant.Constants.BOOL.LOW) ); newInstruction = newInstruction.NodeSignalChildren.Append( // memory of counter value NodeSignal.BuildWith( new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName + SEPARATOR + Resources.Strings.LD_Snap_Ctr_CountName), new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldBool(false), // not forced FieldConstant.Constants.NUMBER.ZERO) ); newInstruction = newInstruction.NodeSignalChildren.Append( // previous rung-in condition NodeSignal.BuildWith( new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName + SEPARATOR + Resources.Strings.LD_Snap_Ctr_OneshotStateName), new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), // not forced FieldConstant.Constants.BOOL.LOW) ); // Input signal: setpoint newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0))); // Input signal: reset newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate a Counter but passed a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
protected InstructionLDMathBase(IEditorItem parent, FieldInstructionType instructionType, NodeInstruction instruction, string defaultName, bool factory, string instructionName, string firstSignalName, string secondSignalName) : base(parent, instructionType) { if (factory) { return; } this.InstructionName = instructionName; this.FirstSignalName = firstSignalName; this.SecondSignalName = secondSignalName; if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Output signal: Named number - result newInstruction = newInstruction.NodeSignalChildren.Append( NodeSignal.BuildWith( new FieldSignalName(defaultName), new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldBool(false), // not forced FieldConstant.Constants.NUMBER.ZERO) ); // Input signal: First newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0))); // Input signal: Second newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.NUMBER), new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0))); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
protected InstructionLDStringContains(IEditorItem parent, NodeInstruction instruction) : base(parent, m_InstructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Output signal: Named boolean - result of the comparison newInstruction = newInstruction.NodeSignalChildren.Append( NodeSignal.BuildWith( new FieldSignalName(Resources.Strings.LD_Snap_StringContains_DefaultName), new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldBool(false), // not forced FieldConstant.Constants.BOOL.LOW) ); // Input signal: string to search newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.STRING), new FieldConstant(FieldDataType.DataTypeEnum.STRING, string.Empty))); // Input signal: string to find newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.STRING), new FieldConstant(FieldDataType.DataTypeEnum.STRING, string.Empty))); // Input signal: case sensitive newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); Instruction = newInstruction; } else { if (instruction.InstructionType != InstructionType) { throw new InvalidOperationException("Tried to instantiate a StringContains but passed a different instruction type."); } Instruction = instruction; } // Build the context menu if (extensionService != null) { ContextMenu = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu); ContextMenuEnabled = true; } }
protected InstructionLDAbstractContact(IEditorItem parent, FieldInstructionType instructionType, NodeInstruction instruction) : base(parent, instructionType) { if (instruction == null) { var newInstruction = NodeInstruction.BuildWith(InstructionType); // Input signal: (coil that we're a contact off) default to always false newInstruction = newInstruction.NodeSignalInChildren.Append( NodeSignalIn.BuildWith( new FieldDataType(FieldDataType.DataTypeEnum.BOOL), new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false))); Instruction = newInstruction; } else { if (instructionType != instruction.InstructionType) { throw new ArgumentOutOfRangeException("Tried to instantiate a contact of type " + instructionType.ToString() + " with an instruction of a different type."); } Instruction = instruction; } }
public static NodeInstruction EmptyRung() { return(NodeInstruction.BuildWith(m_InstructionType)); }