Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
51dc54ab
Commit
51dc54ab
authored
Oct 15, 2019
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GeCurve, read of csv file added
parent
7efec626
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
18 deletions
+63
-18
xtt/lib/ge/src/ge_curve.cpp
xtt/lib/ge/src/ge_curve.cpp
+63
-18
No files found.
xtt/lib/ge/src/ge_curve.cpp
View file @
51dc54ab
...
@@ -1611,6 +1611,10 @@ int GeCurve::read_file(char* filename)
...
@@ -1611,6 +1611,10 @@ int GeCurve::read_file(char* filename)
pwr_tFileName
fname
;
pwr_tFileName
fname
;
int
i
,
j
;
int
i
,
j
;
int
skip_line
;
int
skip_line
;
int
pyformat
=
0
;
pwr_tTime
time
,
start_time
;
pwr_tDeltaTime
dt
;
pwr_tStatus
sts
;
dcli_translate_filename
(
fname
,
filename
);
dcli_translate_filename
(
fname
,
filename
);
...
@@ -1626,6 +1630,13 @@ int GeCurve::read_file(char* filename)
...
@@ -1626,6 +1630,13 @@ int GeCurve::read_file(char* filename)
fprintf
(
stderr
,
"Error! Cannot read curve file: '%s'!
\n
"
,
fname
);
fprintf
(
stderr
,
"Error! Cannot read curve file: '%s'!
\n
"
,
fname
);
return
0
;
return
0
;
}
}
if
(
strncmp
(
line
,
"Time,"
,
5
)
==
0
)
pyformat
=
1
;
if
(
pyformat
)
nr
=
dcli_parse
(
line
,
","
,
""
,
(
char
*
)
item_str
,
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
else
nr
=
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
item_str
,
nr
=
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
item_str
,
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
if
(
nr
==
0
)
{
if
(
nr
==
0
)
{
...
@@ -1667,6 +1678,39 @@ int GeCurve::read_file(char* filename)
...
@@ -1667,6 +1678,39 @@ int GeCurve::read_file(char* filename)
j
=
0
;
j
=
0
;
while
(
dcli_read_line
(
line
,
sizeof
(
line
),
fp
))
{
while
(
dcli_read_line
(
line
,
sizeof
(
line
),
fp
))
{
if
(
pyformat
)
{
dcli_parse
(
line
,
","
,
""
,
(
char
*
)
item_str
,
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
skip_line
=
0
;
for
(
i
=
0
;
i
<
cd
->
cols
+
1
;
i
++
)
{
if
(
i
==
0
)
{
sts
=
time_FormAsciiToA
(
item_str
[
i
],
HUNDRED
,
0
,
&
time
);
if
(
ODD
(
sts
))
{
if
(
j
==
0
)
{
start_time
=
time
;
cd
->
x_data
[
i
][
j
]
=
0
;
}
else
{
time_Adiff
(
&
dt
,
&
time
,
&
start_time
);
time_DToFloat64
(
&
cd
->
x_data
[
i
][
j
],
&
dt
);
}
nr
=
1
;
}
else
nr
=
0
;
}
else
nr
=
sscanf
(
item_str
[
i
],
"%lf"
,
&
cd
->
y_data
[
i
-
1
][
j
]);
if
(
nr
!=
1
)
{
if
(
i
==
0
)
{
printf
(
"Unreadble line %d
\n
"
,
j
);
skip_line
=
1
;
cd
->
rows
[
0
]
--
;
break
;
}
else
cd
->
y_data
[
i
-
1
][
j
]
=
0
;
}
}
}
else
{
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
item_str
,
dcli_parse
(
line
,
" "
,
""
,
(
char
*
)
item_str
,
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
sizeof
(
item_str
)
/
sizeof
(
item_str
[
0
]),
sizeof
(
item_str
[
0
]),
0
);
skip_line
=
0
;
skip_line
=
0
;
...
@@ -1685,6 +1729,7 @@ int GeCurve::read_file(char* filename)
...
@@ -1685,6 +1729,7 @@ int GeCurve::read_file(char* filename)
cd
->
y_data
[
i
-
1
][
j
]
=
0
;
cd
->
y_data
[
i
-
1
][
j
]
=
0
;
}
}
}
}
}
if
(
skip_line
)
if
(
skip_line
)
continue
;
continue
;
j
++
;
j
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment