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

Single step size simulation #76

Closed
zekeriyasari opened this issue May 2, 2021 · 1 comment
Closed

Single step size simulation #76

zekeriyasari opened this issue May 2, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@zekeriyasari
Copy link
Owner

Single-step size simulation should be possible. This can be achieved by updating the buffer sizes of the sink components in the model.

@zekeriyasari zekeriyasari added the enhancement New feature or request label May 2, 2021
@zekeriyasari zekeriyasari self-assigned this May 2, 2021
zekeriyasari pushed a commit that referenced this issue May 9, 2021
@zekeriyasari zekeriyasari reopened this May 9, 2021
@zekeriyasari
Copy link
Owner Author

Example script

using Causal

# Construct model 
@defmodel model begin 
    @nodes begin 
        gen = SinewaveGenerator() 
        ds = ContinuousLinearSystem(
            A = fill(-1., 1, 1), 
            B = fill(1., 1, 1), 
            C = fill(-1., 1, 1), 
            D = fill(0., 1, 1),
            state = [1.], 
            t = 0.,
            input = Inport(), 
            output = Outport()
        )
        writer = Writer(buflen = 1) # Single-length buffer 
    end 
    @branches begin 
        gen => ds
        ds => writer 
    end 
end 

# Simulate model 
clk = Clock(1) 
sim = simulate!(model, clk)

# Read simulation data 
t, x = getcomponent(model, :writer) |> read 
@show t, x;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant