Skip to content
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

Add some all-purpose sequence Blocks #1060

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

franz-hoepfinger-4diac
Copy link

@franz-hoepfinger-4diac franz-hoepfinger-4diac commented Feb 14, 2025

6 Different Types of sequence FBs:

  • E --> Event triggered one-Shot
  • E_looped --> Event triggered looped
  • T --> Time triggered one-Shot
  • T_looped --> Time triggered looped
  • ET --> Event or Time triggered one-Shot
  • ET_looped --> Event or Time triggered looped

A new XML file was added with global constants for sequence control including initial values.
- Added a new FBType for a sequence with 4 outputs looped
- Defined event inputs and outputs, input variables, output variables, and adapter declarations
- Implemented ECStates and ECActions for each state transition
…e transitions and algorithms for the looped sequence.
…ansition by EVENT or TIME. Include event inputs/outputs, state transitions, confirmation steps, entry/exit steps for each state.
@franz-hoepfinger-4diac
Copy link
Author

@bwiesmayr

Copy link

github-actions bot commented Feb 14, 2025

Test Results

   113 files  ±0     113 suites  ±0   52s ⏱️ +4s
29 183 tests ±0  29 183 ✅ ±0  0 💤 ±0  0 ❌ ±0 
29 184 runs  ±0  29 184 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit cd4927d. ± Comparison against base commit 1bb26ac.

This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests.STFunctionValidatorTest ‑ testDuplicateFunctionNameIsForbidden
org.eclipse.fordiac.ide.structuredtextfunctioneditor.tests.TypeInferenceTest ‑ testNestedCondition

♻️ This comment has been updated with latest results.

<VarDeclaration Name="State_08" Type="SINT" Comment="" InitialValue="SINT#8"/>
</GlobalConstants>
<OriginalSource><![CDATA[VAR_GLOBAL CONSTANT
NO_TIME : TIME := TIME#49d17h2m47s295ms;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this no time?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the largest thinkable Time.
with this Constant you can "switch off" a Transition on Time.

so for the ET Block you make that Transition then Event only.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be similar seen as the 0xFFFF for 16-Bit INT for "no Value" which is commonly used in Bus Systems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not the largest possible value for TIME. The largest value how Eclipse 4diac implements it is larger then 290000 years. So it is just some arbitrarily made up value. Which is not good. Why not 0ns or -1ns?

Also the name does not really convey the meaning that you use it for.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1ns i like most yes !

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about:

INF_TIME : TIME := TIME#-1ns;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T#-1ns is a total valid value for time calling it INF_TIME seems wrong to me. Please note that the Time data type is a delta time so it can be positive and negative. As you need some magic number for your design you should choose one wisely and give it a name that fits to the magic that you are using it for. A generic name will not work here.

</GlobalConstants>
<OriginalSource><![CDATA[VAR_GLOBAL CONSTANT
NO_TIME : TIME := TIME#49d17h2m47s295ms;
State_00 : SINT := SINT#0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you give this states more meaningful names. Just numbers are not really helping to understand what they are for. Would an enum be better?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have ENUMS now ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the 4days of Eclipse 4diac edition we have basic support for enums in 4diac IDE. However I just noticed that we do not yet have 4diac FORTE support and with that also no exporters. Also as I read below you need the value that is not possible in IEC 611313- with enums. There is a dedicated data type for that, which we are not supporting.

</Event>
</EventInputs>
<EventOutputs>
<Event Name="CNF" Type="Event" Comment="Execution Confirmation" >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you have cnf and individual events for states?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CNF goes with the State Number, to display current Step in a Display,
the individual Events go for the Individual Outputs
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting approach

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also make CNF and RO like written below.

<ECAction Output="timeOut.STOP"/>
</ECState>
<ECState Name="sRESET" x="-666.67" y="2666.67">
<ECAction Algorithm="State_01_X" Output="EO_S1"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you really want to issue all EO events in case of reset?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, otherwise the Outputs stay on if we go with the Concept you see in the Comment above.

Question is if we want to reset the STATE_NR Output also to 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different to other FBs with Reset inputs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as my resarch no:
E_TOF.fbt if we press 'R' all Outputs go to FALSE.
do you know any where the Outputs stay on ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not talking about the values I'm talking about the events that are sent on reset.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we go so:
image
then we need all this Events,

if we don't, i would make it like E_CTU, where we have R and RO,
to have a dedicated Reset Output Event ?

right ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this was what I wanted to point out. But as I do not really understand what the block is doing and what you need it for it is hard for me to say what a good design is.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traffic Light Example:
"Austria"
image

"International"
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azoitl as said,
a all-purpose Seqence control,
avoiding everybody must go the C++ way for simple Sequences.

Pneumatic, Hydraulic, Traffic Light, etc..

also add a State for reseting the Counter to 0 on Reset.
…tput.

- Refactored event names in EventOutputs section
- Changed timing values to INF_TIME in InputVars section
- Added new event "RO" with associated variables in EventOutputs section
@franz-hoepfinger-4diac
Copy link
Author

@azoitl
sequence_ET_04.fbt
i have adjusted this one now.
if OK, i will change all to this Schema.

is more 61499-ish.

Thanks,
Franz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants