-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/rc1 #10
base: main
Are you sure you want to change the base?
Feature/rc1 #10
Changes from all commits
036c33d
84c1f6f
b864c7f
b4336c9
6f0eb4c
ec0f106
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<DUT Name="SequenceCommand" Id="{5f5128e9-4988-0cd7-37c1-c51312994c6b}"> | ||
<Declaration><![CDATA[TYPE SequenceCommand : | ||
STRUCT | ||
Start : PLCopenCommand; | ||
Stop : PLCopenCommand; | ||
END_STRUCT | ||
END_TYPE | ||
]]></Declaration> | ||
</DUT> | ||
</TcPlcObject> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<POU Name="ExampleProg1" Id="{ef79d040-ac9a-075e-0ecb-cf80cda435b7}" SpecialFunc="None"> | ||
<Declaration><![CDATA[PROGRAM ExampleProg1 | ||
VAR | ||
|
||
Cylinder1 : Mock_EM := (TimeUp:= T#3S, TimeDown:= T#3S); | ||
Cylinder2 : Mock_EM := (TimeUp:= T#1S, TimeDown:= T#1S); | ||
Cylinder3 : Mock_EM := (TimeUp:= T#8S, TimeDown:= T#1S); | ||
Seq1 : ExampleSeq1(0) := (em1:=Cylinder1, em2:=Cylinder2, em3:=Cylinder3); | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[Cylinder1(); | ||
Cylinder2(); | ||
Cylinder3(); | ||
|
||
Seq1(); | ||
]]></ST> | ||
</Implementation> | ||
</POU> | ||
</TcPlcObject> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<POU Name="ExampleSeq1" Id="{0b7420e2-7bee-0073-13f1-581e54ae5023}" SpecialFunc="None"> | ||
<Declaration><![CDATA[FUNCTION_BLOCK ExampleSeq1 EXTENDS Sequencer | ||
VAR_INPUT | ||
em1 : IMOCK_EM; | ||
em2 : IMOCK_EM; | ||
em3 : IMOCK_EM; | ||
END_VAR]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[CASE DoStep() OF | ||
|
||
0: | ||
IF OnEntry() THEN | ||
RequestStep( 1 ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we see if STweep will standardize spaces around parameters automatically? This is inconsistent. |
||
END_IF | ||
|
||
1: | ||
IF OnEntry() THEN | ||
em1.MoveDown(THIS^); | ||
END_IF | ||
|
||
OnSuccess(2); | ||
2: | ||
|
||
IF OnEntry() THEN | ||
em1.MoveUp(THIS^); | ||
em2.MoveUp(THIS^); | ||
em3.MoveUp(THIS^); | ||
END_IF | ||
|
||
OnSuccess(3); | ||
|
||
3: | ||
|
||
IF OnEntry() THEN | ||
em1.MoveDown(THIS^); | ||
em2.MoveDown(THIS^); | ||
em3.MoveUp(THIS^); | ||
END_IF | ||
|
||
|
||
IF OnSuccess(-1) THEN | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A comment to explain the significance of -1 would be helpful. Otherwise it may be interpreted as an error state. In fact, could we make an ENUM for these? OnSuccess(SEQ_COMPLETE), for example? |
||
|
||
SequenceComplete(); | ||
|
||
END_IF | ||
|
||
END_CASE | ||
|
||
IF OnError(-1) THEN | ||
SequenceError(-1, 'General error'); | ||
END_IF]]></ST> | ||
</Implementation> | ||
</POU> | ||
</TcPlcObject> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<Itf Name="IMOCK_EM" Id="{ef49eb67-0dd3-08ee-1676-40a85245db25}"> | ||
<Declaration><![CDATA[INTERFACE IMOCK_EM | ||
]]></Declaration> | ||
<Method Name="MoveDown" Id="{c1097bb8-4cd7-0965-2bad-c28e059eadf2}"> | ||
<Declaration><![CDATA[ | ||
METHOD MoveDown : BOOL | ||
VAR_INPUT | ||
Status : IPLCopenCall; | ||
END_VAR | ||
]]></Declaration> | ||
</Method> | ||
<Method Name="MoveUp" Id="{b592d131-cbee-0403-212c-bb26ab20fc93}"> | ||
<Declaration><![CDATA[ | ||
METHOD MoveUp : BOOL | ||
VAR_INPUT | ||
Status : IPLCopenCall; | ||
END_VAR | ||
]]></Declaration> | ||
</Method> | ||
</Itf> | ||
</TcPlcObject> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1"> | ||
<POU Name="Mock_EM" Id="{2fbe5d7f-06dd-041a-2d03-5fb4cef27abb}" SpecialFunc="None"> | ||
<Declaration><![CDATA[ | ||
FUNCTION_BLOCK Mock_EM IMPLEMENTS IMOCK_EM | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This appears to be the only place where _'s are used in the name. Is there significance to IMOCK being all-caps? |
||
VAR_INPUT | ||
TimeUp : TIME; | ||
TimeDown : TIME; | ||
END_VAR | ||
VAR | ||
_MoveUp : PLCopenCommand; | ||
_MoveDown : PLCopenCommand; | ||
_HeightGroup : PLCopenExclusiveGroup := (commands := [_MoveUp, _MoveDown, 18(0)]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the significance of 18(0) here? I'm surprised to see that as valid syntax, but perhaps I'm missing something. |
||
t : TON; | ||
Up : BOOL; | ||
Down : BOOL; | ||
Up_ : BOOL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the distinction between Up_ and Up? This could be confusing to new users in the example without a comment. |
||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[ | ||
IF _MoveDown.Consume THEN | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Being a user-facing example, this code could benefit from a few brief comments. |
||
|
||
t(IN := FALSE); | ||
t(IN := TRUE, PT := TimeDown); | ||
Up_ := FALSE; | ||
Up := FALSE; | ||
Down := FALSE; | ||
|
||
END_IF | ||
|
||
IF _MoveUp.Consume THEN | ||
|
||
t(IN := FALSE); | ||
t(IN := TRUE, PT := TimeUp); | ||
Up_ := TRUE; | ||
Up := FALSE; | ||
Down := FALSE; | ||
|
||
END_IF | ||
|
||
t(); | ||
|
||
IF t.Q THEN | ||
|
||
t(IN := FALSE); | ||
|
||
IF Up_ THEN | ||
Up := TRUE; | ||
_MoveUp.Finished(); | ||
ELSE | ||
Down := TRUE; | ||
_MoveDown.Finished(); | ||
END_IF | ||
|
||
END_IF | ||
]]></ST> | ||
</Implementation> | ||
<Method Name="MoveDown" Id="{85d33885-fdbf-0e70-0029-961e4e4e3914}"> | ||
<Declaration><![CDATA[ | ||
METHOD MoveDown : BOOL | ||
VAR_INPUT | ||
Status : IPLCopenCall; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[ | ||
Status.Start(_MoveDown); | ||
]]></ST> | ||
</Implementation> | ||
</Method> | ||
<Method Name="MoveUp" Id="{e89b83fa-e799-0cf1-2121-19445f61c4de}"> | ||
<Declaration><![CDATA[ | ||
METHOD MoveUp : BOOL | ||
VAR_INPUT | ||
Status : IPLCopenCall; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[ | ||
Status.Start(_MoveUp); | ||
]]></ST> | ||
</Implementation> | ||
</Method> | ||
</POU> | ||
</TcPlcObject> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to remove this NetID?