LEMS / LEMS/jLEMS

XMLSerializer ignores value of parameters

Open
#70 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
11
Forks
11
Avg merge
8h 6m
Merged PRs (30d)
1

Description

The following is inside a component:

ParamValue: delay(time, svalue = null, dvalue = NaN) = 2.2E-4
ParamValue: duration(time, svalue = null, dvalue = NaN) = 4.0E8
ParamValue: amplitude(current, svalue = null, dvalue = NaN) = 7.300000000000001E-10

however when doing

String serialisedModel = XMLSerializer.serialize(lems)

the file shows

<pulseGenerator id="pulseGen1" delay="0ms" duration="100000000s" amplitude="0.08nA"/>

I suspect the problem is caused by the following objects which are also inside the LEMS component model:

XMLAttribute(delay, 0ms) 
XMLAttribute(duration, 100000000s) 
XMLAttribute(amplitude, 0.08nA) 

which I suspect is what is getting used during serialization.
The same information seems to be stored in two places, if XMLAttribute are necessary for whatever reason then the library should reconcile them if the user changes the value of a parameter through the API

lemsParameter.setDoubleValue(...)

which is what we are doing to let the user change the parameters in the model.
Either that or there should be some method that can be called to update the XMLAttributes.
However ideally redundant information should probably be best avoided altogether.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue through XMLSerializer.serialize(lems) after changing values with lemsParameter.setDoubleValue(...), then inspect how XMLAttribute values are used alongside component parameters. Done means serialized delay, duration, and amplitude reflect the updated parameter values without stale XMLAttribute data.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.