How to make Variable Input Double-Press SUBprogram ?

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

How to make Variable Input Double-Press SUBprogram ?

Beitrag von FeuerTischler » 11 Jan 2012, 18:43

Hallo,

i'm a newbie (Neuling?) to the FT-Computing line and am now playing around with ROBOpro and it's graphic user interface.

i've created a 3-level elevator model and succeeded in moving the lift to each floor based on a switch pressed on each level like so;
Bild

the subprogram "waitPress" shown above is detailed like this;
Bild


now; further to this, i've created a subprogram for a double-press switch activation; meaning, you have to press the switch twice to activate it - like so;
Bild


and now; i would like to combine the "double-press" into the elevator program, where one presses the switch twice before the elevator is called - i would like to use a variable input block but i'm having trouble in linking the first switch-press and the second switch-press, as the program is now; the two switches are not cross-checked - like so;
Bild

how can i make sure the 2nd switch-press HAS TO BE the SAME as the first one ?
how should i make the program logic flow ?

(i hope the picture and the question is clear enough, thanks in advance for any advice !)
give them NOT fish, but TEACH them HOW TO

vleeuwen
Beiträge: 1609
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von vleeuwen » 11 Jan 2012, 21:01

Like it is always with computer programming, a flow chart is only a summary of your problem analysis, your design considerations and your construction of the solution. It the case of RoboPro is the perspective a "work flow oriented way" (with data flow for the inter process synchronization).
Without a description of these parts it is difficult to help you with these more complex problems.

Ask yourself the question what is work flow?
On which moments the data will be inspected by the worker?
The position of the worker in the flow is leading!

You have only one process so there is only one worker following the flow.
What is the roll of the data flow?

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1845
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von Dirk Fox » 12 Jan 2012, 17:25

Hello Bruce,

the easiest and most effective way to control an elevator with RoboPro is by implementing parallel processes: one for the elevator itself and one for each floor.
To get an impression on how you could realise this with RoboPro, take a look at this model and program: http://www.ftcommunity.de/categories.php?cat_id=2040

Regards,
Dirk

vleeuwen
Beiträge: 1609
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von vleeuwen » 12 Jan 2012, 21:31

Hi Dirk,
Could you explain why?
What are you design considerations?

What is the task of the worker on the elevator? The same question for the owrkers on the different floors.

Why it is the most effective way?

Which worker is making the decission about the stop with the highest priority?

Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von FeuerTischler » 13 Jan 2012, 03:11

thank you both for your responses, from a general 'design approach' to a specific example even !

however, my objective is not the elevator, but the subprogram itself; i understand there are "many roads to Rome", and my elevator program is actually too simplistic for 'real world application' - however, i'm still trying to get used to the ROBOpro program blocks and whether there is one function that i have not learned, specifically regarding variable inputs of a switch/taster.

as i have outlined, i have succeeded in making a flow chart for a query of 'double-press' (within 2 seconds), but now want to convert that into a subprogram which will accept (as input) a switch program block (eg. "I6", "I7", etc).

is this at all possible, or do i just have to draw the 'double-press' algorithm for each specific pushbutton switch ?

i have a feeling it has to do with the OR block logical operator and how to "lock it to one pushbutton switch" before feeding it to the subprogram.



to explain it very simplistically;

A) i have succeeded in doing this:
pushbutton switch I6 -> var 'request' = 2
pushbutton switch I7 -> var 'request' = 1
pushbutton switch I8 -> var 'request' = 0

B) and also made a subprogram to wait for a "double-press" of a pushbutton switch.

my objective is:
pushbutton switch I6 twice -> var 'request' = 2
pushbutton switch I7 twice -> var 'request' = 1
pushbutton switch I8 twice -> var 'request' = 0

*however* when i try to combine the two flowcharts, i get
ANY pushbutton switch, then pushbutton switch I6 -> var 'request' = 2
ANY pushbutton switch, then pushbutton switch I7 -> var 'request' = 1
ANY pushbutton switch, then pushbutton switch I8 -> var 'request' = 0

how do i arrange the flowchart to proceed ONLY when first pushbutton switch and second one is the same ?
give them NOT fish, but TEACH them HOW TO

vleeuwen
Beiträge: 1609
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von vleeuwen » 13 Jan 2012, 11:12

@FeuerTischler

A small question to familiarize my self with the nature of yoyr problem, what is your experiances with programming?

Flow chart is a general term.
In this case the flow chart concerns "work flow"=> a worker is following the route, he stop on the nodes and execute the commands. There are no events or notifications. The worker has full control, he collects data or he sends out a command.
A flow chart which concerns "message flow" has a complete different meaning.

So what is the meaning of a subprogram?
A subprogram can mean two thinks:
1) contains a part of a workflow (with the entry and exit elements).
2) contains a work process (with a start and stop process element).

What is for example your subprogram "waitPress" doing?
The worker inspects I6, in case he sees a "1", he sets request to "2" and repeat this until I6 change into "0".
The speed with which the worker is running depends of the processor speed.
You can imaging that the worker will pass this route very often.

What is now the meaning of request "0", during the passage by the worker of I6, I6=0, of I7, I7=0 and the next passage I6=I7=I8=0.
The value of the I6,7,8 OR operation will be inspected by the worker on a different moment.

Your program looks for me a little bit instable because the values of the switches can change on every moment.

I prefer:
1) The worker collects the values of the switches and preserve them into variables.
2) The worker process this data (variables) and determinates the continuation (algoritme).
3) The worker went on to execute the algoritme with the preserve data.
end

Benutzeravatar
FeuerTischler
Beiträge: 13
Registriert: 18 Okt 2011, 04:02

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von FeuerTischler » 14 Jan 2012, 05:35

@vleeuwen

thank you again for your response and the approach from a "bigger picture" viewpoint.

i realise your replies are probably more conceptual based on what my signature is !

however, in this case, i'm not trying to learn to apply the tools yet, but how to use them first, basically learning "what is a hammer", "what is a screwdriver" - still figuring out what they can do, rather than "how do i make a chair" with them.


my programming background is basically HTML and some basic PHP - meaning website-programming.

with FT, i am now trying to "get back" from cyberspace into the 'real world' - by "programming hardware".

i'm not sure if this is a realistic attempt, having ZERO experience with electrical engineering, i don't know how to use a multimeter and wouldn't know the first thing about soldering connections on a PCB !!

that is why FT is appealing to me, because i can just plug in the connections and "only need to know" that 8 inputs & 8 outputs (4 motors) can be manipulated using ROBOpro (i still use the ROBO Interface and do not have the TX controller. [yet?])


anyway, i have since found the solution to my problem, i was tangled up in sorting out the output (variable "request") within the subprogram when it is actually a separate process to the "double-press" routine/subroutine/subprogram.

in other words, the "new subprogram" should replace ONLY the 'Digital Branch' block and therefore is a subprogram of waitPress, and not a replacement of it.

so the 'Digital Branch' block is now replaced by my 'double-press' subprogram, like so;
Bild

and finally used in the waitPress subprogram, like so;
Bild

and this achieves what i was trying to do !
give them NOT fish, but TEACH them HOW TO

vleeuwen
Beiträge: 1609
Registriert: 31 Okt 2010, 22:23
Wohnort: Enschede (NL)
Kontaktdaten:

Re: How to make Variable Input Double-Press SUBprogram ?

Beitrag von vleeuwen » 15 Jan 2012, 00:24

@FeuerTischler

Programming web pages in HTML differs a lot from work flow or message flow oriented programming. HTML has more to do with adding meta information to flat text. The more extended XML-technology with the XSLT and XSL-FO are containing some powerful program features. HTML is incorporated into the XML-technology.

For me it is not so difficult to produce a solution to your problem in a Work flow oriented way.
But this will not help you so much in mastering the concept of work flow oriented programming.
I agree with you that the RoboPro manual does not contains a method about:
"How to work with the work flow concept?"
The concept itself is not so difficult to understand. A worker is walking over a line and executes on each node the instruction which is part of that node.

In case a node has a data input, the worker reads the actual data and us it to execute the instruction.
There exist for example a node that do the worker reads the data very often until the worker notice a change from "1" to "0". After this change the worker continues to follow walk over the line to the next node.
The worker is always in control, he is reading. He is not sleeping until an incoming events wakes him up.

The learning material is missing in the RoboPro manual.

My questions had only as objective to help you with discovering what you program really is doing.
I hope that it will help you with designing new programs in the near future.

Antworten