Run - Extends SMath Studio with the ability to run other worksheets in background - Messages

#1 Posted: 4/12/2016 2:46:51 PM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

SMath Studio compatibility SMath Viewer compatibility mono compatibility

extension page Sources MIT license


  • installation: SMath Studio: Tools > Plugins... > Online Gallery (be sure to have the "Exclude beta-versions" unchecked);
  • documentation: (beta) Run Example.7z (4 KiB) downloaded 244 time(s)..


>>> PLEASE REPORT IN THIS TOPIC ANY ISSUE, MORE DETAILED AS POSSIBLE <<<
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
5 users liked this post
sergio 4/12/2016 3:41:00 PM, ElSid 4/12/2016 4:35:00 PM, frapuano 4/12/2016 4:49:00 PM, Вячеслав Мезенцев 4/13/2016 1:14:00 AM, Kemili 4/13/2016 1:38:00 PM
#2 Posted: 4/12/2016 4:09:25 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

Will this allow us to transfer data? SWEET!
Only thing better would be not needing to use data propagation between the worksheets (e.g. using rfile,
wfile, importData, exportData, ...).
#3 Posted: 4/13/2016 2:21:48 PM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

Wrote

Will this allow us to transfer data? SWEET!


Is more targeted to process data "remotely"; data transfer is driven by existing functions (also include());

Wrote

Only thing better would be not needing to use data propagation between the worksheets (e.g. using rfile, wfile, importData, exportData, ...).


I think the only other way, in the scenario drawn in the example of the first post, would be to transfer data via functions, that is not a feasible way as for now.

Also, I have to improve the log system to better recognize if there are errors in the target worksheets.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Posted: 4/15/2016 5:12:30 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

How is this different than "Include" plug in by Uni?

#5 Posted: 4/16/2016 12:39:42 PM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

Wrote

How is this different than "Include" plug in by Uni?



Mainly:

include() loads the SMath variables/functions from the target worksheet into the one in use, while in Run() each worksheet is indipendent;
include() can't run non-math regions (ComboBoxList, etc...) while Run() execute everything;
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#6 Posted: 8/27/2016 2:28:06 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: User

Wrote

  • requirements: SMath Studio 0.98.5935 or later;
  • installation: SMath Studio: Tools



  • Problem in 98.6081?

    Run error.png
    Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
    #7 Posted: 8/27/2016 8:48:06 AM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Hello collab ndtma,

    Don't take my comment bad. Your snippets are always blurry [not comfortable].
    You can "PrintScreen" paste in Paint to select the portion. That results in
    huge BMP... then reduce to 256 via IrfanView: superfreeware of multiuse ...
    mostly: sharpen image, superbe Lanczos zoon [square/rectangular] gray/color
    images ++++ .
    I use this technique as well as capture a selected region from WinGrab
    [freeware]. Wingrag has more options to reduce 256 colors, in many difficult
    cases of better quality than IrfanView, though is does not apply to Smath snippets.

    Cheers, Jean
    #8 Posted: 8/27/2016 10:10:59 AM
    NDTM Amarasekera

    NDTM Amarasekera

    130 likes in 352 posts.

    Group: User

    Hello Jean,

    Thanks for your valuable suggestions.
    Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
    #9 Posted: 8/27/2016 10:29:53 AM
    Davide Carpi

    Davide Carpi

    1417 likes in 2873 posts.

    Group: Moderator

    Wrote

    Problem in 98.6081?



    Hello ndtma,

    yes, seems there are isSies with the process handle. I'm looking to find the cause and if I can solve it
    If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
    #10 Posted: 8/29/2016 1:05:21 PM
    Davide Carpi

    Davide Carpi

    1417 likes in 2873 posts.

    Group: Moderator

    Issue found.


    edit: fixed in SS 0.98.6179
    If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
    #11 Posted: 11/1/2018 3:30:04 PM
    Kyle Sullivan

    Kyle Sullivan

    0 likes in 7 posts.

    Group: User

    Hi Davide, I created my own example with a 3x3 excel table and it takes about 6 seconds for the "Run" function to execute each row of test data during the for loop. The smath sheet it's running contains 2 variables multiplied together and output as a variable 'd'. Your entire example runs in 22 seconds, with definitely a bit more complexity, but not much. Any ideas here? I'd like to run 400 rows of data (load cases for different members) through a calc sheet and collect the results, just like you've done (except only one calc sheet, not 3 like you've done).

    thx!

    20181101-001874 screenshot.png
    #12 Posted: 11/2/2018 7:24:46 AM
    Davide Carpi

    Davide Carpi

    1417 likes in 2873 posts.

    Group: Moderator

    Currently each Run function triggers a new instance of SMath Studio; this means that all the initialization process must be done every time, rising the execution time. What you can try is to change the logic to start a single run with multiple worksheets, and init/finalize each loop step in a dedicated file.

    new loopSheet.sm
    2018-11-02 12_24_53-Window.png

    initCalc.sm
    2018-11-02 11_23_04-Window.png

    handleCalcResults.sm
    2018-11-02 11_23_10-Window.png
    If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
    1 users liked this post
    Kyle Sullivan 11/2/2018 1:55:00 PM
    #13 Posted: 11/2/2018 2:32:57 PM
    Kyle Sullivan

    Kyle Sullivan

    0 likes in 7 posts.

    Group: User

    Thanks for the response Davide.

    So I went ahead and tried out your idea, it does solve the only 'running' once issue and finishes the script in 6 seconds no matter what.

    But now I have the issue where the Run(exec) command does not seem to be running all the scripts in the exec matrix, or somehow it's only saving the first 'calcResults' in 'allResults'. That said, I was successful in manually looping the 3 sheets, so I thin something is going on incorrectly in the run(exec) line.

    You can see what I did in the gifs below if you open them full size in a new tab..

    Thoughts?

    Calc completed successfully by manually looping the 3 sheets:

    Manual loop method works

    Calc running with loop sheet, only records first row result:

    Calc running with loop sheet
    #14 Posted: 11/2/2018 3:52:52 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Wrote

    so I think something is going on incorrectly in the run(exec) line.


    That I don't understand the idea/purpose of run does not indicate it is useless.
    Do you mean run would calculate in a cash of some sort a selection of work sheets
    and then would show all calculated by clicking "Open file" ?

    #15 Posted: 11/2/2018 6:21:03 PM
    Alvaro Diaz Falconi

    Alvaro Diaz Falconi

    992 likes in 1674 posts.

    Group: User

    Wrote

    Thanks for the response Davide.
    ...
    You can see what I did in the gifs below if you open them full size in a new tab..

    Thoughts?
    ...



    Hi K. Gif shows that you modify iniCalc.sm (disabling some calcs) but don't save it, so others SMath files read the original iniCalc.sm, not the modified. Is this the issue or I'm are not understanding something else?

    Best regards.
    Alvaro.
    #16 Posted: 11/3/2018 12:05:52 AM
    Kyle Sullivan

    Kyle Sullivan

    0 likes in 7 posts.

    Group: User

    I reran it after saving everything and the same thing happened..here's a non-gif image and the files. I guess Davide's example ran fine so I should be able to figure this out haha. I'm currently troubleshooting so stay posted

    testCalc.sm (3 KiB) downloaded 86 time(s).
    handleCalcResults.sm (5 KiB) downloaded 79 time(s).
    initCalc.sm (9 KiB) downloaded 81 time(s).
    input.xlsx (8 KiB) downloaded 73 time(s).
    loopSheet.sm (10 KiB) downloaded 77 time(s).

    20181102-001882 screenshot.png


    This gave me what I want..
    Run(exec)
    Run(exec)
    Run(exec)
    20181102-001887 screenshot.png

    I quit, there's something with run() only running files if they have a different name, or the Run(exec) is called again (like above). I created a new, simpler example.. Below shows that if exec is defined with 3 separate but identical calc.sm files (calc1.sm, calc2.sm, etc) then run(exec) will run all 3 files and the allResults var is fully populated. If I define exec as a vector with all the same calc.sm files then it won't work and allResults will just end up with the first result.

    20181102-001888 screenshot.png

    calcSheet.sm (5 KiB) downloaded 77 time(s).
    loopSheet.sm (5 KiB) downloaded 73 time(s).
    #17 Posted: 11/3/2018 3:46:07 PM
    Davide Carpi

    Davide Carpi

    1417 likes in 2873 posts.

    Group: Moderator

    You are right, I have to investigate it.
    If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
    #18 Posted: 11/3/2018 8:54:20 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Wrote

    I reran it after saving everything and the same thing happened



    Document calcSheet calculates nothing [no maths/formula(s)/result(s)]
    Certainly no gadget will retrieve something from nothing, is it ?

    If calcSheet calculates something, save to file and retrieve from
    any other Smath work sheet. On the other hand, you may save formula(s)
    in calcsheet and retrieve from any other Smath work sheet then modify
    the formula(s) in the working document ... per say change parameters.

    You say nothing about what you have in mind.
    #19 Posted: 11/3/2018 10:54:49 PM
    Kyle Sullivan

    Kyle Sullivan

    0 likes in 7 posts.

    Group: User

    Wrote

    Document calcSheet calculates nothing [no maths/formula(s)/result(s)]



    I know in this case calcSheet.sm is not "calculating" anything. The whole problem we're trying to solve is looping a large data set through the calcSheet, row by row, which processes the data with whatever formulas we want, in this case it's 1*data my previous example actually took one of the values in the 'current row' and multiplied it by 3. I just wanted to make the example here as simple as possible so we could hone in on the problem.
    #20 Posted: 11/4/2018 12:38:23 PM
    Jean Giraud

    Jean Giraud

    983 likes in 6866 posts.

    Group: User

    Wrote

    I know in this case calcSheet.sm is not "calculating" anything. The whole problem we're trying to solve is looping a large data set through the calcSheet, row by row, which processes the data with whatever formulas we want, in this case it's 1*data my previous example actually took one of the values in the 'current row' and multiplied it by 3.I just wanted to make the example here as simple as possible so we could hone in on the problem.


    Simply attach the basic project and describe the next part of the project.
    As you explain, it looks weird from maybe baby simple.

    MatrixStuff.PNG

    • New Posts New Posts
    • No New Posts No New Posts