Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EPlanVisualizer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
嵇洲
EPlanVisualizer
Commits
5842d780
Commit
5842d780
authored
Mar 18, 2026
by
fenghen777
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 提交所有待定修改
parent
22002153
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
123 additions
and
10 deletions
+123
-10
ComponentEditor.jsx
src/components/ComponentEditor/ComponentEditor.jsx
+74
-1
ProjectPanel.module.css
src/components/ProjectPanel/ProjectPanel.module.css
+2
-0
PropertiesPanel.jsx
src/components/PropertiesPanel/PropertiesPanel.jsx
+10
-0
SimResultsModal.jsx
src/components/SimResults/SimResultsModal.jsx
+1
-1
constants.js
src/utils/constants.js
+19
-0
modelMapping.js
src/utils/modelMapping.js
+4
-0
modelicaExporter.js
src/utils/modelicaExporter.js
+13
-8
No files found.
src/components/ComponentEditor/ComponentEditor.jsx
View file @
5842d780
...
@@ -458,7 +458,7 @@ export default function ComponentEditor() {
...
@@ -458,7 +458,7 @@ export default function ComponentEditor() {
onChange=
{
(
e
)
=>
{
onChange=
{
(
e
)
=>
{
const
params
=
[...
editingTemplate
.
params
];
const
params
=
[...
editingTemplate
.
params
];
const
newType
=
e
.
target
.
value
;
const
newType
=
e
.
target
.
value
;
const
autoDefault
=
newType
===
'bool'
?
true
:
newType
===
'int'
?
0
:
newType
===
'real'
?
0
:
''
;
const
autoDefault
=
newType
===
'bool'
?
true
:
newType
===
'int'
?
0
:
newType
===
'real'
?
0
:
newType
===
'select'
?
''
:
''
;
params
[
i
]
=
{
...
params
[
i
],
type
:
newType
,
defaultValue
:
autoDefault
};
params
[
i
]
=
{
...
params
[
i
],
type
:
newType
,
defaultValue
:
autoDefault
};
updateEditing
({
params
});
updateEditing
({
params
});
}
}
}
}
...
@@ -467,6 +467,7 @@ export default function ComponentEditor() {
...
@@ -467,6 +467,7 @@ export default function ComponentEditor() {
<
option
value=
"int"
>
int
</
option
>
<
option
value=
"int"
>
int
</
option
>
<
option
value=
"real"
>
real
</
option
>
<
option
value=
"real"
>
real
</
option
>
<
option
value=
"string"
>
string
</
option
>
<
option
value=
"string"
>
string
</
option
>
<
option
value=
"select"
>
select
</
option
>
</
select
>
</
select
>
</
div
>
</
div
>
<
div
>
<
div
>
...
@@ -498,6 +499,21 @@ export default function ComponentEditor() {
...
@@ -498,6 +499,21 @@ export default function ComponentEditor() {
<
option
value=
"true"
>
true
</
option
>
<
option
value=
"true"
>
true
</
option
>
<
option
value=
"false"
>
false
</
option
>
<
option
value=
"false"
>
false
</
option
>
</
select
>
</
select
>
)
:
(
p
.
type
===
'select'
&&
p
.
options
?.
length
>
0
)
?
(
<
select
className=
{
styles
.
propInput
}
value=
{
String
(
p
.
defaultValue
??
''
)
}
style=
{
{
fontSize
:
10
}
}
onChange=
{
(
e
)
=>
{
const
params
=
[...
editingTemplate
.
params
];
params
[
i
]
=
{
...
params
[
i
],
defaultValue
:
e
.
target
.
value
};
updateEditing
({
params
});
}
}
>
{
p
.
options
.
map
(
opt
=>
(
<
option
key=
{
opt
.
value
}
value=
{
opt
.
value
}
>
{
opt
.
label
}
</
option
>
))
}
</
select
>
)
:
(
)
:
(
<
input
<
input
className=
{
styles
.
propInput
}
className=
{
styles
.
propInput
}
...
@@ -521,6 +537,63 @@ export default function ComponentEditor() {
...
@@ -521,6 +537,63 @@ export default function ComponentEditor() {
>
✕
</
button
>
>
✕
</
button
>
</
div
>
</
div
>
{
/* select 类型选项编辑 */
}
{
p
.
type
===
'select'
&&
(
<
div
style=
{
{
marginTop
:
4
,
padding
:
'6px 8px'
,
background
:
'rgba(99,102,241,0.06)'
,
borderRadius
:
4
,
border
:
'1px solid #2a2a3a'
}
}
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginBottom
:
4
}
}
>
<
span
style=
{
{
fontSize
:
9
,
color
:
'#888'
}
}
>
选项 (
{
(
p
.
options
||
[]).
length
}
)
</
span
>
<
button
style=
{
{
background
:
'none'
,
border
:
'1px solid #333'
,
borderRadius
:
3
,
color
:
'#6366f1'
,
fontSize
:
9
,
cursor
:
'pointer'
,
padding
:
'0 4px'
}
}
onClick=
{
()
=>
{
const
params
=
[...
editingTemplate
.
params
];
const
opts
=
[...(
params
[
i
].
options
||
[])];
opts
.
push
({
value
:
`opt${opts.length + 1}`
,
label
:
`选项${opts.length + 1}`
});
params
[
i
]
=
{
...
params
[
i
],
options
:
opts
,
defaultValue
:
params
[
i
].
defaultValue
||
opts
[
0
]?.
value
||
''
};
updateEditing
({
params
});
}
}
>
+ 添加
</
button
>
</
div
>
{
(
p
.
options
||
[]).
map
((
opt
,
oi
)
=>
(
<
div
key=
{
oi
}
style=
{
{
display
:
'grid'
,
gridTemplateColumns
:
'1fr 1fr auto'
,
gap
:
4
,
marginBottom
:
2
}
}
>
<
input
className=
{
styles
.
propInput
}
value=
{
opt
.
value
}
placeholder=
"值"
style=
{
{
fontSize
:
9
}
}
onChange=
{
(
e
)
=>
{
const
params
=
[...
editingTemplate
.
params
];
const
opts
=
[...(
params
[
i
].
options
||
[])];
opts
[
oi
]
=
{
...
opts
[
oi
],
value
:
e
.
target
.
value
};
params
[
i
]
=
{
...
params
[
i
],
options
:
opts
};
updateEditing
({
params
});
}
}
/>
<
input
className=
{
styles
.
propInput
}
value=
{
opt
.
label
}
placeholder=
"显示名"
style=
{
{
fontSize
:
9
}
}
onChange=
{
(
e
)
=>
{
const
params
=
[...
editingTemplate
.
params
];
const
opts
=
[...(
params
[
i
].
options
||
[])];
opts
[
oi
]
=
{
...
opts
[
oi
],
label
:
e
.
target
.
value
};
params
[
i
]
=
{
...
params
[
i
],
options
:
opts
};
updateEditing
({
params
});
}
}
/>
<
button
style=
{
{
background
:
'none'
,
border
:
'none'
,
color
:
'#666'
,
cursor
:
'pointer'
,
fontSize
:
10
,
padding
:
0
}
}
onClick=
{
()
=>
{
const
params
=
[...
editingTemplate
.
params
];
const
opts
=
(
params
[
i
].
options
||
[]).
filter
((
_
,
j
)
=>
j
!==
oi
);
params
[
i
]
=
{
...
params
[
i
],
options
:
opts
};
updateEditing
({
params
});
}
}
>
✕
</
button
>
</
div
>
))
}
</
div
>
)
}
</
div
>
</
div
>
))
}
))
}
</
div
>
</
div
>
...
...
src/components/ProjectPanel/ProjectPanel.module.css
View file @
5842d780
...
@@ -403,6 +403,8 @@
...
@@ -403,6 +403,8 @@
white-space
:
pre-wrap
;
white-space
:
pre-wrap
;
word-break
:
break-all
;
word-break
:
break-all
;
line-height
:
1.5
;
line-height
:
1.5
;
user-select
:
text
;
cursor
:
text
;
}
}
.logError
{
.logError
{
...
...
src/components/PropertiesPanel/PropertiesPanel.jsx
View file @
5842d780
...
@@ -182,6 +182,16 @@ export default function PropertiesPanel() {
...
@@ -182,6 +182,16 @@ export default function PropertiesPanel() {
<
option
value=
"true"
>
true
</
option
>
<
option
value=
"true"
>
true
</
option
>
<
option
value=
"false"
>
false
</
option
>
<
option
value=
"false"
>
false
</
option
>
</
select
>
</
select
>
)
:
pType
===
'select'
&&
p
.
options
?
(
<
select
className=
{
styles
.
input
}
value=
{
val
??
''
}
onChange=
{
(
e
)
=>
updateNodeParam
(
selectedNode
.
id
,
p
.
key
,
e
.
target
.
value
)
}
>
{
p
.
options
.
map
(
opt
=>
(
<
option
key=
{
opt
.
value
}
value=
{
opt
.
value
}
>
{
opt
.
label
}
</
option
>
))
}
</
select
>
)
:
(
)
:
(
<
input
<
input
className=
{
styles
.
input
}
className=
{
styles
.
input
}
...
...
src/components/SimResults/SimResultsModal.jsx
View file @
5842d780
...
@@ -97,7 +97,7 @@ export default function SimResultsModal({ csvData, modelName, onClose }) {
...
@@ -97,7 +97,7 @@ export default function SimResultsModal({ csvData, modelName, onClose }) {
},
[
headers
]);
},
[
headers
]);
const
xKey
=
headers
[
xIdx
]
||
'time'
;
const
xKey
=
headers
[
xIdx
]
||
'time'
;
const
variables
=
useMemo
(()
=>
const
variables
=
useMemo
(()
=>
headers
.
map
((
h
,
i
)
=>
({
name
:
h
,
index
:
i
})).
filter
((
_
,
i
)
=>
i
!==
xIdx
),
headers
.
map
((
h
,
i
)
=>
({
name
:
h
,
index
:
i
})).
filter
((
v
,
i
)
=>
i
!==
xIdx
&&
!
/
\.\b[
pn
]\b\.
/
.
test
(
v
.
name
)
),
[
headers
,
xIdx
]);
[
headers
,
xIdx
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
src/utils/constants.js
View file @
5842d780
...
@@ -196,6 +196,25 @@ export const DEVICE_CATEGORIES = [
...
@@ -196,6 +196,25 @@ export const DEVICE_CATEGORIES = [
{
key
:
'closed'
,
label
:
'初始状态'
,
type
:
'bool'
,
unit
:
''
,
defaultValue
:
false
},
{
key
:
'closed'
,
label
:
'初始状态'
,
type
:
'bool'
,
unit
:
''
,
defaultValue
:
false
},
],
],
},
},
{
code
:
1008
,
type
:
'signal_generator'
,
label
:
'信号发生器'
,
color
:
'#E040FB'
,
icon
:
'∿'
,
width
:
140
,
height
:
100
,
ports
:
[
{
id
:
'p-pos'
,
name
:
'V+'
,
side
:
'left'
,
position
:
0.5
,
type
:
'power'
,
connector
:
'p'
},
{
id
:
'p-neg'
,
name
:
'V-'
,
side
:
'right'
,
position
:
0.5
,
type
:
'power'
,
connector
:
'n'
},
],
params
:
[
{
key
:
'waveform'
,
label
:
'波形'
,
type
:
'select'
,
unit
:
''
,
defaultValue
:
'sine'
,
options
:
[
{
value
:
'sine'
,
label
:
'正弦波'
},
{
value
:
'square'
,
label
:
'方波'
},
],
},
{
key
:
'amplitude'
,
label
:
'幅值'
,
type
:
'real'
,
unit
:
'V'
,
defaultValue
:
5
},
{
key
:
'frequency'
,
label
:
'频率'
,
type
:
'real'
,
unit
:
'Hz'
,
defaultValue
:
50
},
{
key
:
'offset'
,
label
:
'直流偏置'
,
type
:
'real'
,
unit
:
'V'
,
defaultValue
:
0
},
],
},
],
],
},
},
{
{
...
...
src/utils/modelMapping.js
View file @
5842d780
...
@@ -46,6 +46,10 @@ const MODEL_MAP = {
...
@@ -46,6 +46,10 @@ const MODEL_MAP = {
portMap
:
{
'p-in'
:
'p'
,
'p-out'
:
'n'
},
portMap
:
{
'p-in'
:
'p'
,
'p-out'
:
'n'
},
controlVar
:
'closed'
,
// IdealSwitch.mo: parameter Boolean closed
controlVar
:
'closed'
,
// IdealSwitch.mo: parameter Boolean closed
},
},
signal_generator
:
{
modelName
:
'SignalGenerator'
,
portMap
:
{
'p-pos'
:
'p'
,
'p-neg'
:
'n'
},
},
// ===== 电气控制 =====
// ===== 电气控制 =====
terminal
:
{
terminal
:
{
...
...
src/utils/modelicaExporter.js
View file @
5842d780
...
@@ -155,7 +155,11 @@ export function exportToModelica(data, modelName = 'Circuit') {
...
@@ -155,7 +155,11 @@ export function exportToModelica(data, modelName = 'Circuit') {
(
td
?.
params
||
[]).
forEach
(
p
=>
{
(
td
?.
params
||
[]).
forEach
(
p
=>
{
const
rawVal
=
pv
[
p
.
key
];
const
rawVal
=
pv
[
p
.
key
];
if
(
rawVal
!=
null
&&
rawVal
!==
''
)
{
if
(
rawVal
!=
null
&&
rawVal
!==
''
)
{
// 下拉选择参数:加 Modelica 双引号
if
(
p
.
type
===
'select'
)
{
paramParts
.
push
(
`
${
p
.
key
}
="
${
rawVal
}
"`
);
// 布尔值直接透传 (Modelica 支持 true/false)
// 布尔值直接透传 (Modelica 支持 true/false)
}
else
{
const
lower
=
String
(
rawVal
).
toLowerCase
();
const
lower
=
String
(
rawVal
).
toLowerCase
();
if
(
lower
===
'true'
||
lower
===
'false'
)
{
if
(
lower
===
'true'
||
lower
===
'false'
)
{
paramParts
.
push
(
`
${
p
.
key
}
=
${
lower
}
`
);
paramParts
.
push
(
`
${
p
.
key
}
=
${
lower
}
`
);
...
@@ -169,6 +173,7 @@ export function exportToModelica(data, modelName = 'Circuit') {
...
@@ -169,6 +173,7 @@ export function exportToModelica(data, modelName = 'Circuit') {
}
}
}
}
}
}
}
});
});
const
paramStr
=
paramParts
.
length
>
0
?
`(
${
paramParts
.
join
(
', '
)}
)`
:
''
;
const
paramStr
=
paramParts
.
length
>
0
?
`(
${
paramParts
.
join
(
', '
)}
)`
:
''
;
...
...
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