Bug: round function causes compile error.

Moderator: Benj

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Bug: round function causes compile error.

Postby AbhijitR » Sat Mar 28, 2020 1:51 pm

Hello! Martin

Following the post regarding rounding a real number, everything worked well on the 19th of March, I mean compilation and running on the hardware, after that day I was not able to work on the project due to crises, today when I opened the project I received the popup for updates, as usual I did the complete update and restart FC.

Now I am receiving an error report when I compile (the same chart without any changes) and the error points out to

19477: FCV_DIFF_PRES_VAL_CAL_REAL = {(long)(if (FCV_DIFF_PRES_VAL_CAL_REAL >= 0.0)(FCV_DIFF_PRES_VAL_CAL_REAL) + 0.5; else (FCV_DIFF_PRES_VAL_CAL_REAL) - 0.5)};

If I have not mistaken this is regarding the rounding function, after I disabled all the rounding functions at all the four different locations and compiled with success. Is this something to do with todays update? can you suggest where it is going wrong? can I uninstall todays updates and validate? so many doubts....

Thank you.

Regards
Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

Re: Division by 10 easy?

Postby medelec35 » Sat Mar 28, 2020 3:11 pm

I have updated my version to the latest.
Can you post the flowchart, so I can see if it compiles for me or not?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Division by 10 easy?

Postby AbhijitR » Sat Mar 28, 2020 3:27 pm

Hi!

Thanks for the reply, I have attached a part of the FC, the calculation block in the beginning of the loop if you disable the round off line it compile well on my machine.

Hear you soon.

Abhi
Attachments
LPTR_28-03-2020_Martin.fcfx
(42 KiB) Downloaded 7 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

Re: Division by 10 easy?

Postby medelec35 » Sat Mar 28, 2020 11:30 pm

It does look like there is an issue with the

Code: Select all

round
function
What about replacing the

Code: Select all

round
with

Code: Select all

ceil
?
So you have

Code: Select all

Diff_Pres_Val_Cal_Real = ceil (Diff_Pres_Val_Cal_Real)
These users thanked the author medelec35 for the post:
AbhijitR (Sun Mar 29, 2020 6:40 am)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Division by 10 easy?

Postby AbhijitR » Sun Mar 29, 2020 6:40 am

Hello! Martin
good morning

medelec35 wrote: with

Code: Select all

ceil
?


You are a genius, I don't know the trick but the term/word "ceil" did it, now the chart compile with success.

Thank you again, do take care, stay safe.

Regards
Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

Re: Division by 10 easy?

Postby medelec35 » Sun Mar 29, 2020 10:56 am

You're welcome.
Even though project now compiles, are you getting required results with your hardware?
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Division by 10 easy?

Postby AbhijitR » Sun Mar 29, 2020 5:26 pm

Hi!

medelec35 wrote:Even though project now compiles, are you getting required results with your hardware?


Yes you are again right Martin, no doubt the chart compile but the function is not rounding the figures as it should, what can be done? any idea.

Thank you.

Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8826
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3721 times
Contact:

Re: Division by 10 easy?

Postby medelec35 » Sun Mar 29, 2020 6:06 pm

Until the bug is fixed.
Can you try the attache flowchart on your hardware?
I have split the topic and moved to the bugs section.
Attachments
LPTR_28-03-2020_Martin2.fcfx
(42.7 KiB) Downloaded 6 times
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Bug: round function causes compile error.

Postby AbhijitR » Mon Mar 30, 2020 8:32 am

Hello! Martin

Thanks for taking the correct action.

I tried to run the chart which you last posted, it opened but with one warning about created in new version, so I uninstalled the old version and download the version 8.2 (the big download button) and installed, I also tried to install the patch file and hotfix but received one more error from windows installer so I let it for the moment.

Now I am able to open the recent chart which you posted but unfortunately it do not round off for e.g. 38.25 to 38 but it will round off to 39

I hope someone from Matrix team will also check about the round off function not working or may be I am doing some mistake.

Thank you very much again, hear you soon.

Abhi
Attachments
Version8.2.PNG
Version8.2.PNG (31.54 KiB) Viewed 451 times
My_Present_FC8_Version_30-03-2020.PNG
My_Present_FC8_Version_30-03-2020.PNG (117.59 KiB) Viewed 451 times
Error_Window_Patch_File.PNG
Error_Window_Patch_File.PNG (14.27 KiB) Viewed 451 times

User avatar
LeighM
Matrix Staff
Posts: 2014
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 691 times
Contact:

Re: Bug: round function causes compile error.

Postby LeighM » Mon Mar 30, 2020 11:45 am

Hi Abhi,
Please try the attached to go into
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC
Attachments
PIC_CAL_Float.c
(6.63 KiB) Downloaded 6 times
These users thanked the author LeighM for the post:
AbhijitR (Mon Mar 30, 2020 1:40 pm)
Rating: 5%
 

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Bug: round function causes compile error.

Postby AbhijitR » Mon Mar 30, 2020 1:16 pm

Hi! Leigh

Thank you to address this problem quickly, as per your instructions I deleted the existing *.c file and paste the one you posted, restart FC, compile successfully and run on the hardware too now the rounding function works like before, I will take some more trials and keep you posted but I am sure it works like before.

Thank you to Martin too for creating the new post.

Take care, stay safe.

Abhi
These users thanked the author AbhijitR for the post:
Benj (Mon Mar 30, 2020 9:43 pm)
Rating: 5%
 

User avatar
AbhijitR
Posts: 131
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 185 times
Been thanked: 48 times
Contact:

Re: Bug: round function causes compile error.

Postby AbhijitR » Tue Mar 31, 2020 6:37 am

Hello! Leigh
good morning

Following your last post regarding replacing the PIC_CAL_Float.c notepad file from the C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC location with the notepad file which you provided in that post, everything works well i.e. simulation, compilation and also hardware.

But once I open the same chart again fresh, I am prompted to install the new updates, after completing the update process, same compilation error occurs again. I again followed the same process of deleting and replacing, everything works well.

I tried to compare both the notepad files, the one you gave and the one which I receive after update, there is some difference, I have attached the comparison for your reference, the one highlighted in red is your notepad file and the one in green is from the update. To be honest I do not understand what is the difference (not my cup of tea), :(

Today morning I was again prompted to update but I have skipped the same for the moment, I will do that once the file in update is corrected.

Thank you, hear you soon.

Abhi
Attachments
Update_Prompt_31-03-2020.PNG
Update_Prompt_31-03-2020.PNG (13.37 KiB) Viewed 420 times
Notepad compair.PNG
Notepad compair.PNG (38.88 KiB) Viewed 420 times

User avatar
LeighM
Matrix Staff
Posts: 2014
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 691 times
Contact:

Re: Bug: round function causes compile error.

Postby LeighM » Tue Mar 31, 2020 8:37 am

I have skipped the same for the moment, I will do that once the file in update is corrected.

Yes, please wait until the new corrected version is available in the update system,
this might take some time as we have limited access to the office at the moment.
Thanks!
Leigh