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

Create own class + schema for software #391

Open
vhirtham opened this issue Jul 5, 2021 · 2 comments
Open

Create own class + schema for software #391

vhirtham opened this issue Jul 5, 2021 · 2 comments
Labels
discussion low priority low priority issues during ☕ measurements measurement and signal handling

Comments

@vhirtham
Copy link
Collaborator

vhirtham commented Jul 5, 2021

We are currently using the Software class from ASDF, which contains just a name and a version number. This does not integrate so well with our MeasurementChain in my opinion. Here is how we use a MeasurementEquipment with the MeasurementChain:

current_AD_transform = msm.SignalTransformation(
    name="AD current conversion",
    func=current_AD_func,
    type_transformation="AD",
    error=msm.Error(Q_(0.01, "percent")),
)
voltage_AD_transform = msm.SignalTransformation(
    name="AD voltage conversion",
    func=voltage_AD_func,
    type_transformation="AD",
    error=msm.Error(Q_(0.01, "percent")),
)
BH_ELM = msm.MeasurementEquipment(
    name="Beckhoff ELM3002-0000",
    transformations=[current_AD_transform, voltage_AD_transform],
)

welding_current_chain.add_transformation_from_equipment(
    equipment=BH_ELM, transformation_name="AD current conversion"
)

Now here is the corresponding workflow for a Software:

twincat_scope = Software(name="Beckhoff TwinCAT ScopeView", version="3.4.3143")

current_calib_func = MathematicalExpression(
    "a * x + b", dict(a=Q_(1000.0 / 32768.0, "A"), b=Q_(0.0, "A"))
)
current_calib_transform = msm.SignalTransformation(
    name="current calibration",
    error=msm.Error(0.0),
    func=current_calib_func,
    meta=twincat_scope,
)

welding_current_chain.add_transformation(
    transformation=current_calib_transform, data=current_data
)

The difference is, that I have to create the link between Software and transformation using the meta field and it is only in one direction. The way the MeasurementEquipment works feels more natural to me. You have a piece of equipment and it can perform some transformations. So when you describe a MeasuremertChain you just add the equipment and specify which of its transformations to use (if it has multiple). The rest is figured out by the MeasurementChain.
In the software workflow, I add the transformation directly to the Chain and just "mention" which equipment I used for it.

Basically, you can break it down into the following. With the MeasuremertEquipment I say:

"I used Equipment X to perform Operation Y"

With the software approach we say:

"I performed operation Y using Equipment X"

Apart from maybe being a bit picky here, I guess it is best to stick to one workflow for all pieces of the measurement chain. So my suggestion is to create our own small dataclass and schema for software.

@vhirtham vhirtham added discussion low priority low priority issues during ☕ measurements measurement and signal handling labels Jul 5, 2021
@CagtayFabry
Copy link
Member

I think the ASDF software schema does not really restrict the information that can be serialized so we can add any metadata we want for now as well

@vhirtham
Copy link
Collaborator Author

vhirtham commented Jul 5, 2021

I think the ASDF software schema does not really restrict the information that can be serialized so we can add any metadata we want for now as well

So just derive from the asdf class and use their schema?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion low priority low priority issues during ☕ measurements measurement and signal handling
Projects
None yet
Development

No branches or pull requests

2 participants