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

Segment tag number error #47

Closed
roberthadow opened this issue May 4, 2024 · 4 comments
Closed

Segment tag number error #47

roberthadow opened this issue May 4, 2024 · 4 comments

Comments

@roberthadow
Copy link

Update docs with troubleshooting hints for "Segment tag number error."

While the underlying user error may be common to all NEC2 applications, the error message appears to be unique. A sentence or two in the user manual is easy; a hint in the application error message might be more work.

In the mean time, the user is prevented from saving his or her work, which may be substantial.

@KJ7LNW
Copy link
Owner

KJ7LNW commented May 4, 2024

Can you provide the .NEC file which generated this error?

@KJ7LNW
Copy link
Owner

KJ7LNW commented May 4, 2024

In the mean time, the user is prevented from saving his or her work, which may be substantial.

Calculations cannot run unless the .NEC file has been saved. Thus, as far as I can tell, it is not possible to get this error unless the file has been saved. If you believe this assessment is incorrect, then please provide a step-by-step procedure to generate the error in such way that the file on disk differs from the file in the editor.

@roberthadow
Copy link
Author

This file, generated within the application, produces "Segment tag number error": Moxon240503.nec. [attached with ".txt" extension. Apparently, it did save, even though when I clicked the Save icon, I got the error, implying that the command had not completed. If I had looked at the file characteristics, I would have seen that the OS knew it had been recently modified.

Another file, created outside the application, produces "Segment data error, zero-length line? See console." Moxon240504.nec

If we can capture this class of issue--stupid user tricks and obscure error messages--we can add text to the user manual written once/read many until the app or the error message changes. This is work I for which I would respond to a Help Wanted ad.

Moxon240504.nec.txt
Moxon240503.nec.txt

@KJ7LNW
Copy link
Owner

KJ7LNW commented May 5, 2024

Unfortunately NEC2 tries to parse your input and then calculates segment sizes, so it cannot always produce a meaningful error (this is an NEC2 problem, not an xnec2c problem per se). If you run xnec2c from the command line it may provide more information about the error that is not show in the pop-up window (like tag number).

  • In Moxon240503.nec.txt, your EX tag tells it to excite segment-10 of tag-1, but tag-1 only has one segment defined:
    • GA 1 1 ...
    • EX 0 1 10 ...

Additionally, you have two excitations (EX) defined. I believe that this is acceptable, for example you might have expectations on multiple segments at different phases in some antenna geometries. However, if you are just getting started that I recommend sticking to a single excitation line. The console output shows the following:

[err] no segment has an itag of 1
[err] Stop: Segment tag number error
  • In Moxon240504.nec.txt, your GS tag is all zeros, so it scales the GA tag-1 line to nothing, thus creating a zero length line segment(s). The console output shows the following:
[err] segment data error: tag=1 si=0.000000, bi=0.000000
[err] Stop: Segment data error, zero-length line?  See console.

The official an EC to documentation is available here:

These are the references that I used to diagnose the errors that your geometry generated:

You are correct in that the graphical error could be more meaningful by also displaying the console errors in graphical output. If the Stop() function were to be refactored to support variable length arguments, then console warnings could be merged into graphical warnings, and thus be slightly more verbose at the UI. If you have some background in C programming then it would be pretty easy to convert Stop() into something that supports variable length arguments:

xnec2c/src/utils.c

Lines 91 to 93 in 994927d

/* Does the STOP function of fortran but with a warning dialog */
int
Stop( char *mesg, int err )

I opened issue #48 if that is something that you would like to tackle with a pull request, as I do not know when I will get to that. I am of course open to any means of making this program more accessible to users and improvements are welcome.

KJ7LNW pushed a commit that referenced this issue May 5, 2024
This attempts to address #47 by making it more clear what the problem may be.
@KJ7LNW KJ7LNW closed this as completed Jun 9, 2024
KJ7LNW pushed a commit that referenced this issue Aug 14, 2024
This attempts to address #47 by making it more clear what the problem may be.
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

No branches or pull requests

2 participants